ATLAS Offline Software
Loading...
Searching...
No Matches
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
31namespace LVL1 {
32
35 if (m_debugModuleKey) std::cout << "ClusterProcessorModuleKey: m_debugModuleKey output turned on...."<<std::endl;
36}
37
40
42unsigned 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}
47
48double ClusterProcessorModuleKey::dPhi(const Coordinate& /*coord*/) const{
49 return TrigT1CaloDefs::cpmPhiSize;// one quadrant
50}
51
53double ClusterProcessorModuleKey::dEta(const Coordinate& /*coord*/) const{
55}
56
57} //end of ns
58
60void LVL1::ClusterProcessorModuleKey::setBins(ICoordinate* iCoord, unsigned int& phiBin, int& etaBin){
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 )
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
119unsigned 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}
Used to pass data between the methods of the Key Classes: Returns the Eta and Phi bins,...
Definition BinAndCoord.h:35
double dPhi(const Coordinate &coord) const
height
ClusterProcessorModuleKey()
constructs a ClusterProcessorModuleKey object
BinAndCoord * calculateTriggerBin(ICoordinate *iCoord)
converts integer phi, eta coordinates to phi, eta trigger bins, and central coords
unsigned int cpm(const Coordinate &coord) const
returns CPM number within a crate for a TriggerTower or RoI coordinate
void setBins(ICoordinate *iCoord, unsigned int &phiBin, int &etaBin)
sets the eta and phi bins
bool m_debugModuleKey
set to true to turn debugging info on
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...
unsigned int cpmKey(unsigned int crate, unsigned int module)
calculates key from crate and module index
double dEta(const Coordinate &coord) const
width
Used by Key Classes, returns and integer coorginate for the bin Eta-Phi.
Definition ICoordinate.h:26
int phi() const
return phi
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.
int sharpRound2(int a, int b) const
divides a/b and returns a number as follows (where +b means +ve b): if 0
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.
KeyUtilities()
the constructor is protected so a user can never make a KeyUtilities object
double m_phi
phi coordinate of key
double m_eta
eta coordinate of key
static const double cpmEtaSize
static const double cpmPhiSize
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...