ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::ModuleEnergy Class Reference

This is an internal class, used in the Energy trigger. More...

#include <ModuleEnergy.h>

Collaboration diagram for LVL1::ModuleEnergy:

Public Member Functions

 ModuleEnergy (const xAOD::JetElementMap_t *JEContainer, unsigned int crate, unsigned int module, int JEThresholdEtSum, int JEThresholdEtMiss, const std::map< int, int > *TEMasks=0, int slice=-1)
 ModuleEnergy (unsigned int crate, unsigned int module, unsigned int et, unsigned int ex, unsigned int ey)
 ~ModuleEnergy ()
unsigned int crate () const
 which module is this?
unsigned int module () const
 return module number
unsigned int et () const
 return the scalar & vector sums of all JE ETs (i.e sums the energies of up to 32 contained JEs)
unsigned int ex () const
unsigned int ey () const
int signX () const
 return signs of Ex and Ey for this module
int signY () const

Private Member Functions

void getSinCos (double eta, double phi, int &cosPhi, int &sinPhi)
 return cos, sin coefficients for a given JetElement

Private Attributes

int m_jetElementThresholdEtSum
int m_jetElementThresholdEtMiss
unsigned int m_Et
unsigned int m_Ex
unsigned int m_Ey
int m_signX
int m_signY
unsigned int m_crate
unsigned int m_module
bool m_debug

Static Private Attributes

static const unsigned int m_EtBits = 14

Detailed Description

This is an internal class, used in the Energy trigger.

The ModuleEnergy:

  • identifies JetElements belonging to this particular module and uses them to form ET sums
  • applies thresholds to JetElements on input to ETmiss and ETsum chains
  • converts JetElements to Ex, Ey using coefficients from TrigConfigSvc
  • Ex, Ey, Et all stored with values we would obtain after quad-linear encoding

Definition at line 40 of file ModuleEnergy.h.

Constructor & Destructor Documentation

◆ ModuleEnergy() [1/2]

LVL1::ModuleEnergy::ModuleEnergy ( const xAOD::JetElementMap_t * JEContainer,
unsigned int crate,
unsigned int module,
int JEThresholdEtSum,
int JEThresholdEtMiss,
const std::map< int, int > * TEMasks = 0,
int slice = -1 )

Set up Ex, Ey signs for this module

Look for the JetElements associated with this module

Check JE not masked in TE trigger

Use jet element if it is not in the masked list

Test for saturation

Get ET for requested time slice

Test against ETmiss algorithm threshold

Get sin, cos factors for this JetElement

Convert to Ex, Ey and sum. Replicate integer arithmetic used in hardware

Test against ETsum algorithm threshold & add if passes

Convert Ex, Ey back to 1 GeV/count integers

Check for overflows. Set ET to full scale if these occur

Definition at line 19 of file ModuleEnergy.cxx.

20 :
21 m_jetElementThresholdEtSum(JEThresholdEtSum),
22 m_jetElementThresholdEtMiss(JEThresholdEtMiss),
23 m_Et(0),
24 m_Ex(0),
25 m_Ey(0),
26 m_signX(1),
27 m_signY(1),
30 m_debug(false)
31{
32 // Only fill ModuleEnergys where crate, module numbers valid
33 if (m_debug) std::cout << "Create ModuleEnergy for crate "
34 << crate << " module " << module << std::endl;
35 if (m_crate <= 1 && m_module <= 15) {
37 m_signY = ( (module < 8) ? 1 : -1 );
38 m_signX = ( (crate == 0) ? m_signY : -m_signY );
40 bool saturated = false;
41 JetEnergyModuleKey get;
42 std::vector<unsigned int> keys = get.jeKeys(crate, module);
43 for (unsigned int k : keys) {
44 xAOD::JetElementMap_t::const_iterator test=JEContainer->find(k);
45 if (test != JEContainer->end()) {
47 double eta = test->second->eta();
48 int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1);
50 if (TEMasks == 0 || TEMasks->find(ieta) == TEMasks->end()) {
52 if (test->second->isSaturated()) {
53 saturated = true;
54 }
55 else {
57 int jetElementET;
58 if (slice < 0) jetElementET = test->second->et();
59 else jetElementET = test->second->sliceET(slice);
61 if (jetElementET > m_jetElementThresholdEtMiss) {
63 double phi = test->second->phi();
64 int cosPhi = 0;
65 int sinPhi = 0;
66 getSinCos(eta,phi,cosPhi,sinPhi);
68 unsigned int EnergyX = ((jetElementET*cosPhi) & 0x7ffffc00);
69 unsigned int EnergyY = ((jetElementET*sinPhi) & 0x7ffffc00);
70 m_Ex += EnergyX;
71 m_Ey += EnergyY;
72 if (m_debug) std::cout << "JE phi = " << phi << ", ET = " << jetElementET
73 << ", Ex = " << (EnergyX>>10) << ", Ey = " << (EnergyY>>10) << std::endl;
74 }
76 if ( jetElementET > m_jetElementThresholdEtSum )
77 m_Et += jetElementET;
78 } // End of processing of unsaturated jetElement
79 } // End processing of unvetoed element
80 } // End check for end of container
81 } // End loop through keys
82
84 m_Ex = m_Ex>>12;
85 m_Ey = m_Ey>>12;
86
88 if (saturated || (m_Ex > (1<<m_EtBits)-1)) m_Ex = (1<<m_EtBits)-1;
89 if (saturated || (m_Ey > (1<<m_EtBits)-1)) m_Ey = (1<<m_EtBits)-1;
90 if (saturated || (m_Et > (1<<m_EtBits)-1)) m_Et = (1<<m_EtBits)-1;
91
92 if (m_debug) {
93 std::cout << "Crate " << crate << " Module " << module <<
94 " sums: " << std::endl;
95 std::cout << " Ex = " << static_cast<int>(m_Ex)*m_signX << std::endl;
96 std::cout << " Ey = " << static_cast<int>(m_Ey)*m_signY << std::endl;
97 std::cout << " Et = " << m_Et << std::endl;
98 }
99 }
100}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
unsigned int crate() const
which module is this?
unsigned int m_Ex
unsigned int module() const
return module number
unsigned int m_Ey
unsigned int m_Et
unsigned int m_crate
static const unsigned int m_EtBits
void getSinCos(double eta, double phi, int &cosPhi, int &sinPhi)
return cos, sin coefficients for a given JetElement
unsigned int m_module
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
setScaleOne setStatusOne saturated

◆ ModuleEnergy() [2/2]

LVL1::ModuleEnergy::ModuleEnergy ( unsigned int crate,
unsigned int module,
unsigned int et,
unsigned int ex,
unsigned int ey )

Set up Ex, Ey signs for this module

Check for overflows. Set ET to full scale if these occur

Definition at line 102 of file ModuleEnergy.cxx.

104 :
107 m_Et(et),
108 m_Ex(ex),
109 m_Ey(ey),
110 m_signX(1),
111 m_signY(1),
112 m_crate(crate),
114 m_debug(false)
115{
116 // Only fill ModuleEnergys where crate, module numbers valid
117 if (m_debug) std::cout << "Create ModuleEnergy for crate "
118 << crate << " module " << module << std::endl;
119 if (m_crate <= 1 && m_module <= 15) {
121 m_signY = ( (module < 8) ? 1 : -1 );
122 m_signX = ( (crate == 0) ? m_signY : -m_signY );
123
125 if (m_Ex > (1<<m_EtBits)-1) m_Ex = (1<<m_EtBits)-1;
126 if (m_Ey > (1<<m_EtBits)-1) m_Ey = (1<<m_EtBits)-1;
127 if (m_Et > (1<<m_EtBits)-1) m_Et = (1<<m_EtBits)-1;
128
129 if (m_debug) {
130 std::cout << "Crate " << crate << " Module " << module <<
131 " sums: " << std::endl;
132 std::cout << " Ex = " << static_cast<int>(m_Ex)*m_signX << std::endl;
133 std::cout << " Ey = " << static_cast<int>(m_Ey)*m_signY << std::endl;
134 std::cout << " Et = " << m_Et << std::endl;
135 }
136 }
137}
unsigned int et() const
return the scalar & vector sums of all JE ETs (i.e sums the energies of up to 32 contained JEs)
unsigned int ey() const
unsigned int ex() const

◆ ~ModuleEnergy()

LVL1::ModuleEnergy::~ModuleEnergy ( )

Definition at line 140 of file ModuleEnergy.cxx.

140 {
141}

Member Function Documentation

◆ crate()

unsigned int LVL1::ModuleEnergy::crate ( ) const

which module is this?

return crate number

Definition at line 144 of file ModuleEnergy.cxx.

144 {
145 return m_crate;
146}

◆ et()

unsigned int LVL1::ModuleEnergy::et ( ) const

return the scalar & vector sums of all JE ETs (i.e sums the energies of up to 32 contained JEs)

return Et, Ex, Ey sums of contained JEs (up to 32 JEs)

module sums are unsigned. As a convenience, add methods to return signs for this module

Definition at line 153 of file ModuleEnergy.cxx.

153 {
154 return m_Et;
155}

◆ ex()

unsigned int LVL1::ModuleEnergy::ex ( ) const

Definition at line 156 of file ModuleEnergy.cxx.

156 {
157 return m_Ex;
158}

◆ ey()

unsigned int LVL1::ModuleEnergy::ey ( ) const

Definition at line 159 of file ModuleEnergy.cxx.

159 {
160 return m_Ey;
161}

◆ getSinCos()

void LVL1::ModuleEnergy::getSinCos ( double eta,
double phi,
int & cosPhi,
int & sinPhi )
private

return cos, sin coefficients for a given JetElement

Different phi granularities in central and forward calorimeters

Each module spans 1 quadrant in phi. Hence want phi position relative to module edge

Barrel and endcap calorimeters

Even quadrants, modPhi measured from horizontal

Odd quadrants, modPhi measured from vertical

Forward calorimeters

Definition at line 172 of file ModuleEnergy.cxx.

172 {
173
175 unsigned int SinCos[8] = {401,1187,1928,2594,3161,3607,3913,4070};
176 unsigned int fwdSinCos[4] = {794,2261,3384,3992};
177
179 float modPhi = fmod(phi, M_PI/2.);
180
182 if (fabs(eta) < 3.2) {
183 int phiBin = (int)(modPhi*16/M_PI);
184 if (m_crate > 0) {
185 cosPhi = SinCos[phiBin];
186 sinPhi = SinCos[7-phiBin];
187 }
188 else {
189 cosPhi = SinCos[7-phiBin];
190 sinPhi = SinCos[phiBin];
191 }
192 }
194 else {
195 int phiBin = (int)(modPhi*8/M_PI);
196 if (m_crate > 0) {
197 cosPhi = fwdSinCos[phiBin];
198 sinPhi = fwdSinCos[3-phiBin];
199 }
200 else {
201 cosPhi = fwdSinCos[3-phiBin];
202 sinPhi = fwdSinCos[phiBin];
203 }
204 }
205
206} // end of getSinCos
#define M_PI
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin

◆ module()

unsigned int LVL1::ModuleEnergy::module ( ) const

return module number

Definition at line 148 of file ModuleEnergy.cxx.

148 {
149 return m_module;
150}

◆ signX()

int LVL1::ModuleEnergy::signX ( ) const

return signs of Ex and Ey for this module

Definition at line 164 of file ModuleEnergy.cxx.

164 {
165 return m_signX;
166}

◆ signY()

int LVL1::ModuleEnergy::signY ( ) const

Definition at line 167 of file ModuleEnergy.cxx.

167 {
168 return m_signY;
169}

Member Data Documentation

◆ m_crate

unsigned int LVL1::ModuleEnergy::m_crate
private

Definition at line 70 of file ModuleEnergy.h.

◆ m_debug

bool LVL1::ModuleEnergy::m_debug
private

Definition at line 72 of file ModuleEnergy.h.

◆ m_Et

unsigned int LVL1::ModuleEnergy::m_Et
private

Definition at line 65 of file ModuleEnergy.h.

◆ m_EtBits

const unsigned int LVL1::ModuleEnergy::m_EtBits = 14
staticprivate

Definition at line 73 of file ModuleEnergy.h.

◆ m_Ex

unsigned int LVL1::ModuleEnergy::m_Ex
private

Definition at line 66 of file ModuleEnergy.h.

◆ m_Ey

unsigned int LVL1::ModuleEnergy::m_Ey
private

Definition at line 67 of file ModuleEnergy.h.

◆ m_jetElementThresholdEtMiss

int LVL1::ModuleEnergy::m_jetElementThresholdEtMiss
private

Definition at line 64 of file ModuleEnergy.h.

◆ m_jetElementThresholdEtSum

int LVL1::ModuleEnergy::m_jetElementThresholdEtSum
private

Definition at line 63 of file ModuleEnergy.h.

◆ m_module

unsigned int LVL1::ModuleEnergy::m_module
private

Definition at line 71 of file ModuleEnergy.h.

◆ m_signX

int LVL1::ModuleEnergy::m_signX
private

Definition at line 68 of file ModuleEnergy.h.

◆ m_signY

int LVL1::ModuleEnergy::m_signY
private

Definition at line 69 of file ModuleEnergy.h.


The documentation for this class was generated from the following files: