1 #ifndef L1_DUMMY_PRODUCER_H 2 #define L1_DUMMY_PRODUCER_H 37 #include "CLHEP/Random/RandomEngine.h" 38 #include "CLHEP/Random/RandGaussQ.h" 72 CLHEP::HepRandomEngine* engine,
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 CLHEP::HepRandomEngine* engine,
98 std::unique_ptr<HcalTrigPrimDigiCollection>&
data,
101 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
102 int side = (engine->flat() > 0.5) ? -1 : 1;
103 int ieta = (
int)(1 + 17 * engine->flat());
104 int iphi = (
int)(1 + 72 * engine->flat());
111 data->push_back(h_digi);
115 std::cout <<
"L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
120 CLHEP::HepRandomEngine* engine,
121 std::unique_ptr<L1CaloEmCollection>&
data,
124 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
126 unsigned rank =
energy & 0x3f;
127 unsigned region = (engine->flat() > 0.5 ? 0 : 1);
128 unsigned card = (unsigned)(7 * engine->flat());
129 unsigned crate = (unsigned)(18 * engine->flat());
130 bool iso = (engine->flat() > 0.4);
131 uint16_t
index = (unsigned)(4 * engine->flat());
137 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
142 CLHEP::HepRandomEngine* engine,
143 std::unique_ptr<L1CaloRegionCollection>&
data,
146 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
149 bool overFlow =
false;
150 bool tauVeto =
false;
153 unsigned crate = (unsigned)(18 * engine->flat());
154 unsigned card = (unsigned)(7 * engine->flat());
155 unsigned rgn =
crate % 2;
160 std::cout <<
"L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
165 CLHEP::HepRandomEngine* engine,
166 std::unique_ptr<L1GctEmCandCollection>&
data,
169 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
180 <<
"L1DummyProducer::SimpleDigi production of L1GctEmCandCollection " 181 <<
" invalid type: " <<
type << std::endl;
184 unsigned rank =
energy & 0x3f;
185 unsigned phi = (unsigned)(18 * engine->flat());
186 unsigned eta = (unsigned)(7 * engine->flat());
187 if (engine->flat() > 0.5)
194 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
199 CLHEP::HepRandomEngine* engine,
200 std::unique_ptr<L1GctJetCandCollection>&
data,
203 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
220 <<
"L1DummyProducer::SimpleDigi production of L1GctJetCandCollection " 221 <<
" invalid type: " <<
type << std::endl;
225 unsigned rank =
energy & 0x3f;
226 unsigned phi = (unsigned)(18 * engine->flat());
227 unsigned eta = (unsigned)(7 * engine->flat());
228 if (engine->flat() > 0.5)
234 std::cout <<
"L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
239 CLHEP::HepRandomEngine* engine,
240 std::unique_ptr<L1MuRegionalCandCollection>&
data,
243 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
246 unsigned type_idx =
type;
249 float phiv(0.), etav(0.), ptv(0.);
250 for (
int i = 0;
i < 4;
i++) {
251 phi = (
int)(144 * engine->flat());
252 eta = (
int)(63 * engine->flat());
254 etav = 2.5 * (-1 + 2 *
eta / 63.);
255 pt = ((
int)(32 * engine->flat())) & 0x1f;
256 ptv = 100 * (
pt / 31.);
257 charge = (engine->flat() > 0.5 ? 0 : 1);
263 cand.setPhiValue(phiv);
264 cand.setEtaValue(etav);
265 cand.setPtValue(ptv);
271 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
276 CLHEP::HepRandomEngine* engine,
277 std::unique_ptr<L1MuDTTrackContainer>&
data,
282 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
285 typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
286 std::unique_ptr<L1MuDTTrackCandCollection> tracksd(
new L1MuDTTrackCandCollection());
287 for (L1MuRegionalCandCollection::const_iterator
it =
tracks->begin();
it !=
tracks->end();
it++) {
292 tracksd->push_back(*cnd);
294 data->setContainer(*tracksd);
296 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
303 CLHEP::HepRandomEngine* engine,
304 std::unique_ptr<L1MuDTChambPhContainer>&
data,
307 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
308 typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
310 Phi_Container
tracks(ntrk);
311 int ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt;
312 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());
319 uqua = (
int)(8 * engine->flat());
330 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
335 CLHEP::HepRandomEngine* engine,
336 std::unique_ptr<L1MuDTChambThContainer>&
data,
339 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
340 typedef std::vector<L1MuDTChambThDigi> The_Container;
342 The_Container
tracks(ntrk);
343 int ubx, uwh, usc, ust, uos[7], uqa[7];
344 for (
int i = 0;
i < ntrk;
i++) {
346 uwh = (
int)(-2 + 5 * engine->flat());
347 usc = (
int)(12 * engine->flat());
348 ust = (
int)(1. + 4 * engine->flat());
349 for (
int j = 0;
j < 7;
j++) {
350 uos[
j] = (engine->flat() > 0.5 ? 0 : 1);
351 uqa[
j] = (engine->flat() > 0.5 ? 0 : 1);
361 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
366 CLHEP::HepRandomEngine* engine,
367 std::unique_ptr<L1MuGMTCandCollection>&
data,
370 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
382 double eng =
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine);
384 double eta = 2.5 * (-1 + 2 * engine->flat());
385 cand.setPtValue(eng);
388 unsigned engp = (unsigned)(
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine));
389 unsigned phip = (unsigned)(255 * engine->flat());
390 unsigned etap = (unsigned)(63 * engine->flat());
391 cand.setPtPacked(engp & 0x1f);
392 cand.setPhiPacked(phip & 0x7f);
393 cand.setEtaPacked(etap & 0x3f);
394 double r = engine->flat();
395 cand.setIsolation(
r > 0.2);
396 cand.setMIP(
r > 0.7);
397 cand.setChargePacked(
r > 0.5 ? 0 : 1);
401 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
406 CLHEP::HepRandomEngine* engine,
407 std::unique_ptr<L1MuGMTReadoutCollection>&
data,
410 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
424 for (
int i = 0;
i < 4;
i++) {
430 for (
int nr = 0;
nr < 4;
nr++) {
435 int eta = (
int)(14 * engine->flat());
436 int phi = (
int)(18 * engine->flat());
440 data->addRecord(rec);
451 std::cout <<
"L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
456 CLHEP::HepRandomEngine*,
457 std::unique_ptr<LTCDigiCollection>&
data,
460 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
488 std::cout <<
"L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
493 CLHEP::HepRandomEngine* engine,
494 std::unique_ptr<CSCCorrelatedLCTDigiCollection>&
data,
497 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
504 static constexpr int MIN_ENDCAP = 1, MIN_STATION = 1, MIN_RING = 1, MIN_CHAMBER = 1, MIN_LAYER = 1;
505 static constexpr int MAX_ENDCAP = 2, MAX_STATION = 4, MAX_RING = 4, MAX_CHAMBER = 36, MAX_LAYER = 6;
507 float rnd = engine->flat();
509 int st = (
int)(MIN_STATION + (MAX_STATION - MIN_STATION) * rnd + 1);
510 int rg = (
int)(MIN_RING + (MAX_RING - MIN_RING) * rnd + 1);
511 int ch = (
int)(MIN_CHAMBER + (MAX_CHAMBER - MIN_CHAMBER) * rnd + 1);
512 int lr = (
int)(MIN_LAYER + (MAX_LAYER - MIN_LAYER) * rnd + 1);
516 data->insertDigi(did, dg);
518 std::cout <<
"L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
523 CLHEP::HepRandomEngine* engine,
524 std::unique_ptr<L1CSCTrackCollection>&
data,
527 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
539 L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
540 data->push_back(l1csctrk);
546 std::cout <<
"L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
void setBxInEvent(int bxie)
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
Level-1 Trigger jet candidate.
ALPAKA_FN_ACC int side(int ieta, int iphi)
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
Level-1 Region Calorimeter Trigger EM candidate.
void setInputCand(int nr, unsigned data)
set Input muon
unsigned getDataWord() const
return data word
void setPtValue(float ptVal)
Set Pt Value.
Level-1 Trigger EM candidate at output of GCT.
void setQuietbit(int eta, int phi)
set Quiet bit
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
void setMIPbit(int eta, int phi)
set MIP bit
void setBx(int bx)
Set Bunch Crossing.
void setPhiValue(float phiVal)
Set Phi Value.
void setDataWord(unsigned dataword)
Set data word.
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
std::string instName[dedefs::DEnsys][5]
L1DummyProducer(const edm::ParameterSet &)
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
void setBxNr(int bxnr)
set counters
void SimpleDigi(int nevt, CLHEP::HepRandomEngine *, std::unique_ptr< T > &data, int type=0) const
~L1DummyProducer() override
char data[epos_bytes_allocation]
float ptValue() const
get pt-value of muon candidate in GeV
A calorimeter trigger region (sum of 4x4 trigger towers)
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
float etaValue() const
get eta-value of muon candidate
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
int bx() const
return bunch crossing identifier
bool isTau(const Candidate &part)