ATLAS Offline Software
TriggerTowerKey.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 /***************************************************************************
5  TriggerTowerKey.cpp - description
6  -------------------
7  begin : Tue Sep 26 2000
8  email : e.moyse@qmw.ac.uk
9  ***************************************************************************/
10 
11 
12 #ifndef TRIGGERSPACE
13 // running in Athena
15 
16 #else
17 // running in TRIGGERSPACE
18 #include "TriggerTowerKey.h"
19 
20 #endif
21 
22 #include <cmath>
23 
24 namespace LVL1 {
25 
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 }
39 
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 }
50 
52 }
53 
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  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 
138 unsigned int TriggerTowerKey::ttKey( const TriggerTower & tower) {
139  return key(tower.phi(), tower.eta());
140 }
141 
143 unsigned int TriggerTowerKey::ttKey( const CaloCell & calocell){
144  return key(calocell.phi(), calocell.eta());
145 }
146 #endif
147 
149 unsigned int TriggerTowerKey::ttKey(const double phi, const double eta){
150  if (m_debug) std::cout << "TTK: returning key for coords ("<<phi<<","<<eta<<")"<<std::endl;
151  return key(phi, eta);
152 }
153 
154 } // end LVL1 namespace
155 
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 }
169 
172  TriggerTowerRegion reg = region(coord);
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 }
179 
182  TriggerTowerRegion reg = region(coord);
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 }
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::TriggerTowerKey::~TriggerTowerKey
virtual ~TriggerTowerKey()
Definition: TriggerTowerKey.cxx:56
LVL1::KeyUtilities::m_phi
double m_phi
phi coordinate of key
Definition: KeyUtilities.h:112
CaloCell::phi
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition: CaloCell.h:359
LVL1::Coordinate::phi
double phi() const
return phi
Definition: Coordinate.cxx:50
LVL1::TriggerTowerKey::TTBarrel
@ TTBarrel
Definition: TriggerTowerKey.h:70
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
TriggerTowerKey.h
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
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
python.DomainsRegistry.reg
reg
globals -----------------------------------------------------------------—
Definition: DomainsRegistry.py:343
LVL1::KeyUtilities::m_debug
bool m_debug
turns DEBUG code on and off
Definition: KeyUtilities.h:124
LVL1::ICoordinate
Used by Key Classes, returns and integer coorginate for the bin Eta-Phi.
Definition: ICoordinate.h:31
LVL1::KeyUtilities::eta
virtual double eta() const
returns the centre of the TT at eta_coord:
Definition: KeyUtilities.cxx:150
LVL1::TriggerTowerKey::TriggerTowerKey
TriggerTowerKey()
constructs a TriggerTowerKey object
Definition: TriggerTowerKey.cxx:47
LVL1::ICoordinate::dEta
double dEta() const
return double eta
Definition: ICoordinate.cxx:61
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::Coordinate
Coordinate class declaration.
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:50
LVL1::TriggerTowerKey::calculateTriggerBin
BinAndCoord * calculateTriggerBin(ICoordinate *iCoord)
converts integer phi, eta coordinates to phi, eta trigger bins.
Definition: TriggerTowerKey.cxx:61
LVL1::TriggerTowerKey::TTFCAL
@ TTFCAL
Definition: TriggerTowerKey.h:73
LVL1::BinAndCoord
Used to pass data between the methods of the Key Classes: Returns the Eta and Phi bins,...
Definition: BinAndCoord.h:40
LVL1::KeyUtilities::setupThisKeyValues
void setupThisKeyValues()
Definition: KeyUtilities.cxx:173
LVL1::ICoordinate::phi
int phi() const
return phi
Definition: ICoordinate.cxx:56
LVL1::KeyUtilities::m_eta
double m_eta
eta coordinate of key
Definition: KeyUtilities.h:110
LVL1::TriggerTowerKey::dPhi
double dPhi(const Coordinate &coord) const
returns phi height of trigger tower at coordinate coord
Definition: TriggerTowerKey.cxx:181
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
LVL1::TriggerTowerKey::TriggerTowerRegion
TriggerTowerRegion
Definition: TriggerTowerKey.h:64
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
LVL1::Coordinate::eta
double eta() const
return eta
Definition: Coordinate.cxx:45
LVL1::TriggerTowerKey::TTRegionError
@ TTRegionError
Definition: TriggerTowerKey.h:74
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:232
LVL1::ICoordinate::eta
int eta() const
return eta
Definition: ICoordinate.cxx:51
LVL1::TriggerTowerKey::dEta
double dEta(const Coordinate &coord) const
returns eta width of trigger tower at coordinate coord
Definition: TriggerTowerKey.cxx:171
LVL1::TriggerTowerKey::TTEndCap1
@ TTEndCap1
Definition: TriggerTowerKey.h:71
LVL1::TriggerTowerKey::ttKey
virtual unsigned int ttKey(const TriggerTower &tower)
returns the key of the passed tower
Definition: TriggerTowerKey.cxx:143
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
xAOD::TriggerTower
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/TriggerTower.h:16