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

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

#include <TriggerTowerKey.h>

Inheritance diagram for LVL1::TriggerTowerKey:
Collaboration diagram for LVL1::TriggerTowerKey:

Public Types

enum  TriggerTowerRegion {
  TTBarrel =0 , TTEndCap1 =1 , TTEndCap2 =2 , TTFCAL =3 ,
  TTRegionError =999
}

Public Member Functions

 TriggerTowerKey (double m_phi, double m_eta)
 takes phi and eta and constructs a TriggerTowerKey object which can return the key for this coord *todo This method must be phased out - it will not work when this class simulates the hardware completely
 TriggerTowerKey ()
 constructs a TriggerTowerKey object
virtual ~TriggerTowerKey ()
virtual unsigned int ttKey (const TriggerTower &tower)
 returns the key of the passed tower
unsigned int ttKey (const CaloCell &calocell)
 returns the key of the passed calo cell
unsigned int ttKey (const double phi, const double eta)
 returns trigger tower key of passed coords
TriggerTowerRegion region (const Coordinate &coord) const
 returns the TT region that the coordinate corresponds to.
double dEta (const Coordinate &coord) const
 returns eta width of trigger tower at coordinate coord
double dPhi (const Coordinate &coord) const
 returns phi height of trigger tower at coordinate coord
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)
 converts integer phi, eta coordinates to phi, eta trigger bins.

Detailed Description

The TriggerTowerKey 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 51 of file TriggerTowerKey.h.

Member Enumeration Documentation

◆ TriggerTowerRegion

Enumerator
TTBarrel 
TTEndCap1 
TTEndCap2 
TTFCAL 
TTRegionError 

Definition at line 54 of file TriggerTowerKey.h.

Constructor & Destructor Documentation

◆ TriggerTowerKey() [1/2]

LVL1::TriggerTowerKey::TriggerTowerKey ( double m_phi,
double m_eta )

takes phi and eta and constructs a TriggerTowerKey object which can return the key for this coord *todo This method must be phased out - it will not work when this class simulates the hardware completely

Definition at line 31 of file TriggerTowerKey.cxx.

31 {
32 m_phi=phi;
33 m_eta=eta;
34 m_debug=false;
35 if (m_debug) { std::cout << "TriggerTowerKey: m_debug output turned on...."<<std::endl; }
37 //std::cout << "m_ieta : "<<m_ieta<<std::endl;
38}
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.
bool m_debug
turns DEBUG code on and off
double m_phi
phi coordinate of key
double m_eta
eta coordinate of key

◆ TriggerTowerKey() [2/2]

LVL1::TriggerTowerKey::TriggerTowerKey ( )

constructs a TriggerTowerKey object

Definition at line 42 of file TriggerTowerKey.cxx.

42 {
43 m_phi=0.0;
44 m_eta=0.0;
45 m_debug=false;
46 if (m_debug) { std::cout << "TriggerTowerKey: m_debug output turned on...."<<std::endl; }
48 //std::cout << "m_ieta : "<<m_ieta<<std::endl;
49}

◆ ~TriggerTowerKey()

LVL1::TriggerTowerKey::~TriggerTowerKey ( )
virtual

Definition at line 51 of file TriggerTowerKey.cxx.

51 {
52}

Member Function Documentation

◆ calculateTriggerBin()

BinAndCoord LVL1::TriggerTowerKey::calculateTriggerBin ( const ICoordinate & iCoord)
privatevirtual

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

Implements LVL1::KeyUtilities.

Definition at line 56 of file TriggerTowerKey.cxx.

56 {
57
58 double phiBinWidth=((2*M_PI)/64.0);
59 int iphi=iCoord.phi();
60 int ieta=iCoord.eta();
61 double centralPhi=0.0;
62 double centralEta=0.0;
63 int phiBin=0; int etaBin=0;
64 int abs_ieta=abs(ieta);
65 int sign=ieta/abs_ieta;
66
67 if (m_debug){
68 std::cout << "TriggerTowerKey: start calcTrigBin"<<std::endl;
69 std::cout << "phi, eta : ("<<iCoord.phi()<<", "<<iCoord.eta()<<")"<<std::endl;
70 std::cout << "iphi, ieta : ("<<iphi<<", "<<ieta<<")"<<std::endl;
71 std::cout << "abs_ieta : ("<<abs_ieta<<" and sign : "<<sign<<std::endl;
72 }
73
74 if ( abs_ieta<=25 ){
75 /* in 0.1x0.1 barrel region
76 This extends from -2.4 to +2.4 in eta, and has divisions of 0.1 in eta.
77 ieta extends from -24 to +24, and the centres of ieta=+/-1,2,3 are at
78 centralEta=+/-0.05, 0.15, 0.25 etc.*/
79 phiBin=iphi;
80 etaBin=ieta;
81 centralEta=( (static_cast<double>(abs_ieta)*0.1)-0.05)*sign;
82 centralPhi=(iphi*phiBinWidth)+(phiBinWidth/2);
83 if (m_debug) std::cout << "central : ("<<centralPhi<<", "<<centralEta<<")"<<std::endl;
84 // std::cout<<etaBin<<std::endl;
85 }else{
86 if (abs_ieta>25 && abs_ieta<=32){
87 //std::cout <<"0.2x0.2 :";
88 /* in 0.2 x 0.2 region.
89 Here we have three 0.2 cells from eta=+-2.5-3.2 (etaBin=26,27,28),
90 then a final 0.1 cell from +-3.1 to 3.2 (etaBin=-32).*/
91 etaBin=( ( (abs_ieta-24) /2 )+25)*sign;
92 // this ^ perhaps seems slightly counter-intuitive ...
93 // The point is we have cells like |'|''|''|''|
94 // (where the edge of the first cell is ieta=-32) - i.e. the first
95 // cell is 0.1x0.2 instead of 0.2x0.2.
96 // so if we did (ieta-33)/2+29 as you might expect
97 // our algorithm will (wrongly) behave as if the cells are
98 // |''|''|''|'| instead.
99 phiBin=iphi/2;
100 centralPhi=(static_cast<double>(phiBin)*2.0+1.0)*phiBinWidth;
101 // it's a bit harder for the centralEta case though so:
102 if (abs_ieta<32){
103 centralEta=((static_cast<double>(static_cast<int>((abs_ieta-26)/2))*0.2)+2.6)*sign;
104 }else{
105 //in weird 0.1x0.2 region
106 centralEta=3.15*sign;
107 }
108 }else{
109 // in FCAL
110 // there's a complication here, namely that the eta bins aren't multiples
111 // of 0.1.We therefore must work in doubles ...
112
113 double fcalEtaSize=0.425; //=(4.9-3.2)/4
114
115 double abs_eta = iCoord.dEta()*sign;
116 double temp=static_cast<double>(abs_eta-3.2);
117 temp = (temp/ fcalEtaSize );
118 int iTemp=static_cast<int>(temp);
119 etaBin=(iTemp+32)*sign;
120
121 phiBin=iphi/4;
122
123 centralEta=((static_cast<double>(iTemp)*fcalEtaSize)+3.2+(fcalEtaSize/2))*sign;
124//std::cout<<"eb: "<<etaBin<<" iTemp"<<iTemp<<std::endl;
125 centralPhi=(static_cast<double>(phiBin)*phiBinWidth*4)+(phiBinWidth*2);
126 }// end else: in .4x.4
127 }// end of not in 0.1x0.1
128 if (m_debug) std::cout << "central : /t("<<centralPhi<<", "<<centralEta<<")"<<std::endl;
129 return BinAndCoord(phiBin,etaBin,Coordinate(centralPhi, centralEta));
130}
#define M_PI
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
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 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}
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.

◆ 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::TriggerTowerKey::dEta ( const Coordinate & coord) const
virtual

returns eta width of trigger tower at coordinate coord

Implements LVL1::KeyUtilities.

Definition at line 169 of file TriggerTowerKey.cxx.

169 {
171 if (reg==TTBarrel) return 0.1;
172 if (reg==TTEndCap1) return 0.2;
173 if (reg==TTEndCap2) return 0.1;
174 if (reg==TTFCAL) return 0.425;
175 return 0;
176}
Coordinate coord() const
return central coords of current key value.
TriggerTowerRegion region(const Coordinate &coord) const
returns the TT region that the coordinate corresponds to.

◆ dPhi()

double LVL1::TriggerTowerKey::dPhi ( const Coordinate & coord) const
virtual

returns phi height of trigger tower at coordinate coord

Implements LVL1::KeyUtilities.

Definition at line 179 of file TriggerTowerKey.cxx.

179 {
181 if (reg==TTBarrel) return M_PI/32;//0.0981748;//PI/32
182 if (reg==TTEndCap1) return M_PI/16;//0.19635;//PI/16
183 if (reg==TTEndCap2) return M_PI/16;//0.19635;
184 if (reg==TTFCAL) return M_PI/8;//0.392699;//PI/8
185 return TTRegionError;
186}

◆ 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}

◆ 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}
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates

◆ 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.

◆ 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}

◆ region()

LVL1::TriggerTowerKey::TriggerTowerRegion LVL1::TriggerTowerKey::region ( const Coordinate & coord) const

returns the TT region that the coordinate corresponds to.

Definition at line 156 of file TriggerTowerKey.cxx.

156 {
157 double absEta=fabs(coord.eta());
158 if (absEta<2.5) return TTBarrel;
159 if ((absEta>=2.5)&&(absEta<3.1)) return TTEndCap1;
160 if ((absEta>=3.1)&&(absEta<3.2)) return TTEndCap2;
161 if ((absEta>=3.2)&&(absEta<=4.9)) return TTFCAL;
162 std::cerr <<"TriggerTowerKey::region UNKNOWN REGION"
163 << "Coordinate is ("<<coord.phi()<<", "<<coord.eta()<<")"
164 <<std::endl;
165 return TTRegionError;
166}
bool absEta(const xAOD::TauJet &tau, float &out)

◆ 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

◆ 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}

◆ ttKey() [1/3]

unsigned int LVL1::TriggerTowerKey::ttKey ( const CaloCell & calocell)

returns the key of the passed calo cell

Definition at line 141 of file TriggerTowerKey.cxx.

141 {
142 return key(calocell.phi(), calocell.eta());
143}
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition CaloCell.h:375
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition CaloCell.h:382

◆ ttKey() [2/3]

unsigned int LVL1::TriggerTowerKey::ttKey ( const double phi,
const double eta )

returns trigger tower key of passed coords

Definition at line 147 of file TriggerTowerKey.cxx.

147 {
148 if (m_debug) std::cout << "TTK: returning key for coords ("<<phi<<","<<eta<<")"<<std::endl;
149 return key(phi, eta);
150}

◆ ttKey() [3/3]

unsigned int LVL1::TriggerTowerKey::ttKey ( const TriggerTower & tower)
virtual

returns the key of the passed tower

Definition at line 136 of file TriggerTowerKey.cxx.

136 {
137 return key(tower.phi(), tower.eta());
138}

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_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: