File indexing completed on 2024-04-06 12:20:23
0001
0002
0003
0004
0005
0006
0007
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
0016
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
0050
0051
0052
0053
0054
0055
0056 spare->SetRing(1, HFq2 & 0x7);
0057 }