CMS 3D CMS Logo

List of all members | Public Types | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Static Private Attributes
l1t::CaloTools Class Reference

#include <CaloTools.h>

Public Types

enum  SubDet { ECAL =0x1, HCAL =0x2, CALO =0x3 }
 

Static Public Member Functions

static int bin16Eta (int ieta)
 
static int calHwEtSum (int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, SubDet etMode=CALO)
 
static int calHwEtSum (int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, int iEtaAbsMax, SubDet etMode=CALO)
 
static size_t calNrTowers (int iEtaMin, int iEtaMax, int iPhiMin, int iPhiMax, const std::vector< l1t::CaloTower > &towers, int minHwEt, int maxHwEt, SubDet etMode=CALO)
 
static int caloEta (int ietaMP)
 
static size_t caloTowerHash (int iEta, int iPhi)
 
static size_t caloTowerHashMax ()
 
static l1t::EGamma egP4Demux (l1t::EGamma &)
 
static l1t::EGamma egP4MP (l1t::EGamma &)
 
static l1t::EtSum etSumP4Demux (l1t::EtSum &)
 
static l1t::EtSum etSumP4MP (l1t::EtSum &)
 
static const l1t::CaloClustergetCluster (const std::vector< l1t::CaloCluster > &clusters, int iEta, int iPhi)
 
static const l1t::CaloTowergetTower (const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
 
static unsigned int gloriousDivision (uint32_t aNumerator, uint32_t aDenominator)
 
static int gtEta (int ieta)
 
static int gtPhi (int ieta, int iphi)
 
static bool insertTower (std::vector< l1t::CaloTower > &towers, const l1t::CaloTower &tower)
 
static bool isValidIEtaIPhi (int iEta, int iPhi)
 
static l1t::Jet jetP4Demux (l1t::Jet &)
 
static l1t::Jet jetP4MP (l1t::Jet &)
 
static int mpEta (int ieta)
 
static math::PtEtaPhiMLorentzVector p4Demux (l1t::L1Candidate *)
 
static math::PtEtaPhiMLorentzVector p4MP (l1t::L1Candidate *)
 
static int regionEta (int ieta)
 
static l1t::Tau tauP4Demux (l1t::Tau &)
 
static l1t::Tau tauP4MP (l1t::Tau &)
 
static float towerEta (int ieta)
 
static float towerEtaSize (int ieta)
 
static float towerPhi (int ieta, int iphi)
 
static float towerPhiSize (int ieta)
 

Static Public Attributes

static const int64_t cos_coeff [72] = {1023, 1019, 1007, 988, 961, 927, 886, 838, 784, 723, 658, 587, 512, 432, 350, 265, 178, 89, 0, -89, -178, -265, -350, -432, -512, -587, -658, -723, -784, -838, -886, -927, -961, -988, -1007, -1019, -1023, -1019, -1007, -988, -961, -927, -886, -838, -784, -723, -658, -587, -512, -432, -350, -265, -178, -89, 0, 89, 178, 265, 350, 432, 511, 587, 658, 723, 784, 838, 886, 927, 961, 988, 1007, 1019}
 
static const int emul_to_data_sum_index_map [31]
 
static const int kHBHEEnd =28
 
static const int kHBHENrPhi =72
 
static const int kHFBegin =29
 
static const int kHFEnd =41
 
static const int kHFNrPhi =72/kHFPhiSeg
 
static const int kHFPhiSeg =1
 
static const int kNPhi =72
 
static const int kNrHBHETowers = kHBHEEnd*kHBHENrPhi*2
 
static const int kNrTowers = ((kHFEnd-kHFBegin+1)*kHFNrPhi + kHBHEEnd*kHBHENrPhi )*2
 
static const int kSatEcal = 510
 
static const int kSatHcal = 509
 
static const int kSatJet = 65535
 
static const int kSatTower = 511
 
static const int64_t sin_coeff [72] = {0, 89, 178, 265, 350, 432, 512, 587, 658, 723, 784, 838, 886, 927, 961, 988, 1007, 1019, 1023, 1019, 1007, 988, 961, 927, 886, 838, 784, 723, 658, 587, 512, 432, 350, 265, 178, 89, 0, -89, -178, -265, -350, -432, -512, -587, -658, -723, -784, -838, -886, -927, -961, -988, -1007, -1019, -1023, -1019, -1007, -988, -961, -927, -886, -838, -784, -723, -658, -587, -512, -432, -350, -265, -178, -89}
 

Private Member Functions

 CaloTools ()
 
 ~CaloTools ()
 

Static Private Member Functions

static std::pair< float, float > towerEtaBounds (int ieta)
 

Static Private Attributes

static const float kGTEtaLSB = 0.0435
 
static const float kGTEtLSB = 0.5
 
static const float kGTPhiLSB = 0.0435
 
static const l1t::CaloCluster nullCluster_
 
static const l1t::CaloTower nullTower_
 

Detailed Description

Description: A collection of useful functions for the Calorimeter that are of generic interest

Implementation: currently implimented as a static class rather than a namespace, open to re-writing it as namespace

Author
: Sam Harper - RAL

Definition at line 29 of file CaloTools.h.

Member Enumeration Documentation

Enumerator
ECAL 
HCAL 
CALO 

Definition at line 61 of file CaloTools.h.

61 {ECAL=0x1,HCAL=0x2,CALO=0x3}; //CALO is a short cut for ECAL|HCAL
Definition: HCAL.py:1

Constructor & Destructor Documentation

l1t::CaloTools::CaloTools ( )
inlineprivate

Definition at line 33 of file CaloTools.h.

33 {}
l1t::CaloTools::~CaloTools ( )
inlineprivate

Definition at line 34 of file CaloTools.h.

34 {}

Member Function Documentation

int l1t::CaloTools::bin16Eta ( int  ieta)
static

Definition at line 246 of file CaloTools.cc.

References funct::abs().

Referenced by l1t::Stage2Layer2JetAlgorithmFirmwareImp1::calibrate().

247 {
248  int absIEta = abs(ieta);
249 
250  if (absIEta>0 && absIEta<=5) return 0;
251  else if (absIEta<=9) return 1;
252  else if (absIEta<=13) return 2;
253  else if (absIEta<=15) return 3;
254  else if (absIEta<=17) return 4;
255  else if (absIEta<=19) return 5;
256  else if (absIEta<=21) return 6;
257  else if (absIEta==22) return 7;
258  else if (absIEta==23) return 8;
259  else if (absIEta==24) return 9;
260  else if (absIEta==25) return 10;
261  else if (absIEta==26) return 11;
262  else if (absIEta<=28) return 12;
263  else if (absIEta<=32) return 13;
264  else if (absIEta<=36) return 14;
265  else if (absIEta<=41) return 15;
266  else return -1; // error
267 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int l1t::CaloTools::calHwEtSum ( int  iEta,
int  iPhi,
const std::vector< l1t::CaloTower > &  towers,
int  localEtaMin,
int  localEtaMax,
int  localPhiMin,
int  localPhiMax,
SubDet  etMode = CALO 
)
static

Definition at line 109 of file CaloTools.cc.

References kHFEnd.

Referenced by l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::isoCalEgHwFootPrint(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), and l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent().

112 {
113 
114  return calHwEtSum(iEta,iPhi,towers,localEtaMin,localEtaMax,localPhiMin,localPhiMax,kHFEnd,etMode);
115 }
static int calHwEtSum(int iEta, int iPhi, const std::vector< l1t::CaloTower > &towers, int localEtaMin, int localEtaMax, int localPhiMin, int localPhiMax, SubDet etMode=CALO)
Definition: CaloTools.cc:109
static const int kHFEnd
Definition: CaloTools.h:41
int l1t::CaloTools::calHwEtSum ( int  iEta,
int  iPhi,
const std::vector< l1t::CaloTower > &  towers,
int  localEtaMin,
int  localEtaMax,
int  localPhiMin,
int  localPhiMax,
int  iEtaAbsMax,
SubDet  etMode = CALO 
)
static

Definition at line 117 of file CaloTools.cc.

References funct::abs(), CALO, ECAL, getTower(), l1t::CaloTower::hwEtEm(), l1t::CaloTower::hwEtHad(), l1t::L1Candidate::hwPt(), l1t::CaloStage2Nav::offsetIEta(), and l1t::CaloStage2Nav::offsetIPhi().

120 {
121  int hwEtSum=0;
122  for(int etaNr=localEtaMin;etaNr<=localEtaMax;etaNr++){
123  for(int phiNr=localPhiMin;phiNr<=localPhiMax;phiNr++){
124 
125  int towerIEta = l1t::CaloStage2Nav::offsetIEta(iEta,etaNr);
126  int towerIPhi = l1t::CaloStage2Nav::offsetIPhi(iPhi,phiNr);
127  if(abs(towerIEta)<=iEtaAbsMax){
128  const l1t::CaloTower& tower = getTower(towers,towerIEta,towerIPhi);
129  if(etMode==ECAL) hwEtSum+=tower.hwEtEm();
130  else if(etMode==HCAL) hwEtSum+=tower.hwEtHad();
131  else if(etMode==CALO) hwEtSum+=tower.hwPt();
132  }
133  }
134  }
135  return hwEtSum;
136 }
static int offsetIEta(int iEta, int offset)
Definition: CaloStage2Nav.h:44
int hwEtEm() const
Definition: CaloTower.cc:64
static int offsetIPhi(int iPhi, int offset)
Definition: CaloStage2Nav.h:33
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: HCAL.py:1
int hwPt() const
Definition: L1Candidate.h:48
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:37
int hwEtHad() const
Definition: CaloTower.cc:69
size_t l1t::CaloTools::calNrTowers ( int  iEtaMin,
int  iEtaMax,
int  iPhiMin,
int  iPhiMax,
const std::vector< l1t::CaloTower > &  towers,
int  minHwEt,
int  maxHwEt,
SubDet  etMode = CALO 
)
static

Definition at line 139 of file CaloTools.cc.

References CALO, caloEta(), l1t::CaloStage2Nav::currIEta(), l1t::CaloStage2Nav::currIPhi(), l1t::CaloStage2Nav::east(), ECAL, getTower(), l1t::CaloTower::hwEtEm(), l1t::CaloTower::hwEtHad(), l1t::L1Candidate::hwPt(), hcalTTPDigis_cfi::iEtaMax, l1t::CaloStage2Nav::north(), and l1t::CaloStage2Nav::resetIPhi().

Referenced by l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), l1t::Stage2Layer2EtSumAlgorithmFirmwareImp1::processEvent(), and l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent().

140 {
141  size_t nrTowers=0;
142  l1t::CaloStage2Nav nav(iEtaMin,iPhiMin);
143  while(nav.currIEta()<=iEtaMax){
144  bool finishPhi = false;
145  while(!finishPhi){
146  const l1t::CaloTower& tower = l1t::CaloTools::getTower(towers,CaloTools::caloEta(nav.currIEta()),nav.currIPhi());
147  int towerHwEt =0;
148  if(etMode==ECAL) towerHwEt+=tower.hwEtEm();
149  else if(etMode==HCAL) towerHwEt+=tower.hwEtHad();
150  else if(etMode==CALO) towerHwEt+=tower.hwPt();
151  if(towerHwEt>=minHwEt && towerHwEt<=maxHwEt) nrTowers++;
152  finishPhi = (nav.currIPhi() == iPhiMax);
153  nav.north();
154  }
155  nav.east();
156  nav.resetIPhi();
157  }
158  return nrTowers;
159 }
int hwEtEm() const
Definition: CaloTower.cc:64
Definition: HCAL.py:1
int hwPt() const
Definition: L1Candidate.h:48
static int caloEta(int ietaMP)
Definition: CaloTools.cc:210
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:37
int hwEtHad() const
Definition: CaloTower.cc:69
int l1t::CaloTools::caloEta ( int  ietaMP)
static
size_t l1t::CaloTools::caloTowerHash ( int  iEta,
int  iPhi 
)
static

Definition at line 73 of file CaloTools.cc.

References funct::abs(), caloTowerHashMax(), isValidIEtaIPhi(), kHBHEEnd, kHBHENrPhi, kHFEnd, kHFNrPhi, kHFPhiSeg, kNrHBHETowers, and kNrTowers.

Referenced by getTower(), insertTower(), l1t::stage2::CaloTowerPacker::pack(), and L1TStage2Layer2Producer::produce().

74 {
75 
76  if(!isValidIEtaIPhi(iEta,iPhi)) return caloTowerHashMax();
77  else{
78  const int absIEta = abs(iEta);
79  if(absIEta>kHFEnd) return kNrTowers;
80  else if(absIEta<=kHBHEEnd){ //HBHE
81  int iEtaNoZero=iEta;
82  if(iEta>0) iEtaNoZero--;
83  return (iEtaNoZero+kHBHEEnd)*kHBHENrPhi+iPhi-1;
84  }else{ //HF
85  int iEtaIndex = iEta+kHFEnd; //iEta=-32 is 0
86  if(iEta>0) iEtaIndex= iEta-kHBHEEnd+(kHFEnd-kHBHEEnd)-1; //but iEta=29 is 4
87  return iEtaIndex*kHFNrPhi+iPhi/kHFPhiSeg + kNrHBHETowers;
88  }
89  }
90 }
static const int kHFPhiSeg
Definition: CaloTools.h:42
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:99
static const int kHBHEEnd
Definition: CaloTools.h:39
static const int kNrHBHETowers
Definition: CaloTools.h:47
static const int kHFNrPhi
Definition: CaloTools.h:43
static const int kHFEnd
Definition: CaloTools.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kNrTowers
Definition: CaloTools.h:46
static const int kHBHENrPhi
Definition: CaloTools.h:44
static size_t caloTowerHashMax()
Definition: CaloTools.cc:93
size_t l1t::CaloTools::caloTowerHashMax ( )
static

Definition at line 93 of file CaloTools.cc.

References kNrTowers.

Referenced by caloTowerHash(), and L1TStage2Layer2Producer::produce().

94 {
95  return kNrTowers;
96 }
static const int kNrTowers
Definition: CaloTools.h:46
l1t::EGamma l1t::CaloTools::egP4Demux ( l1t::EGamma eg)
static

Definition at line 300 of file CaloTools.cc.

References l1t::EGamma::footprintEt(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwIso(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), l1t::EGamma::isoEt(), l1t::EGamma::nTT(), p4Demux(), l1t::EGamma::rawEt(), l1t::EGamma::setTowerIPhi(), l1t::EGamma::shape(), l1t::EGamma::towerHoE(), l1t::EGamma::towerIEta(), and l1t::EGamma::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

300  {
301 
302  l1t::EGamma tmpEG( p4Demux(&eg),
303  eg.hwPt(),
304  eg.hwEta(),
305  eg.hwPhi(),
306  eg.hwQual(),
307  eg.hwIso() );
308  tmpEG.setTowerIPhi(eg.towerIPhi());
309  tmpEG.setTowerIEta(eg.towerIEta());
310  tmpEG.setRawEt(eg.rawEt());
311  tmpEG.setIsoEt(eg.isoEt());
312  tmpEG.setFootprintEt(eg.footprintEt());
313  tmpEG.setNTT(eg.nTT());
314  tmpEG.setShape(eg.shape());
315  tmpEG.setTowerHoE(eg.towerHoE());
316 
317  return tmpEG;
318 
319 }
short int towerIEta() const
Definition: EGamma.cc:75
short int towerIPhi() const
Definition: EGamma.cc:79
short int shape() const
Definition: EGamma.cc:99
int hwPhi() const
Definition: L1Candidate.h:50
short int footprintEt() const
Definition: EGamma.cc:91
short int rawEt() const
Definition: EGamma.cc:83
int hwIso() const
Definition: L1Candidate.h:52
short int towerHoE() const
Definition: EGamma.cc:103
short int isoEt() const
Definition: EGamma.cc:87
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
int hwPt() const
Definition: L1Candidate.h:48
void setTowerIPhi(short int iphi)
Definition: EGamma.cc:47
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
short int nTT() const
Definition: EGamma.cc:95
l1t::EGamma l1t::CaloTools::egP4MP ( l1t::EGamma eg)
static

Definition at line 389 of file CaloTools.cc.

References l1t::EGamma::footprintEt(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwIso(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), l1t::EGamma::isoEt(), l1t::EGamma::nTT(), p4MP(), l1t::EGamma::rawEt(), l1t::EGamma::setTowerIPhi(), l1t::EGamma::shape(), l1t::EGamma::towerHoE(), l1t::EGamma::towerIEta(), and l1t::EGamma::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

389  {
390 
391  l1t::EGamma tmpEG( p4MP(&eg),
392  eg.hwPt(),
393  eg.hwEta(),
394  eg.hwPhi(),
395  eg.hwQual(),
396  eg.hwIso() );
397  tmpEG.setTowerIPhi(eg.towerIPhi());
398  tmpEG.setTowerIEta(eg.towerIEta());
399  tmpEG.setRawEt(eg.rawEt());
400  tmpEG.setIsoEt(eg.isoEt());
401  tmpEG.setFootprintEt(eg.footprintEt());
402  tmpEG.setNTT(eg.nTT());
403  tmpEG.setShape(eg.shape());
404  tmpEG.setTowerHoE(eg.towerHoE());
405 
406  return tmpEG;
407 
408 }
short int towerIEta() const
Definition: EGamma.cc:75
short int towerIPhi() const
Definition: EGamma.cc:79
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:380
short int shape() const
Definition: EGamma.cc:99
int hwPhi() const
Definition: L1Candidate.h:50
short int footprintEt() const
Definition: EGamma.cc:91
short int rawEt() const
Definition: EGamma.cc:83
int hwIso() const
Definition: L1Candidate.h:52
short int towerHoE() const
Definition: EGamma.cc:103
short int isoEt() const
Definition: EGamma.cc:87
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
int hwPt() const
Definition: L1Candidate.h:48
void setTowerIPhi(short int iphi)
Definition: EGamma.cc:47
short int nTT() const
Definition: EGamma.cc:95
l1t::EtSum l1t::CaloTools::etSumP4Demux ( l1t::EtSum etsum)
static

Definition at line 366 of file CaloTools.cc.

References l1t::EtSum::getType(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), and p4Demux().

Referenced by L1TStage2Layer2Producer::produce().

366  {
367 
368  return l1t::EtSum( p4Demux(&etsum),
369  etsum.getType(),
370  etsum.hwPt(),
371  etsum.hwEta(),
372  etsum.hwPhi(),
373  etsum.hwQual() );
374 
375 }
int hwPhi() const
Definition: L1Candidate.h:50
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
int hwPt() const
Definition: L1Candidate.h:48
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
EtSumType getType() const
Definition: EtSum.cc:37
l1t::EtSum l1t::CaloTools::etSumP4MP ( l1t::EtSum etsum)
static

Definition at line 452 of file CaloTools.cc.

References l1t::EtSum::getType(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), and p4MP().

Referenced by L1TStage2Layer2Producer::produce().

452  {
453 
454  return l1t::EtSum( p4MP(&etsum),
455  etsum.getType(),
456  etsum.hwPt(),
457  etsum.hwEta(),
458  etsum.hwPhi(),
459  etsum.hwQual() );
460 
461 }
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:380
int hwPhi() const
Definition: L1Candidate.h:50
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
int hwPt() const
Definition: L1Candidate.h:48
EtSumType getType() const
Definition: EtSum.cc:37
const l1t::CaloCluster & l1t::CaloTools::getCluster ( const std::vector< l1t::CaloCluster > &  clusters,
int  iEta,
int  iPhi 
)
static

Definition at line 60 of file CaloTools.cc.

References nullCluster_.

Referenced by l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::filtering().

61 {
62  for(size_t clusterNr=0;clusterNr<clusters.size();clusterNr++){
63  if(clusters[clusterNr].hwEta()==iEta && clusters[clusterNr].hwPhi()==iPhi) return clusters[clusterNr];
64  }
65  return nullCluster_;
66 }
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:131
const l1t::CaloTower & l1t::CaloTools::getTower ( const std::vector< l1t::CaloTower > &  towers,
int  iEta,
int  iPhi 
)
static

Definition at line 37 of file CaloTools.cc.

References funct::abs(), caloTowerHash(), kHFEnd, and nullTower_.

Referenced by L1TStage2InputPatternWriter::analyze(), calHwEtSum(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::calibratedPt(), calNrTowers(), l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::clustering(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1::donutPUEstimate(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1::getChunkyRing(), l1t::Stage2Layer2JetAlgorithmFirmwareImp1::getSumEtEtaMap(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::is3x3Maximum(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::makeSecClusters(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), l1t::Stage2Layer2EtSumAlgorithmFirmwareImp1::processEvent(), l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(), and l1t::Stage2Layer2ClusterAlgorithmFirmwareImp1::refining().

38 {
39  if(abs(iEta) > CaloTools::kHFEnd) return nullTower_;
40 
41  size_t towerIndex = CaloTools::caloTowerHash(iEta, iPhi);
42  if(towerIndex<towers.size()){
43  if(towers[towerIndex].hwEta()!=iEta || towers[towerIndex].hwPhi()!=iPhi){ //it failed, this is bad, but we will not log the error due to policy and silently attempt to do a brute force search instead
44  //std::cout <<"error, tower "<<towers[towerIndex].hwEta()<<" "<<towers[towerIndex].hwPhi()<<" does not match "<<iEta<<" "<<iPhi<<" index "<<towerIndex<<" nr towrs "<<towers.size()<<std::endl;
45  for(size_t towerNr=0;towerNr<towers.size();towerNr++){
46  if(towers[towerNr].hwEta()==iEta && towers[towerNr].hwPhi()==iPhi) return towers[towerNr];
47  }
48  }else return towers[towerIndex];
49 
50  }
51  else{// in case the vector of towers do not contain all the towers (towerIndex can be > towers.size())
52  for(size_t towerNr=0;towerNr<towers.size();towerNr++){
53  if(towers[towerNr].hwEta()==iEta && towers[towerNr].hwPhi()==iPhi) return towers[towerNr];
54  }
55  }
56 
57  return nullTower_;
58 }
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:73
static const int kHFEnd
Definition: CaloTools.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const l1t::CaloTower nullTower_
Definition: CaloTools.h:130
unsigned int l1t::CaloTools::gloriousDivision ( uint32_t  aNumerator,
uint32_t  aDenominator 
)
static

Definition at line 462 of file CaloTools.cc.

References mps_fire::result.

Referenced by l1t::Stage2Layer2DemuxSumsAlgoFirmwareImp1::processEvent().

463 {
464 
465  static const uint64_t lLut[] = { 0,
466  16777215, 4194304, 1864135, 1048576, 671089, 466034, 342392, 262144, 207126, 167772, 138655, 116508, 99273, 85598, 74565,
467  65536, 58053, 51782, 46474, 41943, 38044, 34664, 31715, 29127, 26844, 24818, 23014, 21400, 19949, 18641, 17458,
468  16384, 15406, 14513, 13696, 12945, 12255, 11619, 11030, 10486, 9980, 9511, 9074, 8666, 8285, 7929, 7595,
469  7282, 6988, 6711, 6450, 6205, 5973, 5754, 5546, 5350, 5164, 4987, 4820, 4660, 4509, 4365, 4227,
470  4096, 3971, 3852, 3737, 3628, 3524, 3424, 3328, 3236, 3148, 3064, 2983, 2905, 2830, 2758, 2688,
471  2621, 2557, 2495, 2435, 2378, 2322, 2268, 2217, 2166, 2118, 2071, 2026, 1982, 1940, 1899, 1859,
472  1820, 1783, 1747, 1712, 1678, 1645, 1613, 1581, 1551, 1522, 1493, 1465, 1438, 1412, 1387, 1362,
473  1337, 1314, 1291, 1269, 1247, 1226, 1205, 1185, 1165, 1146, 1127, 1109, 1091, 1074, 1057, 1040,
474  1024, 1008, 993, 978, 963, 948, 934, 921, 907, 894, 881, 868, 856, 844, 832, 820,
475  809, 798, 787, 776, 766, 756, 746, 736, 726, 717, 707, 698, 689, 681, 672, 664,
476  655, 647, 639, 631, 624, 616, 609, 602, 594, 587, 581, 574, 567, 561, 554, 548,
477  542, 536, 530, 524, 518, 512, 506, 501, 496, 490, 485, 480, 475, 470, 465, 460,
478  455, 450, 446, 441, 437, 432, 428, 424, 419, 415, 411, 407, 403, 399, 395, 392,
479  388, 384, 380, 377, 373, 370, 366, 363, 360, 356, 353, 350, 347, 344, 340, 337,
480  334, 331, 328, 326, 323, 320, 317, 314, 312, 309, 306, 304, 301, 299, 296, 294,
481  291, 289, 286, 284, 282, 280, 277, 275, 273, 271, 268, 266, 264, 262, 260, 258,
482  256, 254, 252, 250, 248, 246, 244, 243, 241, 239, 237, 235, 234, 232, 230, 228,
483  227, 225, 223, 222, 220, 219, 217, 216, 214, 212, 211, 209, 208, 207, 205, 204,
484  202, 201, 199, 198, 197, 195, 194, 193, 191, 190, 189, 188, 186, 185, 184, 183,
485  182, 180, 179, 178, 177, 176, 175, 173, 172, 171, 170, 169, 168, 167, 166, 165,
486  164, 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149,
487  149, 148, 147, 146, 145, 144, 143, 143, 142, 141, 140, 139, 139, 138, 137, 136,
488  135, 135, 134, 133, 132, 132, 131, 130, 129, 129, 128, 127, 127, 126, 125, 125,
489  124, 123, 123, 122, 121, 121, 120, 119, 119, 118, 117, 117, 116, 116, 115, 114,
490  114, 113, 113, 112, 111, 111, 110, 110, 109, 109, 108, 108, 107, 106, 106, 105,
491  105, 104, 104, 103, 103, 102, 102, 101, 101, 100, 100, 99, 99, 98, 98, 97,
492  97, 96, 96, 96, 95, 95, 94, 94, 93, 93, 92, 92, 92, 91, 91, 90,
493  90, 89, 89, 89, 88, 88, 87, 87, 87, 86, 86, 85, 85, 85, 84, 84,
494  84, 83, 83, 82, 82, 82, 81, 81, 81, 80, 80, 80, 79, 79, 79, 78,
495  78, 78, 77, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73,
496  73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 68,
497  68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 64 };
498 
499 // Firmware uses 18bit integers - make sure we are in the same range
500  aNumerator &= 0x3FFFF;
501  aDenominator &= 0x3FFFF;
502 
503 // Shift the denominator to optimise the polynomial expansion
504 // I limit the shift to half the denominator size in the firmware to save on resources
505  uint32_t lBitShift(0);
506  for( ;lBitShift!=9 ; ++lBitShift )
507  {
508  if ( aDenominator & 0x20000 ) break; // There is a 1 in the MSB
509  aDenominator <<= 1;
510  }
511 
512 // The magical polynomial expansion Voodoo
513  uint64_t lInverseDenominator( ( ( aDenominator & 0x3FE00 ) - ( aDenominator & 0x001FF ) ) * ( lLut[ aDenominator >> 9 ] ) );
514 
515 // Save on DSPs by throwing away a bunch of LSBs
516  lInverseDenominator >>= 17;
517 
518 // Multiply the numerator by the inverse denominator
519  uint64_t lResult( aNumerator * lInverseDenominator );
520 
521 // Add two bits to the result, to make the Voodoo below work (saves us having an if-else on the shift direction)
522  lResult <<= 2;
523 
524 // Restore the scale by taking into account the bitshift applied above.
525 // We are now 18 bit left-shifted, so the 18 LSBs are effectively the fractional part...
526 
527  uint32_t aFractional = ( lResult >>= ( 9 - lBitShift) ) & 0x3FFFF;
528 // ...and the top 18 bits are the integer part
529 
530  // uint32_t aInteger = ( lResult >>= 18 ) & 0x3FFFF;
531 
532  unsigned int result = aFractional >> 10;
533 
534  return result;
535 
536 // Simples!
537 }
unsigned long long uint64_t
Definition: Time.h:15
int l1t::CaloTools::gtEta ( int  ieta)
static

Definition at line 270 of file CaloTools.cc.

References PVValHelper::eta, kGTEtaLSB, and towerEta().

Referenced by l1t::Stage2Layer2DemuxJetAlgoFirmwareImp1::processEvent().

270  {
271 
272  double eta = towerEta(ieta);
273  return round ( eta / kGTEtaLSB );
274 
275 }
static float towerEta(int ieta)
Definition: CaloTools.cc:171
static const float kGTEtaLSB
Definition: CaloTools.h:133
int l1t::CaloTools::gtPhi ( int  ieta,
int  iphi 
)
static

Definition at line 277 of file CaloTools.cc.

References kGTPhiLSB, M_PI, and towerPhi().

Referenced by l1t::Stage2Layer2DemuxJetAlgoFirmwareImp1::processEvent().

277  {
278 
279  double phi = towerPhi(ieta, iphi);
280  if (phi<0) phi = phi + 2*M_PI;
281  return round ( phi / kGTPhiLSB );
282 
283 }
static const float kGTPhiLSB
Definition: CaloTools.h:134
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:179
#define M_PI
bool l1t::CaloTools::insertTower ( std::vector< l1t::CaloTower > &  towers,
const l1t::CaloTower tower 
)
static

Definition at line 26 of file CaloTools.cc.

References caloTowerHash(), l1t::L1Candidate::hwEta(), and l1t::L1Candidate::hwPhi().

26  {
27  size_t towerIndex = CaloTools::caloTowerHash(tower.hwEta(), tower.hwPhi());
28  if (towers.size() > towerIndex) {
29  towers.at(towerIndex) = tower;
30  return true;
31  }
32  else return false;
33 }
int hwPhi() const
Definition: L1Candidate.h:50
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:73
int hwEta() const
Definition: L1Candidate.h:49
bool l1t::CaloTools::isValidIEtaIPhi ( int  iEta,
int  iPhi 
)
static

Definition at line 99 of file CaloTools.cc.

References funct::abs(), kHFEnd, and kNPhi.

Referenced by caloTowerHash().

100 {
101  size_t absIEta = abs(iEta);
102  if(iPhi<=0 || iPhi>kNPhi) return false;
103  if(absIEta==0 || absIEta>kHFEnd) return false;
104  //if(absIEta>kHBHEEnd && iPhi%kHFPhiSeg!=1) return false;
105  return true;
106 
107 }
static const int kNPhi
Definition: CaloTools.h:45
static const int kHFEnd
Definition: CaloTools.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
l1t::Jet l1t::CaloTools::jetP4Demux ( l1t::Jet jet)
static

Definition at line 343 of file CaloTools.cc.

References l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), p4Demux(), l1t::Jet::puDonutEt(), l1t::Jet::puEt(), l1t::Jet::rawEt(), l1t::Jet::seedEt(), l1t::Jet::setTowerIPhi(), l1t::Jet::towerIEta(), and l1t::Jet::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

343  {
344 
345 
346  l1t::Jet tmpJet ( p4Demux(&jet),
347  jet.hwPt(),
348  jet.hwEta(),
349  jet.hwPhi(),
350  jet.hwQual() );
351  tmpJet.setTowerIPhi(jet.towerIPhi());
352  tmpJet.setTowerIEta(jet.towerIEta());
353  tmpJet.setRawEt(jet.rawEt());
354  tmpJet.setSeedEt(jet.seedEt());
355  tmpJet.setPUEt(jet.puEt());
356  tmpJet.setPUDonutEt(0,jet.puDonutEt(0));
357  tmpJet.setPUDonutEt(1,jet.puDonutEt(1));
358  tmpJet.setPUDonutEt(2,jet.puDonutEt(2));
359  tmpJet.setPUDonutEt(3,jet.puDonutEt(3));
360 
361  return tmpJet;
362 
363 }
short int rawEt() const
int hwPhi() const
Definition: L1Candidate.h:50
short int seedEt() const
short int towerIEta() const
Definition: Jet.h:21
short int puEt() const
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
int hwPt() const
Definition: L1Candidate.h:48
short int towerIPhi() const
void setTowerIPhi(short int iphi)
short int puDonutEt(int i) const
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
l1t::Jet l1t::CaloTools::jetP4MP ( l1t::Jet jet)
static

Definition at line 431 of file CaloTools.cc.

References l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), p4MP(), l1t::Jet::puDonutEt(), l1t::Jet::puEt(), l1t::Jet::rawEt(), l1t::Jet::seedEt(), l1t::Jet::setTowerIPhi(), l1t::Jet::towerIEta(), and l1t::Jet::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

431  {
432 
433  l1t::Jet tmpJet ( p4MP(&jet),
434  jet.hwPt(),
435  jet.hwEta(),
436  jet.hwPhi(),
437  jet.hwQual() );
438  tmpJet.setTowerIPhi(jet.towerIPhi());
439  tmpJet.setTowerIEta(jet.towerIEta());
440  tmpJet.setRawEt(jet.rawEt());
441  tmpJet.setSeedEt(jet.seedEt());
442  tmpJet.setPUEt(jet.puEt());
443  tmpJet.setPUDonutEt(0,jet.puDonutEt(0));
444  tmpJet.setPUDonutEt(1,jet.puDonutEt(1));
445  tmpJet.setPUDonutEt(2,jet.puDonutEt(2));
446  tmpJet.setPUDonutEt(3,jet.puDonutEt(3));
447 
448  return tmpJet;
449 
450 }
short int rawEt() const
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:380
int hwPhi() const
Definition: L1Candidate.h:50
short int seedEt() const
short int towerIEta() const
Definition: Jet.h:21
short int puEt() const
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
int hwPt() const
Definition: L1Candidate.h:48
short int towerIPhi() const
void setTowerIPhi(short int iphi)
short int puDonutEt(int i) const
int l1t::CaloTools::mpEta ( int  ieta)
static
math::PtEtaPhiMLorentzVector l1t::CaloTools::p4Demux ( l1t::L1Candidate cand)
static

Definition at line 290 of file CaloTools.cc.

References l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), kGTEtaLSB, kGTEtLSB, and kGTPhiLSB.

Referenced by egP4Demux(), etSumP4Demux(), jetP4Demux(), tauP4Demux(), l1t::stage2::EtSumUnpacker_0x10010057::unpack(), l1t::stage2::TauUnpacker::unpack(), l1t::stage2::EGammaUnpacker::unpack(), l1t::stage2::EtSumUnpacker::unpack(), and l1t::stage2::JetUnpacker::unpack().

290  {
291 
292  return math::PtEtaPhiMLorentzVector( cand->hwPt() * kGTEtLSB + 1.E-6,
293  cand->hwEta() * kGTEtaLSB,
294  cand->hwPhi() * kGTPhiLSB,
295  0. ) ;
296 
297 }
static const float kGTPhiLSB
Definition: CaloTools.h:134
static const float kGTEtaLSB
Definition: CaloTools.h:133
int hwPhi() const
Definition: L1Candidate.h:50
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int hwEta() const
Definition: L1Candidate.h:49
int hwPt() const
Definition: L1Candidate.h:48
static const float kGTEtLSB
Definition: CaloTools.h:135
math::PtEtaPhiMLorentzVector l1t::CaloTools::p4MP ( l1t::L1Candidate cand)
static

Definition at line 380 of file CaloTools.cc.

References l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), towerEta(), and towerPhi().

Referenced by egP4MP(), etSumP4MP(), jetP4MP(), tauP4MP(), l1t::stage2::MPUnpacker_0x10010033::unpack(), l1t::stage2::MPUnpacker::unpack(), l1t::stage2::MPUnpacker_0x10010010::unpack(), and l1t::stage2::MPUnpacker_0x1001000b::unpack().

380  {
381 
382  return math::PtEtaPhiMLorentzVector( cand->hwPt() * 0.5 + 1.E-6,
383  towerEta(cand->hwEta()),
384  towerPhi(cand->hwEta(), cand->hwPhi()),
385  0. ) ;
386 
387 }
static float towerEta(int ieta)
Definition: CaloTools.cc:171
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:179
int hwPhi() const
Definition: L1Candidate.h:50
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int hwEta() const
Definition: L1Candidate.h:49
int hwPt() const
Definition: L1Candidate.h:48
int l1t::CaloTools::regionEta ( int  ieta)
static

Definition at line 220 of file CaloTools.cc.

References funct::abs(), kHFBegin, and kHFEnd.

Referenced by l1t::Stage2Layer2JetAlgorithmFirmwareImp1::calibrate().

221 {
222 
223  // outside HF
224  if (abs(ieta) > kHFEnd)
225  return (ieta<0 ? 0 : 21);
226 
227  // inside HBHE
228  if (abs(ieta) <= kHFBegin)
229  {
230  if (ieta<0)
231  return 11 - ceil( double (abs(ieta) /4.) );
232  else
233  return ceil( double (abs(ieta) /4.) ) + 10;
234  }
235 
236  // in HF
237  if (ieta<0)
238  return 4 - ceil( double (abs(ieta)-29) /4. );
239  else
240  return ceil( double (abs(ieta)-29) /4. ) + 17;
241 
242 }
static const int kHFBegin
Definition: CaloTools.h:40
static const int kHFEnd
Definition: CaloTools.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
l1t::Tau l1t::CaloTools::tauP4Demux ( l1t::Tau tau)
static

Definition at line 322 of file CaloTools.cc.

References l1t::Tau::hasEM(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwIso(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), l1t::Tau::isMerged(), l1t::Tau::isoEt(), l1t::Tau::nTT(), p4Demux(), l1t::Tau::rawEt(), l1t::Tau::setTowerIPhi(), l1t::Tau::towerIEta(), and l1t::Tau::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

322  {
323 
324  l1t::Tau tmpTau ( p4Demux(&tau),
325  tau.hwPt(),
326  tau.hwEta(),
327  tau.hwPhi(),
328  tau.hwQual(),
329  tau.hwIso());
330  tmpTau.setTowerIPhi(tau.towerIPhi());
331  tmpTau.setTowerIEta(tau.towerIEta());
332  tmpTau.setRawEt(tau.rawEt());
333  tmpTau.setIsoEt(tau.isoEt());
334  tmpTau.setNTT(tau.nTT());
335  tmpTau.setHasEM(tau.hasEM());
336  tmpTau.setIsMerged(tau.isMerged());
337 
338  return tmpTau;
339 
340 }
bool hasEM() const
Definition: Tau.h:21
int hwPhi() const
Definition: L1Candidate.h:50
int hwIso() const
Definition: L1Candidate.h:52
bool isMerged() const
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
short int towerIEta() const
short int rawEt() const
int hwPt() const
Definition: L1Candidate.h:48
static math::PtEtaPhiMLorentzVector p4Demux(l1t::L1Candidate *)
Definition: CaloTools.cc:290
short int isoEt() const
short int towerIPhi() const
short int nTT() const
void setTowerIPhi(short int iphi)
l1t::Tau l1t::CaloTools::tauP4MP ( l1t::Tau tau)
static

Definition at line 411 of file CaloTools.cc.

References l1t::Tau::hasEM(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwIso(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), l1t::Tau::isMerged(), l1t::Tau::isoEt(), l1t::Tau::nTT(), p4MP(), l1t::Tau::rawEt(), l1t::Tau::setTowerIPhi(), l1t::Tau::towerIEta(), and l1t::Tau::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

411  {
412 
413  l1t::Tau tmpTau ( p4MP(&tau),
414  tau.hwPt(),
415  tau.hwEta(),
416  tau.hwPhi(),
417  tau.hwQual(),
418  tau.hwIso());
419  tmpTau.setTowerIPhi(tau.towerIPhi());
420  tmpTau.setTowerIEta(tau.towerIEta());
421  tmpTau.setRawEt(tau.rawEt());
422  tmpTau.setIsoEt(tau.isoEt());
423  tmpTau.setNTT(tau.nTT());
424  tmpTau.setHasEM(tau.hasEM());
425  tmpTau.setIsMerged(tau.isMerged());
426 
427  return tmpTau;
428 }
bool hasEM() const
Definition: Tau.h:21
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:380
int hwPhi() const
Definition: L1Candidate.h:50
int hwIso() const
Definition: L1Candidate.h:52
bool isMerged() const
int hwEta() const
Definition: L1Candidate.h:49
int hwQual() const
Definition: L1Candidate.h:51
short int towerIEta() const
short int rawEt() const
int hwPt() const
Definition: L1Candidate.h:48
short int isoEt() const
short int towerIPhi() const
short int nTT() const
void setTowerIPhi(short int iphi)
float l1t::CaloTools::towerEta ( int  ieta)
static

Definition at line 171 of file CaloTools.cc.

References PVValHelper::eta, Validation_hcalonly_cfi::sign, and towerEtaBounds().

Referenced by gtEta(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), p4MP(), and l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent().

172 {
173  std::pair<float,float> bounds = towerEtaBounds(ieta);
174  float eta = (bounds.second+bounds.first)/2.;
175  float sign = ieta>0 ? 1. : -1.;
176  return sign*eta;
177 }
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:161
std::pair< float, float > l1t::CaloTools::towerEtaBounds ( int  ieta)
staticprivate

Definition at line 161 of file CaloTools.cc.

References funct::abs(), and kHFEnd.

Referenced by towerEta(), and towerEtaSize().

162 {
163  if(ieta==0) ieta = 1;
164  if(ieta>kHFEnd) ieta = kHFEnd;
165  if(ieta<(-1*kHFEnd)) ieta = -1*kHFEnd;
166  //const float towerEtas[33] = {0,0.087,0.174,0.261,0.348,0.435,0.522,0.609,0.696,0.783,0.870,0.957,1.044,1.131,1.218,1.305,1.392,1.479,1.566,1.653,1.740,1.830,1.930,2.043,2.172,2.322,2.5,2.650,3.000,3.5,4.0,4.5,5.0};
167  const float towerEtas[42] = {0,0.087,0.174,0.261,0.348,0.435,0.522,0.609,0.696,0.783,0.870,0.957,1.044,1.131,1.218,1.305,1.392,1.479,1.566,1.653,1.740,1.830,1.930,2.043,2.172,2.322,2.5,2.650,2.853,3.139,3.314,3.489,3.664,3.839,4.013,4.191,4.363,4.538,4.716,4.889,5.191,5.191};
168  return std::make_pair( towerEtas[abs(ieta)-1],towerEtas[abs(ieta)] );
169 }
static const int kHFEnd
Definition: CaloTools.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float l1t::CaloTools::towerEtaSize ( int  ieta)
static

Definition at line 186 of file CaloTools.cc.

References findQualityFiles::size, and towerEtaBounds().

Referenced by l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), and l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent().

187 {
188  std::pair<float,float> bounds = towerEtaBounds(ieta);
189  float size = (bounds.second-bounds.first);
190  return size;
191 }
size
Write out results.
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:161
float l1t::CaloTools::towerPhi ( int  ieta,
int  iphi 
)
static

Definition at line 179 of file CaloTools.cc.

References objects.autophobj::float, M_PI, and towerPhiSize().

Referenced by gtPhi(), l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), p4MP(), and l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent().

180 {
181  float phi = (float(iphi)-0.5)*towerPhiSize(ieta);
182  if (phi > M_PI) phi = phi - (2*M_PI);
183  return phi;
184 }
#define M_PI
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:193
float l1t::CaloTools::towerPhiSize ( int  ieta)
static

Definition at line 193 of file CaloTools.cc.

References kNPhi, and M_PI.

Referenced by l1t::Stage2Layer2TauAlgorithmFirmwareImp1::merging(), l1t::Stage2Layer2EGammaAlgorithmFirmwareImp1::processEvent(), and towerPhi().

194 {
195  return 2.*M_PI/kNPhi;
196 }
static const int kNPhi
Definition: CaloTools.h:45
#define M_PI

Member Data Documentation

const int64_t l1t::CaloTools::cos_coeff = {1023, 1019, 1007, 988, 961, 927, 886, 838, 784, 723, 658, 587, 512, 432, 350, 265, 178, 89, 0, -89, -178, -265, -350, -432, -512, -587, -658, -723, -784, -838, -886, -927, -961, -988, -1007, -1019, -1023, -1019, -1007, -988, -961, -927, -886, -838, -784, -723, -658, -587, -512, -432, -350, -265, -178, -89, 0, 89, 178, 265, 350, 432, 511, 587, 658, 723, 784, 838, 886, 927, 961, 988, 1007, 1019}
static
const int l1t::CaloTools::emul_to_data_sum_index_map
static
Initial value:
= {
9, 1, 19, 8, 0, 18, 10, 4, 6, 14,
28, 24, 13, 27, 23, 15, 5, 7, 22, 12,
3, 21, 11, 2, 20, 17, 30, 26, 16, 29,
25
}

Definition at line 124 of file CaloTools.h.

Referenced by L1TStage2CaloLayer2Comp::compareSums().

const float l1t::CaloTools::kGTEtaLSB = 0.0435
staticprivate

Definition at line 133 of file CaloTools.h.

Referenced by gtEta(), and p4Demux().

const float l1t::CaloTools::kGTEtLSB = 0.5
staticprivate

Definition at line 135 of file CaloTools.h.

Referenced by p4Demux().

const float l1t::CaloTools::kGTPhiLSB = 0.0435
staticprivate

Definition at line 134 of file CaloTools.h.

Referenced by gtPhi(), and p4Demux().

const int l1t::CaloTools::kHBHEEnd =28
static

Definition at line 39 of file CaloTools.h.

Referenced by caloTowerHash().

const int l1t::CaloTools::kHBHENrPhi =72
static
const int l1t::CaloTools::kHFBegin =29
static
const int l1t::CaloTools::kHFEnd =41
static
const int l1t::CaloTools::kHFNrPhi =72/kHFPhiSeg
static

Definition at line 43 of file CaloTools.h.

Referenced by caloTowerHash().

const int l1t::CaloTools::kHFPhiSeg =1
static

Definition at line 42 of file CaloTools.h.

Referenced by caloTowerHash().

const int l1t::CaloTools::kNPhi =72
static

Definition at line 45 of file CaloTools.h.

Referenced by isValidIEtaIPhi(), and towerPhiSize().

const int l1t::CaloTools::kNrHBHETowers = kHBHEEnd*kHBHENrPhi*2
static

Definition at line 47 of file CaloTools.h.

Referenced by caloTowerHash().

const int l1t::CaloTools::kNrTowers = ((kHFEnd-kHFBegin+1)*kHFNrPhi + kHBHEEnd*kHBHENrPhi )*2
static

Definition at line 46 of file CaloTools.h.

Referenced by caloTowerHash(), and caloTowerHashMax().

const int l1t::CaloTools::kSatEcal = 510
static
const int l1t::CaloTools::kSatHcal = 509
static
const int l1t::CaloTools::kSatJet = 65535
static
const int l1t::CaloTools::kSatTower = 511
static
const l1t::CaloCluster l1t::CaloTools::nullCluster_
staticprivate

Definition at line 131 of file CaloTools.h.

Referenced by getCluster().

const l1t::CaloTower l1t::CaloTools::nullTower_
staticprivate

Definition at line 130 of file CaloTools.h.

Referenced by getTower().

const int64_t l1t::CaloTools::sin_coeff = {0, 89, 178, 265, 350, 432, 512, 587, 658, 723, 784, 838, 886, 927, 961, 988, 1007, 1019, 1023, 1019, 1007, 988, 961, 927, 886, 838, 784, 723, 658, 587, 512, 432, 350, 265, 178, 89, 0, -89, -178, -265, -350, -432, -512, -587, -658, -723, -784, -838, -886, -927, -961, -988, -1007, -1019, -1023, -1019, -1007, -988, -961, -927, -886, -838, -784, -723, -658, -587, -512, -432, -350, -265, -178, -89}
static