ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
LVL1::ClusterProcessorModuleKey Class Reference

The ClusterProcessorModuleKey object provides the key for each trigger tower depending on its eta-phi coords. More...

#include <ClusterProcessorModuleKey.h>

Inheritance diagram for LVL1::ClusterProcessorModuleKey:
Collaboration diagram for LVL1::ClusterProcessorModuleKey:

Public Member Functions

 ClusterProcessorModuleKey ()
 constructs a ClusterProcessorModuleKey object More...
 
virtual ~ClusterProcessorModuleKey ()
 
unsigned int cpmKey (unsigned int crate, unsigned int module)
 calculates key from crate and module index More...
 
double dPhi (const Coordinate &coord) const
 height More...
 
double dEta (const Coordinate &coord) const
 width More...
 
unsigned int cpm (const Coordinate &coord) const
 returns CPM number within a crate for a TriggerTower or RoI coordinate 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, and central coords More...
 
void setBins (ICoordinate *iCoord, unsigned int &phiBin, int &etaBin)
 sets the eta and phi bins More...
 
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 270-360 = 3 More...
 

Private Attributes

bool m_debugModuleKey
 set to true to turn debugging info on More...
 

Detailed Description

The ClusterProcessorModuleKey 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 49 of file ClusterProcessorModuleKey.h.

Constructor & Destructor Documentation

◆ ClusterProcessorModuleKey()

LVL1::ClusterProcessorModuleKey::ClusterProcessorModuleKey ( )

constructs a ClusterProcessorModuleKey object

Definition at line 39 of file ClusterProcessorModuleKey.cxx.

◆ ~ClusterProcessorModuleKey()

LVL1::ClusterProcessorModuleKey::~ClusterProcessorModuleKey ( )
virtual

Definition at line 43 of file ClusterProcessorModuleKey.cxx.

Member Function Documentation

◆ calculateTriggerBin()

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

converts integer phi, eta coordinates to phi, eta trigger bins, and central coords

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

Returns coordinates of centre of JEs

Implements LVL1::KeyUtilities.

Definition at line 87 of file ClusterProcessorModuleKey.cxx.

87  {
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 }

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

◆ cpm()

unsigned int LVL1::ClusterProcessorModuleKey::cpm ( const Coordinate coord) const

returns CPM number within a crate for a TriggerTower or RoI coordinate

Returns CPM number for TT coordinate.

TT and RoI coordinates are offset by 0.5*tower width. Shift by 0.25*tower width to allow common code without rounding errors

Definition at line 70 of file ClusterProcessorModuleKey.cxx.

70  {
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 }

◆ cpmKey()

unsigned int LVL1::ClusterProcessorModuleKey::cpmKey ( unsigned int  crate,
unsigned int  module 
)

calculates key from crate and module index

returns trigger tower key of passed crate+module

Definition at line 47 of file ClusterProcessorModuleKey.cxx.

48  {
49  return TrigT1CaloDefs::cpmPhiSize;// one quadrant
50 }
51 

◆ dEta()

double LVL1::ClusterProcessorModuleKey::dEta ( const Coordinate coord) const
virtual

width

return width of JE

Implements LVL1::KeyUtilities.

Definition at line 58 of file ClusterProcessorModuleKey.cxx.

60  {

◆ dPhi()

double LVL1::ClusterProcessorModuleKey::dPhi ( const Coordinate coord) const
virtual

height

return height of CPM

Implements LVL1::KeyUtilities.

Definition at line 53 of file ClusterProcessorModuleKey.cxx.

53  {
55 }

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

◆ phiQuadrant()

unsigned int LVL1::ClusterProcessorModuleKey::phiQuadrant ( const double  phi) const
private

returns the quadrant number associated with the phi coordinate, 0 - 90 = 0 90 - 180 = 1 180-270 = 2 270-360 = 3

Definition at line 119 of file ClusterProcessorModuleKey.cxx.

119  {
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 }

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

◆ setBins()

void LVL1::ClusterProcessorModuleKey::setBins ( ICoordinate iCoord,
unsigned int &  phiBin,
int &  etaBin 
)
private

sets the eta and phi bins

Definition at line 60 of file ClusterProcessorModuleKey.cxx.

60  {
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 }

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

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_debugModuleKey

bool LVL1::ClusterProcessorModuleKey::m_debugModuleKey
private

set to true to turn debugging info on

Definition at line 84 of file ClusterProcessorModuleKey.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::KeyUtilities::key
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates
Definition: KeyUtilities.cxx:82
LVL1::TrigT1CaloDefs::cpmEtaSize
static const double cpmEtaSize
Definition: TrigT1CaloDefs.h:138
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::TrigT1CaloDefs::cpmPhiSize
static const double cpmPhiSize
Definition: TrigT1CaloDefs.h:137
LVL1::KeyUtilities::m_centralPhi
double m_centralPhi
this is the coordinate of the centre of the relevant trigger tower.
Definition: KeyUtilities.h:119
LVL1::KeyUtilities::m_eta
double m_eta
eta coordinate of key
Definition: KeyUtilities.h:110
xAOD::phiBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin
Definition: L2StandAloneMuon_v2.cxx:144
LVL1::Coordinate::eta
double eta() const
return eta
Definition: Coordinate.cxx:45
a
TList * a
Definition: liststreamerinfos.cxx:10
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
LVL1::ClusterProcessorModuleKey::setBins
void setBins(ICoordinate *iCoord, unsigned int &phiBin, int &etaBin)
sets the eta and phi bins
Definition: ClusterProcessorModuleKey.cxx:60
LVL1::ClusterProcessorModuleKey::m_debugModuleKey
bool m_debugModuleKey
set to true to turn debugging info on
Definition: ClusterProcessorModuleKey.h:84
LVL1::KeyUtilities::m_centralEta
double m_centralEta
this is the coordinate of the centre of the relevant trigger tower.
Definition: KeyUtilities.h:122
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