ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::KeyUtilities Class Referenceabstract

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

#include <KeyUtilities.h>

Inheritance diagram for LVL1::KeyUtilities:
Collaboration diagram for LVL1::KeyUtilities:

Public Member Functions

virtual ~KeyUtilities ()
virtual double eta () const
 returns the centre of the TT at eta_coord:
virtual double dEta (const Coordinate &coord) const =0
 returns the width at eta_coord:
virtual double phi () const
 returns phi coordinate of centre of relevant trigger tower.
virtual double dPhi (const Coordinate &coord) const =0
 returns the height at eta_coord:
unsigned int key (double phi, double eta)
 calculates a map key from passed phi, eta coordinates
unsigned int key (const Coordinate &coord)
 returns the key of the passed Coordinate
Coordinate coord () const
 return central coords of current key value.

Protected Member Functions

 KeyUtilities ()
 the constructor is protected so a user can never make a KeyUtilities object
 KeyUtilities (double phi, double eta)
 constructs a KeyUtilities object
ICoordinate convertCoordsToIntegers (double phi, double eta)
 converts the coordinates and corrects for overflows etc.
virtual BinAndCoord calculateTriggerBin (const ICoordinate &iCoord)=0
 converts integer phi, eta coordinates to phi, eta trigger bins.
virtual int sign (int temp) const
 returns -1 if temp is -ve and +1 if it is +ve.
virtual int sign (double temp) const
 returns -1 if temp is -ve and +1 if it is +ve.
int round (double a) const
 rounds number to nearest whole number
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.
int sharpRound2 (int a, int b) const
 divides a/b and returns a number as follows (where +b means +ve b): if 0
void setupThisKeyValues ()

Protected Attributes

int m_iphi
 integer phi coord
int m_ieta
 integer eta coord
double m_eta
 eta coordinate of key
double m_phi
 phi coordinate of key
int m_phiBin
 phi bin
int m_etaBin
 eta bin
double m_centralPhi
 this is the coordinate of the centre of the relevant trigger tower.
double m_centralEta
 this is the coordinate of the centre of the relevant trigger tower.
bool m_debug
 turns DEBUG code on and off

Detailed Description

The KeyUtilities 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 48 of file KeyUtilities.h.

Constructor & Destructor Documentation

◆ ~KeyUtilities()

LVL1::KeyUtilities::~KeyUtilities ( )
virtual

Definition at line 64 of file KeyUtilities.cxx.

64 {
65}

◆ KeyUtilities() [1/2]

LVL1::KeyUtilities::KeyUtilities ( )
protected

the constructor is protected so a user can never make a KeyUtilities object

takes phi and eta and constructs a KeyUtilities object which can return the key for this coord

constructs a KeyUtilities object

Definition at line 37 of file KeyUtilities.cxx.

37 :
38 m_iphi(0),
39 m_ieta(0),
40 m_eta(0.0),
41 m_phi(0.0),
42 m_phiBin(0),
43 m_etaBin(0),
44 m_centralPhi(0.0),
45 m_centralEta(0.0),
46 m_debug(false)
47{
48}
int m_ieta
integer eta coord
int m_iphi
integer phi coord
double m_centralEta
this is the coordinate of the centre of the relevant trigger tower.
double m_centralPhi
this is the coordinate of the centre of the relevant trigger tower.
bool m_debug
turns DEBUG code on and off
double m_phi
phi coordinate of key
double m_eta
eta coordinate of key

◆ KeyUtilities() [2/2]

LVL1::KeyUtilities::KeyUtilities ( double phi,
double eta )
protected

constructs a KeyUtilities object

Definition at line 51 of file KeyUtilities.cxx.

51 :
52 m_iphi(0),
53 m_ieta(0),
54 m_eta(eta),
55 m_phi(phi),
56 m_phiBin(0),
57 m_etaBin(0),
58 m_centralPhi(0.0),
59 m_centralEta(0.0),
60 m_debug(false)
61{
62}
virtual double eta() const
returns the centre of the TT at eta_coord:
virtual double phi() const
returns phi coordinate of centre of relevant trigger tower.

Member Function Documentation

◆ calculateTriggerBin()

virtual BinAndCoord LVL1::KeyUtilities::calculateTriggerBin ( const ICoordinate & iCoord)
protectedpure virtual

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

Implemented in LVL1::ClusterProcessorModuleKey, LVL1::JetElementKeyBase, LVL1::JetEnergyModuleKey, and LVL1::TriggerTowerKey.

◆ convertCoordsToIntegers()

ICoordinate LVL1::KeyUtilities::convertCoordsToIntegers ( double phi,
double eta )
protected

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 103 of file KeyUtilities.cxx.

103 {
104
105 double phiBinWidth=((2*M_PI)/64.0);
106 // there are a maximum of 64 cells in the phi direction
107 // stretching from 0 to ~2*PI.
108 if (m_debug) std::cout << "KU : (phi, eta) ("<<phi<<","<<eta<<")"<<std::endl;
109 int iphi=sharpRound(phi/phiBinWidth);
110 int ieta=0;
111
112 // Now check that m_iphi is between 0 and 64.
113 iphi = iphi%64;
114 if (iphi<0) iphi = 64+iphi;
115
116 // Make m_ieta symmetrical:
117 // o no cell at m_ieta=0
118 // o first cells at +-1
119 // o last cells at about +- 50
120 // this gives us a more useful numerical symmetry.
121
122 // So to get integer value we do:
123 int temp_sign=sign(eta);
124 double temp_abs=eta*temp_sign;
125
126 double temp_double=(temp_abs*10.0+1.0)*temp_sign;
127 if (m_debug) std::cout << "KU : temp_abs, temp_sign, temp_double : "<<temp_abs<<","<<temp_sign<<","<<temp_double<<std::endl;
128// if (m_eta>=0.0){
129// temp_double=m_eta*10.0+1.0;
130// }else{
131// temp_double=m_eta*10.0-1.0;
132// }
133
134 ieta=static_cast<int>(temp_double);
135 if (m_debug) std::cout << "KU : (iphi, ieta) ("<<iphi<<","<<ieta<<")"<<std::endl;
136 return ICoordinate(iphi, ieta, eta);
137}
#define M_PI
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
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.

◆ coord()

LVL1::Coordinate LVL1::KeyUtilities::coord ( ) const

return central coords of current key value.

Definition at line 194 of file KeyUtilities.cxx.

194 {
195 return Coordinate(m_centralPhi,m_centralEta);
196}

◆ dEta()

virtual double LVL1::KeyUtilities::dEta ( const Coordinate & coord) const
pure virtual

◆ dPhi()

virtual double LVL1::KeyUtilities::dPhi ( const Coordinate & coord) const
pure virtual

◆ eta()

double LVL1::KeyUtilities::eta ( ) const
virtual

returns the centre of the TT at eta_coord:

returns the eta coord of the centre of the relevent trigger tower

Definition at line 142 of file KeyUtilities.cxx.

142 {
143 return m_centralEta;
144}

◆ key() [1/2]

unsigned int LVL1::KeyUtilities::key ( const Coordinate & coord)

returns the key of the passed Coordinate

returns trigger tower key of passed Coordinate

Definition at line 94 of file KeyUtilities.cxx.

94 {
95 return key(coord.phi(), coord.eta());
96}
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.

◆ key() [2/2]

unsigned int LVL1::KeyUtilities::key ( double phi,
double eta )

calculates a map key from passed phi, eta coordinates

returns key

calculates a map key from passed phi, eta coordinates

Definition at line 77 of file KeyUtilities.cxx.

77 {
78 m_eta=eta;
79 m_phi=phi;
80 ICoordinate iCoord = convertCoordsToIntegers(m_phi, m_eta);
81 BinAndCoord bandc = calculateTriggerBin(iCoord);
82 if (m_debug) std::cout << "KU : 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 int temp=((m_etaBin+50)<<6) + m_phiBin;
88
89 if (m_debug) std::cout << "KU : key: returning - "<<temp<<std::endl;
90 return static_cast<unsigned int>(temp);
91}
virtual BinAndCoord calculateTriggerBin(const ICoordinate &iCoord)=0
converts integer phi, eta coordinates to phi, eta trigger bins.
ICoordinate convertCoordsToIntegers(double phi, double eta)
converts the coordinates and corrects for overflows etc.

◆ phi()

double LVL1::KeyUtilities::phi ( ) const
virtual

returns phi coordinate of centre of relevant trigger tower.

returns phi coordinate of the centre of the relevent trigger tower.

Definition at line 151 of file KeyUtilities.cxx.

151 {
152 return m_centralPhi;
153}

◆ round()

int LVL1::KeyUtilities::round ( double a) const
protected

rounds number to nearest whole number

Definition at line 175 of file KeyUtilities.cxx.

175 {
176 return static_cast<int>(a<0.0?ceil(a-0.5):a>0.0?floor(a+0.5):0.0);
177}
static Double_t a

◆ setupThisKeyValues()

void LVL1::KeyUtilities::setupThisKeyValues ( )
protected

Definition at line 165 of file KeyUtilities.cxx.

165 {
166 ICoordinate iCoord = convertCoordsToIntegers(m_phi, m_eta);
167 BinAndCoord bandc = calculateTriggerBin(iCoord);
168 m_phiBin=bandc.phiBin();
169 m_etaBin=bandc.etaBin();
170 m_centralPhi=bandc.coords().phi();
171 m_centralEta=bandc.coords().eta();
172}

◆ sharpRound()

int LVL1::KeyUtilities::sharpRound ( double a) const
protected

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 180 of file KeyUtilities.cxx.

180 {
181 return static_cast<int>(a<0.0?(a-1.0):a>0.0?(a):0.0);
182}

◆ sharpRound2()

int LVL1::KeyUtilities::sharpRound2 ( int a,
int b ) const
protected

divides a/b and returns a number as follows (where +b means +ve b): if 0

Definition at line 184 of file KeyUtilities.cxx.

184 {
185 int temp=(abs(a)-1)/b+1;
186 return temp*sign(a);
187}

◆ sign() [1/2]

int LVL1::KeyUtilities::sign ( double temp) const
protectedvirtual

returns -1 if temp is -ve and +1 if it is +ve.

returns 0 if temp =0

Definition at line 161 of file KeyUtilities.cxx.

161 {
162 return ((temp >= 0.0) ? 1 : -1);
163}

◆ sign() [2/2]

int LVL1::KeyUtilities::sign ( int temp) const
protectedvirtual

returns -1 if temp is -ve and +1 if it is +ve.

returns 0 if temp =0

Definition at line 156 of file KeyUtilities.cxx.

156 {
157 return ((temp >= 0) ? 1 : -1);
158}

Member Data Documentation

◆ m_centralEta

double LVL1::KeyUtilities::m_centralEta
protected

this is the coordinate of the centre of the relevant trigger tower.

Definition at line 112 of file KeyUtilities.h.

◆ m_centralPhi

double LVL1::KeyUtilities::m_centralPhi
protected

this is the coordinate of the centre of the relevant trigger tower.

Definition at line 109 of file KeyUtilities.h.

◆ m_debug

bool LVL1::KeyUtilities::m_debug
protected

turns DEBUG code on and off

Definition at line 114 of file KeyUtilities.h.

◆ m_eta

double LVL1::KeyUtilities::m_eta
protected

eta coordinate of key

Definition at line 100 of file KeyUtilities.h.

◆ m_etaBin

int LVL1::KeyUtilities::m_etaBin
protected

eta bin

Definition at line 106 of file KeyUtilities.h.

◆ m_ieta

int LVL1::KeyUtilities::m_ieta
protected

integer eta coord

Definition at line 98 of file KeyUtilities.h.

◆ m_iphi

int LVL1::KeyUtilities::m_iphi
protected

integer phi coord

Definition at line 96 of file KeyUtilities.h.

◆ m_phi

double LVL1::KeyUtilities::m_phi
protected

phi coordinate of key

Definition at line 102 of file KeyUtilities.h.

◆ m_phiBin

int LVL1::KeyUtilities::m_phiBin
protected

phi bin

Definition at line 104 of file KeyUtilities.h.


The documentation for this class was generated from the following files: