Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:23

0001 ///
0002 /// \class l1t::Stage1Layer2FlowAlgorithm
0003 ///
0004 /// \authors: Maxime Guilbaud
0005 ///           R. Alex Barbieri
0006 ///
0007 /// Description: Flow Algorithm HI
0008 
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFRingSumAlgorithmImp.h"
0011 #include "L1Trigger/L1TCalorimeter/interface/PUSubtractionMethods.h"
0012 #include "L1Trigger/L1TCalorimeter/interface/legacyGtHelper.h"
0013 
0014 l1t::Stage1Layer2FlowAlgorithm::Stage1Layer2FlowAlgorithm(CaloParamsHelper const* params) {
0015   //now do what ever initialization is needed
0016   //Converting phi to be as it is define at GCT (-pi to pi instead of 0 to 2*pi)
0017   for (unsigned int i = 0; i < L1CaloRegionDetId::N_PHI; i++) {
0018     if (i < 10) {
0019       sinPhi.push_back(sin(2. * 3.1415927 * i * 1.0 / L1CaloRegionDetId::N_PHI));
0020       cosPhi.push_back(cos(2. * 3.1415927 * i * 1.0 / L1CaloRegionDetId::N_PHI));
0021     } else {
0022       sinPhi.push_back(sin(-3.1415927 + 2. * 3.1415927 * (i - 9) * 1.0 / L1CaloRegionDetId::N_PHI));
0023       cosPhi.push_back(cos(-3.1415927 + 2. * 3.1415927 * (i - 9) * 1.0 / L1CaloRegionDetId::N_PHI));
0024     }
0025   }
0026 }
0027 
0028 void l1t::Stage1Layer2FlowAlgorithm::processEvent(const std::vector<l1t::CaloRegion>& regions,
0029                                                   const std::vector<l1t::CaloEmCand>& EMCands,
0030                                                   const std::vector<l1t::Tau>* taus,
0031                                                   l1t::CaloSpare* spare) {
0032   double q2x = 0;
0033   double q2y = 0;
0034   double regionET = 0.;
0035 
0036   for (std::vector<CaloRegion>::const_iterator region = regions.begin(); region != regions.end(); region++) {
0037     int ieta = region->hwEta();
0038     if (ieta > 3 && ieta < 18) {
0039       continue;
0040     }
0041 
0042     int iphi = region->hwPhi();
0043     regionET = region->hwPt();
0044 
0045     q2x += regionET * cosPhi[iphi];
0046     q2y += regionET * sinPhi[iphi];
0047   }
0048   int HFq2 = q2x * q2x + q2y * q2y;
0049   //double psi2 = 0.5 * atan(q2y/q2x);
0050 
0051   // ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > dummy(0,0,0,0);
0052 
0053   // l1t::CaloSpare V2 (*&dummy,CaloSpare::CaloSpareType::V2,(int)HFq2,0,0,0);
0054 
0055   // spares->push_back(V2);
0056   spare->SetRing(1, HFq2 & 0x7);
0057 }