ATLAS Offline Software
ClusterProcessorModuleKey.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 /***************************************************************************
5  ClusterProcessorModuleKey.cpp - description
6  -------------------
7  begin : Tue Sep 26 2000
8  email : e.moyse@qmw.ac.uk
9  ***************************************************************************/
10 
11 #ifndef TRIGGERSPACE
12 // running in Athena
16 
18 
19 #else
22 #include "TrigT1CaloDefs.h"
23 #include "ICoordinate.h"
24 #include "TriggerTowerKey.h"
25 
26 //
27 #endif
28 
29 #include <math.h>
30 
31 namespace LVL1 {
32 
34 ClusterProcessorModuleKey::ClusterProcessorModuleKey() : KeyUtilities(), m_debugModuleKey(false){
35  if (m_debugModuleKey) std::cout << "ClusterProcessorModuleKey: m_debugModuleKey output turned on...."<<std::endl;
36 }
37 
38 ClusterProcessorModuleKey::~ClusterProcessorModuleKey(){
39 }
40 
42 unsigned int ClusterProcessorModuleKey::cpmKey(unsigned int crate, unsigned int module) {
43  double eta = module*TrigT1CaloDefs::cpmEtaSize - 3.0; // so module 1 spans -2.8<eta<-2.4
44  double phi = (crate+0.5)*TrigT1CaloDefs::cpmPhiSize;
45  return key(phi, eta);
46 }
48 double ClusterProcessorModuleKey::dPhi(const Coordinate& /*coord*/) const{
49  return TrigT1CaloDefs::cpmPhiSize;// one quadrant
50 }
51 
53 double ClusterProcessorModuleKey::dEta(const Coordinate& /*coord*/) const{
54  return TrigT1CaloDefs::cpmEtaSize;
55 }
56 
57 } //end of ns
58 
61  unsigned int iPhiSize=16 ; // 64 bins in total, so 16/module
62  phiBin=( iCoord->phi() )/(iPhiSize);
63  int iEtaSize=4;// CPMs are 0.4 in eta, so ietaSize=4
64  etaBin=sharpRound2(iCoord->eta(),iEtaSize);
65 
66  return;
67 }
68 
73  double eta = coord.eta() - 0.025;
74  if (fabs(eta)<=2.5) { // check within range
75  double offset=2.8; // Offset chosen to get RoI->module without rounding errors
76  double temp = (eta+offset)/TrigT1CaloDefs::cpmEtaSize + 1.;
77  return static_cast<unsigned int>(temp);
78  }
79  else {
80  return 999;
81  }
82 }
83 
88  int abs_ieta=abs(iCoord->eta() );
89  int sign=( iCoord->eta() )/abs_ieta;
90 
91  int etaBin=0; unsigned int phiBin=0;
92  setBins(iCoord,phiBin,etaBin);
93 
94  double centralPhi=( static_cast<double>(phiBin)*TrigT1CaloDefs::cpmPhiSize )
96  double centralEta=( static_cast<double>(etaBin)*TrigT1CaloDefs::cpmEtaSize )
98  if (m_debugModuleKey){
99  std::cout << "ClusterProcessorModuleKey: start calcTrigBin"<<std::endl;
100  std::cout << "phi, eta : ("<<m_phi<<", "<<m_eta<<")"<<std::endl;
101  std::cout << "iphi, ieta : ("<<( iCoord->phi() )<<", "<<( iCoord->eta() )<<")"<<std::endl;
102  std::cout << "abs_ieta : ("<<abs_ieta<<" and sign : "<<sign<<std::endl;
103  std::cout << "central : ("<<centralPhi<<", "<<centralEta<<")"
104  << "bin : ("<<phiBin<<","<<etaBin<<")"<<std::endl;
105  }
106 
107  Coordinate* centralCoords = new Coordinate(centralPhi, centralEta);
108  if (m_debugModuleKey) std::cout <<" ClusterProcessorModuleKey : created coord "<<(*centralCoords)<<std::endl;
109  return new BinAndCoord(phiBin,etaBin,centralCoords);
110 }
111 
112 
113 
119 unsigned int LVL1::ClusterProcessorModuleKey::phiQuadrant(const double phi) const {
120  double temp = phi/TrigT1CaloDefs::cpmPhiSize; // Good for TT coord, not RoI
121  unsigned int quad = static_cast<unsigned int>(temp);
122  quad=(quad > 3 ? 0 : quad);
123 
124  return static_cast<unsigned int>(quad);
125 }
LVL1::ClusterProcessorModuleKey::ClusterProcessorModuleKey
ClusterProcessorModuleKey()
constructs a ClusterProcessorModuleKey object
Definition: ClusterProcessorModuleKey.cxx:39
TriggerTowerKey.h
ClusterProcessorModuleKey.h
LVL1::ClusterProcessorModuleKey::cpm
unsigned int cpm(const Coordinate &coord) const
returns CPM number within a crate for a TriggerTower or RoI coordinate
Definition: ClusterProcessorModuleKey.cxx:70
LVL1::TrigT1CaloDefs::cpmEtaSize
static const double cpmEtaSize
Definition: TrigT1CaloDefs.h:138
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::ICoordinate
Used by Key Classes, returns and integer coorginate for the bin Eta-Phi.
Definition: ICoordinate.h:31
python.PyAthena.module
module
Definition: PyAthena.py:131
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
LVL1::Coordinate
Coordinate class declaration.
Definition: TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:50
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
LVL1::BinAndCoord
Used to pass data between the methods of the Key Classes: Returns the Eta and Phi bins,...
Definition: BinAndCoord.h:40
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
LVL1::TrigT1CaloDefs::cpmPhiSize
static const double cpmPhiSize
Definition: TrigT1CaloDefs.h:137
LVL1::ClusterProcessorModuleKey::phiQuadrant
unsigned int phiQuadrant(const double phi) const
returns the quadrant number associated with the phi coordinate, 0 - 90 = 0 90 - 180 = 1 180-270 = 2 2...
Definition: ClusterProcessorModuleKey.cxx:119
LVL1::ICoordinate::phi
int phi() const
return phi
Definition: ICoordinate.cxx:56
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
TrigT1CaloDefs.h
JetVoronoiDiagramHelpers::coord
double coord
Definition: JetVoronoiDiagramHelpers.h:45
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1::ICoordinate::eta
int eta() const
return eta
Definition: ICoordinate.cxx:51
LVL1::ClusterProcessorModuleKey::setBins
void setBins(ICoordinate *iCoord, unsigned int &phiBin, int &etaBin)
sets the eta and phi bins
Definition: ClusterProcessorModuleKey.cxx:60
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:527
ICoordinate.h
LVL1::ClusterProcessorModuleKey::calculateTriggerBin
BinAndCoord * calculateTriggerBin(ICoordinate *iCoord)
converts integer phi, eta coordinates to phi, eta trigger bins, and central coords
Definition: ClusterProcessorModuleKey.cxx:87
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
dumpNswErrorDb.quad
def quad
Definition: dumpNswErrorDb.py:24
LVL1::KeyUtilities::sharpRound2
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,...
Definition: KeyUtilities.cxx:194