Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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: More...
 
virtual double dEta (const Coordinate &coord) const =0
 returns the width at eta_coord: More...
 
virtual double phi () const
 returns phi coordinate of centre of relevant trigger tower. More...
 
virtual double dPhi (const Coordinate &coord) const =0
 returns the height at eta_coord: 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

 KeyUtilities ()
 the constructor is protected so a user can never make a KeyUtilities object More...
 
 KeyUtilities (double phi, double eta)
 constructs a KeyUtilities object More...
 
ICoordinateconvertCoordsToIntegers (double phi, double eta)
 converts the coordinates and corrects for overflows etc. More...
 
virtual BinAndCoordcalculateTriggerBin (ICoordinate *iCoord)=0
 converts integer phi, eta coordinates to phi, eta trigger bins. 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...
 

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

Constructor & Destructor Documentation

◆ ~KeyUtilities()

LVL1::KeyUtilities::~KeyUtilities ( )
virtual

Definition at line 69 of file KeyUtilities.cxx.

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

47 {
48 }
49 
51 KeyUtilities::KeyUtilities(double phi, double eta) :
52  m_iphi(0),
53  m_ieta(0),

◆ KeyUtilities() [2/2]

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

constructs a KeyUtilities object

Definition at line 56 of file KeyUtilities.cxx.

61 {
62 }
63 
65 }
66 

Member Function Documentation

◆ calculateTriggerBin()

virtual BinAndCoord* LVL1::KeyUtilities::calculateTriggerBin ( ICoordinate iCoord)
protectedpure virtual

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

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

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

return central coords of current key value.

Definition at line 199 of file KeyUtilities.cxx.

199  {
200  return Coordinate(m_centralPhi,m_centralEta);
201 }

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

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

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

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 }

◆ round()

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

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 }

◆ setupThisKeyValues()

void LVL1::KeyUtilities::setupThisKeyValues ( )
protected

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

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

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
protectedvirtual

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
protected

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
protected

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
protected

turns DEBUG code on and off

Definition at line 124 of file KeyUtilities.h.

◆ m_eta

double LVL1::KeyUtilities::m_eta
protected

eta coordinate of key

Definition at line 110 of file KeyUtilities.h.

◆ m_etaBin

int LVL1::KeyUtilities::m_etaBin
protected

eta bin

Definition at line 116 of file KeyUtilities.h.

◆ m_ieta

int LVL1::KeyUtilities::m_ieta
protected

integer eta coord

Definition at line 108 of file KeyUtilities.h.

◆ m_iphi

int LVL1::KeyUtilities::m_iphi
protected

integer phi coord

Definition at line 106 of file KeyUtilities.h.

◆ m_phi

double LVL1::KeyUtilities::m_phi
protected

phi coordinate of key

Definition at line 112 of file KeyUtilities.h.

◆ m_phiBin

int LVL1::KeyUtilities::m_phiBin
protected

phi bin

Definition at line 114 of file KeyUtilities.h.


The documentation for this class was generated from the following files:
LVL1::KeyUtilities::phi
virtual double phi() const
returns phi coordinate of centre of relevant trigger tower.
Definition: KeyUtilities.cxx:159
LVL1::KeyUtilities::key
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates
Definition: KeyUtilities.cxx:82
LVL1::KeyUtilities::m_iphi
int m_iphi
integer phi coord
Definition: KeyUtilities.h:106
LVL1::KeyUtilities::KeyUtilities
KeyUtilities()
the constructor is protected so a user can never make a KeyUtilities object
Definition: KeyUtilities.cxx:42
LVL1::KeyUtilities::eta
virtual double eta() const
returns the centre of the TT at eta_coord:
Definition: KeyUtilities.cxx:150
LVL1::KeyUtilities::m_ieta
int m_ieta
integer eta coord
Definition: KeyUtilities.h:108
LVL1::KeyUtilities::~KeyUtilities
virtual ~KeyUtilities()
Definition: KeyUtilities.cxx:69
LVL1::KeyUtilities::m_centralPhi
double m_centralPhi
this is the coordinate of the centre of the relevant trigger tower.
Definition: KeyUtilities.h:119
a
TList * a
Definition: liststreamerinfos.cxx:10
LVL1::KeyUtilities::m_centralEta
double m_centralEta
this is the coordinate of the centre of the relevant trigger tower.
Definition: KeyUtilities.h:122