Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "L1Trigger/HardwareValidation/plugins/L1DummyProducer.h"
0002 
0003 #include "FWCore/ServiceRegistry/interface/Service.h"
0004 #include "FWCore/Utilities/interface/Exception.h"
0005 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
0006 
0007 using namespace dedefs;
0008 
0009 L1DummyProducer::L1DummyProducer(const edm::ParameterSet& iConfig) {
0010   verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag", 0);
0011 
0012   if (verbose())
0013     std::cout << "L1DummyProducer::L1DummyProducer...\n" << std::flush;
0014 
0015   std::vector<unsigned int> compColls = iConfig.getUntrackedParameter<std::vector<unsigned int> >("DO_SYSTEM");
0016 
0017   for (int i = 0; i < DEnsys; i++)
0018     m_doSys[i] = compColls[i];
0019 
0020   if (verbose()) {
0021     std::cout << "[L1DummyProducer] do sys? ";
0022     for (int i = 0; i < DEnsys; i++)
0023       std::cout << m_doSys[i];
0024     std::cout << std::endl;
0025     for (int i = 0; i < DEnsys; i++)
0026       if (m_doSys[i])
0027         std::cout << SystLabel[i] << " ";
0028     std::cout << std::endl;
0029   }
0030 
0031   std::string CollInstName[DEnsys][5];
0032   for (int i = 0; i < DEnsys; i++)
0033     for (int j = 0; j < 5; j++)
0034       CollInstName[i][j] = std::string("");
0035 
0036   CollInstName[GCT][0] += "isoEm";
0037   CollInstName[GCT][1] += "nonIsoEm";
0038   CollInstName[GCT][2] += "cenJets";
0039   CollInstName[GCT][3] += "forJets";
0040   CollInstName[GCT][4] += "tauJets";
0041   CollInstName[DTF][0] += "DT";
0042   CollInstName[DTF][1] += "DTTF";
0043   CollInstName[CTF][0] += "CSC";
0044   CollInstName[CTF][1] += "";
0045   CollInstName[RPC][0] += "RPCb";
0046   CollInstName[RPC][1] += "RPCf";
0047 
0048   for (int i = 0; i < DEnsys; i++)
0049     for (int j = 0; j < 5; j++)
0050       instName[i][j] = CollInstName[i][j];
0051 
0052   if (verbose()) {
0053     std::cout << "[L1DummyProducer] instName:\n";
0054     for (int i = 0; i < DEnsys; i++)
0055       for (int j = 0; j < 5; j++)
0056         if (!instName[i][j].empty())
0057           std::cout << i << " " << SystLabel[i] << " " << j << " " << instName[i][j] << std::endl;
0058     std::cout << std::flush;
0059   }
0060 
0061   ///assertions/temporary
0062   assert(ETP == 0);
0063   assert(HTP == 1);
0064   assert(RCT == 2);
0065   assert(GCT == 3);
0066   assert(DTP == 4);
0067   assert(DTF == 5);
0068   assert(CTP == 6);
0069   assert(CTF == 7);
0070   assert(RPC == 8);
0071   assert(LTC == 9);
0072   assert(GMT == 10);
0073   assert(GLT == 11);
0074 
0075   /// list of collections to be produced
0076   if (m_doSys[ETP])
0077     produces<EcalTrigPrimDigiCollection>(instName[ETP][0]);
0078   if (m_doSys[HTP])
0079     produces<HcalTrigPrimDigiCollection>(instName[HTP][0]);
0080   if (m_doSys[RCT])
0081     produces<L1CaloEmCollection>(instName[RCT][0]);
0082   if (m_doSys[RCT])
0083     produces<L1CaloRegionCollection>(instName[RCT][0]);
0084   if (m_doSys[GCT])
0085     produces<L1GctEmCandCollection>(instName[GCT][0]);
0086   if (m_doSys[GCT])
0087     produces<L1GctEmCandCollection>(instName[GCT][1]);
0088   if (m_doSys[GCT])
0089     produces<L1GctJetCandCollection>(instName[GCT][2]);
0090   if (m_doSys[GCT])
0091     produces<L1GctJetCandCollection>(instName[GCT][3]);
0092   if (m_doSys[GCT])
0093     produces<L1GctJetCandCollection>(instName[GCT][4]);
0094   if (m_doSys[DTP])
0095     produces<L1MuDTChambPhContainer>(instName[DTP][0]);
0096   if (m_doSys[DTP])
0097     produces<L1MuDTChambThContainer>(instName[DTP][0]);
0098   if (m_doSys[DTF])
0099     produces<L1MuRegionalCandCollection>(instName[DTF][0]);
0100   if (m_doSys[DTF])
0101     produces<L1MuDTTrackContainer>(instName[DTF][1]);
0102   if (m_doSys[CTP])
0103     produces<CSCCorrelatedLCTDigiCollection>(instName[CTP][0]);
0104   if (m_doSys[CTF])
0105     produces<L1MuRegionalCandCollection>(instName[CTF][0]);
0106   if (m_doSys[CTF])
0107     produces<L1CSCTrackCollection>(instName[CTF][1]);
0108   if (m_doSys[RPC])
0109     produces<L1MuRegionalCandCollection>(instName[RPC][0]);
0110   if (m_doSys[RPC])
0111     produces<L1MuRegionalCandCollection>(instName[RPC][1]);
0112   if (m_doSys[LTC])
0113     produces<LTCDigiCollection>(instName[LTC][0]);
0114   if (m_doSys[GMT])
0115     produces<L1MuGMTCandCollection>(instName[GMT][0]);
0116   if (m_doSys[GMT])
0117     produces<L1MuGMTReadoutCollection>(instName[GMT][0]);
0118   if (m_doSys[GLT])
0119     produces<L1GlobalTriggerReadoutRecord>(instName[GLT][0]);
0120   if (m_doSys[GLT])
0121     produces<L1GlobalTriggerEvmReadoutRecord>(instName[GLT][0]);
0122   if (m_doSys[GLT])
0123     produces<L1GlobalTriggerObjectMapRecord>(instName[GLT][0]);
0124 
0125   ///rnd # settings
0126   edm::Service<edm::RandomNumberGenerator> rng;
0127   if (!rng.isAvailable()) {
0128     throw cms::Exception("Configuration")
0129         << "L1DummyProducer requires the RandomNumberGeneratorService\n"
0130            "which is not present in the configuration file.  You must add the service\n"
0131            "in the configuration file or remove the modules that require it.";
0132   }
0133   EBase_ = iConfig.getUntrackedParameter<double>("EnergyBase", 100.);
0134   ESigm_ = iConfig.getUntrackedParameter<double>("EnergySigm", 10.);
0135 
0136   nevt_ = 0;
0137 }
0138 
0139 L1DummyProducer::~L1DummyProducer() {}
0140 
0141 void L1DummyProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
0142   edm::Service<edm::RandomNumberGenerator> rng;
0143   CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID());
0144 
0145   if (verbose())
0146     std::cout << "L1DummyProducer::produce...\n" << std::flush;
0147 
0148   /// define the data collections
0149   std::unique_ptr<EcalTrigPrimDigiCollection> ecal_tp_data(new EcalTrigPrimDigiCollection);
0150   std::unique_ptr<HcalTrigPrimDigiCollection> hcal_tp_data(new HcalTrigPrimDigiCollection);
0151   std::unique_ptr<L1CaloEmCollection> rct_em_data(new L1CaloEmCollection);
0152   std::unique_ptr<L1CaloRegionCollection> rct_rgn_data(new L1CaloRegionCollection);
0153   std::unique_ptr<L1GctEmCandCollection> gct_isolaem_data(new L1GctEmCandCollection);
0154   std::unique_ptr<L1GctEmCandCollection> gct_noisoem_data(new L1GctEmCandCollection);
0155   std::unique_ptr<L1GctJetCandCollection> gct_cenjets_data(new L1GctJetCandCollection);
0156   std::unique_ptr<L1GctJetCandCollection> gct_forjets_data(new L1GctJetCandCollection);
0157   std::unique_ptr<L1GctJetCandCollection> gct_taujets_data(new L1GctJetCandCollection);
0158   std::unique_ptr<L1MuDTChambPhContainer> dtp_ph_data(new L1MuDTChambPhContainer);
0159   std::unique_ptr<L1MuDTChambThContainer> dtp_th_data(new L1MuDTChambThContainer);
0160   std::unique_ptr<L1MuRegionalCandCollection> dtf_data(new L1MuRegionalCandCollection);
0161   std::unique_ptr<L1MuDTTrackContainer> dtf_trk_data(new L1MuDTTrackContainer);
0162   std::unique_ptr<CSCCorrelatedLCTDigiCollection> ctp_data(new CSCCorrelatedLCTDigiCollection);
0163   std::unique_ptr<L1MuRegionalCandCollection> ctf_data(new L1MuRegionalCandCollection);
0164   std::unique_ptr<L1CSCTrackCollection> ctf_trk_data(new L1CSCTrackCollection);
0165   std::unique_ptr<L1MuRegionalCandCollection> rpc_cen_data(new L1MuRegionalCandCollection);
0166   std::unique_ptr<L1MuRegionalCandCollection> rpc_for_data(new L1MuRegionalCandCollection);
0167   std::unique_ptr<LTCDigiCollection> ltc_data(new LTCDigiCollection);
0168   std::unique_ptr<L1MuGMTCandCollection> gmt_data(new L1MuGMTCandCollection);
0169   std::unique_ptr<L1MuGMTReadoutCollection> gmt_rdt_data(new L1MuGMTReadoutCollection);
0170   std::unique_ptr<L1GlobalTriggerReadoutRecord> glt_rdt_data(new L1GlobalTriggerReadoutRecord);
0171   std::unique_ptr<L1GlobalTriggerEvmReadoutRecord> glt_evm_data(new L1GlobalTriggerEvmReadoutRecord);
0172   std::unique_ptr<L1GlobalTriggerObjectMapRecord> glt_obj_data(new L1GlobalTriggerObjectMapRecord);
0173 
0174   /// fill candidate collections
0175   if (m_doSys[ETP])
0176     SimpleDigi(engine, ecal_tp_data);
0177   if (m_doSys[HTP])
0178     SimpleDigi(engine, hcal_tp_data);
0179   if (m_doSys[RCT])
0180     SimpleDigi(engine, rct_em_data);
0181   if (m_doSys[RCT])
0182     SimpleDigi(engine, rct_rgn_data);
0183   if (m_doSys[GCT])
0184     SimpleDigi(engine, gct_isolaem_data, 0);
0185   if (m_doSys[GCT])
0186     SimpleDigi(engine, gct_noisoem_data, 1);
0187   if (m_doSys[GCT])
0188     SimpleDigi(engine, gct_cenjets_data, 0);
0189   if (m_doSys[GCT])
0190     SimpleDigi(engine, gct_forjets_data, 1);
0191   if (m_doSys[GCT])
0192     SimpleDigi(engine, gct_taujets_data, 2);
0193   if (m_doSys[DTP])
0194     SimpleDigi(engine, dtp_ph_data);
0195   if (m_doSys[DTP])
0196     SimpleDigi(engine, dtp_th_data);
0197   if (m_doSys[DTF])
0198     SimpleDigi(engine, dtf_data, 0);
0199   if (m_doSys[DTF])
0200     SimpleDigi(engine, dtf_trk_data);
0201   if (m_doSys[CTP])
0202     SimpleDigi(engine, ctp_data);
0203   if (m_doSys[CTF])
0204     SimpleDigi(engine, ctf_data, 2);
0205   if (m_doSys[CTF])
0206     SimpleDigi(engine, ctf_trk_data);
0207   if (m_doSys[RPC])
0208     SimpleDigi(engine, rpc_cen_data, 1);
0209   if (m_doSys[RPC])
0210     SimpleDigi(engine, rpc_for_data, 3);
0211   if (m_doSys[LTC])
0212     SimpleDigi(engine, ltc_data);
0213   if (m_doSys[GMT])
0214     SimpleDigi(engine, gmt_data);
0215   if (m_doSys[GMT])
0216     SimpleDigi(engine, gmt_rdt_data);
0217   if (m_doSys[GLT])
0218     SimpleDigi(engine, glt_rdt_data);
0219   if (m_doSys[GLT])
0220     SimpleDigi(engine, glt_evm_data);
0221   if (m_doSys[GLT])
0222     SimpleDigi(engine, glt_obj_data);
0223 
0224   /// put collection
0225   if (m_doSys[ETP])
0226     iEvent.put(std::move(ecal_tp_data), instName[ETP][0]);
0227   if (m_doSys[HTP])
0228     iEvent.put(std::move(hcal_tp_data), instName[HTP][0]);
0229   if (m_doSys[RCT])
0230     iEvent.put(std::move(rct_em_data), instName[RCT][0]);
0231   if (m_doSys[RCT])
0232     iEvent.put(std::move(rct_rgn_data), instName[RCT][0]);
0233   if (m_doSys[GCT])
0234     iEvent.put(std::move(gct_isolaem_data), instName[GCT][0]);
0235   if (m_doSys[GCT])
0236     iEvent.put(std::move(gct_noisoem_data), instName[GCT][1]);
0237   if (m_doSys[GCT])
0238     iEvent.put(std::move(gct_cenjets_data), instName[GCT][2]);
0239   if (m_doSys[GCT])
0240     iEvent.put(std::move(gct_forjets_data), instName[GCT][3]);
0241   if (m_doSys[GCT])
0242     iEvent.put(std::move(gct_taujets_data), instName[GCT][4]);
0243   if (m_doSys[DTP])
0244     iEvent.put(std::move(dtp_ph_data), instName[DTP][0]);
0245   if (m_doSys[DTP])
0246     iEvent.put(std::move(dtp_th_data), instName[DTP][0]);
0247   if (m_doSys[DTF])
0248     iEvent.put(std::move(dtf_data), instName[DTF][0]);
0249   if (m_doSys[DTF])
0250     iEvent.put(std::move(dtf_trk_data), instName[DTF][1]);
0251   if (m_doSys[CTP])
0252     iEvent.put(std::move(ctp_data), instName[CTP][0]);
0253   if (m_doSys[CTF])
0254     iEvent.put(std::move(ctf_data), instName[CTF][0]);
0255   if (m_doSys[CTF])
0256     iEvent.put(std::move(ctf_trk_data), instName[CTF][1]);
0257   if (m_doSys[RPC])
0258     iEvent.put(std::move(rpc_cen_data), instName[RPC][0]);
0259   if (m_doSys[RPC])
0260     iEvent.put(std::move(rpc_for_data), instName[RPC][1]);
0261   if (m_doSys[LTC])
0262     iEvent.put(std::move(ltc_data), instName[LTC][0]);
0263   if (m_doSys[GMT])
0264     iEvent.put(std::move(gmt_data), instName[GMT][0]);
0265   if (m_doSys[GMT])
0266     iEvent.put(std::move(gmt_rdt_data), instName[GMT][0]);
0267   if (m_doSys[GLT])
0268     iEvent.put(std::move(glt_rdt_data), instName[GLT][0]);
0269   if (m_doSys[GLT])
0270     iEvent.put(std::move(glt_evm_data), instName[GLT][0]);
0271   if (m_doSys[GLT])
0272     iEvent.put(std::move(glt_obj_data), instName[GLT][0]);
0273 
0274   nevt_++;
0275 
0276   if (verbose())
0277     std::cout << "L1DummyProducer::produce end.\n" << std::flush;
0278 }