1 #ifndef L1_DUMMY_PRODUCER_H
2 #define L1_DUMMY_PRODUCER_H
36 #include "CLHEP/Random/RandomEngine.h"
37 #include "CLHEP/Random/RandGaussQ.h"
73 std::unique_ptr<EcalTrigPrimDigiCollection>&
data,
76 std::cout <<
"L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
77 int side = (engine->flat() > 0.5) ? -1 : 1;
78 int ieta = (
int)(1 + 17 * engine->flat());
79 int iphi = (
int)(1 + 72 * engine->flat());
83 bool fg = (engine->flat() > 0.5);
84 int ttf = (
int)(8 * engine->flat());
88 data->push_back(e_digi);
92 std::cout <<
"L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
97 std::unique_ptr<HcalTrigPrimDigiCollection>&
data,
100 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
101 int side = (engine->flat() > 0.5) ? -1 : 1;
102 int ieta = (
int)(1 + 17 * engine->flat());
103 int iphi = (
int)(1 + 72 * engine->flat());
110 data->push_back(h_digi);
114 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
119 std::unique_ptr<L1CaloEmCollection>&
data,
122 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
124 unsigned rank =
energy & 0x3f;
125 unsigned region = (engine->flat() > 0.5 ? 0 : 1);
126 unsigned card = (unsigned)(7 * engine->flat());
127 unsigned crate = (unsigned)(18 * engine->flat());
128 bool iso = (engine->flat() > 0.4);
129 uint16_t
index = (unsigned)(4 * engine->flat());
135 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
140 std::unique_ptr<L1CaloRegionCollection>&
data,
143 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
146 bool overFlow =
false;
147 bool tauVeto =
false;
150 unsigned crate = (unsigned)(18 * engine->flat());
151 unsigned card = (unsigned)(7 * engine->flat());
152 unsigned rgn = crate % 2;
157 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
162 std::unique_ptr<L1GctEmCandCollection>&
data,
165 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
176 <<
"L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
177 <<
" invalid type: " <<
type << std::endl;
180 unsigned rank =
energy & 0x3f;
181 unsigned phi = (unsigned)(18 * engine->flat());
182 unsigned eta = (unsigned)(7 * engine->flat());
183 if (engine->flat() > 0.5)
190 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
195 std::unique_ptr<L1GctJetCandCollection>&
data,
198 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
215 <<
"L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
216 <<
" invalid type: " <<
type << std::endl;
220 unsigned rank =
energy & 0x3f;
221 unsigned phi = (unsigned)(18 * engine->flat());
222 unsigned eta = (unsigned)(7 * engine->flat());
223 if (engine->flat() > 0.5)
229 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
234 std::unique_ptr<L1MuRegionalCandCollection>&
data,
237 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
240 unsigned type_idx =
type;
243 float phiv(0.), etav(0.), ptv(0.);
244 for (
int i = 0;
i < 4;
i++) {
245 phi = (
int)(144 * engine->flat());
246 eta = (
int)(63 * engine->flat());
248 etav = 2.5 * (-1 + 2 *
eta / 63.);
249 pt = ((
int)(32 * engine->flat())) & 0x1f;
250 ptv = 100 * (
pt / 31.);
251 charge = (engine->flat() > 0.5 ? 0 : 1);
257 cand.setPhiValue(phiv);
258 cand.setEtaValue(etav);
259 cand.setPtValue(ptv);
265 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
270 std::unique_ptr<L1MuDTTrackContainer>&
data,
275 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
278 typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
279 std::unique_ptr<L1MuDTTrackCandCollection> tracksd(
new L1MuDTTrackCandCollection());
280 for (L1MuRegionalCandCollection::const_iterator it =
tracks->begin(); it !=
tracks->end(); it++) {
283 cnd->
setBx(it->bx());
285 tracksd->push_back(*cnd);
287 data->setContainer(*tracksd);
289 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
296 std::unique_ptr<L1MuDTChambPhContainer>&
data,
299 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
300 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
302 Phi_Container
tracks(ntrk);
303 int ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt;
304 for (
int i = 0;
i < ntrk;
i++) {
314 uwh = (
int)(-2 + 5 * engine->flat());
315 usc = (
int)(12 * engine->flat());
316 ust = (
int)(1. + 4 * engine->flat());
317 uqua = (
int)(8 * engine->flat());
325 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
330 std::unique_ptr<L1MuDTChambThContainer>&
data,
333 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
334 typedef std::vector<L1MuDTChambThDigi> The_Container;
336 The_Container
tracks(ntrk);
337 int ubx, uwh, usc, ust, uos[7], uqa[7];
338 for (
int i = 0;
i < ntrk;
i++) {
340 uwh = (
int)(-2 + 5 * engine->flat());
341 usc = (
int)(12 * engine->flat());
342 ust = (
int)(1. + 4 * engine->flat());
343 for (
int j = 0;
j < 7;
j++) {
344 uos[
j] = (engine->flat() > 0.5 ? 0 : 1);
345 uqa[
j] = (engine->flat() > 0.5 ? 0 : 1);
355 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
360 std::unique_ptr<L1MuGMTCandCollection>&
data,
363 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
375 double eng =
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine);
377 double eta = 2.5 * (-1 + 2 * engine->flat());
378 cand.setPtValue(eng);
381 unsigned engp = (unsigned)(
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine));
382 unsigned phip = (unsigned)(255 * engine->flat());
383 unsigned etap = (unsigned)(63 * engine->flat());
384 cand.setPtPacked(engp & 0x1f);
385 cand.setPhiPacked(phip & 0x7f);
386 cand.setEtaPacked(etap & 0x3f);
387 double r = engine->flat();
388 cand.setIsolation(
r > 0.2);
389 cand.setMIP(
r > 0.7);
390 cand.setChargePacked(
r > 0.5 ? 0 : 1);
394 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
399 std::unique_ptr<L1MuGMTReadoutCollection>&
data,
402 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
416 for (
int i = 0;
i < 4;
i++) {
422 for (
int nr = 0;
nr < 4;
nr++) {
427 int eta = (
int)(14 * engine->flat());
428 int phi = (
int)(18 * engine->flat());
432 data->addRecord(rec);
443 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
449 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
477 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
482 std::unique_ptr<CSCCorrelatedLCTDigiCollection>&
data,
485 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
492 enum eMinNum {
MIN_ENDCAP = 1, MIN_STATION = 1, MIN_RING = 1, MIN_CHAMBER = 1, MIN_LAYER = 1 };
493 enum eMaxNum {
MAX_ENDCAP = 2, MAX_STATION = 4, MAX_RING = 4, MAX_CHAMBER = 36, MAX_LAYER = 6 };
494 float rnd = engine->flat();
496 int st = (
int)(MIN_STATION + (MAX_STATION - MIN_STATION) * rnd + 1);
497 int rg = (
int)(MIN_RING + (MAX_RING - MIN_RING) * rnd + 1);
498 int ch = (
int)(MIN_CHAMBER + (MAX_CHAMBER - MIN_CHAMBER) * rnd + 1);
499 int lr = (
int)(MIN_LAYER + (MAX_LAYER - MIN_LAYER) * rnd + 1);
503 data->insertDigi(did, dg);
505 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
510 std::unique_ptr<L1CSCTrackCollection>&
data,
513 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
525 L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
526 data->push_back(l1csctrk);
532 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;