ATLAS Offline Software
jFexMETRoI_v1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 // System include(s):
7 #include <stdexcept>
8 
9 // xAOD include(s):
11 
12 // Local include(s):
13 #include "xAODTrigger/jFexMETRoI.h"
14 
15 namespace xAOD {
16 
18  : SG::AuxElement() {
19  }
20  void jFexMETRoI_v1::initialize( uint8_t jFexNumber,uint8_t fpgaNumber, uint32_t tobWord, int resolution) {
21 
22  setTobWord ( tobWord );
25  setTobEx ( unpackEx() );
26  setTobEy ( unpackEy() );
27  setTobRes ( unpackRes() );
28  setTobSat ( unpackSat() );
30 
31  //include in future when xTOB in jFEX has been implemented.
32 
33  // If the object is a TOB then the isTOB should be true.
34  // For xTOB default is false, but should be set if a matching TOB is found
35  // if (type() == TOB) setIsTOB(1);
36  // else setIsTOB(0);
37 
38  return;
39  }
40 
41  //----------------
43  //----------------
44 
46  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexMETRoI_v1, uint8_t , jFexNumber, setjFexNumber)
47  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexMETRoI_v1, uint8_t , fpgaNumber, setfpgaNumber)
49 
51  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexMETRoI_v1, int , tobEx , setTobEx )
52  AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( jFexMETRoI_v1, int , tobEy , setTobEy )
55 
56 
58 
59  //-----------------
61  //-----------------
62 
63  //include in future when xTOB in jFEX has been implemented.
64 
65 
66  //jFexMETRoI_v1::ObjectType jFexMETRoI_v1::type() const {
67  //if (Word1() == 0) return TOB;
68  //else return xTOB;
69  //}
70 
71 
72  //Return tobEx in a 200 MeV scale
73  int jFexMETRoI_v1::unpackEx() const {
74  int energy = (tobWord() >> s_Ex_Bit) & s_E_xMask; // masking from the TOB word the Ex
75  bool sign = (energy >> s_signed_E) == 1 ; //checks if the value is negative looking at the MSB within the 15 bits
76  if(sign) {
77  energy = -(~(energy-1) & s_E_xMask); // Energy is negative, then using the two's complement method we do absolute value, mask the 15 bits and assign a minus
78  }
79  return energy;
80  }
81 
82  //Return tobEy in a 200 MeV scale
84  int energy = (tobWord() >> s_Ey_Bit) & s_E_yMask; // masking from the TOB word the Ey
85  bool sign = (energy >> s_signed_E) == 1 ;//checks if the value is negative looking at the MSB within the 15 bits
86  if(sign) {
87  energy = -(~(energy-1) & s_E_yMask); // Energy is negative, then using the two's complement method we do absolute value, mask the 15 bits and assign a minus
88  }
89  return energy;
90  }
91 
92  //Return tobSat upper flag
93  unsigned int jFexMETRoI_v1::unpackSat() const {
94  return (tobWord() >> s_SatBit) & s_SatMask;
95  }
96 
97  //Return tobRes lower flag
98  unsigned int jFexMETRoI_v1::unpackRes() const {
99  return (tobWord() >> s_ResBit) & s_ResMask;
100  }
101 
103 
105  int jFexMETRoI_v1::Ex() const {
106  //Since the firmware uses phi values of one hemisphere we need to apply a minus to the other hemisphere
107  int hemisphere = fpgaNumber() == 0 ? 1 : -1;
108 
109  //We need to apply a global minus to return the "missing" vectorial Et instead of the "visible" vectorial Et
110  return -1*hemisphere*tobEx()*tobEtScale();
111  }
112 
114  int jFexMETRoI_v1::Ey() const {
115  //Since the firmware uses phi values of one hemisphere we need to apply a minus to the other hemisphere
116  int hemisphere = fpgaNumber() == 0 ? 1 : -1;
117 
118  //We need to apply a global minus to return the "missing" vectorial Et instead of the "visible" vectorial Et
119  return -1*hemisphere*tobEy()*tobEtScale();
120  }
121 
122 
123 } // namespace xAOD
124 
xAOD::jFexMETRoI_v1::jFexMETRoI_v1
jFexMETRoI_v1()
Default constructor.
Definition: jFexMETRoI_v1.cxx:17
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::jFexMETRoI_v1::s_ResBit
static const int s_ResBit
Definition: jFexMETRoI_v1.h:72
xAOD::jFexMETRoI_v1::unpackEy
int unpackEy() const
Definition: jFexMETRoI_v1.cxx:83
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
xAOD::jFexMETRoI_v1::setjFexNumber
void setjFexNumber(uint8_t jFexNumber)
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::jFexMETRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
AuxStoreAccessorMacros.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
xAOD::jFexMETRoI_v1::s_ResMask
static const int s_ResMask
Definition: jFexMETRoI_v1.h:83
xAOD::jFexMETRoI_v1::setTobRes
void setTobRes(uint8_t value)
xAOD::jFexMETRoI_v1::tobEtScale
int tobEtScale() const
xAOD::jFexMETRoI_v1::Ex
int Ex() const
Methods that require combining results or applying scales.
Definition: jFexMETRoI_v1.cxx:105
xAOD::jFexMETRoI_v1::setTobEx
void setTobEx(int value)
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::jFexMETRoI_v1::initialize
void initialize(uint8_t jFexNumber, uint8_t fpgaNumber, uint32_t tobWord, int resolution)
In future initialze the xTOB as well, word1.
Definition: jFexMETRoI_v1.cxx:20
Dedxcorrection::resolution
double resolution[nGasTypes][nParametersResolution]
Definition: TRT_ToT_Corrections.h:46
xAOD::jFexMETRoI_v1::jFexNumber
uint8_t jFexNumber() const
xAOD::jFexMETRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexMETRoI_v1.h:22
xAOD::jFexMETRoI_v1::setTobWord
void setTobWord(uint32_t tobWord)
Set the "raw" 32-bit words describing the object candidate.
xAOD::jFexMETRoI_v1::s_signed_E
static const int s_signed_E
Definition: jFexMETRoI_v1.h:78
xAOD::jFexMETRoI_v1::fpgaNumber
uint8_t fpgaNumber() const
xAOD::jFexMETRoI_v1::s_SatBit
static const int s_SatBit
Definition: jFexMETRoI_v1.h:75
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
xAOD::jFexMETRoI_v1::tobEy
int tobEy() const
xAOD::jFexMETRoI_v1::unpackEx
int unpackEx() const
Raw data words.
Definition: jFexMETRoI_v1.cxx:73
xAOD::jFexMETRoI_v1::tobEx
int tobEx() const
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:127
xAOD::jFexMETRoI_v1::setTobEy
void setTobEy(int value)
xAOD::jFexMETRoI_v1::setfpgaNumber
void setfpgaNumber(uint8_t fpgaNumber)
jFexMETRoI.h
xAOD::jFexMETRoI_v1::s_Ey_Bit
static const int s_Ey_Bit
Definition: jFexMETRoI_v1.h:73
xAOD::jFexMETRoI_v1::s_SatMask
static const int s_SatMask
Definition: jFexMETRoI_v1.h:84
xAOD::jFexMETRoI_v1::unpackSat
unsigned int unpackSat() const
Definition: jFexMETRoI_v1.cxx:93
xAOD::jFexMETRoI_v1::Ey
int Ey() const
Met Ey in 1 MeV scale (all signs considered)
Definition: jFexMETRoI_v1.cxx:114
xAOD::jFexMETRoI_v1::unpackRes
unsigned int unpackRes() const
Definition: jFexMETRoI_v1.cxx:98
xAOD::jFexMETRoI_v1::setResolution
void setResolution(int value)
xAOD::tobEtScale
tobEtScale
Definition: gFexJetRoI_v1.cxx:61
xAOD::jFexMETRoI_v1::s_E_yMask
static const int s_E_yMask
Definition: jFexMETRoI_v1.h:82
xAOD::jFexMETRoI_v1::setTobSat
void setTobSat(uint8_t value)
xAOD::int
setRawEt setRawPhi int
Definition: TrigCaloCluster_v1.cxx:33