CMS 3D CMS Logo

L1DummyProducer.h
Go to the documentation of this file.
1 #ifndef L1_DUMMY_PRODUCER_H
2 #define L1_DUMMY_PRODUCER_H
3 
4 /*\class L1DummyProducer
5  *\description produces simplified, random L1 trigger digis
6  *\usage pattern and monitoring software test and validation
7  *\author Nuno Leonardo (CERN)
8  *\date 07.07
9  */
10 
11 // system includes
12 #include <memory>
13 #include <string>
14 #include <iostream>
15 #include <fstream>
16 #include <iomanip>
17 #include <vector>
18 #include <algorithm>
19 #include "TMath.h"
20 #include <bitset>
21 #include <atomic>
22 
23 // common includes
30 
31 // l1 dataformats, d|e record includes
35 
36 // random # generator
37 #include "CLHEP/Random/RandomEngine.h"
38 #include "CLHEP/Random/RandGaussQ.h"
39 
41 public:
42  explicit L1DummyProducer(const edm::ParameterSet&);
43  ~L1DummyProducer() override;
44 
45 private:
46  //virtual void beginRun(edm::Run&, const edm::EventSetup&);
47  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
48 
49 public:
50  template <class T>
51  void SimpleDigi(int nevt, CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type = 0) const;
52 
53 private:
54  int verbose_;
55  int verbose() const { return verbose_; }
56  mutable std::atomic<int> nevt_;
57 
60 
61  double EBase_;
62  double ESigm_;
63 };
64 
65 template <class T>
66 void L1DummyProducer::SimpleDigi(int, CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type) const {
67  /*collections generated in specializations below*/
68 }
69 
70 template <>
72  CLHEP::HepRandomEngine* engine,
73  std::unique_ptr<EcalTrigPrimDigiCollection>& data,
74  int type) const {
75  if (verbose())
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()); //1-17
79  int iphi = (int)(1 + 72 * engine->flat()); //1-72
80  const EcalTrigTowerDetId e_id(side, EcalBarrel, ieta, iphi, 0);
81  EcalTriggerPrimitiveDigi e_digi(e_id);
82  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
83  bool fg = (engine->flat() > 0.5);
84  int ttf = (int)(8 * engine->flat()); //0-7
85  EcalTriggerPrimitiveSample e_sample(energy, fg, ttf);
86  e_digi.setSize(1); //set sampleOfInterest to 0
87  e_digi.setSample(0, e_sample);
88  data->push_back(e_digi);
89  //EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int triggerFlag);
90  //const EcalTrigTowerDetId e_id( zside , EcalBarrel, etaTT, phiTT, 0);
91  if (verbose())
92  std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
93 }
94 
95 template <>
97  CLHEP::HepRandomEngine* engine,
98  std::unique_ptr<HcalTrigPrimDigiCollection>& data,
99  int type) const {
100  if (verbose())
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());
105  const HcalTrigTowerDetId h_id(side * ieta, iphi);
106  HcalTriggerPrimitiveDigi h_digi(h_id);
107  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
108  HcalTriggerPrimitiveSample h_sample(energy, false, 0, 0);
109  h_digi.setSize(1); //set sampleOfInterest to 0
110  h_digi.setSample(0, h_sample);
111  data->push_back(h_digi);
112  //HcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int slb, int slbchan);
113  //HcalTrigTowerDetId(int ieta, int iphi);
114  if (verbose())
115  std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
116 }
117 
118 template <>
120  CLHEP::HepRandomEngine* engine,
121  std::unique_ptr<L1CaloEmCollection>& data,
122  int type) const {
123  if (verbose())
124  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
125  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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());
132  int16_t bx = nevt;
133  L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
134  data->push_back(cand);
135  //L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
136  if (verbose())
137  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
138 }
139 
140 template <>
142  CLHEP::HepRandomEngine* engine,
143  std::unique_ptr<L1CaloRegionCollection>& data,
144  int type) const {
145  if (verbose())
146  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
147  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
148  unsigned et = energy & 0x3ff;
149  bool overFlow = false; //(engine->flat()>0.4);
150  bool tauVeto = false; //(engine->flat()>0.3);
151  bool mip = false; //(engine->flat()>0.1);
152  bool quiet = false; //(engine->flat()>0.6);
153  unsigned crate = (unsigned)(18 * engine->flat());
154  unsigned card = (unsigned)(7 * engine->flat());
155  unsigned rgn = crate % 2; //(engine->flat()>0.5?0:1);
156  L1CaloRegion cand(et, overFlow, tauVeto, mip, quiet, crate, card, rgn);
157  data->push_back(cand);
158  //L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
159  if (verbose())
160  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
161 }
162 
163 template <>
165  CLHEP::HepRandomEngine* engine,
166  std::unique_ptr<L1GctEmCandCollection>& data,
167  int type) const {
168  if (verbose())
169  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
170  bool iso; //= type==0;
171  switch (type) { // 0 iso, 1 noniso
172  case 0:
173  iso = true;
174  break;
175  case 1:
176  iso = false;
177  break;
178  default:
179  throw cms::Exception("L1DummyProducerInvalidType")
180  << "L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
181  << " invalid type: " << type << std::endl;
182  }
183  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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) //-z (eta sign)
188  eta = (eta & 0x7) + (0x1 << 3);
189  L1GctEmCand cand(rank, phi, eta, iso);
190  data->push_back(cand);
191  // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
192  //L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
193  if (verbose())
194  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
195 }
196 
197 template <>
199  CLHEP::HepRandomEngine* engine,
200  std::unique_ptr<L1GctJetCandCollection>& data,
201  int type) const {
202  if (verbose())
203  std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
204  bool isFor, isTau;
205  switch (type) { // 0 cen, 1 for, 2 tau
206  case 0:
207  isFor = false;
208  isTau = false;
209  break;
210  case 1:
211  isFor = true;
212  isTau = false;
213  break;
214  case 2:
215  isFor = false;
216  isTau = true;
217  break;
218  default:
219  throw cms::Exception("L1DummyProducerInvalidType")
220  << "L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
221  << " invalid type: " << type << std::endl;
222  }
223 
224  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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) //-z (eta sign)
229  eta = (eta & 0x7) + (0x1 << 3);
230  L1GctJetCand cand(rank, phi, eta, isTau, isFor);
231  data->push_back(cand);
232  //L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor);
233  if (verbose())
234  std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
235 }
236 
237 template <>
239  CLHEP::HepRandomEngine* engine,
240  std::unique_ptr<L1MuRegionalCandCollection>& data,
241  int type) const {
242  if (verbose())
243  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
244  //typedef std::vector<L1MuRegionalCand> L1MuRegionalCandCollection;
245  assert(type >= 0 && type < 4);
246  unsigned type_idx = type; //tType: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
247  int bx = 0;
248  unsigned phi, eta, pt, charge, ch_valid, finehalo, quality;
249  float phiv(0.), etav(0.), ptv(0.); //linear translation? 0.2pi,-2.5..2.5,0..100
250  for (int i = 0; i < 4; i++) {
251  phi = (int)(144 * engine->flat()); //8bits, 0..143
252  eta = (int)(63 * engine->flat()); //6bits code
253  phiv = phi * 2 * TMath::Pi() / 144.;
254  etav = 2.5 * (-1 + 2 * eta / 63.);
255  pt = ((int)(32 * engine->flat())) & 0x1f; //5bits: 0..31
256  ptv = 100 * (pt / 31.);
257  charge = (engine->flat() > 0.5 ? 0 : 1);
258  ;
259  ch_valid = 0;
260  finehalo = 0;
261  quality = (int)(8 * engine->flat()); //3bits: 0..7
262  L1MuRegionalCand cand(type_idx, phi, eta, pt, charge, ch_valid, finehalo, quality, bx);
263  cand.setPhiValue(phiv);
264  cand.setEtaValue(etav);
265  cand.setPtValue(ptv);
266  data->push_back(cand);
267  }
268  //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt,
269  //unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
270  if (verbose())
271  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
272 }
273 
274 template <>
276  CLHEP::HepRandomEngine* engine,
277  std::unique_ptr<L1MuDTTrackContainer>& data,
278  int type) const {
279  assert(type == 0);
280  int type_idx = type; //choose data type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
281  if (verbose())
282  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
283  std::unique_ptr<L1MuRegionalCandCollection> tracks(new L1MuRegionalCandCollection());
284  SimpleDigi(nevt, engine, tracks, type_idx);
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++) {
288  L1MuDTTrackCand* cnd = new L1MuDTTrackCand();
289  cnd->setDataWord(it->getDataWord());
290  cnd->setBx(it->bx());
291  tracksd->push_back(L1MuDTTrackCand());
292  tracksd->push_back(*cnd);
293  }
294  data->setContainer(*tracksd);
295  if (verbose())
296  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
297  //L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc, int utag,
298  // int adr1, int adr2, int adr3, int adr4, int utc );
299 }
300 
301 template <>
303  CLHEP::HepRandomEngine* engine,
304  std::unique_ptr<L1MuDTChambPhContainer>& data,
305  int type) const {
306  if (verbose())
307  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
308  typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
309  int ntrk = 4;
310  Phi_Container tracks(ntrk);
311  int ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt;
312  for (int i = 0; i < ntrk; i++) {
313  ubx = 0; //bxNum() - bx
314  uwh = (int)(-2 + 5 * engine->flat()); //whNum() - wheel
315  usc = (int)(12 * engine->flat()); //scNum() - sector
316  ust = (int)(1. + 4 * engine->flat()); //stNum() - station
317  uphr = 0; //phi() - radialAngle
318  uphb = 0; //phiB() - bendingAngle
319  uqua = (int)(8 * engine->flat()); //code() - qualityCode
320  utag = 0; //Ts2Tag() - Ts2TagCode
321  ucnt = 0; //BxCnt() - BxCntCode
322 
323  L1MuDTChambPhDigi cand(ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt);
324  tracks.push_back(cand);
325  }
326  data->setContainer(tracks);
327  //L1MuDTChambPhDigi( int ubx, int uwh, int usc, int ust,
328  // int uphr, int uphb, int uqua, int utag, int ucnt );
329  if (verbose())
330  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
331 }
332 
333 template <>
335  CLHEP::HepRandomEngine* engine,
336  std::unique_ptr<L1MuDTChambThContainer>& data,
337  int type) const {
338  if (verbose())
339  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
340  typedef std::vector<L1MuDTChambThDigi> The_Container;
341  int ntrk = 4;
342  The_Container tracks(ntrk);
343  int ubx, uwh, usc, ust, uos[7], uqa[7];
344  for (int i = 0; i < ntrk; i++) {
345  ubx = 0;
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);
352  }
353  L1MuDTChambThDigi cand(ubx, uwh, usc, ust, uos, uqa);
354  tracks.push_back(cand);
355  }
356  data->setContainer(tracks);
357  //L1MuDTChambThDigi( int ubx, int uwh, int usc, int ust,
358  // int* uos, [int* uqual] );
359  //"DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
360  if (verbose())
361  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
362 }
363 
364 template <>
366  CLHEP::HepRandomEngine* engine,
367  std::unique_ptr<L1MuGMTCandCollection>& data,
368  int type) const {
369  if (verbose())
370  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
371  //typedef std::vector<L1MuGMTCand> L1MuGMTCandCollection;
372  L1MuGMTCand cand(0, nevt);
373  //cand.setPhiPacked();//8bits
374  //cand.setPtPacked ();//5bits
375  //cand.setQuality ();//3bits
376  //cand.setEtaPacked();//6bits
377  //cand.setIsolation();//1bit
378  //cand.setMIP ();//1bit
379  //cand.setChargePacked();//0:+, 1:-, 2:undef, 3:sync
380  //cand.setBx (nevt);
381  //set physical values
382  double eng = EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine);
383  double phi = 2 * TMath::Pi() * engine->flat();
384  double eta = 2.5 * (-1 + 2 * engine->flat());
385  cand.setPtValue(eng);
386  cand.setPhiValue(phi);
387  cand.setEtaValue(eta);
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);
398  cand.setBx(0);
399  data->push_back(cand);
400  if (verbose())
401  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
402 }
403 
404 template <>
406  CLHEP::HepRandomEngine* engine,
407  std::unique_ptr<L1MuGMTReadoutCollection>& data,
408  int type) const {
409  if (verbose())
410  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
411  L1MuGMTReadoutRecord rec(0);
412  int bxn = nevt;
413  rec.setBxNr(bxn);
414  rec.setEvNr(bxn);
415  rec.setBxInEvent(0);
416  std::unique_ptr<L1MuRegionalCandCollection> trks_dttf(new L1MuRegionalCandCollection);
417  std::unique_ptr<L1MuRegionalCandCollection> trks_rpcb(new L1MuRegionalCandCollection);
418  std::unique_ptr<L1MuRegionalCandCollection> trks_csc(new L1MuRegionalCandCollection);
419  std::unique_ptr<L1MuRegionalCandCollection> trks_rpcf(new L1MuRegionalCandCollection);
420  SimpleDigi(nevt, engine, trks_dttf, 0);
421  SimpleDigi(nevt, engine, trks_rpcb, 1);
422  SimpleDigi(nevt, engine, trks_csc, 2);
423  SimpleDigi(nevt, engine, trks_rpcf, 3);
424  for (int i = 0; i < 4; i++) {
425  rec.setInputCand(i, trks_dttf->at(i)); //dt : 0..3
426  rec.setInputCand(i + 4, trks_rpcb->at(i)); //rpcb: 4..7
427  rec.setInputCand(i + 8, trks_csc->at(i)); //csc : 8..11
428  rec.setInputCand(i + 12, trks_rpcf->at(i)); //rpcf:12..15
429  }
430  for (int nr = 0; nr < 4; nr++) {
431  int eng = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
432  rec.setGMTBrlCand(nr, eng & 0x11, eng & 0x11); //set GMT barrel candidate
433  rec.setGMTFwdCand(nr, eng & 0x11, eng & 0x11); //set GMT forward candidate
434  rec.setGMTCand(nr, eng & 0x11); //set GMT candidate (does not store rank)
435  int eta = (int)(14 * engine->flat()); //0..13
436  int phi = (int)(18 * engine->flat()); //0..17
437  rec.setMIPbit(eta, phi);
438  rec.setQuietbit(eta, phi);
439  }
440  data->addRecord(rec);
442  //rec.setBCERR(int bcerr);
443  //rec.setGMTBrlCand(int nr, L1MuGMTExtendedCand const& cand);
444  //rec.setGMTFwdCand(int nr, L1MuGMTExtendedCand const& cand);
445  //rec.setGMTCand (int nr, L1MuGMTExtendedCand const& cand);
446  //rec.setInputCand (int nr, L1MuRegionalCand const& cand);
447  //L1MuGMTReadoutCollection :: std::vector<L1MuGMTReadoutRecord> m_Records;
448  //L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
449  //L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx=0) : L1MuGMTCand (data, bx), m_rank(rank) {}
450  if (verbose())
451  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
452 }
453 
454 template <>
456  CLHEP::HepRandomEngine*,
457  std::unique_ptr<LTCDigiCollection>& data,
458  int type) const {
459  if (verbose())
460  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
461  //LTCs are FED id 816-823
462  /*
463  6 64-bit words
464  uint64_t *ld = (uint64_t*)data;
465 
466  word0: 59:56 4 bit ld[0]>>56 & 0xf trigType
467  55:32 24 bit ld[0]>>32 & 0x00ffffff eventID
468  31:20 12 bit ld[0]>>20 & 0xfff bunchNumber
469  19: 8 12 bit ld[0]>> 8 & 0x00000fff sourceID (816-823?)
470 
471  word1: 63:32 32 bit ld[1]>>32 & 0xffffffff orbitNumber
472  31:24 8 bit ld[1]>>24 & 0xff versionNumber
473  3: 0 4 bit ld[1 & 0xf daqPartition
474 
475  word2: 63:32 32 bit ld[0]>>32 & 0xffffffff runNumber
476  31: 0 32 bit ld[0] & 0xffffffff eventNumber
477 
478  word3: 63:32 32 bit ld[3]>>32 & 0xffffffff trigInhibitNumber
479  31: 0 32 bit ld[3] & 0xffffffff trigInputStat
480 
481  word4: 63:0 64 bit ld[4] bstGpsTime
482 
483  word5: (empty)
484  */
485  //need to make up something meaningfull to produce here..
486  //LTCDigi(const unsigned char* data);
487  if (verbose())
488  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
489 }
490 
491 template <>
493  CLHEP::HepRandomEngine* engine,
494  std::unique_ptr<CSCCorrelatedLCTDigiCollection>& data,
495  int type) const {
496  if (verbose())
497  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
498  //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
499  //CSCCorrelatedLCTDigi(const int trknmb, const int valid, const int quality, const int keywire, const int strip, const int clct_pattern, const int bend, const int bx, const int& mpclink = 0, const uint16_t & bx0=0, const uint16_t & syncErr = 0, const uint16_t & cscID=0);
501  //tbd: set non-trivial random values
502  dg.clear(); // set contents to zero
503  //CSCDetId( int iendcap, int istation, int iring, int ichamber, int ilayer = 0 );
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;
506 
507  float rnd = engine->flat();
508  int ec = (int)(MIN_ENDCAP + (MAX_ENDCAP - MIN_ENDCAP) * rnd + 1);
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);
513  CSCDetId did = CSCDetId(ec, st, rg, ch, lr);
514  //CSCDetId did = CSCDetId(); //DetId(DetId::Muon, MuonSubdetId::CSC)
515  //MuonDigiCollection::insertDigi(const IndexType& index, const DigiType& digi)
516  data->insertDigi(did, dg);
517  if (verbose())
518  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
519 }
520 
521 template <>
523  CLHEP::HepRandomEngine* engine,
524  std::unique_ptr<L1CSCTrackCollection>& data,
525  int type) const {
526  if (verbose())
527  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
528  std::unique_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
529  SimpleDigi(nevt, engine, dgcoll, 0);
530  csc::L1Track l1trk = csc::L1Track();
531  std::unique_ptr<L1MuRegionalCandCollection> regcoll(new L1MuRegionalCandCollection);
532  SimpleDigi(nevt, engine, regcoll, 2);
533  L1MuRegionalCand regcand = *(regcoll->begin());
534  l1trk.setDataWord(regcand.getDataWord());
535  l1trk.setBx(regcand.bx());
536  l1trk.setPhiValue(regcand.phiValue());
537  l1trk.setEtaValue(regcand.etaValue());
538  l1trk.setPtValue(regcand.ptValue());
539  L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
540  data->push_back(l1csctrk);
541  //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
542  //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
543  //L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { setType(2); setPtPacked(0); }
544  //L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
545  if (verbose())
546  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
547 }
548 
549 #endif
const double Pi
constexpr int MIN_ENDCAP
Definition: Common.h:45
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
const int DEnsys
Definition: DEtrait.h:38
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
void setInputCand(int nr, unsigned data)
set Input muon
unsigned getDataWord() const
return data word
assert(be >=bs)
void setPtValue(float ptVal)
Set Pt Value.
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
std::atomic< int > nevt_
void setQuietbit(int eta, int phi)
set Quiet bit
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
string quality
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
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
Definition: L1Track.h:8
void SimpleDigi(int nevt, CLHEP::HepRandomEngine *, std::unique_ptr< T > &data, int type=0) const
~L1DummyProducer() override
constexpr int MAX_ENDCAP
Definition: Common.h:46
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
float ptValue() const
get pt-value of muon candidate in GeV
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
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
void clear()
clear this LCT
int verbose() const
int bx() const
return bunch crossing identifier
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:11