From f8ae720080a3d5762ea51cac95e196afde946145 Mon Sep 17 00:00:00 2001 From: Lukas Alexander Heinrich <Lukas.Heinrich@cern.ch> Date: Sun, 10 Aug 2014 17:25:10 +0200 Subject: [PATCH] xAOD sercnv (TrigMissingEtEvent-00-00-12) --- .../TrigMissingEtEvent/TrigMissingET.h | 193 ++++++++ .../TrigMissingETContainer.h | 18 + .../TrigMissingEtComponent.h | 128 +++++ .../TrigMissingEtEventDict.h | 17 + .../TrigMissingEtEvent/TrigPileUpInfo.h | 61 +++ .../TrigMissingEtEvent/selection.xml | 11 + .../TrigMissingEtEvent/cmt/requirements | 47 ++ .../TrigMissingEtEvent/doc/mainpage.h | 58 +++ .../TrigMissingEtEvent/src/TrigMissingET.cxx | 463 ++++++++++++++++++ .../src/TrigMissingEtComponent.cxx | 85 ++++ .../TrigMissingEtEventStorageDefinitions.cxx | 11 + .../TrigMissingEtEvent/src/TrigPileUpInfo.cxx | 67 +++ .../components/TrigMissingEtEvent_entries.cxx | 5 + .../components/TrigMissingEtEvent_load.cxx | 4 + 14 files changed, 1168 insertions(+) create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingET.h create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingETContainer.h create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtComponent.h create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtEventDict.h create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigPileUpInfo.h create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/selection.xml create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/cmt/requirements create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/doc/mainpage.h create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingET.cxx create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtComponent.cxx create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtEventStorageDefinitions.cxx create mode 100644 Trigger/TrigEvent/TrigMissingEtEvent/src/TrigPileUpInfo.cxx create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_entries.cxx create mode 100755 Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_load.cxx diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingET.h b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingET.h new file mode 100755 index 00000000000..11c7f4eff2d --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingET.h @@ -0,0 +1,193 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigMissingET.h +// PACKAGE: Trigger/TrigEvent/TrigMissingEtEvent +// +// AUTHOR: Rashid Djilkibaev (Diego Casadei) +// CREATED: March, 2006 (auxiliary info added in March 2008) +// +// Description: MET trigger slice persistent class. +// Basic info: Ex, Ey, Ez, SumE, SumEt, and a status flag. +// Auxiliary info: collection of TrigMissingEtComponent's +// +// ******************************************************************** + +#ifndef TRIGMISSINGETEVENT_TRIGMISSINGET_H +#define TRIGMISSINGETEVENT_TRIGMISSINGET_H + + +#include "CLIDSvc/CLASS_DEF.h" +#include "DataModel/DataVector.h" +#include "TrigMissingEtEvent/TrigMissingEtComponent.h" +#include "GaudiKernel/MsgStream.h" + +#include <vector> +#include <string> +#include <map> +#include <math.h> + +/** Class for LVL2/EF MissingET trigger */ + +class TrigMissingET{ + + public: +/** default constructor */ + TrigMissingET(); +/** constructor (input is number of auxiliary components; if n==0 is like default) */ + TrigMissingET(unsigned char n); //<! +/** destructor */ + ~TrigMissingET(); + +/** reset contents */ + void clear(); + +/** Ex component of missing energy vector */ + float ex() const { return m_ex; } +/** Ey component of missing energy vector */ + float ey() const { return m_ey; } +/** Ez component of missing energy vector */ + float ez() const { return m_ez; } +/** sum of |Et| */ + float sumEt() const { return m_sum_et; } +/** sum of |E| */ + float sumE() const { return m_sum_e; } +/** (modulus of) transverse energy */ + float et() const { return sqrt(m_ex*m_ex+m_ey*m_ey); } +/** (modulus of) energy */ + float e() const { return sqrt(m_ex*m_ex+m_ey*m_ey+m_ez*m_ez); } + +/** event flag: 0 (default) means OK */ + int getFlag() const {return m_flag;} +/** RoI word */ + long RoIword() const { return m_roiWord; } + +/** increment Ex component */ + void addEx(float ex) { m_ex += ex; } +/** increment Ey component */ + void addEy(float ey) { m_ey += ey; } +/** increment Ez component */ + void addEz(float ez) { m_ez += ez; } + +/** increment sumEt */ + void addSumEt(float ets) { m_sum_et += ets; } +/** increment sumE */ + void addSumE(float sumE) { m_sum_e += sumE; } + +/** set Ex component */ + void setEx(float ex) { m_ex = ex; } +/** set Ey component */ + void setEy(float ey) { m_ey = ey; } +/** set Ez component */ + void setEz(float ez) { m_ez = ez; } +/** set sum of |Et| */ + void setSumEt(float ets) { m_sum_et = ets; } +/** set sum of |E| */ + void setSumE(float sumE) { m_sum_e = sumE; } + +/** set event flag */ + void setFlag(int flag) { m_flag=flag; } +/** set RoIword */ + void set_RoIword(long word) { m_roiWord=word; } + +/** get number of auxiliary components */ + unsigned int getNumOfComponents() const {return m_compVec.size();} + +/** get name of component `index' */ + std::string getNameOfComponent(unsigned int index) const; +/** get Ex from component `index' */ + float getExComponent(unsigned int index) const; +/** get Ey from component `index' */ + float getEyComponent(unsigned int index) const; +/** get Ez from component `index' */ + float getEzComponent(unsigned int index) const; +/** get sum of |Et| from component `index' */ + float getSumEtComponent(unsigned int index) const; +/** get sum of |E| from component `index' */ + float getSumEComponent(unsigned int index) const; +/** get constant term for calibration of component `index' */ + float getComponentCalib0(unsigned int index) const; +/** get scale for calibration of component `index' */ + float getComponentCalib1(unsigned int index) const; +/** get sum of energy signs for calibration of component `index' */ + short getSumOfSigns(unsigned int index) const; +/** get number of used channes in component `index' */ + unsigned short getUsedChannels(unsigned int index) const; +/** get status flag for component `index' */ + short getStatus(unsigned int index) const; + +/** set name of component `index' */ + void setNameOfComponent(unsigned int index, const char* str); +/** set Ex for component `index' */ + void setExComponent(unsigned int index, float value); +/** set Ey for component `index' */ + void setEyComponent(unsigned int index, float value); +/** set Ez for component `index' */ + void setEzComponent(unsigned int index, float value); +/** set sum of |Et| for component `index' */ + void setSumEtComponent(unsigned int index, float value); +/** set sum of |E| for component `index' */ + void setSumEComponent(unsigned int index, float value); +/** set constant term for calibration of component `index' */ + void setComponentCalib0(unsigned int index, float value); +/** set scale for calibration of component `index' */ + void setComponentCalib1(unsigned int index, float value); +/** set sum of energy signs for calibration of component `index' */ + void setSumOfSigns(unsigned int index, short value); +/** set number of used channels in component `index' */ + void setUsedChannels(unsigned int index, unsigned short value); +/** set status flag of component `index' */ + void setStatus(unsigned int index, short value); + +/** formatted output */ + friend MsgStream& operator<< (MsgStream& m, const TrigMissingET& d); + + + private: + +/** Basic information: Ex component */ + float m_ex; +/** Basic information: Ey component */ + float m_ey; +/** Basic information: Ez component */ + float m_ez; +/** Basic information: scalar sum of Et */ + float m_sum_et; +/** Basic information: scalar sum of E */ + float m_sum_e; +/** Basic information: event status flag: 0 (default) means OK */ + int m_flag; +/** Basic information: RoIword */ + long m_roiWord; + +/** Auxiliary information: + components from different calo layers and muons */ + std::vector< TrigMissingEtComponent > m_compVec; + +}; + + +/// Operator comparing two objects for equality +bool operator== (const TrigMissingET& a, const TrigMissingET& b); + +/// Operator comparing two objects for inequality +inline bool operator!= (const TrigMissingET& a, const TrigMissingET& b) { + return !( a == b ); +} + +/// Comparison with feedback +void diff(const TrigMissingET& a, const TrigMissingET& b, + std::map<std::string, double>& variableChange); + +/// conversion to formatted string: multi-line! +std::string str (const TrigMissingET& a); + + + +CLASS_DEF(TrigMissingET, 145610168, 1) +CLASS_DEF( DataVector<TrigMissingET> , 23170091 , 1 ) + +#endif diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingETContainer.h b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingETContainer.h new file mode 100644 index 00000000000..21e1221f7cf --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingETContainer.h @@ -0,0 +1,18 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGMISSINGETEVENT_TRIGMISSINGETCONTAINER_H +#define TRIGMISSINGETEVENT_TRIGMISSINGETCONTAINER_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "TrigMissingEtEvent/TrigMissingET.h" +#include "SGTools/BaseInfo.h" + +class TrigMissingETContainer : public DataVector<TrigMissingET> { }; + +CLASS_DEF( TrigMissingETContainer , 1271945976 , 1 ) + +SG_BASE(TrigMissingETContainer, DataVector<TrigMissingET>); + +#endif diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtComponent.h b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtComponent.h new file mode 100644 index 00000000000..d831d97eb8d --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtComponent.h @@ -0,0 +1,128 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigMissingEtComponent.h +// PACKAGE: Trigger/TrigEvent/TrigCaloEvent +// +// AUTHOR: Diego Casadei +// CREATED: April, 2008 +// +// Description: MET trigger slice components (auxiliary information). +// +// ******************************************************************** + +#ifndef TRIGCALOEVENT_TRIGMISSINGETCOMPONENT_H +#define TRIGCALOEVENT_TRIGMISSINGETCOMPONENT_H + +#include "CLIDSvc/CLASS_DEF.h" +#include <string> + +/** MET trigger slice components + ** (auxiliary information for TrigMissingET) + **/ + +class TrigMissingEtComponent { + + public: + +/** constructor */ + TrigMissingEtComponent(); +/** destructor */ + ~TrigMissingEtComponent(); +/** clean values and calibration constants */ + void reset(); +/** use this to print the header of the table printed by the following method */ + std::string getFormattedHeader(); +/** print the (1-line) table of all attributes */ + std::string getFormattedValues(); + + // Read access +/** get component name */ + std::string name() const {return m_name;} +/** get status flag */ + short status() const {return m_status;} +/** get Ex */ + float ex() const {return m_ex;} +/** get Ey */ + float ey() const {return m_ey;} +/** get Ez */ + float ez() const {return m_ez;} +/** get sum of |Et| */ + float sumEt() const {return m_sumEt;} +/** get sum of |E| */ + float sumE() const {return m_sumE;} +/** get constant term, for calibration */ + float calib0() const {return m_calib0;} +/** get scale, for calibration */ + float calib1() const {return m_calib1;} +/** get sum of energy signs, for calibration */ + short sumOfSigns() const {return m_sumOfSigns;} +/** get used channels */ + unsigned short usedChannels() const {return m_usedChannels;} + + // Write access +/** set component name */ + void setName(const char* s) {m_name = s;}; +/** set status flag */ + void setStatus(short v) {m_status = v;} +/** set Ex */ + void setEx(float v) {m_ex = v;} +/** set Ey */ + void setEy(float v) {m_ey = v;} +/** set Ez */ + void setEz(float v) {m_ez = v;} +/** set sum of |Et| */ + void setSumEt(float v) {m_sumEt = v;} +/** set sum of |E| */ + void setSumE(float v) {m_sumE = v;} +/** set constant term, for calibration */ + void setCalib0(float v) {m_calib0 = v;} +/** set scale, for calibration */ + void setCalib1(float v) {m_calib1 = v;} +/** set sum of energy signs, for calibration */ + void setSumOfSigns(short v) {m_sumOfSigns = v;} +/** set number of used channels */ + void setUsedChannels(unsigned short v) {m_usedChannels = v;} + + private: +/** name */ + std::string m_name; +/** status flag */ + short m_status; //<! default 0 = OK +/** Ey */ + float m_ex; +/** Ey */ + float m_ey; +/** Ez */ + float m_ez; +/** sum of |Et| */ + float m_sumEt; +/** sum of |E| */ + float m_sumE; +/** constant term, for calibration (default 0) */ + float m_calib0; +/** scale, for calibration (default 1) */ + float m_calib1; +/** calibration: sum of energy signs (-1, +1) */ + short m_sumOfSigns; +/** number of used channels */ + unsigned short m_usedChannels; + +}; + + +/// Operator comparing two objects for equality +bool operator== ( const TrigMissingEtComponent& a, const TrigMissingEtComponent& b ); + +/// Operator comparing two objects for inequality +inline bool operator!= ( const TrigMissingEtComponent& a, const TrigMissingEtComponent& b ) { + return !( a == b ); +} + + +CLASS_DEF( TrigMissingEtComponent , 129642584 , 1 ) + +#endif diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtEventDict.h b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtEventDict.h new file mode 100755 index 00000000000..e00d8063897 --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigMissingEtEventDict.h @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRACKMISSINGETEVENT_H +#define TRACKMISSINGETEVENT_H + +#include "TrigMissingEtEvent/TrigMissingET.h" +#include "TrigMissingEtEvent/TrigMissingETContainer.h" + +void dummy_function_for_TrigMissingEtEvent_which_forces_dictionaries_generation ( DataVector<TrigMissingET> a, + DataVector<TrigMissingETContainer> b + ) { + DataVector<TrigMissingET> aa = a; + DataVector<TrigMissingETContainer> bb = b; +} +#endif diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigPileUpInfo.h b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigPileUpInfo.h new file mode 100644 index 00000000000..a17c7e4d9fa --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/TrigPileUpInfo.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef TRIGL2PILEUP_TRIGPILEUPINFO_H +#define TRIGL2PILEUP_TRIGPILEUPINFO_H + +#include "CLIDSvc/CLASS_DEF.h" +#include "SGTools/BaseInfo.h" +#include "DataModel/DataVector.h" +#include "GaudiKernel/MsgStream.h" + +#include <vector> + + +class TrigPileUpInfo{ + + public: + + TrigPileUpInfo(); + + void clear(); + + int numFJ(){ return (int) m_FJ.size(); } + int numBJ(){ return (int) m_BJ.size(); } + int numPV(){ return (int) m_PV_Track.size(); } + + void addFJ(int); + void addBJ(int); + void addPV(int); + + int getFJ(unsigned int index) const; + int getBJ(unsigned int index) const; + int getPV(unsigned int index) const; + + std::vector<int> getFJVec() const; + std::vector<int> getBJVec() const; + std::vector<int> getPVVec() const; + + private: + + std::vector<int> m_FJ; // Forward Jet thresholds + std::vector<int> m_BJ; // Backward Jet thresholds + std::vector<int> m_PV_Track; // Number of Primarty Vertices + +}; + + +CLASS_DEF( TrigPileUpInfo , 95781919 , 1 ) +CLASS_DEF( DataVector<TrigPileUpInfo> , 182719150 , 1 ) + + +class TrigPileUpInfoContainer : public DataVector<TrigPileUpInfo> { }; + +CLASS_DEF( TrigPileUpInfoContainer , 1255908109 , 1 ) + +SG_BASE(TrigPileUpInfoContainer, DataVector<TrigPileUpInfo>); + + +#endif diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/selection.xml b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/selection.xml new file mode 100755 index 00000000000..df948b09b53 --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/TrigMissingEtEvent/selection.xml @@ -0,0 +1,11 @@ +<lcgdict> + <class name="TrigMissingETContainer" id="9481B442-D877-44A2-BB21-7A1B5D47710F"/> + + <class name="TrigMissingET" id="1403772C-7444-4340-930B-ABD51C243A09"/> + <class name="DataVector<TrigMissingET>" id="301D572F-D972-45C8-B3ED-0CC090F15C7A" /> + <class name="std::vector<TrigMissingET*>" /> + + <class name="TrigMissingEtComponent"/> + <class name="std::vector<TrigMissingEtComponent>"/> + +</lcgdict> diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/cmt/requirements b/Trigger/TrigEvent/TrigMissingEtEvent/cmt/requirements new file mode 100755 index 00000000000..569c67cebfe --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/cmt/requirements @@ -0,0 +1,47 @@ +package TrigMissingEtEvent + +author Fabrizio Salvatore <P.F.Salvatore@sussex.ac.uk> +author Diego Casadei <diego.casadei@cern.ch> + +use AtlasPolicy AtlasPolicy-* + +use DataModel DataModel-* Control +use CLIDSvc CLIDSvc-* Control +use AtlasDoxygen AtlasDoxygen-* Tools +#use TrigRingerTools TrigRingerTools-* Trigger/TrigTools +use SGTools SGTools-* Control + +use GaudiInterface GaudiInterface-* External +#use GaudiKernel GaudiKernel-* External + +library TrigMissingEtEvent *.cxx -s=components *.cxx + +apply_pattern installed_library + +private +use TrigNavigation TrigNavigation-* Trigger/TrigEvent +use AtlasReflex AtlasReflex-* External -no_auto_imports +use TrigSerializeUtils TrigSerializeUtils-* Trigger/TrigDataAccess +use xAODTrigMissingET xAODTrigMissingET-* Event/xAOD + +apply_pattern lcgdict dict=TrigMissingEtEvent \ +selectionfile=selection.xml \ +headerfiles="../TrigMissingEtEvent/TrigMissingEtEventDict.h" \ +dataLinks="TrigMissingET" +#elementLinks="TrigEMClusterContainer RingerRingsContainer TrigTauClusterContainer TrigTauClusterDetailsContainer" + +apply_pattern sercnv files="-s=${TrigMissingEtEvent_root}/TrigMissingEtEvent TrigMissingET.h\ + TrigMissingETContainer.h TrigMissingEtComponent.h " + +apply_pattern sercnv \ +libtag="xAOD" \ +typesWithNamespace="xAOD::TrigMissingETContainer xAOD::TrigMissingETAuxContainer" \ + files="-s=${xAODTrigMissingET_root}/xAODTrigMissingET TrigMissingETContainer.h TrigMissingETAuxContainer.h" + + + +# Doxygen switches +macro DOXYGEN_UML_LOOK "YES" + +end_private + diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/doc/mainpage.h b/Trigger/TrigEvent/TrigMissingEtEvent/doc/mainpage.h new file mode 100644 index 00000000000..a313e400c44 --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/doc/mainpage.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +/** +@mainpage TrigMissingEtEvent +@author Diego Casadei + + +@section TrigMissingEtEventIntro Introduction + +This package defines the transient class needed to keep info about the +missing energy vector and the total (scalar) energy sums computed by +the ATLAS HLT. More details are provided by the <a +href="https://twiki.cern.ch/twiki/bin/view/Atlas/AtlasHltMetSlice">AtlasHltMetSlice</a> +twiki page and in the <a +href="http://cdsweb.cern.ch/record/1129146">ATL-COM-DAQ-2008-008</a> +note. + + +@section TrigMissingEtEventOverview Class Overview + +The TrigMissingEtEvent package contains of following classes: + + - TrigMissingET : contains global quantities [the missing energy vector + components, scalar sums of total and transverse energy, + the event flag and the (unused) RoIword] and local + quantities corresponding to individual contributions + [e.g. calo samplings, muons]. + Each individual component is an instance of the + TrigMissingEtComponent class. + + - TrigMissingEtComponent : contains local contributions to the missing + energy vector and to the scalar energy sums, + together with calibration constants and a + component-level status flag. + + - TrigMissingETContainer : used to save things on disk, via transient / + persistent separation implemented in the + TrigMissingEtEventTPCnv package. + + + +@ref used_TrigMissingEtEvent + +@ref requirements_TrigMissingEtEvent + +*/ + +/** +@page used_TrigMissingEtEvent Used Packages +@htmlinclude used_packages.html +*/ + +/** +@page requirements_TrigMissingEtEvent Requirements +@include requirements +*/ diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingET.cxx b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingET.cxx new file mode 100755 index 00000000000..eae258df61c --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingET.cxx @@ -0,0 +1,463 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigMissingEtEvent/TrigMissingET.h" +#include "TrigMissingEtEvent/TrigMissingEtComponent.h" + +#include <string> +#include <stdio.h> +#include <string.h> +#include <math.h> + +TrigMissingET::TrigMissingET() : + m_ex(0), m_ey(0), m_ez(0), m_sum_et(0), m_sum_e(0), + m_flag(0), m_roiWord(0) +{ +} + + +TrigMissingET::TrigMissingET(unsigned char n) : + m_ex(0), m_ey(0), m_ez(0), m_sum_et(0), m_sum_e(0), + m_flag(0), m_roiWord(0) +{ + /// definition of auxiliary information + // 1. muons + all calo samplings in barrel + calo samplings in both end-caps + char names25[25][6] = {"EMB0", "EMB1", "EMB2", "EMB3", + "EME0", "EME1", "EME2", "EME3", + "HEC0", "HEC1", "HEC2", "HEC3", + "TiB0", "TiB1", "TiB2", + "TiG1", "TiG2", "TiG3", + "TiE0", "TiE1", "TiE2", + "FCa0", "FCa1", "FCa2", + "Muon"}; + + // 2. only muons + char names1[1][6] = {"Muon"}; + + // 3. muons + sum of all EM + sum of all HAD + char names3[3][6] = {"Muon", "E.M.", "Had."}; + + // 4. muons + EM_barrel + EM_endcaps + HAD_barrel + HAD_endcaps + char names5[5][6] = {"Muon", "EM_B", "EM_E", "HadB", "HadE"}; + + if (n>0) m_compVec.reserve(n); + for (int i=0; i<n; ++i) { + TrigMissingEtComponent c; + if (n==25) { + c.setName(names25[i]); + } else if (n==1) { + c.setName(names1[i]); + } else if (n==3) { + c.setName(names3[i]); + } else if (n==5) { + c.setName(names5[i]); + } else { + c.setName("????"); + } + m_compVec.push_back(c); + } +} + + +TrigMissingET::~TrigMissingET(){} + + +void TrigMissingET::clear() +{ + + m_ex=0; + m_ey=0; + m_ez=0; + m_sum_et=0; + m_sum_e=0; + m_flag=0; + + for (unsigned int i=0; i<m_compVec.size(); ++i) { + m_compVec[i].reset(); + } + +} + + +std::string TrigMissingET::getNameOfComponent(unsigned int index) const +{ + if (index < m_compVec.size()) + return m_compVec[index].name(); + else + return std::string("WRONG INDEX!"); +} + + +float TrigMissingET::getExComponent(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].ex(); + else + return 0; //<! safe but silent! +} + + +float TrigMissingET::getEyComponent(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].ey(); + else + return 0; //<! safe but silent! +} + + +float TrigMissingET::getEzComponent(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].ez(); + else + return 0; //<! safe but silent! +} + + +float TrigMissingET::getSumEtComponent(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].sumEt(); + else + return 0; //<! safe but silent! +} + + +float TrigMissingET::getSumEComponent(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].sumE(); + else + return 0; //<! safe but silent! +} + + +short TrigMissingET::getSumOfSigns(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].sumOfSigns(); + else + return 0; //<! safe but silent! +} + + +unsigned short TrigMissingET::getUsedChannels(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].usedChannels(); + else + return 0; //<! safe but silent! +} + + +short TrigMissingET::getStatus(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].status(); + else + return 0; //<! safe but silent! +} + + +float TrigMissingET::getComponentCalib0(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].calib0(); + else + return 0; //<! safe but silent! +} + + +float TrigMissingET::getComponentCalib1(unsigned int index) const{ + if (index < m_compVec.size()) + return m_compVec[index].calib1(); + else + return 0; //<! safe but silent! +} + + + + +void TrigMissingET::setNameOfComponent(unsigned int index, const char* str){ + if (index < m_compVec.size()) m_compVec[index].setName(str); +} + + +void TrigMissingET::setExComponent(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setEx(value); +} + + +void TrigMissingET::setEyComponent(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setEy(value); +} + + +void TrigMissingET::setEzComponent(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setEz(value); +} + + +void TrigMissingET::setSumEtComponent(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setSumEt(value); +} + + +void TrigMissingET::setSumEComponent(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setSumE(value); +} + + +void TrigMissingET::setComponentCalib0(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setCalib0(value); +} + + +void TrigMissingET::setComponentCalib1(unsigned int index, float value){ + if (index < m_compVec.size()) m_compVec[index].setCalib1(value); +} + + +void TrigMissingET::setSumOfSigns(unsigned int index, short value){ + if (index < m_compVec.size()) m_compVec[index].setSumOfSigns(value); +} + + +void TrigMissingET::setUsedChannels(unsigned int index, unsigned short value){ + if (index < m_compVec.size()) m_compVec[index].setUsedChannels(value); +} + + +void TrigMissingET::setStatus(unsigned int index, short value){ + if (index < m_compVec.size()) m_compVec[index].setStatus(value); +} + + + + + +bool operator== ( const TrigMissingET& a, const TrigMissingET& b ) { + + const double DELTA=1e-3; // distance used to compare floats + + if( a.getNumOfComponents() != b.getNumOfComponents() ) + return false; + if( a.getFlag() != b.getFlag() ) + return false; + if( a.RoIword() != b.RoIword() ) + return false; + + if( fabsf(a.ex() - b.ex()) > DELTA ) + return false; + if( fabsf(a.ey() - b.ey()) > DELTA ) + return false; + if( fabsf(a.ez() - b.ez()) > DELTA ) + return false; + if( fabsf(a.sumEt() - b.sumEt()) > DELTA ) + return false; + if( fabsf(a.sumE() - b.sumE()) > DELTA ) + return false; + + for (unsigned u=0; u<a.getNumOfComponents(); ++u) { + if( a.getNameOfComponent(u) != b.getNameOfComponent(u) ) + return false; + if( a.getStatus(u) != b.getStatus(u) ) + return false; + if( a.getSumOfSigns(u) != b.getSumOfSigns(u) ) + return false; + if( a.getUsedChannels(u) != b.getUsedChannels(u) ) + return false; + if( fabsf(a.getExComponent(u) - b.getExComponent(u)) > DELTA ) + return false; + if( fabsf(a.getEyComponent(u) - b.getEyComponent(u)) > DELTA ) + return false; + if( fabsf(a.getEzComponent(u) - b.getEzComponent(u)) > DELTA ) + return false; + if( fabsf(a.getSumEtComponent(u) - b.getSumEtComponent(u)) > DELTA ) + return false; + if( fabsf(a.getSumEComponent(u) - b.getSumEComponent(u)) > DELTA ) + return false; + if( fabsf(a.getComponentCalib0(u) - b.getComponentCalib0(u)) > DELTA ) + return false; + if( fabsf(a.getComponentCalib1(u) - b.getComponentCalib1(u)) > DELTA ) + return false; + } + + return true; +} + + +std::string str (const TrigMissingET& a){ + std::string s=""; + char buff[1024]; + + std::sprintf(buff,"MEx = %10.2f MeV\n", a.ex()); s += buff; + std::sprintf(buff,"MEy = %10.2f MeV\n", a.ey()); s += buff; + std::sprintf(buff,"MEz = %10.2f MeV\n", a.ez()); s += buff; + + float et = std::sqrt(a.ex()*a.ex()+a.ey()*a.ey()); + std::sprintf(buff,"MEt = %10.2f MeV\n", et); s += buff; + std::sprintf(buff,"SumEt = %10.2f MeV\n", a.sumEt()); s += buff; + std::sprintf(buff,"SumE = %10.2f MeV\n", a.sumE()); s += buff; + + std::sprintf(buff,"Event status = 0x%08x\n", (unsigned)a.getFlag()); s += buff; + unsigned int N = a.getNumOfComponents(); + std::sprintf(buff,"Auxiliary components = %4d\n", N); s += buff; + + if (N==0) return s; // basic info only + + // header + s += "__name_____status__usedCh.__sumOfSigns__calib1_calib0"; + s += "/MeV___Ex/MeV_____Ey/MeV_____Ez/MeV___SumE/MeV__SumEt/MeV\n"; + + for (unsigned int i=0; i<N; ++i){ + std::sprintf(buff, + "%10s 0x%04x %8d %11d %7.2f %8.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n", + a.getNameOfComponent(i).c_str(), + (unsigned)a.getStatus(i), + a.getUsedChannels(i), + a.getSumOfSigns(i), + a.getComponentCalib1(i), + a.getComponentCalib0(i), + a.getExComponent(i), + a.getEyComponent(i), + a.getEzComponent(i), + a.getSumEComponent(i), + a.getSumEtComponent(i)); + s += buff; + } + + return s; +} + + +MsgStream& operator<< (MsgStream& m, const TrigMissingET& d) { + return ( m << str( d ) ); +} + + + +void diff(const TrigMissingET& a, const TrigMissingET& b, + std::map<std::string, double>& variableChange){ + + const double DELTA=1e-3; // distance used to compare floats + + int Na = a.getNumOfComponents(); + int Nb = b.getNumOfComponents(); + if( Na != Nb ) + variableChange[ "NumOfComponents" ] = Na - Nb; + + unsigned aFlag = (unsigned) a.getFlag(); + unsigned bFlag = (unsigned) b.getFlag(); + if( aFlag != bFlag ) + variableChange[ "FlagsXOR" ] = aFlag ^ bFlag; + + unsigned long aRoI = (unsigned long) a.RoIword(); + unsigned long bRoI = (unsigned long) b.RoIword(); + if( aRoI != bRoI ) + variableChange[ "RoIwordsXOR" ] = aRoI ^ bRoI; + + float aEx = a.ex(); + float bEx = b.ex(); + if( fabsf(aEx - bEx) > DELTA ) + variableChange[ "Ex" ] = aEx - bEx; + + float aEy = a.ey(); + float bEy = b.ey(); + if( fabsf(aEy - bEy) > DELTA ) + variableChange[ "Ey" ] = aEy - bEy; + + float aEz = a.ez(); + float bEz = b.ez(); + if( fabsf(aEz - bEz) > DELTA ) + variableChange[ "Ez" ] = aEz - bEz; + + float aSumEt = a.sumEt(); + float bSumEt = b.sumEt(); + if( fabsf(aSumEt - bSumEt) > DELTA ) + variableChange[ "sumEt" ] = aSumEt - bSumEt; + + float aSumE = a.sumE(); + float bSumE = b.sumE(); + if( fabsf(aSumE - bSumE) > DELTA ) + variableChange[ "sumE" ] = aSumE - bSumE; + + for (unsigned u=0; u<a.getNumOfComponents(); ++u) { + char num[4]; + std::sprintf(num, "%02d", u); + std::string key; + + if( a.getNameOfComponent(u) != b.getNameOfComponent(u) ) { + key="CompNameStrCmp"; key+=num; + variableChange[ key.c_str() ] = + strcmp(a.getNameOfComponent(u).c_str(), + b.getNameOfComponent(u).c_str()); + } + + unsigned aFlag = (unsigned) a.getStatus(u); + unsigned bFlag = (unsigned) b.getStatus(u); + if( aFlag != bFlag ) { + key="CompStatusXOR"; key+=num; + variableChange[ key.c_str() ] = aFlag ^ bFlag; + } + + int aSigns = a.getSumOfSigns(u); + int bSigns = b.getSumOfSigns(u); + if( aSigns != bSigns ) { + key="CompSumSigns"; key+=num; + variableChange[ key.c_str() ] = aSigns - bSigns; + } + + int aChans = a.getUsedChannels(u); + int bChans = b.getUsedChannels(u); + if( aChans != bChans ) { + key="CompUsedChans"; key+=num; + variableChange[ key.c_str() ] = aChans - bChans; + } + + float aEx = a.getExComponent(u); + float bEx = b.getExComponent(u); + if( fabsf(aEx - bEx) > DELTA ) { + key="CompEx"; key+=num; + variableChange[ key.c_str() ] = aEx - bEx; + } + + float aEy = a.getEyComponent(u); + float bEy = b.getEyComponent(u); + if( fabsf(aEy - bEy) > DELTA ) { + key="CompEy"; key+=num; + variableChange[ key.c_str() ] = aEy - bEy; + } + + float aEz = a.getEzComponent(u); + float bEz = b.getEzComponent(u); + if( fabsf(aEz - bEz) > DELTA ) { + key="CompEz"; key+=num; + variableChange[ key.c_str() ] = aEz - bEz; + } + + float aSumEt = a.getSumEtComponent(u); + float bSumEt = b.getSumEtComponent(u); + if( fabsf(aSumEt - bSumEt) > DELTA ) { + key="CompSumEt"; key+=num; + variableChange[ key.c_str() ] = aSumEt - bSumEt; + } + + float aSumE = a.getSumEComponent(u); + float bSumE = b.getSumEComponent(u); + if( fabsf(aSumE - bSumE) > DELTA ) { + key="CompSumE"; key+=num; + variableChange[ key.c_str() ] = aSumE - bSumE; + } + + float aCalib0 = a.getComponentCalib0(u); + float bCalib0 = b.getComponentCalib0(u); + if( fabsf(aCalib0 - bCalib0) > DELTA ) { + key="CompCalib0_"; key+=num; + variableChange[ key.c_str() ] = aCalib0 - bCalib0; + } + + float aCalib1 = a.getComponentCalib1(u); + float bCalib1 = b.getComponentCalib1(u); + if( fabsf(aCalib1 - bCalib1) > DELTA ) { + key="CompCalib1_"; key+=num; + variableChange[ key.c_str() ] = aCalib1 - bCalib1; + } + } + + return; +} + diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtComponent.cxx b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtComponent.cxx new file mode 100644 index 00000000000..68b731999bb --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtComponent.cxx @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigMissingEtComponent.cxx +// PACKAGE: Trigger/TrigEvent/TrigMissingEtEvent +// +// AUTHOR: Diego Casadei +// CREATED: April, 2008 +// +// Description: MET trigger slice components (auxiliary information). +// +// ******************************************************************** + +#include "TrigMissingEtEvent/TrigMissingEtComponent.h" +#include <math.h> +#include <stdio.h> + +TrigMissingEtComponent::TrigMissingEtComponent(){ + m_name = "empty"; + reset(); +} + +TrigMissingEtComponent::~TrigMissingEtComponent(){ +} + + +void TrigMissingEtComponent::reset(){ + m_status = m_usedChannels = m_sumOfSigns = 0; + m_calib0 = 0; + m_calib1 = 1; + m_ex = m_ey = m_ez = m_sumEt = m_sumE = 0; +} + + +std::string TrigMissingEtComponent::getFormattedHeader(){ + std::string s="_name__status_usedChannels__sumOfSigns__calib1_calib0/MeV"; + s+="___ex/MeV_____ey/MeV_____ez/MeV___sumE/MeV__sumEt/MeV"; + return s; +} + + +std::string TrigMissingEtComponent::getFormattedValues(){ + char buff[256]; + sprintf(buff, + "%s %7d %12d %11d %7.3f %7.2f %10.2f %10.2f %10.2f %10.2f %10.2f\n", + m_name.c_str(), + m_status, m_usedChannels, m_sumOfSigns, m_calib1, m_calib0, + m_ex, m_ey, m_ez, m_sumEt, m_sumE); + return std::string(buff); +} + + +bool operator== ( const TrigMissingEtComponent& a, const TrigMissingEtComponent& b ) { + + const double DELTA=1e-3; // distance used to compare floats + + if( a.name() != b.name() ) + return false; + if( a.status() != b.status() ) + return false; + if( a.sumOfSigns() != b.sumOfSigns() ) + return false; + if( a.usedChannels() != b.usedChannels() ) + return false; + + if( fabsf(a.ex() - b.ex()) > DELTA ) + return false; + if( fabsf(a.ey() - b.ey()) > DELTA ) + return false; + if( fabsf(a.ez() - b.ez()) > DELTA ) + return false; + if( fabsf(a.sumEt() - b.sumEt()) > DELTA ) + return false; + if( fabsf(a.sumE() - b.sumE()) > DELTA ) + return false; + if( fabsf(a.calib0() - b.calib0()) > DELTA ) + return false; + if( fabsf(a.calib1() - b.calib1()) > DELTA ) + return false; + + return true; +} diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtEventStorageDefinitions.cxx b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtEventStorageDefinitions.cxx new file mode 100644 index 00000000000..5e74df559ab --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigMissingEtEventStorageDefinitions.cxx @@ -0,0 +1,11 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigMissingEtEvent/TrigMissingETContainer.h" +#include "TrigMissingEtEvent/TrigPileUpInfo.h" +#include "xAODTrigMissingET/TrigMissingETContainer.h" +#include "xAODTrigMissingET/TrigMissingETAuxContainer.h" + +#include "TrigNavigation/TypeRegistration.h" +REGISTER_PACKAGE_WITH_NAVI(TrigMissingEtEvent) diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigPileUpInfo.cxx b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigPileUpInfo.cxx new file mode 100644 index 00000000000..b1dd621dbf1 --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/src/TrigPileUpInfo.cxx @@ -0,0 +1,67 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + + +#include "TrigMissingEtEvent/TrigPileUpInfo.h" + +#include <vector> + + +TrigPileUpInfo::TrigPileUpInfo(){ + clear(); +} + + +void TrigPileUpInfo::clear(){ + m_FJ.clear(); + m_BJ.clear(); + m_PV_Track.clear(); +} + + +int TrigPileUpInfo::getFJ(unsigned int index) const{ + if (index < m_FJ.size()) + return m_FJ.at(index); + else + return 0; //<! safe but silent! +} + +int TrigPileUpInfo::getBJ(unsigned int index) const{ + if (index < m_BJ.size()) + return m_BJ.at(index); + else + return 0; //<! safe but silent! +} + +int TrigPileUpInfo::getPV(unsigned int index) const{ + if (index < m_PV_Track.size()) + return m_PV_Track.at(index); + else + return 0; //<! safe but silent! +} + +std::vector<int> TrigPileUpInfo::getFJVec() const{ + return m_FJ; +} + +std::vector<int> TrigPileUpInfo::getBJVec() const{ + return m_BJ; +} + +std::vector<int> TrigPileUpInfo::getPVVec() const{ + return m_PV_Track; +} + + +void TrigPileUpInfo::addFJ(int FJ){ + m_FJ.push_back(FJ); +} + +void TrigPileUpInfo::addBJ(int BJ){ + m_BJ.push_back(BJ); +} + +void TrigPileUpInfo::addPV(int PV_Track){ + m_PV_Track.push_back(PV_Track); +} diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_entries.cxx b/Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_entries.cxx new file mode 100755 index 00000000000..fbe56b88ce3 --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_entries.cxx @@ -0,0 +1,5 @@ + +#include "GaudiKernel/DeclareFactoryEntries.h" + +DECLARE_FACTORY_ENTRIES(TrigMissingEtEvent) { +} diff --git a/Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_load.cxx b/Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_load.cxx new file mode 100755 index 00000000000..d6c2e7223b5 --- /dev/null +++ b/Trigger/TrigEvent/TrigMissingEtEvent/src/components/TrigMissingEtEvent_load.cxx @@ -0,0 +1,4 @@ + +#include "GaudiKernel/LoadFactoryEntries.h" + +LOAD_FACTORY_ENTRIES(TrigMissingEtEvent) -- GitLab