Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 ///
0002 /// \class l1t::Stage2Layer2MainProcessorFirmwareImp1
0003 ///
0004 /// \author: Jim Brooke
0005 ///
0006 /// Description: first iteration of stage 2 processing
0007 
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include "L1Trigger/L1TCalorimeter/interface/Stage2MainProcessorFirmware.h"
0010 #include "L1Trigger/L1TCalorimeter/interface/Stage2TowerDecompressAlgorithmFirmware.h"
0011 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2ClusterAlgorithmFirmware.h"
0012 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2EGammaAlgorithmFirmware.h"
0013 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2TauAlgorithmFirmware.h"
0014 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2JetAlgorithmFirmware.h"
0015 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2EtSumAlgorithmFirmware.h"
0016 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2JetSumAlgorithmFirmware.h"
0017 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2DemuxEGAlgoFirmware.h"
0018 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2DemuxTauAlgoFirmware.h"
0019 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2DemuxJetAlgoFirmware.h"
0020 #include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2DemuxSumsAlgoFirmware.h"
0021 
0022 #include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
0023 
0024 using namespace std;
0025 
0026 l1t::Stage2MainProcessorFirmwareImp1::Stage2MainProcessorFirmwareImp1(unsigned fwv, CaloParamsHelper const* params) {
0027   m_towerAlgo = make_unique<Stage2TowerDecompressAlgorithmFirmwareImp1>(params);
0028   m_egClusterAlgo = make_unique<Stage2Layer2ClusterAlgorithmFirmwareImp1>(
0029       params, Stage2Layer2ClusterAlgorithmFirmwareImp1::ClusterInput::EH);
0030   m_egAlgo = make_unique<Stage2Layer2EGammaAlgorithmFirmwareImp1>(params);
0031   m_tauClusterAlgo = make_unique<Stage2Layer2ClusterAlgorithmFirmwareImp1>(
0032       params, Stage2Layer2ClusterAlgorithmFirmwareImp1::ClusterInput::EH);
0033   m_tauAlgo = make_unique<Stage2Layer2TauAlgorithmFirmwareImp1>(params);
0034   m_jetAlgo = make_unique<Stage2Layer2JetAlgorithmFirmwareImp1>(params);
0035   m_sumAlgo = make_unique<Stage2Layer2EtSumAlgorithmFirmwareImp1>(params);
0036   m_jetSumAlgo = make_unique<Stage2Layer2JetSumAlgorithmFirmwareImp1>(params);
0037 
0038   m_demuxEGAlgo = make_unique<Stage2Layer2DemuxEGAlgoFirmwareImp1>(params);
0039   m_demuxTauAlgo = make_unique<Stage2Layer2DemuxTauAlgoFirmwareImp1>(params);
0040   m_demuxJetAlgo = make_unique<Stage2Layer2DemuxJetAlgoFirmwareImp1>(params);
0041   m_demuxSumsAlgo = make_unique<Stage2Layer2DemuxSumsAlgoFirmwareImp1>(params);
0042 }
0043 
0044 //need to switch to BXVector
0045 void l1t::Stage2MainProcessorFirmwareImp1::processEvent(const std::vector<l1t::CaloTower>& inTowers,
0046                                                         std::vector<l1t::CaloTower>& outTowers,
0047                                                         std::vector<l1t::CaloCluster>& clusters,
0048                                                         std::vector<l1t::EGamma>& mpEGammas,
0049                                                         std::vector<l1t::Tau>& mpTaus,
0050                                                         std::vector<l1t::Jet>& mpJets,
0051                                                         std::vector<l1t::EtSum>& mpSums,
0052                                                         std::vector<l1t::EGamma>& egammas,
0053                                                         std::vector<l1t::Tau>& taus,
0054                                                         std::vector<l1t::Jet>& jets,
0055                                                         std::vector<l1t::EtSum>& etSums) {
0056   // processing below is performed by the MP
0057   std::vector<l1t::CaloCluster> egClusters;
0058   std::vector<l1t::CaloCluster> tauClusters;
0059   std::vector<l1t::Jet> mpAllJets;
0060   std::vector<l1t::EtSum> towerSums;
0061   std::vector<l1t::EtSum> jetSums;
0062 
0063   m_towerAlgo->processEvent(inTowers, outTowers);
0064   m_egClusterAlgo->processEvent(outTowers, egClusters);
0065   m_egAlgo->processEvent(egClusters, outTowers, mpEGammas);
0066   m_tauClusterAlgo->processEvent(outTowers, tauClusters);
0067   m_tauAlgo->processEvent(tauClusters, outTowers, mpTaus);
0068   m_jetAlgo->processEvent(outTowers, mpJets, mpAllJets);
0069   m_sumAlgo->processEvent(outTowers, towerSums);
0070   m_jetSumAlgo->processEvent(mpAllJets, jetSums);
0071 
0072   clusters.insert(clusters.end(), egClusters.begin(), egClusters.end());
0073 
0074   mpSums.insert(mpSums.end(), towerSums.begin(), towerSums.end());
0075   mpSums.insert(mpSums.end(), jetSums.begin(), jetSums.end());
0076 
0077   // processing below is actually performed by the Demux card
0078   // in principle this could be done in a separate EDProduce
0079   // but it is done here for flexibility
0080 
0081   m_demuxEGAlgo->processEvent(mpEGammas, egammas);
0082   m_demuxTauAlgo->processEvent(mpTaus, taus);
0083   m_demuxJetAlgo->processEvent(mpJets, jets);
0084   m_demuxSumsAlgo->processEvent(mpSums, etSums);
0085 }
0086 
0087 void l1t::Stage2MainProcessorFirmwareImp1::print(std::ostream& out) const {
0088   out << "Calo Stage 2 Main Processor" << std::endl;
0089   out << "  Tower algo       : " << (m_towerAlgo ? 1 : 0) << std::endl;
0090   out << "  EG cluster algo  : " << (m_egClusterAlgo ? 1 : 0) << std::endl;
0091   out << "  EG ID algo       : " << (m_egAlgo ? 1 : 0) << std::endl;
0092   out << "  Tau cluster algo : " << (m_tauClusterAlgo ? 1 : 0) << std::endl;
0093   out << "  Tau ID algo      : " << (m_tauAlgo ? 1 : 0) << std::endl;
0094   out << "  Jet algo         : " << (m_jetAlgo ? 1 : 0) << std::endl;
0095   out << "  Jet sum algo     : " << (m_jetSumAlgo ? 1 : 0) << std::endl;
0096   out << "  Sums algo        : " << (m_sumAlgo ? 1 : 0) << std::endl;
0097 }