Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
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 More...
 
 TriggerTowerKey ()
 constructs a TriggerTowerKey object More...
 
virtual ~TriggerTowerKey ()
 
virtual unsigned int ttKey (const TriggerTower &tower)
 returns the key of the passed tower More...
 
unsigned int ttKey (const CaloCell &calocell)
 returns the key of the passed calo cell More...
 
unsigned int ttKey (const double phi, const double eta)
 returns trigger tower key of passed coords More...
 
TriggerTowerRegion region (const Coordinate &coord) const
 returns the TT region that the coordinate corresponds to. More...
 
double dEta (const Coordinate &coord) const
 returns eta width of trigger tower at coordinate coord More...
 
double dPhi (const Coordinate &coord) const
 returns phi height of trigger tower at coordinate coord More...
 
virtual double eta () const
 returns the centre of the TT at eta_coord: More...
 
virtual double phi () const
 returns phi coordinate of centre of relevant trigger tower. More...
 
unsigned int key (double phi, double eta)
 calculates a map key from passed phi, eta coordinates More...
 
unsigned int key (const Coordinate &coord)
 returns the key of the passed Coordinate More...
 
Coordinate coord () const
 return central coords of current key value. More...
 

Protected Member Functions

ICoordinateconvertCoordsToIntegers (double phi, double eta)
 converts the coordinates and corrects for overflows etc. More...
 
virtual int sign (int temp) const
 returns -1 if temp is -ve and +1 if it is +ve. More...
 
virtual int sign (double temp) const
 returns -1 if temp is -ve and +1 if it is +ve. More...
 
int round (double a) const
 rounds number to nearest whole number More...
 
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. More...
 
int sharpRound2 (int a, int b) const
 divides a/b and returns a number as follows (where +b means +ve b): if 0<a<+b, then n=1, if +b<a<+2b, n=2, if -b<a<0, n=-1, if -2b<a<-b, n=-2 More...
 
void setupThisKeyValues ()
 

Protected Attributes

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

Private Member Functions

BinAndCoordcalculateTriggerBin (ICoordinate *iCoord)
 converts integer phi, eta coordinates to phi, eta trigger bins. More...
 

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

Member Enumeration Documentation

◆ TriggerTowerRegion

Enumerator
TTBarrel 
TTEndCap1 
TTEndCap2 
TTFCAL 
TTRegionError 

Definition at line 64 of file TriggerTowerKey.h.

86  : // Private methods

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 36 of file TriggerTowerKey.cxx.

42  {
43  m_phi=0.0;

◆ TriggerTowerKey() [2/2]

LVL1::TriggerTowerKey::TriggerTowerKey ( )

constructs a TriggerTowerKey object

Definition at line 47 of file TriggerTowerKey.cxx.

51  {
52 }
53 

◆ ~TriggerTowerKey()

LVL1::TriggerTowerKey::~TriggerTowerKey ( )
virtual

Definition at line 56 of file TriggerTowerKey.cxx.

56  {
57 

Member Function Documentation

◆ calculateTriggerBin()

BinAndCoord * LVL1::TriggerTowerKey::calculateTriggerBin ( ICoordinate iCoord)
privatevirtual

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

Implements LVL1::KeyUtilities.

Definition at line 61 of file TriggerTowerKey.cxx.

67  {
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  Coordinate* centralCoords = new Coordinate(centralPhi, centralEta);
130  BinAndCoord* bandc = new BinAndCoord(phiBin,etaBin,centralCoords);
131  return bandc;
132 }
133 
134 #ifndef TRIGGERSPACE
135 // these methods are only applicable if running in Athena
136 

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

110  : (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 }
141 
142 
145 double LVL1::KeyUtilities::eta() const{

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

◆ 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 171 of file TriggerTowerKey.cxx.

171  {
173  if (reg==TTBarrel) return 0.1;
174  if (reg==TTEndCap1) return 0.2;
175  if (reg==TTEndCap2) return 0.1;
176  if (reg==TTFCAL) return 0.425;
177  return 0;
178 }

◆ 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 181 of file TriggerTowerKey.cxx.

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

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

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

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

82  : 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 }
94 
96 unsigned int KeyUtilities::key(const Coordinate& coord) {
97  return key(coord.phi(), coord.eta());
98 }

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

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

◆ region()

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

returns the TT region that the coordinate corresponds to.

Definition at line 158 of file TriggerTowerKey.cxx.

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

◆ round()

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

rounds number to nearest whole number

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 }

◆ setupThisKeyValues()

void LVL1::KeyUtilities::setupThisKeyValues ( )
protectedinherited

Definition at line 173 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 }

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

◆ 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<a<+b, then n=1, if +b<a<+2b, n=2, if -b<a<0, n=-1, if -2b<a<-b, n=-2

Definition at line 194 of file KeyUtilities.cxx.

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

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

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

◆ ttKey() [1/3]

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

returns the key of the passed calo cell

Definition at line 148 of file TriggerTowerKey.cxx.

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

◆ ttKey() [2/3]

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

returns trigger tower key of passed coords

Definition at line 154 of file TriggerTowerKey.cxx.

◆ ttKey() [3/3]

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

returns the key of the passed tower

Definition at line 143 of file TriggerTowerKey.cxx.

143  {
144  return key(calocell.phi(), calocell.eta());
145 }

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 122 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 119 of file KeyUtilities.h.

◆ m_debug

bool LVL1::KeyUtilities::m_debug
protectedinherited

turns DEBUG code on and off

Definition at line 124 of file KeyUtilities.h.

◆ m_eta

double LVL1::KeyUtilities::m_eta
protectedinherited

eta coordinate of key

Definition at line 110 of file KeyUtilities.h.

◆ m_etaBin

int LVL1::KeyUtilities::m_etaBin
protectedinherited

eta bin

Definition at line 116 of file KeyUtilities.h.

◆ m_ieta

int LVL1::KeyUtilities::m_ieta
protectedinherited

integer eta coord

Definition at line 108 of file KeyUtilities.h.

◆ m_iphi

int LVL1::KeyUtilities::m_iphi
protectedinherited

integer phi coord

Definition at line 106 of file KeyUtilities.h.

◆ m_phi

double LVL1::KeyUtilities::m_phi
protectedinherited

phi coordinate of key

Definition at line 112 of file KeyUtilities.h.

◆ m_phiBin

int LVL1::KeyUtilities::m_phiBin
protectedinherited

phi bin

Definition at line 114 of file KeyUtilities.h.


The documentation for this class was generated from the following files:
LVL1::KeyUtilities::sign
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
Definition: KeyUtilities.cxx:164
LVL1::KeyUtilities::phi
virtual double phi() const
returns phi coordinate of centre of relevant trigger tower.
Definition: KeyUtilities.cxx:159
LVL1::KeyUtilities::m_phi
double m_phi
phi coordinate of key
Definition: KeyUtilities.h:112
LVL1::Coordinate::phi
double phi() const
return phi
Definition: Coordinate.cxx:50
LVL1::TriggerTowerKey::TTBarrel
@ TTBarrel
Definition: TriggerTowerKey.h:70
LVL1::KeyUtilities::key
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates
Definition: KeyUtilities.cxx:82
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::TriggerTowerKey::TTEndCap2
@ TTEndCap2
Definition: TriggerTowerKey.h:72
LVL1::TriggerTowerKey::region
TriggerTowerRegion region(const Coordinate &coord) const
returns the TT region that the coordinate corresponds to.
Definition: TriggerTowerKey.cxx:158
LVL1::KeyUtilities::m_debug
bool m_debug
turns DEBUG code on and off
Definition: KeyUtilities.h:124
LVL1::KeyUtilities::eta
virtual double eta() const
returns the centre of the TT at eta_coord:
Definition: KeyUtilities.cxx:150
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
LVL1::KeyUtilities::coord
Coordinate coord() const
return central coords of current key value.
Definition: KeyUtilities.cxx:199
LVL1::TriggerTowerKey::TTFCAL
@ TTFCAL
Definition: TriggerTowerKey.h:73
LVL1::KeyUtilities::m_centralPhi
double m_centralPhi
this is the coordinate of the centre of the relevant trigger tower.
Definition: KeyUtilities.h:119
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
LVL1::TriggerTowerKey::TriggerTowerRegion
TriggerTowerRegion
Definition: TriggerTowerKey.h:64
LVL1::Coordinate::eta
double eta() const
return eta
Definition: Coordinate.cxx:45
LVL1::TriggerTowerKey::TTRegionError
@ TTRegionError
Definition: TriggerTowerKey.h:74
a
TList * a
Definition: liststreamerinfos.cxx:10
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:244
LVL1::TriggerTowerKey::TTEndCap1
@ TTEndCap1
Definition: TriggerTowerKey.h:71
LVL1::KeyUtilities::m_centralEta
double m_centralEta
this is the coordinate of the centre of the relevant trigger tower.
Definition: KeyUtilities.h:122