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());
131 L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
132 data->push_back(cand);
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;
145 unsigned et = energy & 0x3ff;
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;
153 L1CaloRegion cand(et, overFlow, tauVeto, mip, quiet, crate, card, rgn);
154 data->push_back(cand);
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)
184 eta = (eta & 0x7) + (0x1 << 3);
186 data->push_back(cand);
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)
224 eta = (eta & 0x7) + (0x1 << 3);
226 data->push_back(cand);
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;
239 assert(type >= 0 && type < 4);
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);
255 quality = (int)(8 * engine->flat());
256 L1MuRegionalCand cand(type_idx, phi, eta, pt, charge, ch_valid, finehalo, quality, bx);
260 data->push_back(cand);
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());
319 tracks.push_back(cand);
321 data->setContainer(tracks);
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);
348 tracks.push_back(cand);
350 data->setContainer(tracks);
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());
381 unsigned engp = (unsigned)(
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine));
382 unsigned phip = (unsigned)(255 * engine->flat());
383 unsigned etap = (unsigned)(63 * engine->flat());
387 double r = engine->flat();
392 data->push_back(cand);
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++) {
423 int eng = (int)(
EBase_ +
ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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;
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
void setBxInEvent(int bxie)
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
void setMIP(bool mip)
set min ionizing bit for muon candidate
float etaValue() const
get eta-value of muon candidate
uint32_t const *__restrict__ Quality * quality
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
Level-1 Trigger jet candidate.
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
auto const & tracks
cannot be loose
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
void setMIPbit(int eta, int phi)
set MIP bit
void setBx(int bx)
Set Bunch Crossing.
float ptValue() const
get pt-value of muon candidate in GeV
void setPhiValue(float phiVal)
Set Phi Value.
void setDataWord(unsigned dataword)
Set data word.
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
void setPhiValue(float phiVal)
Setters for physical values.
unsigned getDataWord() const
return data word
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
std::string instName[dedefs::DEnsys][5]
void setBx(int bx)
set bunch crossing identifier
L1DummyProducer(const edm::ParameterSet &)
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
void SimpleDigi(CLHEP::HepRandomEngine *, std::unique_ptr< T > &data, int type=0)
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
void setBxNr(int bxnr)
set counters
void produce(edm::Event &, const edm::EventSetup &) override
int bx() const
return bunch crossing identifier
~L1DummyProducer() override
char data[epos_bytes_allocation]
A calorimeter trigger region (sum of 4x4 trigger towers)
void beginJob(void) override
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
void setPtValue(float ptVal)
Set Pt Value.
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
void setIsolation(bool isol)
set isolation of muon candidate
bool isTau(const Candidate &part)