Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:43

0001 ///
0002 /// \class l1t::Stage1Layer2MainProcessorFirmwareImp1
0003 ///
0004 ///
0005 /// \author: R. Alex Barbieri MIT
0006 ///
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2MainProcessorFirmware.h"
0009 
0010 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2EGammaAlgorithmImp.h"
0011 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2EtSumAlgorithmImp.h"
0012 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2JetAlgorithmImp.h"
0013 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2TauAlgorithmImp.h"
0014 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFRingSumAlgorithmImp.h"
0015 #include "L1Trigger/L1TCalorimeter/interface/Stage1Layer2HFBitCountAlgorithmImp.h"
0016 
0017 using namespace std;
0018 using namespace l1t;
0019 
0020 // Stage1Layer2MainProcessorFirmwareImp1::Stage1Layer2MainProcessorFirmwareImp1(/*const CaloParamsHelper & dbPars*/
0021 Stage1Layer2MainProcessorFirmwareImp1::Stage1Layer2MainProcessorFirmwareImp1(const int fwv,
0022                                                                              CaloParamsHelper const* dbPars)
0023     : m_fwv(fwv) {
0024   if (m_fwv == 1) {  //HI algo
0025     m_egAlgo = std::make_unique<Stage1Layer2EGammaAlgorithmImpHI>(dbPars);
0026     m_sumAlgo = std::make_unique<Stage1Layer2EtSumAlgorithmImpHI>(dbPars);
0027     m_jetAlgo = std::make_unique<Stage1Layer2JetAlgorithmImpHI>(dbPars);  //fwv =1 => HI algo
0028     m_tauAlgo = std::make_unique<Stage1Layer2SingleTrackHI>(dbPars);      //fwv=1 => single track seed
0029     m_hfRingAlgo = std::make_unique<Stage1Layer2CentralityAlgorithm>(dbPars);
0030     m_hfBitAlgo = std::make_unique<Stage1Layer2HFMinimumBias>(dbPars);
0031     // m_hfRingAlgo = std::make_unique<Stage1Layer2FlowAlgorithm>(dbPars);
0032     // m_hfBitAlgo = std::make_unique<Stage1Layer2CentralityAlgorithm>(dbPars);
0033   } else if (m_fwv == 2) {  //PP algorithm
0034     m_egAlgo = std::make_unique<Stage1Layer2EGammaAlgorithmImpPP>(dbPars);
0035     m_sumAlgo = std::make_unique<Stage1Layer2EtSumAlgorithmImpPP>(dbPars);
0036     m_jetAlgo = std::make_unique<Stage1Layer2JetAlgorithmImpPP>(dbPars);  //fwv =2 => PP algo
0037     m_tauAlgo = std::make_unique<Stage1Layer2TauAlgorithmImpPP>(dbPars);
0038     m_hfRingAlgo = std::make_unique<Stage1Layer2DiTauAlgorithm>(dbPars);
0039     m_hfBitAlgo = nullptr;
0040   } else if (m_fwv == 3) {  // hw testing algorithms
0041     m_jetAlgo = std::make_unique<Stage1Layer2JetAlgorithmImpSimpleHW>(dbPars);
0042     m_egAlgo = std::make_unique<Stage1Layer2EGammaAlgorithmImpHW>(dbPars);
0043     m_sumAlgo = std::make_unique<Stage1Layer2EtSumAlgorithmImpHW>(dbPars);
0044     m_tauAlgo = std::make_unique<Stage1Layer2TauAlgorithmImpHW>(dbPars);
0045     m_hfRingAlgo = std::make_unique<Stage1Layer2DiTauAlgorithm>(dbPars);
0046     m_hfBitAlgo = std::make_unique<Stage1Layer2HFMinimumBias>(dbPars);
0047   } else {  // undefined fwv version
0048     edm::LogError("FWVersionError") << "Undefined firmware version passed to Stage1Layer2MainProcessorFirmwareImp1"
0049                                     << std::endl;
0050     return;
0051   }
0052 }
0053 
0054 void Stage1Layer2MainProcessorFirmwareImp1::processEvent(const std::vector<CaloEmCand>& emcands,
0055                                                          const std::vector<CaloRegion>& regions,
0056                                                          std::vector<EGamma>* egammas,
0057                                                          std::vector<Tau>* taus,
0058                                                          std::vector<Tau>* isoTaus,
0059                                                          std::vector<Jet>* jets,
0060                                                          std::vector<Jet>* preGtJets,
0061                                                          std::vector<EtSum>* etsums,
0062                                                          CaloSpare* HFringsums,
0063                                                          CaloSpare* HFbitcounts) {
0064   if (m_jetAlgo)
0065     m_jetAlgo->processEvent(regions, emcands, jets, preGtJets);  // need to run jets before MHT
0066   if (m_egAlgo)
0067     m_egAlgo->processEvent(emcands, regions, jets, egammas);
0068   if (m_tauAlgo)
0069     m_tauAlgo->processEvent(emcands, regions, isoTaus, taus);
0070   if (m_sumAlgo)
0071     m_sumAlgo->processEvent(regions, emcands, jets, etsums);  //MHT uses jets for phi calculation
0072   if (m_hfRingAlgo)
0073     m_hfRingAlgo->processEvent(regions, emcands, isoTaus, HFringsums);
0074   if (m_hfBitAlgo)
0075     m_hfBitAlgo->processEvent(regions, emcands, HFbitcounts);
0076 }