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

The JetEnergyModuleKey object provides the key for each trigger tower depending on its eta-phi coords. More...

#include <JetEnergyModuleKey.h>

Inheritance diagram for LVL1::JetEnergyModuleKey:
Collaboration diagram for LVL1::JetEnergyModuleKey:

Public Types

enum  JEMRegion { MidJEM =0 , LeftEndJEM =1 , RightEndJEM =2 , JEMRegionERROR =999 }

Public Member Functions

 JetEnergyModuleKey ()
 constructs a JetEnergyModuleKey object
virtual ~JetEnergyModuleKey ()
unsigned int jemKey (const xAOD::JetElement *jetElement)
 returns the key of the passed Coordinate
unsigned int jemKey (unsigned int crate, unsigned int module)
 calculates key from crate and module index
std::vector< unsigned int > jeKeys (unsigned int crate, unsigned int module)
 calculates keys of all JetElements in given crate and module
std::vector< CoordinatejeCoords (unsigned int crate, unsigned int module)
 returns coordinates of all JetElements in given crate and module
unsigned int row (const Coordinate &coord) const
 returns the phi row of a coord within the JEM that contains it.
unsigned int row (const xAOD::JetElement *jetElement) const
 returns the phi row of a coord within the JEM that contains it.
double rowPhiCoord (unsigned int row, const Coordinate &jemCoord)
 returns the phi coord of the row of the JEM at the coordinates passed
virtual double dPhi (const Coordinate &coord) const override
 height
virtual double dEta (const Coordinate &coord) const override
 width
JEMRegion region (const Coordinate &coord) const
 region
unsigned int col (const Coordinate &coord)
 return row of passed coordinate
unsigned int jem (const Coordinate &coord) const
 returns ID of JEP module (i.e.
virtual double eta () const
 returns the centre of the TT at eta_coord:
virtual double phi () const
 returns phi coordinate of centre of relevant trigger tower.
unsigned int key (double phi, double eta)
 calculates a map key from passed phi, eta coordinates
unsigned int key (const Coordinate &coord)
 returns the key of the passed Coordinate
Coordinate coord () const
 return central coords of current key value.

Protected Member Functions

ICoordinate convertCoordsToIntegers (double phi, double eta)
 converts the coordinates and corrects for overflows etc.
virtual int sign (int temp) const
 returns -1 if temp is -ve and +1 if it is +ve.
virtual int sign (double temp) const
 returns -1 if temp is -ve and +1 if it is +ve.
int round (double a) const
 rounds number to nearest whole number
int sharpRound (double a) const
 rounds number as follows (-1.0 to 0.0) -> -1, (0.0 to 1.0) -> 0, (1.0 to 2.0)->1 etc.
int sharpRound2 (int a, int b) const
 divides a/b and returns a number as follows (where +b means +ve b): if 0
void setupThisKeyValues ()

Protected Attributes

int m_iphi
 integer phi coord
int m_ieta
 integer eta coord
double m_eta
 eta coordinate of key
double m_phi
 phi coordinate of key
int m_phiBin
 phi bin
int m_etaBin
 eta bin
double m_centralPhi
 this is the coordinate of the centre of the relevant trigger tower.
double m_centralEta
 this is the coordinate of the centre of the relevant trigger tower.
bool m_debug
 turns DEBUG code on and off

Private Member Functions

virtual BinAndCoord calculateTriggerBin (const ICoordinate &iCoord) override
 converts integer phi, eta coordinates to phi, eta trigger bins, and central coords
void setBins (const ICoordinate &iCoord, unsigned int &phiBin, int &etaBin)
 sets the eta and phi bins
unsigned int midJEMEtaCol (const Coordinate &coord) const
 No descriptions.
unsigned int leftEndJEMEtaCol (const Coordinate &coord) const
 returns eta row of JEMs 0, or 8
unsigned int rightEndJEMEtaCol (const Coordinate &coord) const
 returns eta row of JEMs 7 or 15
unsigned int phiQuadrant (const double phi) const
 returns the quadrant number associated with the phi coordinate, 0 - 90 = 0 90 - 180 = 1 180-270 = 2 270-360 = 3

Private Attributes

bool m_debugModuleKey
 set to true to turn debugging info on

Detailed Description

The JetEnergyModuleKey object provides the key for each trigger tower depending on its eta-phi coords.

The key is an integer number that uniquely identifies each tower, and is needed by the STL map container: the map holds trigger towers and we retrieve them using their keys.

Author
Edward Moyse

Definition at line 35 of file JetEnergyModuleKey.h.

Member Enumeration Documentation

◆ JEMRegion

Enumerator
MidJEM 
LeftEndJEM 
RightEndJEM 
JEMRegionERROR 

Definition at line 38 of file JetEnergyModuleKey.h.

Constructor & Destructor Documentation

◆ JetEnergyModuleKey()

LVL1::JetEnergyModuleKey::JetEnergyModuleKey ( )

constructs a JetEnergyModuleKey object

Definition at line 36 of file JetEnergyModuleKey.cxx.

37 if (m_debugModuleKey) std::cout << "JetEnergyModuleKey: m_debugModuleKey output turned on...."<<std::endl;
38}
bool m_debugModuleKey
set to true to turn debugging info on
KeyUtilities()
the constructor is protected so a user can never make a KeyUtilities object

◆ ~JetEnergyModuleKey()

LVL1::JetEnergyModuleKey::~JetEnergyModuleKey ( )
virtual

Definition at line 40 of file JetEnergyModuleKey.cxx.

40 {
41}

Member Function Documentation

◆ calculateTriggerBin()

LVL1::BinAndCoord LVL1::JetEnergyModuleKey::calculateTriggerBin ( const ICoordinate & iCoord)
overrideprivatevirtual

converts integer phi, eta coordinates to phi, eta trigger bins, and central coords

converts integer phi, eta coordinates to phi, eta trigger bins.

Returns coordinates of centre of JEs

Implements LVL1::KeyUtilities.

Definition at line 245 of file JetEnergyModuleKey.cxx.

245 {
246// double phiBinWidth=((2*M_PI)/64.0);
247 int abs_ieta=abs(iCoord.eta() );
248 int sign=( iCoord.eta() )/abs_ieta;
249
250 int etaBin=0; unsigned int phiBin=0;
251 setBins(iCoord,phiBin,etaBin);
252
253 double centralPhi=( (static_cast<double>(phiBin))*TrigT1CaloDefs::jemPhiSize )
255 double centralEta=0.0;
256 if ((etaBin>-4)&&(etaBin<4)){
257 centralEta=(static_cast<double>(etaBin)*(TrigT1CaloDefs::jemEtaSize) )
259 }else{
260 centralEta=3.65*sign;//centre of end JEMs
261 }
262 if (m_debugModuleKey){
263 std::cout << "JetEnergyModuleKey: start calcTrigBin"<<std::endl;
264 std::cout << "phi, eta : ("<<m_phi<<", "<<m_eta<<")"<<std::endl;
265 std::cout << "iphi, ieta : ("<<( iCoord.phi() )<<", "<<( iCoord.eta() )<<")"<<std::endl;
266 std::cout << "abs_ieta : ("<<abs_ieta<<" and sign : "<<sign<<std::endl;
267 std::cout << "central : ("<<centralPhi<<", "<<centralEta<<")"
268 << "bin : ("<<phiBin<<","<<etaBin<<")"<<std::endl;
269 }
270
271 Coordinate centralCoords(centralPhi, centralEta);
272 if (m_debugModuleKey) std::cout <<" JetEnergyModuleKey : created coord "<<centralCoords<<std::endl;
273 return BinAndCoord(phiBin,etaBin,centralCoords);
274}
void setBins(const ICoordinate &iCoord, unsigned int &phiBin, int &etaBin)
sets the eta and phi bins
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
double m_phi
phi coordinate of key
double m_eta
eta coordinate of key
static const double jemPhiSize
static const double jemEtaSize
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin

◆ col()

unsigned int LVL1::JetEnergyModuleKey::col ( const Coordinate & coord)

return row of passed coordinate

Definition at line 213 of file JetEnergyModuleKey.cxx.

213 {
214 switch (region(coord)){
215 case MidJEM :
216 return midJEMEtaCol(coord);
217 case LeftEndJEM :
218 return leftEndJEMEtaCol(coord);
219 case RightEndJEM :
220 return rightEndJEMEtaCol(coord);
221 default:
222 std::cerr << "JetEnergyModuleKey::etaColumn UNKNOWN REGION"<<std::endl;
223 }
224 return static_cast<unsigned int>(JEMRegionERROR);
225}
unsigned int midJEMEtaCol(const Coordinate &coord) const
No descriptions.
unsigned int leftEndJEMEtaCol(const Coordinate &coord) const
returns eta row of JEMs 0, or 8
unsigned int rightEndJEMEtaCol(const Coordinate &coord) const
returns eta row of JEMs 7 or 15
JEMRegion region(const Coordinate &coord) const
region
Coordinate coord() const
return central coords of current key value.

◆ convertCoordsToIntegers()

ICoordinate LVL1::KeyUtilities::convertCoordsToIntegers ( double phi,
double eta )
protectedinherited

converts the coordinates and corrects for overflows etc.

For instance, if phi is negative this routine converts to the equivalent positive position.

For instance, if phi is negative this routine converts to the equivalent positive position. *todo tidy up a bit.

Definition at line 103 of file KeyUtilities.cxx.

103 {
104
105 double phiBinWidth=((2*M_PI)/64.0);
106 // there are a maximum of 64 cells in the phi direction
107 // stretching from 0 to ~2*PI.
108 if (m_debug) std::cout << "KU : (phi, eta) ("<<phi<<","<<eta<<")"<<std::endl;
109 int iphi=sharpRound(phi/phiBinWidth);
110 int ieta=0;
111
112 // Now check that m_iphi is between 0 and 64.
113 iphi = iphi%64;
114 if (iphi<0) iphi = 64+iphi;
115
116 // Make m_ieta symmetrical:
117 // o no cell at m_ieta=0
118 // o first cells at +-1
119 // o last cells at about +- 50
120 // this gives us a more useful numerical symmetry.
121
122 // So to get integer value we do:
123 int temp_sign=sign(eta);
124 double temp_abs=eta*temp_sign;
125
126 double temp_double=(temp_abs*10.0+1.0)*temp_sign;
127 if (m_debug) std::cout << "KU : temp_abs, temp_sign, temp_double : "<<temp_abs<<","<<temp_sign<<","<<temp_double<<std::endl;
128// if (m_eta>=0.0){
129// temp_double=m_eta*10.0+1.0;
130// }else{
131// temp_double=m_eta*10.0-1.0;
132// }
133
134 ieta=static_cast<int>(temp_double);
135 if (m_debug) std::cout << "KU : (iphi, ieta) ("<<iphi<<","<<ieta<<")"<<std::endl;
136 return ICoordinate(iphi, ieta, eta);
137}
#define M_PI
virtual double eta() const
returns the centre of the TT at eta_coord:
virtual double phi() const
returns phi coordinate of centre of relevant trigger tower.
int sharpRound(double a) const
rounds number as follows (-1.0 to 0.0) -> -1, (0.0 to 1.0) -> 0, (1.0 to 2.0)->1 etc.
bool m_debug
turns DEBUG code on and off

◆ coord()

LVL1::Coordinate LVL1::KeyUtilities::coord ( ) const
inherited

return central coords of current key value.

Definition at line 194 of file KeyUtilities.cxx.

194 {
195 return Coordinate(m_centralPhi,m_centralEta);
196}
double m_centralEta
this is the coordinate of the centre of the relevant trigger tower.
double m_centralPhi
this is the coordinate of the centre of the relevant trigger tower.

◆ dEta()

double LVL1::JetEnergyModuleKey::dEta ( const Coordinate & coord) const
overridevirtual

width

return width of JE

Implements LVL1::KeyUtilities.

Definition at line 174 of file JetEnergyModuleKey.cxx.

174 {
175 if (region(coord) == MidJEM) return 0.8;
177 return 2.5;//end JEMs cover 2.4-4.9
178 return 0.0;
179}

◆ dPhi()

double LVL1::JetEnergyModuleKey::dPhi ( const Coordinate & coord) const
overridevirtual

height

return height of JEM

Implements LVL1::KeyUtilities.

Definition at line 169 of file JetEnergyModuleKey.cxx.

169 {
170 return M_PI/2;// one quadrant
171}

◆ eta()

double LVL1::KeyUtilities::eta ( ) const
virtualinherited

returns the centre of the TT at eta_coord:

returns the eta coord of the centre of the relevent trigger tower

Definition at line 142 of file KeyUtilities.cxx.

142 {
143 return m_centralEta;
144}

◆ jeCoords()

std::vector< Coordinate > LVL1::JetEnergyModuleKey::jeCoords ( unsigned int crate,
unsigned int module )

returns coordinates of all JetElements in given crate and module

returns coordinates of all JetElements in passed crate+module

Get keys for core JetElement locations in this module
Algorithm: start from bottom-left JetElement coordinate in JEM
Then step up by 8 elements in phi (4 in FCAL)
Increment eta and repeat
Do so for all 4 eta bins in JEM

Definition at line 79 of file JetEnergyModuleKey.cxx.

79 {
80 std::vector<Coordinate> coords;
81
82 // Protection
83 if (crate > 1 || module > 15) return coords;
84
90
91 int top = ( module < 8 ? 0 : 1 );
92 double phiStart = crate*TrigT1CaloDefs::jemPhiSize
95 double etaStart;
96 // Central JEMs are easy
97 if ( (module%8) > 0) {
98 etaStart = (module%8)*TrigT1CaloDefs::jemEtaSize - 3.1;
99 }
100 // -ive eta end
101 else {
103 }
104
105 // First coordinate for this JEM
106 Coordinate startCol(phiStart, etaStart);
107 // Nested incrementation of eta and phi
108 CoordToHardware cth;
109 JetElementKey get(0.,0.);
110 while (cth.jepModule( startCol ) == module) {
111 Coordinate next = get.getCentre(startCol);
112 while (cth.jepCrate( next ) == crate) {
113 coords.push_back(next);
114 next = get.upPhi(next);
115 }
116 startCol = get.rightEta(startCol);
117 if (startCol.eta() == TrigT1CaloDefs::RegionERROREtaCentre) break;
118 }
119
120 return coords;
121}
@ top
static const double Region5EtaCentre
static const double RegionERROREtaCentre
static const double Region0Height
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ jeKeys()

std::vector< unsigned int > LVL1::JetEnergyModuleKey::jeKeys ( unsigned int crate,
unsigned int module )

calculates keys of all JetElements in given crate and module

returns JetElementKeys of all JetElements in passed crate+module

Definition at line 59 of file JetEnergyModuleKey.cxx.

59 {
60 std::vector<unsigned int> keys;
61
62 // Protection
63 if (crate > 1 || module > 15) return keys;
64
65 // First get coordinates
66 std::vector<Coordinate> coords = jeCoords(crate, module);
67
68 // Then calculate keys
69 JetElementKey get(0.,0.);
70 for (const Coordinate& c : coords) {
71 keys.push_back(get.jeKey(c));
72 }
73
74 return keys;
75}
std::vector< Coordinate > jeCoords(unsigned int crate, unsigned int module)
returns coordinates of all JetElements in given crate and module

◆ jem()

unsigned int LVL1::JetEnergyModuleKey::jem ( const Coordinate & coord) const

returns ID of JEP module (i.e.

Returns JEM number for coordinate.

JEM) There are 16 JEMS per crate, and 8 JEMS per quadrant. The central 6 JEMS cover the barrel, JEMs 0,7,8 & 15 extend over the FCAL as well. (each crate contains JEMS for opposite quadrants, so one crate might have JEMs 0-7 in quadrant 0 and JEMs 8-15 in quadrant 2)

Definition at line 228 of file JetEnergyModuleKey.cxx.

228 {
229 double min=3.2; double jemEtaWidth=0.8;
230 unsigned int crateModifier=(phiQuadrant(coord.phi())/2);
231 //=0 for quad 0&1, =1 for quad 2&3
232
233 double temp = (coord.eta()+min)/jemEtaWidth;
234 int jem = static_cast<int>(temp);
235 jem=(jem < 0 ? 0 : jem);
236 jem=(jem > 7 ? 7 : jem);
237
238 jem+=(8*crateModifier);
239 return static_cast<unsigned int>(jem);
240}
#define min(a, b)
Definition cfImp.cxx:40
unsigned int phiQuadrant(const double phi) const
returns the quadrant number associated with the phi coordinate, 0 - 90 = 0 90 - 180 = 1 180-270 = 2 2...
unsigned int jem(const Coordinate &coord) const
returns ID of JEP module (i.e.

◆ jemKey() [1/2]

unsigned int LVL1::JetEnergyModuleKey::jemKey ( const xAOD::JetElement * jetElement)

returns the key of the passed Coordinate

returns trigger tower key of passed Coordinate

Definition at line 44 of file JetEnergyModuleKey.cxx.

44 {
45 return key(jetElement->phi(), jetElement->eta());
46}
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates
float phi() const
get phi (note that for L1Calo phi runs from 0 to 2pi)
float eta() const
get eta

◆ jemKey() [2/2]

unsigned int LVL1::JetEnergyModuleKey::jemKey ( unsigned int crate,
unsigned int module )

calculates key from crate and module index

returns trigger tower key of passed crate+module

Definition at line 51 of file JetEnergyModuleKey.cxx.

51 {
52 double eta = ((module%8)+0.5)*TrigT1CaloDefs::jemEtaSize - 3.2;
53 int quadrant = crate + ((module>7) ? 2 : 0);
54 double phi = (quadrant+0.5)*TrigT1CaloDefs::jemPhiSize;
55 return key(phi, eta);
56}

◆ key() [1/2]

unsigned int LVL1::KeyUtilities::key ( const Coordinate & coord)
inherited

returns the key of the passed Coordinate

returns trigger tower key of passed Coordinate

Definition at line 94 of file KeyUtilities.cxx.

94 {
95 return key(coord.phi(), coord.eta());
96}

◆ key() [2/2]

unsigned int LVL1::KeyUtilities::key ( double phi,
double eta )
inherited

calculates a map key from passed phi, eta coordinates

returns key

calculates a map key from passed phi, eta coordinates

Definition at line 77 of file KeyUtilities.cxx.

77 {
78 m_eta=eta;
79 m_phi=phi;
80 ICoordinate iCoord = convertCoordsToIntegers(m_phi, m_eta);
81 BinAndCoord bandc = calculateTriggerBin(iCoord);
82 if (m_debug) std::cout << "KU : key: got bandc "<<std::endl;
83 m_phiBin=bandc.phiBin();
84 m_etaBin=bandc.etaBin();
85 m_centralPhi=bandc.coords().phi();
86 m_centralEta=bandc.coords().eta();
87 int temp=((m_etaBin+50)<<6) + m_phiBin;
88
89 if (m_debug) std::cout << "KU : key: returning - "<<temp<<std::endl;
90 return static_cast<unsigned int>(temp);
91}
virtual BinAndCoord calculateTriggerBin(const ICoordinate &iCoord)=0
converts integer phi, eta coordinates to phi, eta trigger bins.
ICoordinate convertCoordsToIntegers(double phi, double eta)
converts the coordinates and corrects for overflows etc.

◆ leftEndJEMEtaCol()

unsigned int LVL1::JetEnergyModuleKey::leftEndJEMEtaCol ( const Coordinate & coord) const
private

returns eta row of JEMs 0, or 8

returns eta row of JEMs 0,7,8 or 15

Definition at line 293 of file JetEnergyModuleKey.cxx.

293 {
294 // left hand end first
295 JetElementKey get;
296 switch (get.jeRegion( coord )){
298 return 3;
299 break;
301 return 2;
302 break;
304 return 1;
305 break;
307 return 0;
308 break;
310 // here to stop compiler warnings
311 break;
313 // here to stop compiler warnings
314 break;
315 }
316 return static_cast<unsigned int>(JEMRegionERROR);
317}

◆ midJEMEtaCol()

unsigned int LVL1::JetEnergyModuleKey::midJEMEtaCol ( const Coordinate & coord) const
private

No descriptions.

Definition at line 277 of file JetEnergyModuleKey.cxx.

277 {
278 double etaWidth=0.2;//only true for middle JEMS
279 double JEMEtaSize=0.8;
280// unsigned int columnsPerJEM= 4;
281 int etaBin=( jem(coord)%8)-4;//bins range from -4 to +3
282 double etaMin=(etaBin*JEMEtaSize);
283
284 double temp =(coord.eta()-etaMin)/etaWidth;
285 int colNum=sharpRound(temp);
286
287 colNum=(colNum < 0 ? 0 : colNum);//sorts out any rounding errors
288 colNum=(colNum > 3 ? 3 : colNum);
289
290 return colNum;
291}

◆ phi()

double LVL1::KeyUtilities::phi ( ) const
virtualinherited

returns phi coordinate of centre of relevant trigger tower.

returns phi coordinate of the centre of the relevent trigger tower.

Definition at line 151 of file KeyUtilities.cxx.

151 {
152 return m_centralPhi;
153}

◆ phiQuadrant()

unsigned int LVL1::JetEnergyModuleKey::phiQuadrant ( const double phi) const
private

returns the quadrant number associated with the phi coordinate, 0 - 90 = 0 90 - 180 = 1 180-270 = 2 270-360 = 3

Definition at line 353 of file JetEnergyModuleKey.cxx.

353 {
354 double temp = phi/(M_PI/2);
355 unsigned int quad = static_cast<unsigned int>(temp);
356 quad=(quad > 3 ? 0 : quad);
357
358 return static_cast<unsigned int>(quad);
359}

◆ region()

LVL1::JetEnergyModuleKey::JEMRegion LVL1::JetEnergyModuleKey::region ( const Coordinate & coord) const

region

r

Definition at line 186 of file JetEnergyModuleKey.cxx.

186 {
187 double absEta=fabs(coord.eta());
188 if (absEta<=2.4) return MidJEM;
189 if ((coord.eta()>2.4)&&(coord.eta()<=4.9))return RightEndJEM;
190 if ((coord.eta()>=-4.9)&&(coord.eta()<-2.4))return LeftEndJEM;
191 std::cerr << "JetEnergyModuleKey::region ... Unknown region!"<<std::endl
192 << "Coordinate is ("<<coord.phi()<<", "<<coord.eta()<<")"
193 <<std::endl;
194 return JEMRegionERROR;
195}
bool absEta(const xAOD::TauJet &tau, float &out)

◆ rightEndJEMEtaCol()

unsigned int LVL1::JetEnergyModuleKey::rightEndJEMEtaCol ( const Coordinate & coord) const
private

returns eta row of JEMs 7 or 15

returns eta row of JEMs 0,7,8 or 15

Definition at line 320 of file JetEnergyModuleKey.cxx.

320 {
321 // left hand end first
322 JetElementKey get;
323 switch (get.jeRegion( coord )){
325 return 0;
326 break;
328 return 1;
329 break;
331 return 2;
332 break;
334 return 3;
335 break;
337 // here to stop compiler warnings
338 break;
340 // here to stop compiler warnings
341 break;
342 }
343 return static_cast<unsigned int>(JEMRegionERROR);
344}

◆ round()

int LVL1::KeyUtilities::round ( double a) const
protectedinherited

rounds number to nearest whole number

Definition at line 175 of file KeyUtilities.cxx.

175 {
176 return static_cast<int>(a<0.0?ceil(a-0.5):a>0.0?floor(a+0.5):0.0);
177}
static Double_t a

◆ row() [1/2]

unsigned int LVL1::JetEnergyModuleKey::row ( const Coordinate & coord) const

returns the phi row of a coord within the JEM that contains it.

Used in energy trigger (JEM)

Definition at line 124 of file JetEnergyModuleKey.cxx.

124 {
125 double phi=coord.phi();
126 double rowHeight=TrigT1CaloDefs::jemPhiSize/8.0;
127
128 unsigned int rowsPerJEM = 8u;
129 int rowNum=static_cast<int>(phi/rowHeight);
130 rowNum=rowNum%rowsPerJEM;
131 return rowNum;
132}

◆ row() [2/2]

unsigned int LVL1::JetEnergyModuleKey::row ( const xAOD::JetElement * JE) const

returns the phi row of a coord within the JEM that contains it.

Used in energy trigger (JEM)

Definition at line 136 of file JetEnergyModuleKey.cxx.

136 {
137 Coordinate coord(JE->phi(), JE->eta());
138 return row( coord );
139}
unsigned int row(const Coordinate &coord) const
returns the phi row of a coord within the JEM that contains it.

◆ rowPhiCoord()

double LVL1::JetEnergyModuleKey::rowPhiCoord ( unsigned int row,
const Coordinate & jemCoord )

returns the phi coord of the row of the JEM at the coordinates passed

Definition at line 143 of file JetEnergyModuleKey.cxx.

143 {
144 //not sure how to do this.
145 //should really reuse code, but above is tied to KU stuff. Probably way to go though.
146
147 ICoordinate iCoord = convertCoordsToIntegers(jemCoord.phi(), jemCoord.eta());
148 int etaBin=0; unsigned int phiBin=0;
149 setBins(iCoord,phiBin,etaBin);
150 // now work out row coord.
151
152 if (rowNum>7){
153 std::cerr << "ERROR!!! JetEnergyModuleKey::rowPhiCoord exceeds allowed range. Row, "<<rowNum
154 <<" will be set to zero"<<std::endl;
155 rowNum=0;
156 }
157 double phi =( (static_cast<double>(phiBin))*TrigT1CaloDefs::jemPhiSize ); //bot of JEM
158 phi+= static_cast<double>( rowNum )*0.2+0.1; //mid of row
159 if (m_debugModuleKey){
160 if ( (phi<(jemCoord.phi()-0.8))||(phi>(jemCoord.phi()+0.8) ) ){
161 std::cerr << "ERROR!!! JetEnergyModuleKey::rowPhiCoord phi of row is "<<phi
162 <<" in a JEM at ("<<jemCoord.phi()<<", "<<jemCoord.eta()<<")"<<std::endl;
163 }//endif phi sensible
164 }//endif debug
165 return phi;
166}

◆ setBins()

void LVL1::JetEnergyModuleKey::setBins ( const ICoordinate & iCoord,
unsigned int & phiBin,
int & etaBin )
private

sets the eta and phi bins

Definition at line 200 of file JetEnergyModuleKey.cxx.

200 {
201 unsigned int iPhiSize=16 ; // =PI/2 * 10
202 phiBin=( iCoord.phi() )/(iPhiSize);
203 int iEtaSize=8;// JEMs are 0.8 in eta, i.e ietaSize=8
204 etaBin=sharpRound2(iCoord.eta(),iEtaSize);
205 // the above calculation fails since end JEMs are larger, so ....
206 etaBin=(etaBin < -4 ? -4 : etaBin); // etaBin=-5
207 etaBin=(etaBin > 4 ? 4 : etaBin); // belongs to the JEM in etaBin=-4
208
209 return;
210}
int sharpRound2(int a, int b) const
divides a/b and returns a number as follows (where +b means +ve b): if 0

◆ setupThisKeyValues()

void LVL1::KeyUtilities::setupThisKeyValues ( )
protectedinherited

Definition at line 165 of file KeyUtilities.cxx.

165 {
166 ICoordinate iCoord = convertCoordsToIntegers(m_phi, m_eta);
167 BinAndCoord bandc = calculateTriggerBin(iCoord);
168 m_phiBin=bandc.phiBin();
169 m_etaBin=bandc.etaBin();
170 m_centralPhi=bandc.coords().phi();
171 m_centralEta=bandc.coords().eta();
172}

◆ sharpRound()

int LVL1::KeyUtilities::sharpRound ( double a) const
protectedinherited

rounds number as follows (-1.0 to 0.0) -> -1, (0.0 to 1.0) -> 0, (1.0 to 2.0)->1 etc.

Definition at line 180 of file KeyUtilities.cxx.

180 {
181 return static_cast<int>(a<0.0?(a-1.0):a>0.0?(a):0.0);
182}

◆ sharpRound2()

int LVL1::KeyUtilities::sharpRound2 ( int a,
int b ) const
protectedinherited

divides a/b and returns a number as follows (where +b means +ve b): if 0

Definition at line 184 of file KeyUtilities.cxx.

184 {
185 int temp=(abs(a)-1)/b+1;
186 return temp*sign(a);
187}

◆ sign() [1/2]

int LVL1::KeyUtilities::sign ( double temp) const
protectedvirtualinherited

returns -1 if temp is -ve and +1 if it is +ve.

returns 0 if temp =0

Definition at line 161 of file KeyUtilities.cxx.

161 {
162 return ((temp >= 0.0) ? 1 : -1);
163}

◆ sign() [2/2]

int LVL1::KeyUtilities::sign ( int temp) const
protectedvirtualinherited

returns -1 if temp is -ve and +1 if it is +ve.

returns 0 if temp =0

Definition at line 156 of file KeyUtilities.cxx.

156 {
157 return ((temp >= 0) ? 1 : -1);
158}

Member Data Documentation

◆ m_centralEta

double LVL1::KeyUtilities::m_centralEta
protectedinherited

this is the coordinate of the centre of the relevant trigger tower.

Definition at line 112 of file KeyUtilities.h.

◆ m_centralPhi

double LVL1::KeyUtilities::m_centralPhi
protectedinherited

this is the coordinate of the centre of the relevant trigger tower.

Definition at line 109 of file KeyUtilities.h.

◆ m_debug

bool LVL1::KeyUtilities::m_debug
protectedinherited

turns DEBUG code on and off

Definition at line 114 of file KeyUtilities.h.

◆ m_debugModuleKey

bool LVL1::JetEnergyModuleKey::m_debugModuleKey
private

set to true to turn debugging info on

Definition at line 100 of file JetEnergyModuleKey.h.

◆ m_eta

double LVL1::KeyUtilities::m_eta
protectedinherited

eta coordinate of key

Definition at line 100 of file KeyUtilities.h.

◆ m_etaBin

int LVL1::KeyUtilities::m_etaBin
protectedinherited

eta bin

Definition at line 106 of file KeyUtilities.h.

◆ m_ieta

int LVL1::KeyUtilities::m_ieta
protectedinherited

integer eta coord

Definition at line 98 of file KeyUtilities.h.

◆ m_iphi

int LVL1::KeyUtilities::m_iphi
protectedinherited

integer phi coord

Definition at line 96 of file KeyUtilities.h.

◆ m_phi

double LVL1::KeyUtilities::m_phi
protectedinherited

phi coordinate of key

Definition at line 102 of file KeyUtilities.h.

◆ m_phiBin

int LVL1::KeyUtilities::m_phiBin
protectedinherited

phi bin

Definition at line 104 of file KeyUtilities.h.


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