CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 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 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 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 50 of file CaloTools.h.

50 {ECAL=0x1,HCAL=0x2,CALO=0x3}; //CALO is a short cut for ECAL|HCAL

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 239 of file CaloTools.cc.

References funct::abs().

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

240 {
241  int absIEta = abs(ieta);
242 
243  if (absIEta>0 && absIEta<=5) return 0;
244  else if (absIEta<=9) return 1;
245  else if (absIEta<=13) return 2;
246  else if (absIEta<=15) return 3;
247  else if (absIEta<=17) return 4;
248  else if (absIEta<=19) return 5;
249  else if (absIEta<=21) return 6;
250  else if (absIEta==22) return 7;
251  else if (absIEta==23) return 8;
252  else if (absIEta==24) return 9;
253  else if (absIEta==25) return 10;
254  else if (absIEta==26) return 11;
255  else if (absIEta<=28) return 12;
256  else if (absIEta<=32) return 13;
257  else if (absIEta<=36) return 14;
258  else if (absIEta<=41) return 15;
259  else return -1; // error
260 }
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 102 of file CaloTools.cc.

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

105 {
106 
107  return calHwEtSum(iEta,iPhi,towers,localEtaMin,localEtaMax,localPhiMin,localPhiMax,kHFEnd,etMode);
108 }
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:102
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 110 of file CaloTools.cc.

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

113 {
114  int hwEtSum=0;
115  for(int etaNr=localEtaMin;etaNr<=localEtaMax;etaNr++){
116  for(int phiNr=localPhiMin;phiNr<=localPhiMax;phiNr++){
117 
118  int towerIEta = l1t::CaloStage2Nav::offsetIEta(iEta,etaNr);
119  int towerIPhi = l1t::CaloStage2Nav::offsetIPhi(iPhi,phiNr);
120  if(abs(towerIEta)<=iEtaAbsMax){
121  const l1t::CaloTower& tower = getTower(towers,CaloTools::caloEta(towerIEta),towerIPhi);
122  if(etMode==ECAL) hwEtSum+=tower.hwEtEm();
123  else if(etMode==HCAL) hwEtSum+=tower.hwEtHad();
124  else if(etMode==CALO) hwEtSum+=tower.hwPt();
125  }
126  }
127  }
128  return hwEtSum;
129 }
static int offsetIEta(int iEta, int offset)
Definition: CaloStage2Nav.h:43
int hwEtEm() const
Definition: CaloTower.cc:64
static int offsetIPhi(int iPhi, int offset)
Definition: CaloStage2Nav.h:32
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int hwPt() const
Definition: L1Candidate.h:48
static int caloEta(int ietaMP)
Definition: CaloTools.cc:203
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:30
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 132 of file CaloTools.cc.

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

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

133 {
134  size_t nrTowers=0;
135  l1t::CaloStage2Nav nav(iEtaMin,iPhiMin);
136  while(nav.currIEta()<=iEtaMax){
137  bool finishPhi = false;
138  while(!finishPhi){
139  const l1t::CaloTower& tower = l1t::CaloTools::getTower(towers,CaloTools::caloEta(nav.currIEta()),nav.currIPhi());
140  int towerHwEt =0;
141  if(etMode==ECAL) towerHwEt+=tower.hwEtEm();
142  else if(etMode==HCAL) towerHwEt+=tower.hwEtHad();
143  else if(etMode==CALO) towerHwEt+=tower.hwPt();
144  if(towerHwEt>=minHwEt && towerHwEt<=maxHwEt) nrTowers++;
145  finishPhi = (nav.currIPhi() == iPhiMax);
146  nav.north();
147  }
148  nav.east();
149  nav.resetIPhi();
150  }
151  return nrTowers;
152 }
int hwEtEm() const
Definition: CaloTower.cc:64
int hwPt() const
Definition: L1Candidate.h:48
static int caloEta(int ietaMP)
Definition: CaloTools.cc:203
static const l1t::CaloTower & getTower(const std::vector< l1t::CaloTower > &towers, int iEta, int iPhi)
Definition: CaloTools.cc:30
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 66 of file CaloTools.cc.

References funct::abs().

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

67 {
68 
69  if(!isValidIEtaIPhi(iEta,iPhi)) return caloTowerHashMax();
70  else{
71  const int absIEta = abs(iEta);
72  if(absIEta>kHFEnd) return kNrTowers;
73  else if(absIEta<=kHBHEEnd){ //HBHE
74  int iEtaNoZero=iEta;
75  if(iEta>0) iEtaNoZero--;
76  return (iEtaNoZero+kHBHEEnd)*kHBHENrPhi+iPhi-1;
77  }else{ //HF
78  int iEtaIndex = iEta+kHFEnd; //iEta=-32 is 0
79  if(iEta>0) iEtaIndex= iEta-kHBHEEnd+(kHFEnd-kHBHEEnd)-1; //but iEta=29 is 4
80  return iEtaIndex*kHFNrPhi+iPhi/kHFPhiSeg + kNrHBHETowers;
81  }
82  }
83 }
static const int kHFPhiSeg
Definition: CaloTools.h:42
static bool isValidIEtaIPhi(int iEta, int iPhi)
Definition: CaloTools.cc:92
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:86
size_t l1t::CaloTools::caloTowerHashMax ( )
static

Definition at line 86 of file CaloTools.cc.

Referenced by L1TStage2Layer2Producer::produce().

87 {
88  return kNrTowers;
89 }
static const int kNrTowers
Definition: CaloTools.h:46
l1t::EGamma l1t::CaloTools::egP4Demux ( l1t::EGamma eg)
static

Definition at line 293 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(), l1t::EGamma::rawEt(), l1t::EGamma::setTowerIPhi(), l1t::EGamma::shape(), l1t::EGamma::towerHoE(), l1t::EGamma::towerIEta(), and l1t::EGamma::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

293  {
294 
295  l1t::EGamma tmpEG( p4Demux(&eg),
296  eg.hwPt(),
297  eg.hwEta(),
298  eg.hwPhi(),
299  eg.hwQual(),
300  eg.hwIso() );
301  tmpEG.setTowerIPhi(eg.towerIPhi());
302  tmpEG.setTowerIEta(eg.towerIEta());
303  tmpEG.setRawEt(eg.rawEt());
304  tmpEG.setIsoEt(eg.isoEt());
305  tmpEG.setFootprintEt(eg.footprintEt());
306  tmpEG.setNTT(eg.nTT());
307  tmpEG.setShape(eg.shape());
308  tmpEG.setTowerHoE(eg.towerHoE());
309 
310  return tmpEG;
311 
312 }
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:283
short int nTT() const
Definition: EGamma.cc:95
l1t::EGamma l1t::CaloTools::egP4MP ( l1t::EGamma eg)
static

Definition at line 382 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(), l1t::EGamma::rawEt(), l1t::EGamma::setTowerIPhi(), l1t::EGamma::shape(), l1t::EGamma::towerIEta(), and l1t::EGamma::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

382  {
383 
384  l1t::EGamma tmpEG( p4MP(&eg),
385  eg.hwPt(),
386  eg.hwEta(),
387  eg.hwPhi(),
388  eg.hwQual(),
389  eg.hwIso() );
390  tmpEG.setTowerIPhi(eg.towerIPhi());
391  tmpEG.setTowerIEta(eg.towerIEta());
392  tmpEG.setRawEt(eg.rawEt());
393  tmpEG.setIsoEt(eg.isoEt());
394  tmpEG.setFootprintEt(eg.footprintEt());
395  tmpEG.setNTT(eg.nTT());
396  tmpEG.setShape(eg.shape());
397 
398  return tmpEG;
399 
400 }
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:373
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 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 359 of file CaloTools.cc.

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

Referenced by L1TStage2Layer2Producer::produce().

359  {
360 
361  return l1t::EtSum( p4Demux(&etsum),
362  etsum.getType(),
363  etsum.hwPt(),
364  etsum.hwEta(),
365  etsum.hwPhi(),
366  etsum.hwQual() );
367 
368 }
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:283
EtSumType getType() const
Definition: EtSum.cc:37
l1t::EtSum l1t::CaloTools::etSumP4MP ( l1t::EtSum etsum)
static

Definition at line 444 of file CaloTools.cc.

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

Referenced by L1TStage2Layer2Producer::produce().

444  {
445 
446  return l1t::EtSum( p4MP(&etsum),
447  etsum.getType(),
448  etsum.hwPt(),
449  etsum.hwEta(),
450  etsum.hwPhi(),
451  etsum.hwQual() );
452 
453 }
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:373
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 53 of file CaloTools.cc.

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

54 {
55  for(size_t clusterNr=0;clusterNr<clusters.size();clusterNr++){
56  if(clusters[clusterNr].hwEta()==iEta && clusters[clusterNr].hwPhi()==iPhi) return clusters[clusterNr];
57  }
58  return nullCluster_;
59 }
static const l1t::CaloCluster nullCluster_
Definition: CaloTools.h:114
const l1t::CaloTower & l1t::CaloTools::getTower ( const std::vector< l1t::CaloTower > &  towers,
int  iEta,
int  iPhi 
)
static

Definition at line 30 of file CaloTools.cc.

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

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

31 {
32  if(abs(iEta) > CaloTools::kHFEnd) return nullTower_;
33 
34  size_t towerIndex = CaloTools::caloTowerHash(iEta, iPhi);
35  if(towerIndex<towers.size()){
36  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
37  //std::cout <<"error, tower "<<towers[towerIndex].hwEta()<<" "<<towers[towerIndex].hwPhi()<<" does not match "<<iEta<<" "<<iPhi<<" index "<<towerIndex<<" nr towrs "<<towers.size()<<std::endl;
38  for(size_t towerNr=0;towerNr<towers.size();towerNr++){
39  if(towers[towerNr].hwEta()==iEta && towers[towerNr].hwPhi()==iPhi) return towers[towerNr];
40  }
41  }else return towers[towerIndex];
42 
43  }
44  else{// in case the vector of towers do not contain all the towers (towerIndex can be > towers.size())
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  }
49 
50  return nullTower_;
51 }
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:66
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:113
int l1t::CaloTools::gtEta ( int  ieta)
static

Definition at line 263 of file CaloTools.cc.

References eta.

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

263  {
264 
265  double eta = towerEta(ieta);
266  return round ( eta / kGTEtaLSB );
267 
268 }
static float towerEta(int ieta)
Definition: CaloTools.cc:164
static const float kGTEtaLSB
Definition: CaloTools.h:116
int l1t::CaloTools::gtPhi ( int  ieta,
int  iphi 
)
static

Definition at line 270 of file CaloTools.cc.

References M_PI, and phi().

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

270  {
271 
272  double phi = towerPhi(ieta, iphi);
273  if (phi<0) phi = phi + 2*M_PI;
274  return round ( phi / kGTPhiLSB );
275 
276 }
static const float kGTPhiLSB
Definition: CaloTools.h:117
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:172
#define M_PI
bool l1t::CaloTools::insertTower ( std::vector< l1t::CaloTower > &  towers,
const l1t::CaloTower tower 
)
static

Definition at line 19 of file CaloTools.cc.

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

19  {
20  size_t towerIndex = CaloTools::caloTowerHash(tower.hwEta(), tower.hwPhi());
21  if (towers.size() > towerIndex) {
22  towers.at(towerIndex) = tower;
23  return true;
24  }
25  else return false;
26 }
int hwPhi() const
Definition: L1Candidate.h:50
static size_t caloTowerHash(int iEta, int iPhi)
Definition: CaloTools.cc:66
int hwEta() const
Definition: L1Candidate.h:49
bool l1t::CaloTools::isValidIEtaIPhi ( int  iEta,
int  iPhi 
)
static

Definition at line 92 of file CaloTools.cc.

References funct::abs().

93 {
94  size_t absIEta = abs(iEta);
95  if(iPhi<=0 || iPhi>kNPhi) return false;
96  if(absIEta==0 || absIEta>kHFEnd) return false;
97  //if(absIEta>kHBHEEnd && iPhi%kHFPhiSeg!=1) return false;
98  return true;
99 
100 }
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 336 of file CaloTools.cc.

References l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), 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().

336  {
337 
338 
339  l1t::Jet tmpJet ( p4Demux(&jet),
340  jet.hwPt(),
341  jet.hwEta(),
342  jet.hwPhi(),
343  jet.hwQual() );
344  tmpJet.setTowerIPhi(jet.towerIPhi());
345  tmpJet.setTowerIEta(jet.towerIEta());
346  tmpJet.setRawEt(jet.rawEt());
347  tmpJet.setSeedEt(jet.seedEt());
348  tmpJet.setPUEt(jet.puEt());
349  tmpJet.setPUDonutEt(0,jet.puDonutEt(0));
350  tmpJet.setPUDonutEt(1,jet.puDonutEt(1));
351  tmpJet.setPUDonutEt(2,jet.puDonutEt(2));
352  tmpJet.setPUDonutEt(3,jet.puDonutEt(3));
353 
354  return tmpJet;
355 
356 }
short int rawEt() const
int hwPhi() const
Definition: L1Candidate.h:50
short int seedEt() const
short int towerIEta() const
Definition: Jet.h:16
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:283
l1t::Jet l1t::CaloTools::jetP4MP ( l1t::Jet jet)
static

Definition at line 423 of file CaloTools.cc.

References l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), 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().

423  {
424 
425  l1t::Jet tmpJet ( p4MP(&jet),
426  jet.hwPt(),
427  jet.hwEta(),
428  jet.hwPhi(),
429  jet.hwQual() );
430  tmpJet.setTowerIPhi(jet.towerIPhi());
431  tmpJet.setTowerIEta(jet.towerIEta());
432  tmpJet.setRawEt(jet.rawEt());
433  tmpJet.setSeedEt(jet.seedEt());
434  tmpJet.setPUEt(jet.puEt());
435  tmpJet.setPUDonutEt(0,jet.puDonutEt(0));
436  tmpJet.setPUDonutEt(1,jet.puDonutEt(1));
437  tmpJet.setPUDonutEt(2,jet.puDonutEt(2));
438  tmpJet.setPUDonutEt(3,jet.puDonutEt(3));
439 
440  return tmpJet;
441 
442 }
short int rawEt() const
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:373
int hwPhi() const
Definition: L1Candidate.h:50
short int seedEt() const
short int towerIEta() const
Definition: Jet.h:16
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 283 of file CaloTools.cc.

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

Referenced by l1t::stage2::EtSumUnpacker::unpack(), l1t::stage2::TauUnpacker::unpack(), l1t::stage2::JetUnpacker::unpack(), and l1t::stage2::EGammaUnpacker::unpack().

283  {
284 
285  return math::PtEtaPhiMLorentzVector( cand->hwPt() * kGTEtLSB + 1.E-6,
286  cand->hwEta() * kGTEtaLSB,
287  cand->hwPhi() * kGTPhiLSB,
288  0. ) ;
289 
290 }
static const float kGTPhiLSB
Definition: CaloTools.h:117
static const float kGTEtaLSB
Definition: CaloTools.h:116
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:118
math::PtEtaPhiMLorentzVector l1t::CaloTools::p4MP ( l1t::L1Candidate cand)
static

Definition at line 373 of file CaloTools.cc.

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

Referenced by l1t::stage2::MPUnpacker::unpack(), l1t::stage2::MPUnpacker_0x10010033::unpack(), l1t::stage2::MPUnpacker_0x10010010::unpack(), and l1t::stage2::MPUnpacker_0x1001000b::unpack().

373  {
374 
375  return math::PtEtaPhiMLorentzVector( cand->hwPt() * 0.5 + 1.E-6,
376  towerEta(cand->hwEta()),
377  towerPhi(cand->hwEta(), cand->hwPhi()),
378  0. ) ;
379 
380 }
static float towerEta(int ieta)
Definition: CaloTools.cc:164
static float towerPhi(int ieta, int iphi)
Definition: CaloTools.cc:172
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 213 of file CaloTools.cc.

References funct::abs().

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

214 {
215 
216  // outside HF
217  if (abs(ieta) > kHFEnd)
218  return (ieta<0 ? 0 : 21);
219 
220  // inside HBHE
221  if (abs(ieta) <= kHFBegin)
222  {
223  if (ieta<0)
224  return 11 - ceil( double (abs(ieta) /4.) );
225  else
226  return ceil( double (abs(ieta) /4.) ) + 10;
227  }
228 
229  // in HF
230  if (ieta<0)
231  return 4 - ceil( double (abs(ieta)-29) /4. );
232  else
233  return ceil( double (abs(ieta)-29) /4. ) + 17;
234 
235 }
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 315 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(), l1t::Tau::rawEt(), l1t::Tau::setTowerIPhi(), l1t::Tau::towerIEta(), and l1t::Tau::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

315  {
316 
317  l1t::Tau tmpTau ( p4Demux(&tau),
318  tau.hwPt(),
319  tau.hwEta(),
320  tau.hwPhi(),
321  tau.hwQual(),
322  tau.hwIso());
323  tmpTau.setTowerIPhi(tau.towerIPhi());
324  tmpTau.setTowerIEta(tau.towerIEta());
325  tmpTau.setRawEt(tau.rawEt());
326  tmpTau.setIsoEt(tau.isoEt());
327  tmpTau.setNTT(tau.nTT());
328  tmpTau.setHasEM(tau.hasEM());
329  tmpTau.setIsMerged(tau.isMerged());
330 
331  return tmpTau;
332 
333 }
bool hasEM() const
Definition: Tau.h:16
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:283
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 403 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(), l1t::Tau::rawEt(), l1t::Tau::setTowerIPhi(), l1t::Tau::towerIEta(), and l1t::Tau::towerIPhi().

Referenced by L1TStage2Layer2Producer::produce().

403  {
404 
405  l1t::Tau tmpTau ( p4MP(&tau),
406  tau.hwPt(),
407  tau.hwEta(),
408  tau.hwPhi(),
409  tau.hwQual(),
410  tau.hwIso());
411  tmpTau.setTowerIPhi(tau.towerIPhi());
412  tmpTau.setTowerIEta(tau.towerIEta());
413  tmpTau.setRawEt(tau.rawEt());
414  tmpTau.setIsoEt(tau.isoEt());
415  tmpTau.setNTT(tau.nTT());
416  tmpTau.setHasEM(tau.hasEM());
417  tmpTau.setIsMerged(tau.isMerged());
418 
419  return tmpTau;
420 }
bool hasEM() const
Definition: Tau.h:16
static math::PtEtaPhiMLorentzVector p4MP(l1t::L1Candidate *)
Definition: CaloTools.cc:373
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 164 of file CaloTools.cc.

References eta, and jetcorrextractor::sign().

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

165 {
166  std::pair<float,float> bounds = towerEtaBounds(ieta);
167  float eta = (bounds.second+bounds.first)/2.;
168  float sign = ieta>0 ? 1. : -1.;
169  return sign*eta;
170 }
double sign(double x)
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:154
std::pair< float, float > l1t::CaloTools::towerEtaBounds ( int  ieta)
staticprivate

Definition at line 154 of file CaloTools.cc.

References funct::abs().

155 {
156  if(ieta==0) ieta = 1;
157  if(ieta>kHFEnd) ieta = kHFEnd;
158  if(ieta<(-1*kHFEnd)) ieta = -1*kHFEnd;
159  //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};
160  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};
161  return std::make_pair( towerEtas[abs(ieta)-1],towerEtas[abs(ieta)] );
162 }
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 179 of file CaloTools.cc.

References findQualityFiles::size.

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

180 {
181  std::pair<float,float> bounds = towerEtaBounds(ieta);
182  float size = (bounds.second-bounds.first);
183  return size;
184 }
static std::pair< float, float > towerEtaBounds(int ieta)
Definition: CaloTools.cc:154
tuple size
Write out results.
float l1t::CaloTools::towerPhi ( int  ieta,
int  iphi 
)
static

Definition at line 172 of file CaloTools.cc.

References M_PI, and phi().

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

173 {
174  float phi = (float(iphi)-0.5)*towerPhiSize(ieta);
175  if (phi > M_PI) phi = phi - (2*M_PI);
176  return phi;
177 }
#define M_PI
static float towerPhiSize(int ieta)
Definition: CaloTools.cc:186
float l1t::CaloTools::towerPhiSize ( int  ieta)
static

Definition at line 186 of file CaloTools.cc.

References M_PI.

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

187 {
188  return 2.*M_PI/kNPhi;
189 }
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 float l1t::CaloTools::kGTEtaLSB = 0.0435
staticprivate

Definition at line 116 of file CaloTools.h.

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

Definition at line 118 of file CaloTools.h.

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

Definition at line 117 of file CaloTools.h.

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

Definition at line 39 of file CaloTools.h.

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.

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

Definition at line 42 of file CaloTools.h.

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

Definition at line 45 of file CaloTools.h.

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

Definition at line 47 of file CaloTools.h.

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

Definition at line 46 of file CaloTools.h.

const l1t::CaloCluster l1t::CaloTools::nullCluster_
staticprivate

Definition at line 114 of file CaloTools.h.

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

Definition at line 113 of file CaloTools.h.

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