Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:15:09

0001 #include "FWCore/Utilities/interface/InputTag.h"
0002 
0003 #include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h"
0004 #include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h"
0005 #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h"
0006 
0007 #include "CaloSetup.h"
0008 
0009 using namespace l1t;
0010 using namespace l1t::stage1;
0011 
0012 std::unique_ptr<PackerTokens> CaloSetup::registerConsumes(const edm::ParameterSet& cfg, edm::ConsumesCollector& cc) {
0013   return std::unique_ptr<PackerTokens>(new CaloTokens(cfg, cc));
0014 }
0015 
0016 void CaloSetup::fillDescription(edm::ParameterSetDescription& desc) {
0017   desc.addOptional<edm::InputTag>("TauInputLabel")->setComment("for stage1");
0018   desc.addOptional<edm::InputTag>("IsoTauInputLabel")->setComment("for stage1");
0019   desc.addOptional<edm::InputTag>("HFBitCountsInputLabel")->setComment("for stage1");
0020   desc.addOptional<edm::InputTag>("HFRingSumsInputLabel")->setComment("for stage1");
0021   desc.addOptional<edm::InputTag>("RegionInputLabel")->setComment("for stage1");
0022   desc.addOptional<edm::InputTag>("EmCandInputLabel")->setComment("for stage1");
0023 }
0024 
0025 PackerMap CaloSetup::getPackers(int fed, unsigned int fw) {
0026   PackerMap res;
0027 
0028   res[{1, 0x2300}] = {
0029       PackerFactory::get()->make("stage1::IsoEGammaPacker"),
0030       PackerFactory::get()->make("stage1::NonIsoEGammaPacker"),
0031       PackerFactory::get()->make("stage1::CentralJetPacker"),
0032       PackerFactory::get()->make("stage1::ForwardJetPacker"),
0033       PackerFactory::get()->make("stage1::TauPacker"),
0034       PackerFactory::get()->make("stage1::IsoTauPacker"),
0035       PackerFactory::get()->make("stage1::EtSumPacker"),
0036       PackerFactory::get()->make("stage1::MissEtPacker"),
0037       PackerFactory::get()->make("stage1::CaloSpareHFPacker"),
0038       PackerFactory::get()->make("stage1::MissHtPacker"),
0039       PackerFactory::get()->make("stage1::RCTEmRegionPacker"),
0040   };
0041 
0042   return res;
0043 }
0044 
0045 void CaloSetup::registerProducts(edm::ProducesCollector prod) {
0046   prod.produces<L1CaloEmCollection>();
0047   prod.produces<CaloSpareBxCollection>("HFBitCounts");
0048   prod.produces<CaloSpareBxCollection>("HFRingSums");
0049   prod.produces<L1CaloRegionCollection>();
0050   prod.produces<CaloTowerBxCollection>();
0051   prod.produces<EGammaBxCollection>();
0052   prod.produces<EtSumBxCollection>();
0053   prod.produces<JetBxCollection>();
0054   prod.produces<TauBxCollection>("rlxTaus");
0055   prod.produces<TauBxCollection>("isoTaus");
0056 }
0057 
0058 std::unique_ptr<UnpackerCollections> CaloSetup::getCollections(edm::Event& e) {
0059   return std::unique_ptr<UnpackerCollections>(new CaloCollections(e));
0060 }
0061 
0062 UnpackerMap CaloSetup::getUnpackers(int fed, int board, int amc, unsigned int fw) {
0063   UnpackerMap res;
0064 
0065   // FIXME Hard-coded firmware version for first 74x MC campaigns.
0066   // Will account for differences in the AMC payload, MP7 payload,
0067   // and unpacker setup.
0068   if ((fw >> 24) == 0xff) {
0069     auto cjet_unp = UnpackerFactory::get()->make("stage1::legacy::CentralJetUnpacker");
0070     auto fjet_unp = UnpackerFactory::get()->make("stage1::legacy::ForwardJetUnpacker");
0071 
0072     if (fed == 1352) {
0073       if (board == 0x200D) {
0074         auto iegamma_unp = UnpackerFactory::get()->make("stage1::legacy::IsoEGammaUnpacker");
0075         auto niegamma_unp = UnpackerFactory::get()->make("stage1::legacy::NonIsoEGammaUnpacker");
0076         auto tau_unp = UnpackerFactory::get()->make("stage1::legacy::TauUnpacker");
0077         auto isotau_unp = UnpackerFactory::get()->make("stage1::legacy::IsoTauUnpacker");
0078         auto etsum_unp = UnpackerFactory::get()->make("stage1::legacy::EtSumUnpacker");
0079         auto ring_unp = UnpackerFactory::get()->make("stage1::legacy::HFRingUnpacker");
0080 
0081         res[1] = iegamma_unp;
0082         res[2] = niegamma_unp;
0083         res[3] = cjet_unp;
0084         res[4] = fjet_unp;
0085         res[5] = tau_unp;
0086         res[6] = etsum_unp;
0087         res[7] = ring_unp;
0088         res[8] = isotau_unp;
0089       }
0090     }
0091   } else {
0092     auto cjet_unp_Left = UnpackerFactory::get()->make("stage1::CentralJetUnpackerLeft");
0093     auto fjet_unp_Left = UnpackerFactory::get()->make("stage1::ForwardJetUnpackerLeft");
0094     auto iegamma_unp_Left = UnpackerFactory::get()->make("stage1::IsoEGammaUnpackerLeft");
0095     auto niegamma_unp_Left = UnpackerFactory::get()->make("stage1::NonIsoEGammaUnpackerLeft");
0096     auto tau_unp_Left = UnpackerFactory::get()->make("stage1::TauUnpackerLeft");
0097     auto isotau_unp_Left = UnpackerFactory::get()->make("stage1::IsoTauUnpackerLeft");
0098     auto cjet_unp_Right = UnpackerFactory::get()->make("stage1::CentralJetUnpackerRight");
0099     auto fjet_unp_Right = UnpackerFactory::get()->make("stage1::ForwardJetUnpackerRight");
0100     auto iegamma_unp_Right = UnpackerFactory::get()->make("stage1::IsoEGammaUnpackerRight");
0101     auto niegamma_unp_Right = UnpackerFactory::get()->make("stage1::NonIsoEGammaUnpackerRight");
0102     auto tau_unp_Right = UnpackerFactory::get()->make("stage1::TauUnpackerRight");
0103     auto isotau_unp_Right = UnpackerFactory::get()->make("stage1::IsoTauUnpackerRight");
0104     auto etsum_unp = UnpackerFactory::get()->make("stage1::EtSumUnpacker");
0105     auto missetsum_unp = UnpackerFactory::get()->make("stage1::MissEtUnpacker");
0106     auto calospare_unp = UnpackerFactory::get()->make("stage1::CaloSpareHFUnpacker");
0107     auto misshtsum_unp = UnpackerFactory::get()->make("stage1::MissHtUnpacker");
0108 
0109     if (fed == 1352) {
0110       auto rct_unp = UnpackerFactory::get()->make("stage1::RCTEmRegionUnpacker");
0111 
0112       // 4109 == 0x100D
0113       if (board == 0x2300) {
0114         res[77] = cjet_unp_Left;
0115         res[79] = cjet_unp_Right;
0116         res[81] = fjet_unp_Left;
0117         res[83] = fjet_unp_Right;
0118         res[85] = iegamma_unp_Left;
0119         res[87] = iegamma_unp_Right;
0120         res[89] = niegamma_unp_Left;
0121         res[91] = niegamma_unp_Right;
0122         res[93] = etsum_unp;
0123         res[95] = missetsum_unp;
0124         res[97] = calospare_unp;
0125         res[99] = misshtsum_unp;
0126         res[101] = tau_unp_Left;
0127         res[103] = tau_unp_Right;
0128         res[105] = isotau_unp_Left;
0129         res[107] = isotau_unp_Right;
0130 
0131         for (int m = 0; m < 36; m++) {
0132           res[m * 2] = rct_unp;
0133         }
0134       }
0135     }
0136   }
0137   return res;
0138 }
0139 
0140 DEFINE_L1T_PACKING_SETUP(l1t::stage1::CaloSetup);