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

The JetElementKey object provides the key for each JetElement depending on its eta,phi coords (JetElementKey differs from JetInputKey in that ElementKey has 0.4 FCAL granularity, while InputKey has 0.2 FCAL granularity). More...

#include <JetElementKey.h>

Inheritance diagram for LVL1::JetElementKey:
Collaboration diagram for LVL1::JetElementKey:

Public Types

enum  JERegion {
  Barrel =0 , EndBarrel =1 , EndCap1 =2 , EndCap2 =3 ,
  EndCap3 =4 , FCAL =5
}

Public Member Functions

 JetElementKey (double phi, double eta)
 takes phi and eta and constructs a JetElementKey object which can return the key for this coord
 JetElementKey (const Coordinate coord)
 constructs a JetElementKey object
 JetElementKey ()
 constructs a JetElementKey object
virtual unsigned int jeKey (const xAOD::TriggerTower &tower)
 returns key of passed tower
virtual unsigned int jeKey (const xAOD::JetElement &jetElement)
 returns key of passed jetelement
virtual unsigned int jeKey (const double phi, const double eta)
 returns the key of the passed coords
virtual unsigned int jeKey (const Coordinate coord)
 returns the key of the passed Coordinate
unsigned int leftEtaKey (const double phi, const double eta)
 returns key of JE in +ve eta dir.
unsigned int rightEtaKey (const double phi, const double eta)
 returns key of JE in -ve eta dir.
unsigned int upPhiKey (const double phi, const double eta)
 returns key of next JE in +ve phi dir.
unsigned int downPhiKey (const double phi, const double eta)
 returns key of next JE in -ve phi dir.
Coordinate getCentre (const double phi, const double eta)
 returns the central coordinate of the JE which contains the passed coord
Coordinate getCentre (const Coordinate coord)
 returns the central coordinate of the JE which contains the passed coord
Coordinate rightEta (const double phi, const double eta)
 Functions for finding coordinates of neighbouring JEs.
Coordinate rightEta (const Coordinate coord)
 returns eta coord of JE in +ve eta dir.
Coordinate leftEta (const double phi, const double eta)
 returns key of JE in -ve eta dir.
Coordinate leftEta (const Coordinate coord)
 returns key of JE in -ve eta dir.
Coordinate downPhi (const double phi, const double eta)
 returns coord of next JE in -ve phi dir.
Coordinate downPhi (const Coordinate coord)
 returns coord of next JE in -ve phi dir.
Coordinate upPhi (const double phi, const double eta)
 returns coord of next JE in +ve phi dir.
Coordinate upPhi (const Coordinate coord)
 returns coord of next JE in +ve phi dir.
Coordinate upperLeft (const double phi, const double eta)
Coordinate upperLeft (const Coordinate coord)
Coordinate upperRight (const double phi, const double eta)
Coordinate upperRight (const Coordinate coord)
Coordinate lowerLeft (const double phi, const double eta)
Coordinate lowerLeft (const Coordinate coord)
Coordinate lowerRight (const double phi, const double eta)
Coordinate lowerRight (const Coordinate coord)
double dPhi (const double phi, const double eta) const
 return height of JE
double dPhi () const
 return height of JE
double dPhi (const Coordinate &coord) const
 return height of JE
double dEta (const double phi, const double eta) const
 return width of JE
double dEta () const
 return width of JE
double dEta (const Coordinate &coord) const
 return width of JE
unsigned int region (double eta) const
 returns region number at eta, where region is:
JERegion jeRegion (const Coordinate &coord) const
bool isFCAL (double eta) const
 returns TRUE if this coordinate is in the FCAL
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

void setupRegionData ()
 get region data from TrigT1CaloDefs and put in more useful format - vectors
void setupJetRegionData ()
 Does same as setupRegionData, except in FCAL where uses phi granularity appropriate for the jet trigger.
ICoordinateconvertCoordsToIntegers (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

BinAndCoordcalculateTriggerBin (ICoordinate *iCoord)
 converts integer phi, eta coordinates to phi, eta trigger bins.
void analCoordChecking (const Coordinate &coord)
 this is a bit over the top, but it looks to see if the calculated coordinate matches a coordinate centre that JetElementKeyBase would return.

Private Attributes

bool m_debugKeyBase
 set to true to turn debugging info on
std::vector< double > m_regionEtaCentre
 holds central coords of JEs in regions: Region Eta 0 <2.2 1 2.2-2.4 2 2.4-2.7 3 2.7-2.9 4 2.9-3.2 5 3.2-4.9
std::vector< double > m_regionWidth
 holds width of JEs in regions:
std::vector< double > m_regionHeight
 holds height of JEs in regions:

Detailed Description

The JetElementKey object provides the key for each JetElement depending on its eta,phi coords (JetElementKey differs from JetInputKey in that ElementKey has 0.4 FCAL granularity, while InputKey has 0.2 FCAL granularity).

As 2 implementations are required for the Jet and Energy triggers, differing only in the FCAL granularity, we solve this problem by inheritance. Thus JetElementKey now inherits from JetElementKeyBase (which is essentially the original JetElementKey, & itself inherits from KeyUtilities).

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.

Definition at line 46 of file JetElementKey.h.

Member Enumeration Documentation

◆ JERegion

Enumerator
Barrel 
EndBarrel 
EndCap1 
EndCap2 
EndCap3 
FCAL 

Definition at line 51 of file JetElementKeyBase.h.

Constructor & Destructor Documentation

◆ JetElementKey() [1/3]

LVL1::JetElementKey::JetElementKey ( double phi,
double eta )

takes phi and eta and constructs a JetElementKey object which can return the key for this coord

Definition at line 26 of file JetElementKey.cxx.

27{
30}
JetElementKeyBase()
constructs a JetElementKeyBase object
void setupRegionData()
get region data from TrigT1CaloDefs and put in more useful format - vectors
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.

◆ JetElementKey() [2/3]

LVL1::JetElementKey::JetElementKey ( const Coordinate coord)

constructs a JetElementKey object

Definition at line 40 of file JetElementKey.cxx.

40 : JetElementKeyBase(coord.phi(),coord.eta())
41{
44}
Coordinate coord() const
return central coords of current key value.

◆ JetElementKey() [3/3]

LVL1::JetElementKey::JetElementKey ( )

constructs a JetElementKey object

Definition at line 33 of file JetElementKey.cxx.

Member Function Documentation

◆ analCoordChecking()

void LVL1::JetElementKeyBase::analCoordChecking ( const Coordinate & coord)
privateinherited

this is a bit over the top, but it looks to see if the calculated coordinate matches a coordinate centre that JetElementKeyBase would return.

It doesn't return any errors or anything as it's purely being used in tests external to Athena

Definition at line 502 of file JetElementKeyBase.cxx.

502 {
503 Coordinate centre( getCentre( coord.phi(), coord.eta() ) );
504 double allowedSpread=0.0002;// I don't mind a bit of a rounding error....
505 if ( (coord.phi()<(centre.phi()-allowedSpread))||(coord.phi()>(centre.phi()+allowedSpread) ) )
506 std::cout << "PHI ERROR: "<< coord.phi() <<"!="<<centre.phi()<<std::endl;
507 if ( (coord.eta()<(centre.eta()-allowedSpread))||(coord.eta()>(centre.eta()+allowedSpread) ) )
508 std::cout << "ETA ERROR: "<< coord.eta() <<"!="<<centre.eta()<<std::endl;
509 return;
510}
Coordinate getCentre(const double phi, const double eta)
returns the central coordinate of the JE which contains the passed coord

◆ calculateTriggerBin()

BinAndCoord * LVL1::JetElementKeyBase::calculateTriggerBin ( ICoordinate * iCoord)
privatevirtualinherited

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

Returns coordinates of centre of JEs

Implements LVL1::KeyUtilities.

Definition at line 70 of file JetElementKeyBase.cxx.

70 {
71
72 int iphi=iCoord->phi();
73 int ieta=iCoord->eta();
74 double centralPhi=0.0;
75 double centralEta=0.0;
76 int phiBin=0; int etaBin=0;
77 int abs_ieta=abs(ieta);
78 int sign=ieta/abs_ieta;
79
80 if (m_debugKeyBase){
81 std::cout << "JetElementKeyBase: start calculateTriggerBin"<<std::endl;
82 //std::cout << "phi, eta : ("<<m_phi<<", "<<m_eta<<")"<<std::endl;
83 std::cout << "iphi, ieta : ("<<iphi<<", "<<ieta<<")"<<std::endl;
84 std::cout << "abs_ieta : ("<<abs_ieta<<") and sign : "<<sign<<std::endl;
85 }
86
88
89 // okay this JE has been deliberately labelled as a wrong 'un.
90 // so basically ignore it.
91 phiBin=0;
92 centralPhi=0.0;
93 etaBin=20*sign;
95
96 }else{
97
98 int region;
99 if ( abs_ieta<23 ) {
100 region = 0;
101 etaBin=(ieta+1)/2;
102 }
103 else if ( abs_ieta<25 ) { // can't see why this region != region 0??
104 region = 1;
105 etaBin=(ieta+1)/2;
106 }
107 else if ( abs_ieta<28 ) { // remaining regions only have 1 eta bin, varying sizes
108 region = 2;
109 etaBin=13*sign;
110 }
111 else if ( abs_ieta<30 ) {
112 region = 3;
113 etaBin=14*sign;
114 }
115 else if ( abs_ieta<=32 ) {
116 region = 4;
117 etaBin=15*sign;
118 }
119 else {
120 region = 5;
121 etaBin=16*sign;
122 }
123
124 // Get centre of JE in eta and phi
125 if (region == 0) {
126 centralEta=(static_cast<double>(etaBin)*0.2)-0.1;
127 }
128 else {
129 centralEta=m_regionEtaCentre[region]*sign;
130 }
131
132 // Phi bin size depends on region - this should take care of that
133 int nTTperJE = static_cast<int>( 0.5 + (m_regionHeight[region]/(M_PI/32)) );
134 phiBin=iphi/nTTperJE;
135 centralPhi=(static_cast<double>(phiBin)+0.5)*m_regionHeight[region];
136
137 }
138
139 if (m_debugKeyBase) std::cout << "central : ("<<centralPhi<<", "<<centralEta<<")"
140 << " bin : ("<<phiBin<<","<<etaBin<<")"<<std::endl;
141 Coordinate* centralCoords = new Coordinate(centralPhi, centralEta);
142 BinAndCoord* bandc = new BinAndCoord(phiBin,etaBin,centralCoords);
143 return bandc;
144}
#define M_PI
bool m_debugKeyBase
set to true to turn debugging info on
std::vector< double > m_regionHeight
holds height of JEs in regions:
unsigned int region(double eta) const
returns region number at eta, where region is:
std::vector< double > m_regionEtaCentre
holds central coords of JEs in regions: Region Eta 0 <2.2 1 2.2-2.4 2 2.4-2.7 3 2....
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
static const double RegionERROREtaCentre
static const int RegionERROREtaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin

◆ 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 105 of file KeyUtilities.cxx.

105 {
106
107 double phiBinWidth=((2*M_PI)/64.0);
108 // there are a maximum of 64 cells in the phi direction
109 // stretching from 0 to ~2*PI.
110 if (m_debug) std::cout << "KU : (phi, eta) ("<<phi<<","<<eta<<")"<<std::endl;
111 int iphi=sharpRound(phi/phiBinWidth);
112 int ieta=0;
113
114 // Now check that m_iphi is between 0 and 64.
115 iphi = iphi%64;
116 if (iphi<0) iphi = 64+iphi;
117
118 // Make m_ieta symmetrical:
119 // o no cell at m_ieta=0
120 // o first cells at +-1
121 // o last cells at about +- 50
122 // this gives us a more useful numerical symmetry.
123
124 // So to get integer value we do:
125 int temp_sign=sign(eta);
126 double temp_abs=eta*temp_sign;
127
128 double temp_double=(temp_abs*10.0+1.0)*temp_sign;
129 if (m_debug) std::cout << "KU : temp_abs, temp_sign, temp_double : "<<temp_abs<<","<<temp_sign<<","<<temp_double<<std::endl;
130// if (m_eta>=0.0){
131// temp_double=m_eta*10.0+1.0;
132// }else{
133// temp_double=m_eta*10.0-1.0;
134// }
135
136 ieta=static_cast<int>(temp_double);
137 if (m_debug) std::cout << "KU : (iphi, ieta) ("<<iphi<<","<<ieta<<")"<<std::endl;
138 ICoordinate* iCoord=new ICoordinate(iphi, ieta, eta);
139 return iCoord;
140}
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 199 of file KeyUtilities.cxx.

199 {
200 return Coordinate(m_centralPhi,m_centralEta);
201}
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() [1/3]

double LVL1::JetElementKeyBase::dEta ( ) const
inherited

return width of JE

return width of this JE

Definition at line 381 of file JetElementKeyBase.cxx.

381 {
382 return dEta(m_phi,m_eta);
383}
double dEta() const
return width of JE
double m_phi
phi coordinate of key
double m_eta
eta coordinate of key

◆ dEta() [2/3]

double LVL1::JetElementKeyBase::dEta ( const Coordinate & coord) const
virtualinherited

return width of JE

Implements LVL1::KeyUtilities.

Definition at line 386 of file JetElementKeyBase.cxx.

386 {
387 return dEta(coord.phi(), coord.eta() );
388}

◆ dEta() [3/3]

double LVL1::JetElementKeyBase::dEta ( const double phi,
const double eta ) const
inherited

return width of JE

return width of JE at (phi,eta)

Definition at line 373 of file JetElementKeyBase.cxx.

373 {
374 unsigned int reg=region(eta);
375 if (reg==TrigT1CaloDefs::RegionError) return 0.0;
376
377 return m_regionWidth[reg];
378}
std::vector< double > m_regionWidth
holds width of JEs in regions:
static const unsigned int RegionError

◆ downPhi() [1/2]

Coordinate LVL1::JetElementKeyBase::downPhi ( const Coordinate coord)
inherited

returns coord of next JE in -ve phi dir.

Definition at line 299 of file JetElementKeyBase.cxx.

299 {
300 return downPhi(coord.phi(), coord.eta());
301}
Coordinate downPhi(const double phi, const double eta)
returns coord of next JE in -ve phi dir.

◆ downPhi() [2/2]

Coordinate LVL1::JetElementKeyBase::downPhi ( const double phi,
const double eta )
inherited

returns coord of next JE in -ve phi dir.

Definition at line 283 of file JetElementKeyBase.cxx.

283 {
284 Coordinate centre=getCentre(phi,eta);
285 double temp_phi=centre.phi();
286 unsigned int reg=region(centre.eta());
288// std::cout << "Out of bounds error in JetElementKeyBase::downPhi"<<std::endl;
289 temp_phi=0.0;
290 }else{
291 temp_phi-= m_regionHeight[reg];
292 }
293 centre.setCoords(temp_phi,centre.eta());
294 analCoordChecking(centre);
295 return centre;
296}
void analCoordChecking(const Coordinate &coord)
this is a bit over the top, but it looks to see if the calculated coordinate matches a coordinate cen...

◆ downPhiKey()

unsigned int LVL1::JetElementKeyBase::downPhiKey ( const double phi,
const double eta )
inherited

returns key of next JE in -ve phi dir.

Definition at line 305 of file JetElementKeyBase.cxx.

305 {
306 Coordinate coord=downPhi(phi,eta);
307 return jeKey(coord.phi(),coord.eta());
308}
virtual unsigned int jeKey(const xAOD::TriggerTower &tower)
returns key of passed tower

◆ dPhi() [1/3]

double LVL1::JetElementKeyBase::dPhi ( ) const
inherited

return height of JE

return height of this JE

Definition at line 363 of file JetElementKeyBase.cxx.

363 {
364 return dPhi(m_phi,m_eta);
365}
double dPhi() const
return height of JE

◆ dPhi() [2/3]

double LVL1::JetElementKeyBase::dPhi ( const Coordinate & coord) const
virtualinherited

return height of JE

Implements LVL1::KeyUtilities.

Definition at line 368 of file JetElementKeyBase.cxx.

368 {
369 return dPhi(coord.phi(), coord.eta() );
370}

◆ dPhi() [3/3]

double LVL1::JetElementKeyBase::dPhi ( const double phi,
const double eta ) const
inherited

return height of JE

return height of JE at (phi,eta)

Definition at line 355 of file JetElementKeyBase.cxx.

355 {
356 unsigned int reg=region(eta);
357
358 if (reg==TrigT1CaloDefs::RegionError) return 0.0;
359 return m_regionHeight[reg];
360}

◆ 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 145 of file KeyUtilities.cxx.

145 {
146 return m_centralEta;
147}

◆ getCentre() [1/2]

Coordinate LVL1::JetElementKeyBase::getCentre ( const Coordinate coord)
inherited

returns the central coordinate of the JE which contains the passed coord

Definition at line 491 of file JetElementKeyBase.cxx.

491 {
492 Coordinate centre = getCentre( coord.phi(), coord.eta() );
493 return centre;
494}

◆ getCentre() [2/2]

Coordinate LVL1::JetElementKeyBase::getCentre ( const double phi,
const double eta )
inherited

returns the central coordinate of the JE which contains the passed coord

Definition at line 482 of file JetElementKeyBase.cxx.

482 {
483 ICoordinate* iCoord = convertCoordsToIntegers(phi, eta);
484 BinAndCoord* bandc = calculateTriggerBin(iCoord);
485 Coordinate yuck=*(bandc->coords() ); // this is horrible, but easier than changing other stuff
486 delete iCoord; delete bandc ;
487 return yuck;
488}
BinAndCoord * calculateTriggerBin(ICoordinate *iCoord)
converts integer phi, eta coordinates to phi, eta trigger bins.
ICoordinate * convertCoordsToIntegers(double phi, double eta)
converts the coordinates and corrects for overflows etc.

◆ isFCAL()

bool LVL1::JetElementKeyBase::isFCAL ( double eta) const
inherited

returns TRUE if this coordinate is in the FCAL

Definition at line 423 of file JetElementKeyBase.cxx.

423 {
424 return (region(eta)==5);
425}

◆ jeKey() [1/4]

unsigned int LVL1::JetElementKeyBase::jeKey ( const Coordinate coord)
virtualinherited

returns the key of the passed Coordinate

returns trigger tower key of passed Coordinate

Definition at line 171 of file JetElementKeyBase.cxx.

171 {
172 if (m_debugKeyBase) std::cout << "JetElementKeyBase: returning key for Coord: ("<<coord.phi()<<","<<coord.eta()<<")"<<std::endl;
173 return key(coord.phi(), coord.eta());
174}
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates

◆ jeKey() [2/4]

unsigned int LVL1::JetElementKeyBase::jeKey ( const double phi,
const double eta )
virtualinherited

returns the key of the passed coords

returns trigger tower key of passed coords

Definition at line 165 of file JetElementKeyBase.cxx.

165 {
166 if (m_debugKeyBase) std::cout << "JetElementKeyBase: returning key for coords ("<<phi<<","<<eta<<")"<<std::endl;
167 return key(phi, eta);
168}

◆ jeKey() [3/4]

unsigned int LVL1::JetElementKeyBase::jeKey ( const xAOD::JetElement & jetElement)
virtualinherited

returns key of passed jetelement

returns the key of the passed tower

Definition at line 156 of file JetElementKeyBase.cxx.

156 {
157 if (m_debugKeyBase) std::cout << "JetElementKeyBase: returning key for coords ("<<jetElement.phi()<<","<<jetElement.eta()<<")"<<std::endl;
158 return key(jetElement.phi(), jetElement.eta());
159}
float phi() const
get phi (note that for L1Calo phi runs from 0 to 2pi)
float eta() const
get eta

◆ jeKey() [4/4]

unsigned int LVL1::JetElementKeyBase::jeKey ( const xAOD::TriggerTower & tower)
virtualinherited

returns key of passed tower

Definition at line 150 of file JetElementKeyBase.cxx.

150 {
151 if (m_debugKeyBase) std::cout << "JetElementKeyBase: returning key for coords ("<<tower.phi()<<","<<tower.eta()<<")"<<std::endl;
152 return key(tower.phi(), tower.eta());
153}
virtual double eta() const final
The pseudorapidity ( ) of the particle.
virtual double phi() const final
The azimuthal angle ( ) of the particle.

◆ jeRegion()

JetElementKeyBase::JERegion LVL1::JetElementKeyBase::jeRegion ( const Coordinate & coord) const
inherited

Definition at line 408 of file JetElementKeyBase.cxx.

408 {
409 // really unhappy about this. It'll go horribly wrong if anyone alters the enum.
410 // Ideally I'd like region(eta) to return an enum, and have a
411 // separate numRegion(eta) which returns ints.
412 // That will require a lot of re-writing though....
413 unsigned int reg=region(coord.eta());
414 if (reg==5) return FCAL;
415 if (reg==4) return EndCap3;
416 if (reg==3) return EndCap2;
417 if (reg==2) return EndCap1;
418 if (reg==1) return EndBarrel;
419 return Barrel;
420
421}

◆ 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 96 of file KeyUtilities.cxx.

96 {
97 return key(coord.phi(), coord.eta());
98}

◆ 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 delete bandc;
88 delete iCoord;
89 int temp=((m_etaBin+50)<<6) + m_phiBin;
90
91 if (m_debug) std::cout << "KU : key: returning - "<<temp<<std::endl;
92 return static_cast<unsigned int>(temp);
93}
virtual BinAndCoord * calculateTriggerBin(ICoordinate *iCoord)=0
converts integer phi, eta coordinates to phi, eta trigger bins.

◆ leftEta() [1/2]

Coordinate LVL1::JetElementKeyBase::leftEta ( const Coordinate coord)
inherited

returns key of JE in -ve eta dir.

Definition at line 206 of file JetElementKeyBase.cxx.

206 {
207 return leftEta(coord.phi(), coord.eta());
208}
Coordinate leftEta(const double phi, const double eta)
returns key of JE in -ve eta dir.

◆ leftEta() [2/2]

Coordinate LVL1::JetElementKeyBase::leftEta ( const double phi,
const double eta )
inherited

returns key of JE in -ve eta dir.

Definition at line 179 of file JetElementKeyBase.cxx.

179 {
180 Coordinate centre=getCentre(phi,eta);
181 double temp_eta=centre.eta();
182
183 // look in method for definition of regions
184 unsigned int reg=region(temp_eta);
185 // suppress leftEta in -ve region 5
186 unsigned int maxRegion=5+((temp_eta>0.0)? 0:-1);
187 if ( reg==0 ){
188 temp_eta-=m_regionWidth[0];
189 }else{
190 if ((reg==TrigT1CaloDefs::RegionError)||(reg>maxRegion)) {
192 }else{
193 int sign = ((temp_eta>0.0)? 1:-1);
194 temp_eta= sign*m_regionEtaCentre[reg-sign]; }
195 }
196 // there's a complication here ... moving left can move us
197 // into a JE with a different phi height, and so phi can change.
198 // However we want to keep eta at 8.0, so reset eta afterwards.
199 Coordinate coord( getCentre(phi,temp_eta) );
200 coord.setCoords(coord.phi(), temp_eta) ;
201// analCoordChecking(coord);
202 return coord;
203}

◆ leftEtaKey()

unsigned int LVL1::JetElementKeyBase::leftEtaKey ( const double phi,
const double eta )
inherited

returns key of JE in +ve eta dir.

returns key of JE in -ve eta dir.

Definition at line 211 of file JetElementKeyBase.cxx.

211 {
212 Coordinate coord=leftEta(phi,eta);
213 return jeKey(coord.phi(),coord.eta());
214}

◆ lowerLeft() [1/2]

Coordinate LVL1::JetElementKeyBase::lowerLeft ( const Coordinate coord)
inherited

Definition at line 344 of file JetElementKeyBase.cxx.

344 {
345 Coordinate newCoord=lowerLeft(coord.phi(),coord.eta());
346 return newCoord;
347}
Coordinate lowerLeft(const double phi, const double eta)

◆ lowerLeft() [2/2]

Coordinate LVL1::JetElementKeyBase::lowerLeft ( const double phi,
const double eta )
inherited

Definition at line 322 of file JetElementKeyBase.cxx.

322 {
323 Coordinate coord=downPhi(phi,eta);
324 coord=leftEta(coord.phi(),coord.eta());
325 return coord;
326}

◆ lowerRight() [1/2]

Coordinate LVL1::JetElementKeyBase::lowerRight ( const Coordinate coord)
inherited

Definition at line 349 of file JetElementKeyBase.cxx.

349 {
350 Coordinate newCoord=lowerRight(coord.phi(),coord.eta());
351 return newCoord;
352}
Coordinate lowerRight(const double phi, const double eta)

◆ lowerRight() [2/2]

Coordinate LVL1::JetElementKeyBase::lowerRight ( const double phi,
const double eta )
inherited

Definition at line 328 of file JetElementKeyBase.cxx.

328 {
329 Coordinate coord=downPhi(phi,eta);
330 coord=rightEta(coord.phi(),coord.eta());
331 return coord;
332}
Coordinate rightEta(const double phi, const double eta)
Functions for finding coordinates of neighbouring JEs.

◆ 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 154 of file KeyUtilities.cxx.

154 {
155 return m_centralPhi;
156}

◆ region()

unsigned int LVL1::JetElementKeyBase::region ( double eta) const
inherited

returns region number at eta, where region is:

Definition at line 390 of file JetElementKeyBase.cxx.

390 {
391 unsigned int reg=TrigT1CaloDefs::RegionError;
392 int sign=((eta>0.0) ? 1:-1);
393 if (eta==0.0) sign=1;
394 double abs_eta=eta*sign;
395 if (abs_eta<2.2){
396 // barrel
397 reg=0;
398 }else{
399 if((abs_eta>2.2)&&(abs_eta<=2.4)) reg=1;
400 if((abs_eta>2.4)&&(abs_eta<=2.7)) reg=2;
401 if((abs_eta>2.7)&&(abs_eta<=2.9)) reg=3;
402 if((abs_eta>2.9)&&(abs_eta<=3.2)) reg=4;
403 if((abs_eta>3.2)&&(abs_eta<=4.9)) reg=5;
404 }//end if
405 return reg;
406}

◆ rightEta() [1/2]

Coordinate LVL1::JetElementKeyBase::rightEta ( const Coordinate coord)
inherited

returns eta coord of JE in +ve eta dir.

Definition at line 250 of file JetElementKeyBase.cxx.

250 {
251 return rightEta(coord.phi(), coord.eta());
252}

◆ rightEta() [2/2]

Coordinate LVL1::JetElementKeyBase::rightEta ( const double phi,
const double eta )
inherited

Functions for finding coordinates of neighbouring JEs.

returns eta coord of JE in +ve eta dir.

Definition at line 223 of file JetElementKeyBase.cxx.

223 {
224 Coordinate centre=getCentre(phi,eta);
225 double temp_eta=centre.eta();
226
227 unsigned int reg=region(temp_eta);
228 // supress rightEta in +ve region 5
229 unsigned int maxRegion=5+((temp_eta>0.0)? -1:0);
230 if ( reg==0 ){
231 temp_eta+=m_regionWidth[0];
232 }else{
233 if ((reg==TrigT1CaloDefs::RegionError)||(reg>maxRegion)) {
235 }else{
236 int sign = ((temp_eta>0.0)? 1:-1);
237 temp_eta= sign*m_regionEtaCentre[reg+sign];
238 }
239 }
240 // there's a complication here ... moving right can move us
241 // into a JE with a different phi height, and so phi can change.
242 // However we want to keep eta at 8.0, so reset eta afterwards.
243 Coordinate coord( getCentre(phi,temp_eta) );
244 coord.setCoords(coord.phi(), temp_eta) ;
245// analCoordChecking(coord);
246 return coord;
247}

◆ rightEtaKey()

unsigned int LVL1::JetElementKeyBase::rightEtaKey ( const double phi,
const double eta )
inherited

returns key of JE in -ve eta dir.

returns key of JE in +ve eta dir.

Definition at line 217 of file JetElementKeyBase.cxx.

217 {
218 Coordinate coord=rightEta(phi,eta);
219 return jeKey(coord.phi(),coord.eta());
220}

◆ round()

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

rounds number to nearest whole number

Definition at line 180 of file KeyUtilities.cxx.

180 {
181 return static_cast<int>(a<0.0?ceil(a-0.5):a>0.0?floor(a+0.5):0.0);
182}
static Double_t a

◆ setupJetRegionData()

void LVL1::JetElementKeyBase::setupJetRegionData ( )
protectedinherited

Does same as setupRegionData, except in FCAL where uses phi granularity appropriate for the jet trigger.

Definition at line 456 of file JetElementKeyBase.cxx.

456 {
457 // the first case is a bit weird - it's actually the centre
458 // of the outermost cell of region 0
465
472
479}
static const double Region5Width
static const double Region4EtaCentre
static const double Region2EtaCentre
static const double Region4Width
static const double Region2Height
static const double Region3Width
static const double Region1EtaCentre
static const double Region3Height
static const double Region5EtaCentre
static const double Region0Width
static const double Region0EtaCentre
static const double Region0Height
static const double Region5JetHeight
static const double Region1Height
static const double Region1Width
static const double Region3EtaCentre
static const double Region2Width
static const double Region4Height

◆ setupRegionData()

void LVL1::JetElementKeyBase::setupRegionData ( )
protectedinherited

◆ setupThisKeyValues()

void LVL1::KeyUtilities::setupThisKeyValues ( )
protectedinherited

Definition at line 168 of file KeyUtilities.cxx.

168 {
169 ICoordinate* iCoord = convertCoordsToIntegers(m_phi, m_eta);
170 BinAndCoord* bandc = calculateTriggerBin(iCoord);
171 m_phiBin=bandc->phiBin();
172 m_etaBin=bandc->etaBin();
173 m_centralPhi=bandc->coords()->phi();
174 m_centralEta=bandc->coords()->eta();
175 delete bandc;
176 delete iCoord;
177}

◆ 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 185 of file KeyUtilities.cxx.

185 {
186 return static_cast<int>(a<0.0?(a-1.0):a>0.0?(a):0.0);
187}

◆ 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 189 of file KeyUtilities.cxx.

189 {
190 int temp=(abs(a)-1)/b+1;
191 return temp*sign(a);
192}

◆ 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 164 of file KeyUtilities.cxx.

164 {
165 return ((temp >= 0.0) ? 1 : -1);
166}

◆ 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 159 of file KeyUtilities.cxx.

159 {
160 return ((temp >= 0) ? 1 : -1);
161}

◆ upperLeft() [1/2]

Coordinate LVL1::JetElementKeyBase::upperLeft ( const Coordinate coord)
inherited

Definition at line 334 of file JetElementKeyBase.cxx.

334 {
335 Coordinate newCoord=upperLeft(coord.phi(),coord.eta());
336 return newCoord;
337}
Coordinate upperLeft(const double phi, const double eta)

◆ upperLeft() [2/2]

Coordinate LVL1::JetElementKeyBase::upperLeft ( const double phi,
const double eta )
inherited

Definition at line 310 of file JetElementKeyBase.cxx.

310 {
311 Coordinate coord=upPhi(phi,eta);
312 coord=leftEta(coord.phi(),coord.eta());
313 return coord;
314}
Coordinate upPhi(const double phi, const double eta)
returns coord of next JE in +ve phi dir.

◆ upperRight() [1/2]

Coordinate LVL1::JetElementKeyBase::upperRight ( const Coordinate coord)
inherited

Definition at line 339 of file JetElementKeyBase.cxx.

339 {
340 Coordinate newCoord=upperRight(coord.phi(),coord.eta());
341 return newCoord;
342}
Coordinate upperRight(const double phi, const double eta)

◆ upperRight() [2/2]

Coordinate LVL1::JetElementKeyBase::upperRight ( const double phi,
const double eta )
inherited

Definition at line 316 of file JetElementKeyBase.cxx.

316 {
317 Coordinate coord=upPhi(phi,eta);
318 coord=rightEta(coord.phi(),coord.eta());
319 return coord;
320}

◆ upPhi() [1/2]

Coordinate LVL1::JetElementKeyBase::upPhi ( const Coordinate coord)
inherited

returns coord of next JE in +ve phi dir.

Definition at line 272 of file JetElementKeyBase.cxx.

272 {
273 return upPhi(coord.phi(), coord.eta());
274}

◆ upPhi() [2/2]

Coordinate LVL1::JetElementKeyBase::upPhi ( const double phi,
const double eta )
inherited

returns coord of next JE in +ve phi dir.

Definition at line 256 of file JetElementKeyBase.cxx.

256 {
257 Coordinate centre=getCentre(phi,eta);
258 double temp_phi=centre.phi();
259 unsigned int reg=region(centre.eta());
261// std::cout << "Out of bounds error in JetElementKeyBase::upPhi"<<std::endl;
262 temp_phi=0.0;
263 }else{
264 temp_phi+= m_regionHeight[reg];
265 }
266 centre.setCoords(temp_phi,centre.eta());
267 analCoordChecking(centre);
268 return centre;
269}

◆ upPhiKey()

unsigned int LVL1::JetElementKeyBase::upPhiKey ( const double phi,
const double eta )
inherited

returns key of next JE in +ve phi dir.

Definition at line 277 of file JetElementKeyBase.cxx.

277 {
278 Coordinate coord=upPhi(phi,eta);
279 return jeKey(coord.phi(),coord.eta());
280}

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_debugKeyBase

bool LVL1::JetElementKeyBase::m_debugKeyBase
privateinherited

set to true to turn debugging info on

Definition at line 152 of file JetElementKeyBase.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.

◆ m_regionEtaCentre

std::vector<double> LVL1::JetElementKeyBase::m_regionEtaCentre
privateinherited

holds central coords of JEs in regions: Region Eta 0 <2.2 1 2.2-2.4 2 2.4-2.7 3 2.7-2.9 4 2.9-3.2 5 3.2-4.9

Definition at line 161 of file JetElementKeyBase.h.

◆ m_regionHeight

std::vector<double> LVL1::JetElementKeyBase::m_regionHeight
privateinherited

holds height of JEs in regions:

Definition at line 165 of file JetElementKeyBase.h.

◆ m_regionWidth

std::vector<double> LVL1::JetElementKeyBase::m_regionWidth
privateinherited

holds width of JEs in regions:

Definition at line 163 of file JetElementKeyBase.h.


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