ATLAS Offline Software
Loading...
Searching...
No Matches
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
24namespace 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
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
138unsigned int TriggerTowerKey::ttKey( const TriggerTower & tower) {
139 return key(tower.phi(), tower.eta());
140}
141
143unsigned int TriggerTowerKey::ttKey( const CaloCell & calocell){
144 return key(calocell.phi(), calocell.eta());
145}
146#endif
147
149unsigned 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
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
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}
#define M_PI
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
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
Used to pass data between the methods of the Key Classes: Returns the Eta and Phi bins,...
Definition BinAndCoord.h:35
Used by Key Classes, returns and integer coorginate for the bin Eta-Phi.
Definition ICoordinate.h:26
int phi() const
return phi
double dEta() const
return double eta
int eta() const
return eta
virtual double eta() const
returns the centre of the TT at eta_coord:
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
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
Coordinate coord() const
return central coords of current key value.
bool m_debug
turns DEBUG code on and off
double m_phi
phi coordinate of key
double m_eta
eta coordinate of key
TriggerTowerRegion region(const Coordinate &coord) const
returns the TT region that the coordinate corresponds to.
double dPhi(const Coordinate &coord) const
returns phi height of trigger tower at coordinate coord
double dEta(const Coordinate &coord) const
returns eta width of trigger tower at coordinate coord
TriggerTowerKey()
constructs a TriggerTowerKey object
virtual unsigned int ttKey(const TriggerTower &tower)
returns the key of the passed tower
BinAndCoord * calculateTriggerBin(ICoordinate *iCoord)
converts integer phi, eta coordinates to phi, eta trigger bins.
Trigger towers are the inputs to all other parts of the calorimeter trigger.
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...