CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/L1Trigger/HardwareValidation/plugins/L1DummyProducer.cc

Go to the documentation of this file.
00001 #include "L1Trigger/HardwareValidation/plugins/L1DummyProducer.h"
00002 
00003 using namespace dedefs;
00004 
00005 L1DummyProducer::L1DummyProducer(const edm::ParameterSet& iConfig) {
00006 
00007   verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag",0);
00008   
00009   if(verbose())
00010     std::cout << "L1DummyProducer::L1DummyProducer...\n" << std::flush;
00011 
00012   std::vector<unsigned int> compColls  
00013     = iConfig.getUntrackedParameter<std::vector<unsigned int> >("DO_SYSTEM");
00014 
00015   for(int i=0; i<DEnsys; i++) 
00016     m_doSys[i] = compColls[i];
00017   
00018   if(verbose()) {
00019     std::cout << "[L1DummyProducer] do sys? ";
00020     for(int i=0; i<DEnsys; i++)
00021       std::cout << m_doSys[i];
00022     std::cout << std::endl;  
00023     for(int i=0; i<DEnsys; i++)
00024       if(m_doSys[i]) 
00025         std::cout << SystLabel[i] << " ";
00026     std::cout << std::endl;  
00027   }
00028 
00029   std::string CollInstName[DEnsys][5];
00030   for(int i=0; i<DEnsys; i++)
00031     for(int j=0; j<5; j++)
00032       CollInstName[i][j]=std::string("");
00033 
00034   CollInstName[GCT][0]+="isoEm"   ;
00035   CollInstName[GCT][1]+="nonIsoEm";
00036   CollInstName[GCT][2]+="cenJets" ;
00037   CollInstName[GCT][3]+="forJets" ;
00038   CollInstName[GCT][4]+="tauJets" ;
00039   CollInstName[DTF][0]+="DT"      ;
00040   CollInstName[DTF][1]+="DTTF"    ;
00041   CollInstName[CTF][0]+="CSC"     ;
00042   CollInstName[CTF][1]+=""        ;
00043   CollInstName[RPC][0]+="RPCb"    ;
00044   CollInstName[RPC][1]+="RPCf"    ;
00045   
00046   for(int i=0; i<DEnsys; i++)
00047     for(int j=0; j<5; j++)
00048       instName[i][j] = CollInstName[i][j];
00049 
00050   if(verbose()) {
00051     std::cout << "[L1DummyProducer] instName:\n";
00052     for(int i=0; i<DEnsys; i++)
00053       for(int j=0; j<5; j++)
00054         if(instName[i][j] != "")
00055           std::cout << i << " " << SystLabel[i] << " " << j << " " 
00056                     << instName[i][j] << std::endl;
00057     std::cout << std::flush;
00058   }
00059 
00061   assert(ETP==0); assert(HTP==1); assert(RCT== 2); assert(GCT== 3);
00062   assert(DTP==4); assert(DTF==5); assert(CTP== 6); assert(CTF== 7);
00063   assert(RPC==8); assert(LTC==9); assert(GMT==10); assert(GLT==11);
00064 
00066   if(m_doSys[ETP])  produces<EcalTrigPrimDigiCollection>     (instName[ETP][0]);
00067   if(m_doSys[HTP])  produces<HcalTrigPrimDigiCollection>     (instName[HTP][0]);
00068   if(m_doSys[RCT])  produces<L1CaloEmCollection>             (instName[RCT][0]);
00069   if(m_doSys[RCT])  produces<L1CaloRegionCollection>         (instName[RCT][0]);
00070   if(m_doSys[GCT])  produces<L1GctEmCandCollection>          (instName[GCT][0]);
00071   if(m_doSys[GCT])  produces<L1GctEmCandCollection>          (instName[GCT][1]);
00072   if(m_doSys[GCT])  produces<L1GctJetCandCollection>         (instName[GCT][2]);
00073   if(m_doSys[GCT])  produces<L1GctJetCandCollection>         (instName[GCT][3]);
00074   if(m_doSys[GCT])  produces<L1GctJetCandCollection>         (instName[GCT][4]);
00075   if(m_doSys[DTP])  produces<L1MuDTChambPhContainer>         (instName[DTP][0]);
00076   if(m_doSys[DTP])  produces<L1MuDTChambThContainer>         (instName[DTP][0]);
00077   if(m_doSys[DTF])  produces<L1MuRegionalCandCollection>     (instName[DTF][0]);
00078   if(m_doSys[DTF])  produces<L1MuDTTrackContainer>           (instName[DTF][1]);
00079   if(m_doSys[CTP])  produces<CSCCorrelatedLCTDigiCollection> (instName[CTP][0]);
00080   if(m_doSys[CTF])  produces<L1MuRegionalCandCollection>     (instName[CTF][0]);
00081   if(m_doSys[CTF])  produces<L1CSCTrackCollection>           (instName[CTF][1]);
00082   if(m_doSys[RPC])  produces<L1MuRegionalCandCollection>     (instName[RPC][0]);
00083   if(m_doSys[RPC])  produces<L1MuRegionalCandCollection>     (instName[RPC][1]);
00084   if(m_doSys[LTC])  produces<LTCDigiCollection>              (instName[LTC][0]);
00085   if(m_doSys[GMT])  produces<L1MuGMTCandCollection>          (instName[GMT][0]);
00086   if(m_doSys[GMT])  produces<L1MuGMTReadoutCollection>       (instName[GMT][0]);
00087   if(m_doSys[GLT])  produces<L1GlobalTriggerReadoutRecord>   (instName[GLT][0]);
00088   if(m_doSys[GLT])  produces<L1GlobalTriggerEvmReadoutRecord>(instName[GLT][0]);
00089   if(m_doSys[GLT])  produces<L1GlobalTriggerObjectMapRecord> (instName[GLT][0]);
00090 
00092   edm::Service<edm::RandomNumberGenerator> rng;
00093   CLHEP::HepRandomEngine& engine = rng->getEngine();
00094   rndFlat_ = new CLHEP::RandFlat  (engine, 0., 1.);
00095   rndGaus_ = new CLHEP::RandGaussQ(engine, 0., 1.);
00096   EBase_ = iConfig.getUntrackedParameter<double>("EnergyBase",100.);
00097   ESigm_ = iConfig.getUntrackedParameter<double>("EnergySigm",10.);
00098 
00099   nevt_=0;
00100   
00101 }
00102   
00103 L1DummyProducer::~L1DummyProducer() {
00104   delete rndFlat_;
00105   delete rndGaus_;
00106 }
00107 
00108 void
00109 L1DummyProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
00110 
00111   if(verbose())
00112     std::cout << "L1DummyProducer::produce...\n" << std::flush;
00113 
00115   std::auto_ptr<EcalTrigPrimDigiCollection>         ecal_tp_data(new EcalTrigPrimDigiCollection     );
00116   std::auto_ptr<HcalTrigPrimDigiCollection>         hcal_tp_data(new HcalTrigPrimDigiCollection     );
00117   std::auto_ptr<L1CaloEmCollection>                  rct_em_data(new L1CaloEmCollection             );
00118   std::auto_ptr<L1CaloRegionCollection>             rct_rgn_data(new L1CaloRegionCollection         );
00119   std::auto_ptr<L1GctEmCandCollection>          gct_isolaem_data(new L1GctEmCandCollection          ); 
00120   std::auto_ptr<L1GctEmCandCollection>          gct_noisoem_data(new L1GctEmCandCollection          ); 
00121   std::auto_ptr<L1GctJetCandCollection>         gct_cenjets_data(new L1GctJetCandCollection         ); 
00122   std::auto_ptr<L1GctJetCandCollection>         gct_forjets_data(new L1GctJetCandCollection         ); 
00123   std::auto_ptr<L1GctJetCandCollection>         gct_taujets_data(new L1GctJetCandCollection         ); 
00124   std::auto_ptr<L1MuDTChambPhContainer>              dtp_ph_data(new L1MuDTChambPhContainer         );
00125   std::auto_ptr<L1MuDTChambThContainer>              dtp_th_data(new L1MuDTChambThContainer         );
00126   std::auto_ptr<L1MuRegionalCandCollection>             dtf_data(new L1MuRegionalCandCollection     );
00127   std::auto_ptr<L1MuDTTrackContainer>               dtf_trk_data(new L1MuDTTrackContainer           );
00128   std::auto_ptr<CSCCorrelatedLCTDigiCollection>         ctp_data(new CSCCorrelatedLCTDigiCollection );
00129   std::auto_ptr<L1MuRegionalCandCollection>             ctf_data(new L1MuRegionalCandCollection     );
00130   std::auto_ptr<L1CSCTrackCollection>               ctf_trk_data(new L1CSCTrackCollection           );
00131   std::auto_ptr<L1MuRegionalCandCollection>         rpc_cen_data(new L1MuRegionalCandCollection     );
00132   std::auto_ptr<L1MuRegionalCandCollection>         rpc_for_data(new L1MuRegionalCandCollection     );
00133   std::auto_ptr<LTCDigiCollection>                      ltc_data(new LTCDigiCollection              );
00134   std::auto_ptr<L1MuGMTCandCollection>                  gmt_data(new L1MuGMTCandCollection          );
00135   std::auto_ptr<L1MuGMTReadoutCollection>           gmt_rdt_data(new L1MuGMTReadoutCollection       ); 
00136   std::auto_ptr<L1GlobalTriggerReadoutRecord>       glt_rdt_data(new L1GlobalTriggerReadoutRecord   );
00137   std::auto_ptr<L1GlobalTriggerEvmReadoutRecord>    glt_evm_data(new L1GlobalTriggerEvmReadoutRecord);
00138   std::auto_ptr<L1GlobalTriggerObjectMapRecord>     glt_obj_data(new L1GlobalTriggerObjectMapRecord );
00139 
00141   if(m_doSys[ETP]) SimpleDigi(    ecal_tp_data  );
00142   if(m_doSys[HTP]) SimpleDigi(    hcal_tp_data  );
00143   if(m_doSys[RCT]) SimpleDigi(     rct_em_data  );
00144   if(m_doSys[RCT]) SimpleDigi(    rct_rgn_data  );
00145   if(m_doSys[GCT]) SimpleDigi(gct_isolaem_data,0);
00146   if(m_doSys[GCT]) SimpleDigi(gct_noisoem_data,1);
00147   if(m_doSys[GCT]) SimpleDigi(gct_cenjets_data,0);
00148   if(m_doSys[GCT]) SimpleDigi(gct_forjets_data,1);
00149   if(m_doSys[GCT]) SimpleDigi(gct_taujets_data,2);
00150   if(m_doSys[DTP]) SimpleDigi(     dtp_ph_data  );
00151   if(m_doSys[DTP]) SimpleDigi(     dtp_th_data  );
00152   if(m_doSys[DTF]) SimpleDigi(        dtf_data,0);
00153   if(m_doSys[DTF]) SimpleDigi(    dtf_trk_data  );
00154   if(m_doSys[CTP]) SimpleDigi(        ctp_data  );
00155   if(m_doSys[CTF]) SimpleDigi(        ctf_data,2);
00156   if(m_doSys[CTF]) SimpleDigi(    ctf_trk_data  );
00157   if(m_doSys[RPC]) SimpleDigi(    rpc_cen_data,1);
00158   if(m_doSys[RPC]) SimpleDigi(    rpc_for_data,3);
00159   if(m_doSys[LTC]) SimpleDigi(        ltc_data  );
00160   if(m_doSys[GMT]) SimpleDigi(        gmt_data  );
00161   if(m_doSys[GMT]) SimpleDigi(    gmt_rdt_data  );
00162   if(m_doSys[GLT]) SimpleDigi(    glt_rdt_data  );
00163   if(m_doSys[GLT]) SimpleDigi(    glt_evm_data  );
00164   if(m_doSys[GLT]) SimpleDigi(    glt_obj_data  );
00165 
00167   if(m_doSys[ETP]) iEvent.put(    ecal_tp_data,instName[ETP][0]);
00168   if(m_doSys[HTP]) iEvent.put(    hcal_tp_data,instName[HTP][0]);
00169   if(m_doSys[RCT]) iEvent.put(     rct_em_data,instName[RCT][0]);
00170   if(m_doSys[RCT]) iEvent.put(    rct_rgn_data,instName[RCT][0]);
00171   if(m_doSys[GCT]) iEvent.put(gct_isolaem_data,instName[GCT][0]);
00172   if(m_doSys[GCT]) iEvent.put(gct_noisoem_data,instName[GCT][1]);
00173   if(m_doSys[GCT]) iEvent.put(gct_cenjets_data,instName[GCT][2]);
00174   if(m_doSys[GCT]) iEvent.put(gct_forjets_data,instName[GCT][3]);
00175   if(m_doSys[GCT]) iEvent.put(gct_taujets_data,instName[GCT][4]);
00176   if(m_doSys[DTP]) iEvent.put(     dtp_ph_data,instName[DTP][0]);
00177   if(m_doSys[DTP]) iEvent.put(     dtp_th_data,instName[DTP][0]);
00178   if(m_doSys[DTF]) iEvent.put(        dtf_data,instName[DTF][0]);
00179   if(m_doSys[DTF]) iEvent.put(    dtf_trk_data,instName[DTF][1]);
00180   if(m_doSys[CTP]) iEvent.put(        ctp_data,instName[CTP][0]);
00181   if(m_doSys[CTF]) iEvent.put(        ctf_data,instName[CTF][0]);
00182   if(m_doSys[CTF]) iEvent.put(    ctf_trk_data,instName[CTF][1]);
00183   if(m_doSys[RPC]) iEvent.put(    rpc_cen_data,instName[RPC][0]);
00184   if(m_doSys[RPC]) iEvent.put(    rpc_for_data,instName[RPC][1]);
00185   if(m_doSys[LTC]) iEvent.put(        ltc_data,instName[LTC][0]);
00186   if(m_doSys[GMT]) iEvent.put(        gmt_data,instName[GMT][0]);
00187   if(m_doSys[GMT]) iEvent.put(    gmt_rdt_data,instName[GMT][0]);
00188   if(m_doSys[GLT]) iEvent.put(    glt_rdt_data,instName[GLT][0]);
00189   if(m_doSys[GLT]) iEvent.put(    glt_evm_data,instName[GLT][0]);
00190   if(m_doSys[GLT]) iEvent.put(    glt_obj_data,instName[GLT][0]);
00191 
00192   nevt_++;
00193 
00194   if(verbose())
00195     std::cout << "L1DummyProducer::produce end.\n" << std::flush;
00196   
00197 }