CMS 3D CMS Logo

Stage1Layer2FlowAlgorithm.cc
Go to the documentation of this file.
1 
13 
15  //now do what ever initialization is needed
16  //Converting phi to be as it is define at GCT (-pi to pi instead of 0 to 2*pi)
17  for(unsigned int i = 0; i < L1CaloRegionDetId::N_PHI; i++) {
18  if(i < 10){
19  sinPhi.push_back(sin(2. * 3.1415927 * i * 1.0 / L1CaloRegionDetId::N_PHI));
20  cosPhi.push_back(cos(2. * 3.1415927 * i * 1.0 / L1CaloRegionDetId::N_PHI));
21  }
22  else {
23  sinPhi.push_back(sin(-3.1415927 + 2. * 3.1415927 * (i-9) * 1.0 / L1CaloRegionDetId::N_PHI));
24  cosPhi.push_back(cos(-3.1415927 + 2. * 3.1415927 * (i-9) * 1.0 / L1CaloRegionDetId::N_PHI));
25  }
26  }
27 }
28 
29 
30 void l1t::Stage1Layer2FlowAlgorithm::processEvent(const std::vector<l1t::CaloRegion> & regions,
31  const std::vector<l1t::CaloEmCand> & EMCands,
32  const std::vector<l1t::Tau> * taus,
33  l1t::CaloSpare * spare) {
34  double q2x = 0;
35  double q2y = 0;
36  double regionET=0.;
37 
38  for(std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
39 
40  int ieta=region->hwEta();
41  if (ieta > 3 && ieta < 18) {
42  continue;
43  }
44 
45  int iphi=region->hwPhi();
46  regionET=region->hwPt();
47 
48  q2x+= regionET * cosPhi[iphi];
49  q2y+= regionET * sinPhi[iphi];
50  }
51  int HFq2 = q2x*q2x+q2y*q2y;
52  //double psi2 = 0.5 * atan(q2y/q2x);
53 
54  // ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > dummy(0,0,0,0);
55 
56  // l1t::CaloSpare V2 (*&dummy,CaloSpare::CaloSpareType::V2,(int)HFq2,0,0,0);
57 
58  // spares->push_back(V2);
59  spare->SetRing(1, HFq2&0x7);
60 }
Stage1Layer2FlowAlgorithm(CaloParamsHelper const *params)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void SetRing(unsigned index, int value)
Definition: CaloSpare.cc:42
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void processEvent(const std::vector< l1t::CaloRegion > &regions, const std::vector< l1t::CaloEmCand > &EMCands, const std::vector< l1t::Tau > *taus, l1t::CaloSpare *spare) override
static const unsigned N_PHI