CMS 3D CMS Logo

L1EmulBias.cc
Go to the documentation of this file.
2 
6 
7 using namespace dedefs;
8 
10 
11  verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag",0);
12 
13  for(int sys=0; sys<DEnsys; sys++) {
14  std::string label = SystLabel[sys] + "source";
15  m_DEsource[sys][0] = iConfig.getParameter<edm::InputTag>(label);
16  if(sys==CTF) {
17  std::string label = "CTTsource";
18  m_DEsource[sys][1] = iConfig.getParameter<edm::InputTag>(label);
19  }
20  }
21 
22  std::vector<unsigned int> compColls
23  = iConfig.getUntrackedParameter<std::vector<unsigned int> >("DO_SYSTEM");
24  for(int i=0; i<DEnsys; i++)
25  m_doSys[i] = compColls[i];
26 
27  if(verbose()) {
28  std::cout << "[L1EmulBias] do sys? ";
29  for(int i=0; i<DEnsys; i++)
30  std::cout << m_doSys[i];
31  std::cout << "\n\t";
32  for(int i=0; i<DEnsys; i++)
33  if(m_doSys[i])
34  std::cout << SystLabel[i] << " ";
35  std::cout << std::endl;
36  }
37 
38  std::string CollInstName[DEnsys][5];
39  for(int i=0; i<DEnsys; i++)
40  for(int j=0; j<5; j++)
41  CollInstName[i][j]=std::string("");
42 
43  CollInstName[GCT][0]+="isoEm" ;
44  CollInstName[GCT][1]+="nonIsoEm";
45  CollInstName[GCT][2]+="cenJets" ;
46  CollInstName[GCT][3]+="forJets" ;
47  CollInstName[GCT][4]+="tauJets" ;
48  CollInstName[DTF][0]+="DT" ;
49  CollInstName[DTF][1]+="DTTF" ;
50  CollInstName[CTF][0]+="CSC" ;
51  CollInstName[CTF][1]+="" ;
52  CollInstName[RPC][0]+="RPCb" ;
53  CollInstName[RPC][1]+="RPCf" ;
54 
55  for(int i=0; i<DEnsys; i++)
56  for(int j=0; j<5; j++)
57  instName[i][j] = CollInstName[i][j];
58 
59  if(verbose())
60  for(int i=0; i<DEnsys; i++)
61  for(int j=0; j<5; j++)
62  if(instName[i][j] != "")
63  std::cout << "[emulbias] " << i << " " << SystLabel[i]
64  << " " << j << " " << instName[i][j]
65  << std::endl;
66 
68  assert(ETP==0); assert(HTP==1); assert(RCT== 2); assert(GCT== 3);
69  assert(DTP==4); assert(DTF==5); assert(CTP== 6); assert(CTF== 7);
70  assert(RPC==8); assert(LTC==9); assert(GMT==10); assert(GLT==11);
71 
73  if(m_doSys[ETP]) produces<EcalTrigPrimDigiCollection> (instName[ETP][0]);
74  if(m_doSys[HTP]) produces<HcalTrigPrimDigiCollection> (instName[HTP][0]);
75  if(m_doSys[RCT]) produces<L1CaloEmCollection> (instName[RCT][0]);
76  if(m_doSys[RCT]) produces<L1CaloRegionCollection> (instName[RCT][0]);
77  if(m_doSys[GCT]) produces<L1GctEmCandCollection> (instName[GCT][0]);
78  if(m_doSys[GCT]) produces<L1GctEmCandCollection> (instName[GCT][1]);
79  if(m_doSys[GCT]) produces<L1GctJetCandCollection> (instName[GCT][2]);
80  if(m_doSys[GCT]) produces<L1GctJetCandCollection> (instName[GCT][3]);
81  if(m_doSys[GCT]) produces<L1GctJetCandCollection> (instName[GCT][4]);
82  if(m_doSys[DTP]) produces<L1MuDTChambPhContainer> (instName[DTP][0]);
83  if(m_doSys[DTP]) produces<L1MuDTChambThContainer> (instName[DTP][0]);
84  if(m_doSys[DTF]) produces<L1MuRegionalCandCollection> (instName[DTF][0]);
85  if(m_doSys[DTF]) produces<L1MuDTTrackContainer> (instName[DTF][1]);
86  if(m_doSys[CTP]) produces<CSCCorrelatedLCTDigiCollection> (instName[CTP][0]);
87  if(m_doSys[CTF]) produces<L1MuRegionalCandCollection> (instName[CTF][0]);
88  if(m_doSys[CTF]) produces<L1CSCTrackCollection> (instName[CTF][1]);
89  if(m_doSys[RPC]) produces<L1MuRegionalCandCollection> (instName[RPC][0]);
90  if(m_doSys[RPC]) produces<L1MuRegionalCandCollection> (instName[RPC][1]);
91  if(m_doSys[LTC]) produces<LTCDigiCollection> (instName[LTC][0]);
92  if(m_doSys[GMT]) produces<L1MuGMTCandCollection> (instName[GMT][0]);
93  if(m_doSys[GMT]) produces<L1MuGMTReadoutCollection> (instName[GMT][0]);
94  if(m_doSys[GLT]) produces<L1GlobalTriggerReadoutRecord> (instName[GLT][0]);
95  if(m_doSys[GLT]) produces<L1GlobalTriggerEvmReadoutRecord>(instName[GLT][0]);
96  if(m_doSys[GLT]) produces<L1GlobalTriggerObjectMapRecord> (instName[GLT][0]);
97 
99  if(!rng.isAvailable()) {
100  throw cms::Exception("Configuration")
101  << "L1EmulBias requires the RandomNumberGeneratorService\n"
102  "which is not present in the configuration file. You must add the service\n"
103  "in the configuration file or remove the modules that require it.";
104  }
105 
106  if(verbose())
107  std::cout << "L1EmulBias::L1EmulBias()... done." << std::endl;
108 }
109 
111 }
112 
113 // ------------ method called to produce the data ------------
114 void
116 
118  CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID());
119 
120  if(verbose())
121  std::cout << "L1EmulBias::produce...\n" << std::flush;
122 
128  edm::Handle<L1GctEmCandCollection> gct_isolaem_emul;
129  edm::Handle<L1GctEmCandCollection> gct_noisoem_emul;
130  edm::Handle<L1GctJetCandCollection> gct_cenjets_emul;
131  edm::Handle<L1GctJetCandCollection> gct_forjets_emul;
132  edm::Handle<L1GctJetCandCollection> gct_taujets_emul;
149 
151  if(m_doSys[ETP]) iEvent.getByLabel(m_DEsource[ETP][0].label(),instName[ETP][0], ecal_tp_emul);
152  if(m_doSys[HTP]) iEvent.getByLabel(m_DEsource[HTP][0].label(),instName[HTP][0], hcal_tp_emul);
153  if(m_doSys[RCT]) iEvent.getByLabel(m_DEsource[RCT][0].label(),instName[RCT][0], rct_em_emul);
154  if(m_doSys[RCT]) iEvent.getByLabel(m_DEsource[RCT][0].label(),instName[RCT][0], rct_rgn_emul);
155  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][0],gct_isolaem_emul);
156  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][1],gct_noisoem_emul);
157  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][2],gct_cenjets_emul);
158  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][3],gct_forjets_emul);
159  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][4],gct_taujets_emul);
160  if(m_doSys[DTP]) iEvent.getByLabel(m_DEsource[DTP][0].label(),instName[DTP][0], dtp_ph_emul);
161  if(m_doSys[DTP]) iEvent.getByLabel(m_DEsource[DTP][0].label(),instName[DTP][0], dtp_th_emul);
162  if(m_doSys[DTF]) iEvent.getByLabel(m_DEsource[DTF][0].label(),instName[DTF][0], dtf_emul);
163  if(m_doSys[DTF]) iEvent.getByLabel(m_DEsource[DTF][0].label(),instName[DTF][1], dtf_trk_emul);
164  if(m_doSys[CTP]) iEvent.getByLabel(m_DEsource[CTP][0].label(),instName[CTP][0], ctp_emul);
165  if(m_doSys[CTF]) iEvent.getByLabel(m_DEsource[CTF][0].label(),instName[CTF][0], ctf_emul);
166  if(m_doSys[CTF]) iEvent.getByLabel(m_DEsource[CTF][1].label(),instName[CTF][1], ctf_trk_emul);
167  if(m_doSys[RPC]) iEvent.getByLabel(m_DEsource[RPC][0].label(),instName[RPC][0], rpc_cen_emul);
168  if(m_doSys[RPC]) iEvent.getByLabel(m_DEsource[RPC][0].label(),instName[RPC][1], rpc_for_emul);
169  if(m_doSys[LTC]) iEvent.getByLabel(m_DEsource[LTC][0].label(),instName[LTC][0], ltc_emul);
170  if(m_doSys[GMT]) iEvent.getByLabel(m_DEsource[GMT][0].label(),instName[GMT][0], gmt_emul);
171  if(m_doSys[GMT]) iEvent.getByLabel(m_DEsource[GMT][0].label(),instName[GMT][0], gmt_rdt_emul);
172  if(m_doSys[GLT]) iEvent.getByLabel(m_DEsource[GLT][0].label(),instName[GLT][0], glt_rdt_emul);
173  if(m_doSys[GLT]) iEvent.getByLabel(m_DEsource[GLT][0].label(),instName[GLT][0], glt_evm_emul);
174  if(m_doSys[GLT]) iEvent.getByLabel(m_DEsource[GLT][0].label(),instName[GLT][0], glt_obj_emul);
175 
177  if(m_doSys[ETP]) assert( ecal_tp_emul.isValid());
178  if(m_doSys[HTP]) assert( hcal_tp_emul.isValid());
179  if(m_doSys[RCT]) assert( rct_em_emul.isValid());
180  if(m_doSys[RCT]) assert( rct_rgn_emul.isValid());
181  if(m_doSys[GCT]) assert(gct_isolaem_emul.isValid());
182  if(m_doSys[GCT]) assert(gct_noisoem_emul.isValid());
183  if(m_doSys[GCT]) assert(gct_cenjets_emul.isValid());
184  if(m_doSys[GCT]) assert(gct_forjets_emul.isValid());
185  if(m_doSys[GCT]) assert(gct_taujets_emul.isValid());
186  if(m_doSys[DTP]) assert( dtp_ph_emul.isValid());
187  if(m_doSys[DTP]) assert( dtp_th_emul.isValid());
188  if(m_doSys[DTF]) assert( dtf_emul.isValid());
189  if(m_doSys[DTF]) assert( dtf_trk_emul.isValid());
190  if(m_doSys[CTP]) assert( ctp_emul.isValid());
191  if(m_doSys[CTF]) assert( ctf_emul.isValid());
192  if(m_doSys[CTF]) assert( ctf_trk_emul.isValid());
193  if(m_doSys[RPC]) assert( rpc_cen_emul.isValid());
194  if(m_doSys[RPC]) assert( rpc_for_emul.isValid());
195  if(m_doSys[LTC]) assert( ltc_emul.isValid());
196  if(m_doSys[GMT]) assert( gmt_emul.isValid());
197  if(m_doSys[GMT]) assert( gmt_rdt_emul.isValid());
198  if(m_doSys[GLT]) assert( glt_rdt_emul.isValid());
199  if(m_doSys[GLT]) assert( glt_evm_emul.isValid());
200  if(m_doSys[GLT]) assert( glt_obj_emul.isValid());
201 
203  std::unique_ptr<EcalTrigPrimDigiCollection> ecal_tp_data(new EcalTrigPrimDigiCollection );
204  std::unique_ptr<HcalTrigPrimDigiCollection> hcal_tp_data(new HcalTrigPrimDigiCollection );
205  std::unique_ptr<L1CaloEmCollection> rct_em_data(new L1CaloEmCollection );
206  std::unique_ptr<L1CaloRegionCollection> rct_rgn_data(new L1CaloRegionCollection );
207  std::unique_ptr<L1GctEmCandCollection> gct_isolaem_data(new L1GctEmCandCollection );
208  std::unique_ptr<L1GctEmCandCollection> gct_noisoem_data(new L1GctEmCandCollection );
209  std::unique_ptr<L1GctJetCandCollection> gct_cenjets_data(new L1GctJetCandCollection );
210  std::unique_ptr<L1GctJetCandCollection> gct_forjets_data(new L1GctJetCandCollection );
211  std::unique_ptr<L1GctJetCandCollection> gct_taujets_data(new L1GctJetCandCollection );
212  std::unique_ptr<L1MuDTChambPhContainer> dtp_ph_data(new L1MuDTChambPhContainer );
213  std::unique_ptr<L1MuDTChambThContainer> dtp_th_data(new L1MuDTChambThContainer );
214  std::unique_ptr<L1MuRegionalCandCollection> dtf_data(new L1MuRegionalCandCollection );
215  std::unique_ptr<L1MuDTTrackContainer> dtf_trk_data(new L1MuDTTrackContainer );
216  std::unique_ptr<CSCCorrelatedLCTDigiCollection> ctp_data(new CSCCorrelatedLCTDigiCollection );
217  std::unique_ptr<L1MuRegionalCandCollection> ctf_data(new L1MuRegionalCandCollection );
218  std::unique_ptr<L1CSCTrackCollection> ctf_trk_data(new L1CSCTrackCollection );
219  std::unique_ptr<L1MuRegionalCandCollection> rpc_cen_data(new L1MuRegionalCandCollection );
220  std::unique_ptr<L1MuRegionalCandCollection> rpc_for_data(new L1MuRegionalCandCollection );
221  std::unique_ptr<LTCDigiCollection> ltc_data(new LTCDigiCollection );
222  std::unique_ptr<L1MuGMTCandCollection> gmt_data(new L1MuGMTCandCollection );
223  std::unique_ptr<L1MuGMTReadoutCollection> gmt_rdt_data(new L1MuGMTReadoutCollection );
224  std::unique_ptr<L1GlobalTriggerReadoutRecord> glt_rdt_data(new L1GlobalTriggerReadoutRecord );
225  std::unique_ptr<L1GlobalTriggerEvmReadoutRecord> glt_evm_data(new L1GlobalTriggerEvmReadoutRecord);
226  std::unique_ptr<L1GlobalTriggerObjectMapRecord> glt_obj_data(new L1GlobalTriggerObjectMapRecord );
227 
228  if(verbose())
229  std::cout << "L1EmulBias::produce - modify...\n" << std::flush;
230 
232  if(m_doSys[ETP]) ModifyCollection( ecal_tp_data, ecal_tp_emul, engine);
233  if(m_doSys[HTP]) ModifyCollection( hcal_tp_data, hcal_tp_emul, engine);
234  if(m_doSys[RCT]) ModifyCollection( rct_em_data, rct_em_emul, engine);
235  if(m_doSys[RCT]) ModifyCollection( rct_rgn_data, rct_rgn_emul, engine);
236  if(m_doSys[GCT]) ModifyCollection(gct_isolaem_data,gct_isolaem_emul, engine);
237  if(m_doSys[GCT]) ModifyCollection(gct_noisoem_data,gct_noisoem_emul, engine);
238  if(m_doSys[GCT]) ModifyCollection(gct_cenjets_data,gct_cenjets_emul, engine);
239  if(m_doSys[GCT]) ModifyCollection(gct_forjets_data,gct_forjets_emul, engine);
240  if(m_doSys[GCT]) ModifyCollection(gct_taujets_data,gct_taujets_emul, engine);
241  if(m_doSys[DTP]) ModifyCollection( dtp_ph_data, dtp_ph_emul, engine);
242  if(m_doSys[DTP]) ModifyCollection( dtp_th_data, dtp_th_emul, engine);
243  if(m_doSys[DTF]) ModifyCollection( dtf_data, dtf_emul, engine);
244  if(m_doSys[DTF]) ModifyCollection( dtf_trk_data, dtf_trk_emul, engine);
245  if(m_doSys[CTP]) ModifyCollection( ctp_data, ctp_emul, engine);
246  if(m_doSys[CTF]) ModifyCollection( ctf_data, ctf_emul, engine);
247  if(m_doSys[CTF]) ModifyCollection( ctf_trk_data, ctf_trk_emul, engine);
248  if(m_doSys[RPC]) ModifyCollection( rpc_cen_data, rpc_cen_emul, engine);
249  if(m_doSys[RPC]) ModifyCollection( rpc_for_data, rpc_for_emul, engine);
250  if(m_doSys[LTC]) ModifyCollection( ltc_data, ltc_emul, engine);
251  if(m_doSys[GMT]) ModifyCollection( gmt_data, gmt_emul, engine);
252  if(m_doSys[GMT]) ModifyCollection( gmt_rdt_data, gmt_rdt_emul, engine);
253  if(m_doSys[GLT]) ModifyCollection( glt_rdt_data, glt_rdt_emul, engine);
254  if(m_doSys[GLT]) ModifyCollection( glt_evm_data, glt_evm_emul, engine);
255  if(m_doSys[GLT]) ModifyCollection( glt_obj_data, glt_obj_emul, engine);
256 
257  if(verbose())
258  std::cout << "L1EmulBias::produce - put...\n" << std::flush;
259 
261  if(m_doSys[ETP]) iEvent.put(std::move( ecal_tp_data), instName[ETP][0]);
262  if(m_doSys[HTP]) iEvent.put(std::move( hcal_tp_data), instName[HTP][0]);
263  if(m_doSys[RCT]) iEvent.put(std::move( rct_em_data), instName[RCT][0]);
264  if(m_doSys[RCT]) iEvent.put(std::move( rct_rgn_data), instName[RCT][0]);
265  if(m_doSys[GCT]) iEvent.put(std::move(gct_isolaem_data), instName[GCT][0]);
266  if(m_doSys[GCT]) iEvent.put(std::move(gct_noisoem_data), instName[GCT][1]);
267  if(m_doSys[GCT]) iEvent.put(std::move(gct_cenjets_data), instName[GCT][2]);
268  if(m_doSys[GCT]) iEvent.put(std::move(gct_forjets_data), instName[GCT][3]);
269  if(m_doSys[GCT]) iEvent.put(std::move(gct_taujets_data), instName[GCT][4]);
270  if(m_doSys[DTP]) iEvent.put(std::move( dtp_ph_data), instName[DTP][0]);
271  if(m_doSys[DTP]) iEvent.put(std::move( dtp_th_data), instName[DTP][0]);
272  if(m_doSys[DTF]) iEvent.put(std::move( dtf_data), instName[DTF][0]);
273  if(m_doSys[DTF]) iEvent.put(std::move( dtf_trk_data), instName[DTF][1]);
274  if(m_doSys[CTP]) iEvent.put(std::move( ctp_data), instName[CTP][0]);
275  if(m_doSys[CTF]) iEvent.put(std::move( ctf_data), instName[CTF][0]);
276  if(m_doSys[CTF]) iEvent.put(std::move( ctf_trk_data), instName[CTF][1]);
277  if(m_doSys[RPC]) iEvent.put(std::move( rpc_cen_data), instName[RPC][0]);
278  if(m_doSys[RPC]) iEvent.put(std::move( rpc_for_data), instName[RPC][1]);
279  if(m_doSys[LTC]) iEvent.put(std::move( ltc_data), instName[LTC][0]);
280  if(m_doSys[GMT]) iEvent.put(std::move( gmt_data), instName[GMT][0]);
281  if(m_doSys[GMT]) iEvent.put(std::move( gmt_rdt_data), instName[GMT][0]);
282  if(m_doSys[GLT]) iEvent.put(std::move( glt_rdt_data), instName[GLT][0]);
283  if(m_doSys[GLT]) iEvent.put(std::move( glt_evm_data), instName[GLT][0]);
284  if(m_doSys[GLT]) iEvent.put(std::move( glt_obj_data), instName[GLT][0]);
285 
286  if(verbose())
287  std::cout << "L1EmulBias::produce...done.\n" << std::flush;
288 
289 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< L1CaloEmCand > L1CaloEmCollection
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const int DEnsys
Definition: DEtrait.h:38
bool verbose
std::vector< L1CSCTrack > L1CSCTrackCollection
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
L1EmulBias(const edm::ParameterSet &)
Definition: L1EmulBias.cc:9
std::vector< L1GctJetCand > L1GctJetCandCollection
int iEvent
Definition: GenABIO.cc:230
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: L1EmulBias.cc:115
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< LTCDigi > LTCDigiCollection
Definition: LTCDigi.h:106
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
const std::string SystLabel[DEnsys]
Definition: DEtrait.h:45
Definition: DEtrait.h:36
StreamID streamID() const
Definition: Event.h:86
std::vector< L1CaloRegion > L1CaloRegionCollection
def move(src, dest)
Definition: eostools.py:510
std::vector< L1MuGMTCand > L1MuGMTCandCollection
Definition: DEtrait.h:78
std::vector< L1GctEmCand > L1GctEmCandCollection