CMS 3D CMS Logo

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