1 #ifndef L1_DUMMY_PRODUCER_H
2 #define L1_DUMMY_PRODUCER_H
34 #include "CLHEP/Random/RandomEngine.h"
35 #include "CLHEP/Random/RandGaussQ.h"
71 std::unique_ptr<EcalTrigPrimDigiCollection>&
data,
74 std::cout <<
"L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
75 int side = (engine->flat() > 0.5) ? -1 : 1;
76 int ieta = (
int)(1 + 17 * engine->flat());
77 int iphi = (
int)(1 + 72 * engine->flat());
81 bool fg = (engine->flat() > 0.5);
82 int ttf = (
int)(8 * engine->flat());
86 data->push_back(e_digi);
90 std::cout <<
"L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
95 std::unique_ptr<HcalTrigPrimDigiCollection>&
data,
98 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
99 int side = (engine->flat() > 0.5) ? -1 : 1;
100 int ieta = (
int)(1 + 17 * engine->flat());
101 int iphi = (
int)(1 + 72 * engine->flat());
108 data->push_back(h_digi);
112 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
117 std::unique_ptr<L1CaloEmCollection>&
data,
120 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
122 unsigned rank =
energy & 0x3f;
123 unsigned region = (engine->flat() > 0.5 ? 0 : 1);
124 unsigned card = (unsigned)(7 * engine->flat());
125 unsigned crate = (unsigned)(18 * engine->flat());
126 bool iso = (engine->flat() > 0.4);
127 uint16_t
index = (unsigned)(4 * engine->flat());
133 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
138 std::unique_ptr<L1CaloRegionCollection>&
data,
141 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
144 bool overFlow =
false;
145 bool tauVeto =
false;
148 unsigned crate = (unsigned)(18 * engine->flat());
149 unsigned card = (unsigned)(7 * engine->flat());
150 unsigned rgn = crate % 2;
155 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
160 std::unique_ptr<L1GctEmCandCollection>&
data,
163 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
174 <<
"L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
175 <<
" invalid type: " <<
type << std::endl;
178 unsigned rank =
energy & 0x3f;
179 unsigned phi = (unsigned)(18 * engine->flat());
180 unsigned eta = (unsigned)(7 * engine->flat());
181 if (engine->flat() > 0.5)
188 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
193 std::unique_ptr<L1GctJetCandCollection>&
data,
196 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
213 <<
"L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
214 <<
" invalid type: " <<
type << std::endl;
218 unsigned rank =
energy & 0x3f;
219 unsigned phi = (unsigned)(18 * engine->flat());
220 unsigned eta = (unsigned)(7 * engine->flat());
221 if (engine->flat() > 0.5)
227 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
232 std::unique_ptr<L1MuRegionalCandCollection>&
data,
235 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
238 unsigned type_idx =
type;
241 float phiv(0.), etav(0.), ptv(0.);
242 for (
int i = 0;
i < 4;
i++) {
243 phi = (
int)(144 * engine->flat());
244 eta = (
int)(63 * engine->flat());
246 etav = 2.5 * (-1 + 2 *
eta / 63.);
247 pt = ((
int)(32 * engine->flat())) & 0x1f;
248 ptv = 100 * (
pt / 31.);
249 charge = (engine->flat() > 0.5 ? 0 : 1);
255 cand.setPhiValue(phiv);
256 cand.setEtaValue(etav);
257 cand.setPtValue(ptv);
263 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
268 std::unique_ptr<L1MuDTTrackContainer>&
data,
273 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
276 typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
277 std::unique_ptr<L1MuDTTrackCandCollection> tracksd(
new L1MuDTTrackCandCollection());
278 for (L1MuRegionalCandCollection::const_iterator it =
tracks->begin(); it !=
tracks->end(); it++) {
281 cnd->
setBx(it->bx());
283 tracksd->push_back(*cnd);
285 data->setContainer(*tracksd);
287 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
294 std::unique_ptr<L1MuDTChambPhContainer>&
data,
297 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
298 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
300 Phi_Container
tracks(ntrk);
301 int ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt;
302 for (
int i = 0;
i < ntrk;
i++) {
312 uwh = (
int)(-2 + 5 * engine->flat());
313 usc = (
int)(12 * engine->flat());
314 ust = (
int)(1. + 4 * engine->flat());
315 uqua = (
int)(8 * engine->flat());
323 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
328 std::unique_ptr<L1MuDTChambThContainer>&
data,
331 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
332 typedef std::vector<L1MuDTChambThDigi> The_Container;
334 The_Container
tracks(ntrk);
335 int ubx, uwh, usc, ust, uos[7], uqa[7];
336 for (
int i = 0;
i < ntrk;
i++) {
338 uwh = (
int)(-2 + 5 * engine->flat());
339 usc = (
int)(12 * engine->flat());
340 ust = (
int)(1. + 4 * engine->flat());
341 for (
int j = 0;
j < 7;
j++) {
342 uos[
j] = (engine->flat() > 0.5 ? 0 : 1);
343 uqa[
j] = (engine->flat() > 0.5 ? 0 : 1);
353 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
358 std::unique_ptr<L1MuGMTCandCollection>&
data,
361 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
373 double eng =
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine);
375 double eta = 2.5 * (-1 + 2 * engine->flat());
376 cand.setPtValue(eng);
379 unsigned engp = (unsigned)(
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine));
380 unsigned phip = (unsigned)(255 * engine->flat());
381 unsigned etap = (unsigned)(63 * engine->flat());
382 cand.setPtPacked(engp & 0x1f);
383 cand.setPhiPacked(phip & 0x7f);
384 cand.setEtaPacked(etap & 0x3f);
385 double r = engine->flat();
386 cand.setIsolation(
r > 0.2);
387 cand.setMIP(
r > 0.7);
388 cand.setChargePacked(
r > 0.5 ? 0 : 1);
392 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
397 std::unique_ptr<L1MuGMTReadoutCollection>&
data,
400 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
414 for (
int i = 0;
i < 4;
i++) {
420 for (
int nr = 0;
nr < 4;
nr++) {
425 int eta = (
int)(14 * engine->flat());
426 int phi = (
int)(18 * engine->flat());
430 data->addRecord(rec);
441 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
447 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
475 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
480 std::unique_ptr<CSCCorrelatedLCTDigiCollection>&
data,
483 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
490 enum eMinNum {
MIN_ENDCAP = 1, MIN_STATION = 1, MIN_RING = 1, MIN_CHAMBER = 1, MIN_LAYER = 1 };
491 enum eMaxNum {
MAX_ENDCAP = 2, MAX_STATION = 4, MAX_RING = 4, MAX_CHAMBER = 36, MAX_LAYER = 6 };
492 float rnd = engine->flat();
494 int st = (
int)(MIN_STATION + (MAX_STATION - MIN_STATION) * rnd + 1);
495 int rg = (
int)(MIN_RING + (MAX_RING - MIN_RING) * rnd + 1);
496 int ch = (
int)(MIN_CHAMBER + (MAX_CHAMBER - MIN_CHAMBER) * rnd + 1);
497 int lr = (
int)(MIN_LAYER + (MAX_LAYER - MIN_LAYER) * rnd + 1);
501 data->insertDigi(did, dg);
503 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
508 std::unique_ptr<L1CSCTrackCollection>&
data,
511 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
523 L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
524 data->push_back(l1csctrk);
530 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;