CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Stage2Layer2JetSumAlgorithmFirmwareImp1.cc
Go to the documentation of this file.
1 
10 
12  params_(params)
13 {
16 
19 
22 }
23 
24 
26 
27 
28 }
29 
30 
31 void l1t::Stage2Layer2JetSumAlgorithmFirmwareImp1::processEvent(const std::vector<l1t::Jet> & alljets, std::vector<l1t::EtSum> & htsums)
32 {
33 
34  int etaMax=40, etaMin=1, phiMax=72, phiMin=1;
35 
36  // etaSide=1 is positive eta, etaSide=-1 is negative eta
37  for (int etaSide=1; etaSide>=-1; etaSide-=2) {
38 
39  int32_t hx(0), hy(0), ht(0);
40 
41  std::vector<int> rings;
42  for (int i=etaMin; i<=etaMax; i++) rings.push_back(i*etaSide);
43 
44  // loop over rings
45  for (unsigned etaIt=0; etaIt<rings.size(); etaIt++) {
46 
47  int ieta = rings.at(etaIt);
48 
49  int32_t ringHx(0), ringHy(0), ringHt(0);
50 
51  // loop over phi
52  for (int iphi=phiMin; iphi<=phiMax; iphi++) {
53 
54  // find the jet at this (eta,phi)
55  l1t::Jet thisJet;
56  bool foundJet = false;
57  for (unsigned jetIt=0; jetIt<alljets.size(); jetIt++) {
58  if (alljets.at(jetIt).hwEta()==ieta && alljets.at(jetIt).hwPhi()==iphi) {
59  thisJet = alljets.at(jetIt);
60  foundJet = true;
61  }
62  }
63  if (!foundJet) continue;
64 
65  if (thisJet.hwPt()>etSumEtThresholdHwMet_ && thisJet.hwEta()>=etSumEtaMinMet_ && thisJet.hwEta()<=etSumEtaMaxMet_) {
66  ringHx += (int32_t) ( thisJet.hwPt() * std::trunc ( 511. * cos ( 2 * M_PI * (72 - iphi) / 72.0 ) )) >> 10;
67  ringHy += (int32_t) ( thisJet.hwPt() * std::trunc ( 511. * sin ( 2 * M_PI * iphi / 72.0 ) )) >> 10;
68  }
69 
70  if (thisJet.hwPt()>etSumEtThresholdHwEt_ && thisJet.hwEta()>=etSumEtaMinEt_ && thisJet.hwEta()<=etSumEtaMaxEt_) {
71  ringHt += thisJet.hwPt();
72  }
73  }
74 
75  hx += (ringHx >> 5);
76  hy += (ringHy >> 5);
77  ht += (ringHt >> 5);
78 
79  }
80 
82 
83  l1t::EtSum htSumHt(p4,l1t::EtSum::EtSumType::kTotalHt,ht,0,0,0);
84  l1t::EtSum htSumHx(p4,l1t::EtSum::EtSumType::kTotalHtx,hx,0,0,0);
85  l1t::EtSum htSumHy(p4,l1t::EtSum::EtSumType::kTotalHty,hy,0,0,0);
86 
87  htsums.push_back(htSumHt);
88  htsums.push_back(htSumHx);
89  htsums.push_back(htSumHy);
90 
91  }
92 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double etSumEtThreshold(unsigned isum) const
int etSumEtaMax(unsigned isum) const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
Definition: Jet.h:13
int etSumEtaMin(unsigned isum) const
double p4[4]
Definition: TauolaWrapper.h:92
double jetLsb() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int hwEta() const
Definition: L1Candidate.cc:74
#define M_PI
int hwPt() const
Definition: L1Candidate.cc:69
virtual void processEvent(const std::vector< l1t::Jet > &alljets, std::vector< l1t::EtSum > &htsums)