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 
22 // common includes
29 
30 // l1 dataformats, d|e record includes
34 
35 // random # generator
36 #include "CLHEP/Random/RandomEngine.h"
37 #include "CLHEP/Random/RandGaussQ.h"
38 
40 public:
41  explicit L1DummyProducer(const edm::ParameterSet&);
42  ~L1DummyProducer() override;
43 
44 private:
45  void beginJob(void) override{};
46  //virtual void beginRun(edm::Run&, const edm::EventSetup&);
47  void produce(edm::Event&, const edm::EventSetup&) override;
48  void endJob() override{};
49 
50 public:
51  template <class T>
52  void SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type = 0);
53 
54 private:
55  int verbose_;
56  int verbose() { return verbose_; }
57  int nevt_;
58 
61 
62  double EBase_;
63  double ESigm_;
64 };
65 
66 template <class T>
67 void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type) {
68  /*collections generated in specializations below*/
69 }
70 
71 template <>
72 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
73  std::unique_ptr<EcalTrigPrimDigiCollection>& data,
74  int type) {
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 <>
96 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
97  std::unique_ptr<HcalTrigPrimDigiCollection>& data,
98  int type) {
99  if (verbose())
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());
104  const HcalTrigTowerDetId h_id(side * ieta, iphi);
105  HcalTriggerPrimitiveDigi h_digi(h_id);
106  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
107  HcalTriggerPrimitiveSample h_sample(energy, false, 0, 0);
108  h_digi.setSize(1); //set sampleOfInterest to 0
109  h_digi.setSample(0, h_sample);
110  data->push_back(h_digi);
111  //HcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int slb, int slbchan);
112  //HcalTrigTowerDetId(int ieta, int iphi);
113  if (verbose())
114  std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
115 }
116 
117 template <>
118 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
119  std::unique_ptr<L1CaloEmCollection>& data,
120  int type) {
121  if (verbose())
122  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
123  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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());
130  int16_t bx = nevt_;
131  L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
132  data->push_back(cand);
133  //L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
134  if (verbose())
135  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
136 }
137 
138 template <>
139 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
140  std::unique_ptr<L1CaloRegionCollection>& data,
141  int type) {
142  if (verbose())
143  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
144  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
145  unsigned et = energy & 0x3ff;
146  bool overFlow = false; //(engine->flat()>0.4);
147  bool tauVeto = false; //(engine->flat()>0.3);
148  bool mip = false; //(engine->flat()>0.1);
149  bool quiet = false; //(engine->flat()>0.6);
150  unsigned crate = (unsigned)(18 * engine->flat());
151  unsigned card = (unsigned)(7 * engine->flat());
152  unsigned rgn = crate % 2; //(engine->flat()>0.5?0:1);
153  L1CaloRegion cand(et, overFlow, tauVeto, mip, quiet, crate, card, rgn);
154  data->push_back(cand);
155  //L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
156  if (verbose())
157  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
158 }
159 
160 template <>
161 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
162  std::unique_ptr<L1GctEmCandCollection>& data,
163  int type) {
164  if (verbose())
165  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
166  bool iso; //= type==0;
167  switch (type) { // 0 iso, 1 noniso
168  case 0:
169  iso = true;
170  break;
171  case 1:
172  iso = false;
173  break;
174  default:
175  throw cms::Exception("L1DummyProducerInvalidType")
176  << "L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
177  << " invalid type: " << type << std::endl;
178  }
179  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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) //-z (eta sign)
184  eta = (eta & 0x7) + (0x1 << 3);
185  L1GctEmCand cand(rank, phi, eta, iso);
186  data->push_back(cand);
187  // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
188  //L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
189  if (verbose())
190  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
191 }
192 
193 template <>
194 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
195  std::unique_ptr<L1GctJetCandCollection>& data,
196  int type) {
197  if (verbose())
198  std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
199  bool isFor, isTau;
200  switch (type) { // 0 cen, 1 for, 2 tau
201  case 0:
202  isFor = false;
203  isTau = false;
204  break;
205  case 1:
206  isFor = true;
207  isTau = false;
208  break;
209  case 2:
210  isFor = false;
211  isTau = true;
212  break;
213  default:
214  throw cms::Exception("L1DummyProducerInvalidType")
215  << "L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
216  << " invalid type: " << type << std::endl;
217  }
218 
219  int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
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) //-z (eta sign)
224  eta = (eta & 0x7) + (0x1 << 3);
225  L1GctJetCand cand(rank, phi, eta, isTau, isFor);
226  data->push_back(cand);
227  //L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor);
228  if (verbose())
229  std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
230 }
231 
232 template <>
233 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
234  std::unique_ptr<L1MuRegionalCandCollection>& data,
235  int type) {
236  if (verbose())
237  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
238  //typedef std::vector<L1MuRegionalCand> L1MuRegionalCandCollection;
239  assert(type >= 0 && type < 4);
240  unsigned type_idx = type; //tType: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
241  int bx = 0;
242  unsigned phi, eta, pt, charge, ch_valid, finehalo, quality;
243  float phiv(0.), etav(0.), ptv(0.); //linear translation? 0.2pi,-2.5..2.5,0..100
244  for (int i = 0; i < 4; i++) {
245  phi = (int)(144 * engine->flat()); //8bits, 0..143
246  eta = (int)(63 * engine->flat()); //6bits code
247  phiv = phi * 2 * TMath::Pi() / 144.;
248  etav = 2.5 * (-1 + 2 * eta / 63.);
249  pt = ((int)(32 * engine->flat())) & 0x1f; //5bits: 0..31
250  ptv = 100 * (pt / 31.);
251  charge = (engine->flat() > 0.5 ? 0 : 1);
252  ;
253  ch_valid = 0;
254  finehalo = 0;
255  quality = (int)(8 * engine->flat()); //3bits: 0..7
256  L1MuRegionalCand cand(type_idx, phi, eta, pt, charge, ch_valid, finehalo, quality, bx);
257  cand.setPhiValue(phiv);
258  cand.setEtaValue(etav);
259  cand.setPtValue(ptv);
260  data->push_back(cand);
261  }
262  //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt,
263  //unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
264  if (verbose())
265  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
266 }
267 
268 template <>
269 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
270  std::unique_ptr<L1MuDTTrackContainer>& data,
271  int type) {
272  assert(type == 0);
273  int type_idx = type; //choose data type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
274  if (verbose())
275  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
276  std::unique_ptr<L1MuRegionalCandCollection> tracks(new L1MuRegionalCandCollection());
277  SimpleDigi(engine, tracks, type_idx);
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++) {
281  L1MuDTTrackCand* cnd = new L1MuDTTrackCand();
282  cnd->setDataWord(it->getDataWord());
283  cnd->setBx(it->bx());
284  tracksd->push_back(L1MuDTTrackCand());
285  tracksd->push_back(*cnd);
286  }
287  data->setContainer(*tracksd);
288  if (verbose())
289  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
290  //L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc, int utag,
291  // int adr1, int adr2, int adr3, int adr4, int utc );
292 }
293 
294 template <>
295 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
296  std::unique_ptr<L1MuDTChambPhContainer>& data,
297  int type) {
298  if (verbose())
299  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
300  typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
301  int ntrk = 4;
302  Phi_Container tracks(ntrk);
303  int ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt;
304  for (int i = 0; i < ntrk; i++) {
305  ubx = 0; //bxNum() - bx
306  uwh = 0; //whNum() - wheel
307  usc = 0; //scNum() - sector
308  ust = 0; //stNum() - station
309  uphr = 0; //phi() - radialAngle
310  uphb = 0; //phiB() - bendingAngle
311  uqua = 0; //code() - qualityCode
312  utag = 0; //Ts2Tag() - Ts2TagCode
313  ucnt = 0; //BxCnt() - BxCntCode
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());
318  L1MuDTChambPhDigi cand(ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt);
319  tracks.push_back(cand);
320  }
321  data->setContainer(tracks);
322  //L1MuDTChambPhDigi( int ubx, int uwh, int usc, int ust,
323  // int uphr, int uphb, int uqua, int utag, int ucnt );
324  if (verbose())
325  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
326 }
327 
328 template <>
329 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
330  std::unique_ptr<L1MuDTChambThContainer>& data,
331  int type) {
332  if (verbose())
333  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
334  typedef std::vector<L1MuDTChambThDigi> The_Container;
335  int ntrk = 4;
336  The_Container tracks(ntrk);
337  int ubx, uwh, usc, ust, uos[7], uqa[7];
338  for (int i = 0; i < ntrk; i++) {
339  ubx = 0;
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);
346  }
347  L1MuDTChambThDigi cand(ubx, uwh, usc, ust, uos, uqa);
348  tracks.push_back(cand);
349  }
350  data->setContainer(tracks);
351  //L1MuDTChambThDigi( int ubx, int uwh, int usc, int ust,
352  // int* uos, [int* uqual] );
353  //"DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
354  if (verbose())
355  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
356 }
357 
358 template <>
359 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
360  std::unique_ptr<L1MuGMTCandCollection>& data,
361  int type) {
362  if (verbose())
363  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
364  //typedef std::vector<L1MuGMTCand> L1MuGMTCandCollection;
365  L1MuGMTCand cand(0, nevt_);
366  //cand.setPhiPacked();//8bits
367  //cand.setPtPacked ();//5bits
368  //cand.setQuality ();//3bits
369  //cand.setEtaPacked();//6bits
370  //cand.setIsolation();//1bit
371  //cand.setMIP ();//1bit
372  //cand.setChargePacked();//0:+, 1:-, 2:undef, 3:sync
373  //cand.setBx (nevt_);
374  //set physical values
375  double eng = EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine);
376  double phi = 2 * TMath::Pi() * engine->flat();
377  double eta = 2.5 * (-1 + 2 * engine->flat());
378  cand.setPtValue(eng);
379  cand.setPhiValue(phi);
380  cand.setEtaValue(eta);
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);
391  cand.setBx(0);
392  data->push_back(cand);
393  if (verbose())
394  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
395 }
396 
397 template <>
398 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
399  std::unique_ptr<L1MuGMTReadoutCollection>& data,
400  int type) {
401  if (verbose())
402  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
403  L1MuGMTReadoutRecord rec(0);
404  int bxn = nevt_;
405  rec.setBxNr(bxn);
406  rec.setEvNr(bxn);
407  rec.setBxInEvent(0);
408  std::unique_ptr<L1MuRegionalCandCollection> trks_dttf(new L1MuRegionalCandCollection);
409  std::unique_ptr<L1MuRegionalCandCollection> trks_rpcb(new L1MuRegionalCandCollection);
410  std::unique_ptr<L1MuRegionalCandCollection> trks_csc(new L1MuRegionalCandCollection);
411  std::unique_ptr<L1MuRegionalCandCollection> trks_rpcf(new L1MuRegionalCandCollection);
412  SimpleDigi(engine, trks_dttf, 0);
413  SimpleDigi(engine, trks_rpcb, 1);
414  SimpleDigi(engine, trks_csc, 2);
415  SimpleDigi(engine, trks_rpcf, 3);
416  for (int i = 0; i < 4; i++) {
417  rec.setInputCand(i, trks_dttf->at(i)); //dt : 0..3
418  rec.setInputCand(i + 4, trks_rpcb->at(i)); //rpcb: 4..7
419  rec.setInputCand(i + 8, trks_csc->at(i)); //csc : 8..11
420  rec.setInputCand(i + 12, trks_rpcf->at(i)); //rpcf:12..15
421  }
422  for (int nr = 0; nr < 4; nr++) {
423  int eng = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
424  rec.setGMTBrlCand(nr, eng & 0x11, eng & 0x11); //set GMT barrel candidate
425  rec.setGMTFwdCand(nr, eng & 0x11, eng & 0x11); //set GMT forward candidate
426  rec.setGMTCand(nr, eng & 0x11); //set GMT candidate (does not store rank)
427  int eta = (int)(14 * engine->flat()); //0..13
428  int phi = (int)(18 * engine->flat()); //0..17
429  rec.setMIPbit(eta, phi);
430  rec.setQuietbit(eta, phi);
431  }
432  data->addRecord(rec);
434  //rec.setBCERR(int bcerr);
435  //rec.setGMTBrlCand(int nr, L1MuGMTExtendedCand const& cand);
436  //rec.setGMTFwdCand(int nr, L1MuGMTExtendedCand const& cand);
437  //rec.setGMTCand (int nr, L1MuGMTExtendedCand const& cand);
438  //rec.setInputCand (int nr, L1MuRegionalCand const& cand);
439  //L1MuGMTReadoutCollection :: std::vector<L1MuGMTReadoutRecord> m_Records;
440  //L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
441  //L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx=0) : L1MuGMTCand (data, bx), m_rank(rank) {}
442  if (verbose())
443  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
444 }
445 
446 template <>
447 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<LTCDigiCollection>& data, int type) {
448  if (verbose())
449  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
450  //LTCs are FED id 816-823
451  /*
452  6 64-bit words
453  uint64_t *ld = (uint64_t*)data;
454 
455  word0: 59:56 4 bit ld[0]>>56 & 0xf trigType
456  55:32 24 bit ld[0]>>32 & 0x00ffffff eventID
457  31:20 12 bit ld[0]>>20 & 0xfff bunchNumber
458  19: 8 12 bit ld[0]>> 8 & 0x00000fff sourceID (816-823?)
459 
460  word1: 63:32 32 bit ld[1]>>32 & 0xffffffff orbitNumber
461  31:24 8 bit ld[1]>>24 & 0xff versionNumber
462  3: 0 4 bit ld[1 & 0xf daqPartition
463 
464  word2: 63:32 32 bit ld[0]>>32 & 0xffffffff runNumber
465  31: 0 32 bit ld[0] & 0xffffffff eventNumber
466 
467  word3: 63:32 32 bit ld[3]>>32 & 0xffffffff trigInhibitNumber
468  31: 0 32 bit ld[3] & 0xffffffff trigInputStat
469 
470  word4: 63:0 64 bit ld[4] bstGpsTime
471 
472  word5: (empty)
473  */
474  //need to make up something meaningfull to produce here..
475  //LTCDigi(const unsigned char* data);
476  if (verbose())
477  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
478 }
479 
480 template <>
481 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
482  std::unique_ptr<CSCCorrelatedLCTDigiCollection>& data,
483  int type) {
484  if (verbose())
485  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
486  //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
487  //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);
489  //tbd: set non-trivial random values
490  dg.clear(); // set contents to zero
491  //CSCDetId( int iendcap, int istation, int iring, int ichamber, int ilayer = 0 );
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();
495  int ec = (int)(MIN_ENDCAP + (MAX_ENDCAP - MIN_ENDCAP) * rnd + 1);
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);
500  CSCDetId did = CSCDetId(ec, st, rg, ch, lr);
501  //CSCDetId did = CSCDetId(); //DetId(DetId::Muon, MuonSubdetId::CSC)
502  //MuonDigiCollection::insertDigi(const IndexType& index, const DigiType& digi)
503  data->insertDigi(did, dg);
504  if (verbose())
505  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
506 }
507 
508 template <>
509 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
510  std::unique_ptr<L1CSCTrackCollection>& data,
511  int type) {
512  if (verbose())
513  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
514  std::unique_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
515  SimpleDigi(engine, dgcoll, 0);
516  csc::L1Track l1trk = csc::L1Track();
517  std::unique_ptr<L1MuRegionalCandCollection> regcoll(new L1MuRegionalCandCollection);
518  SimpleDigi(engine, regcoll, 2);
519  L1MuRegionalCand regcand = *(regcoll->begin());
520  l1trk.setDataWord(regcand.getDataWord());
521  l1trk.setBx(regcand.bx());
522  l1trk.setPhiValue(regcand.phiValue());
523  l1trk.setEtaValue(regcand.etaValue());
524  l1trk.setPtValue(regcand.ptValue());
525  L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
526  data->push_back(l1csctrk);
527  //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
528  //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
529  //L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { setType(2); setPtPacked(0); }
530  //L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
531  if (verbose())
532  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
533 }
534 
535 #endif
L1DummyProducer::SimpleDigi
void SimpleDigi(CLHEP::HepRandomEngine *, std::unique_ptr< T > &data, int type=0)
Definition: L1DummyProducer.h:67
L1MuRegionalCand::bx
int bx() const
return bunch crossing identifier
Definition: L1MuRegionalCand.h:79
L1MuRegionalCand::setPtValue
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuRegionalCand.h:148
mps_fire.i
i
Definition: mps_fire.py:428
L1MuRegionalCand::etaValue
float etaValue() const
get eta-value of muon candidate
Definition: L1MuRegionalCand.cc:87
L1GctJetCand
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:17
MessageLogger.h
L1CSCTrack
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
Definition: L1CSCTrackCollection.h:7
EDProducer.h
L1CaloRegion
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:21
L1DummyProducer::~L1DummyProducer
~L1DummyProducer() override
Definition: L1DummyProducer.cc:139
L1MuGMTReadoutRecord::setInputCand
void setInputCand(int nr, unsigned data)
set Input muon
Definition: L1MuGMTReadoutRecord.cc:223
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
HcalTriggerPrimitiveSample
Definition: HcalTriggerPrimitiveSample.h:11
L1MuGMTReadoutRecord::setBxInEvent
void setBxInEvent(int bxie)
Definition: L1MuGMTReadoutRecord.h:105
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1MuRegionalCand::setPhiValue
void setPhiValue(float phiVal)
Set Phi Value.
Definition: L1MuRegionalCand.h:145
L1MuGMTReadoutRecord::setGMTBrlCand
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
Definition: L1MuGMTReadoutRecord.cc:230
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
emtf::MAX_ENDCAP
constexpr int MAX_ENDCAP
Definition: Common.h:46
L1GctEmCand
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:21
cms::cuda::assert
assert(be >=bs)
L1DummyProducer::ESigm_
double ESigm_
Definition: L1DummyProducer.h:63
L1DummyProducer::nevt_
int nevt_
Definition: L1DummyProducer.h:57
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
L1MuGMTReadoutRecord::setGMTFwdCand
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
Definition: L1MuGMTReadoutRecord.cc:244
HcalTriggerPrimitiveDigi::setSample
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
Definition: HcalTriggerPrimitiveDigi.h:43
L1MuGMTReadoutRecord::setMIPbit
void setMIPbit(int eta, int phi)
set MIP bit
Definition: L1MuGMTReadoutRecord.cc:292
L1MuGMTCand
Definition: L1MuGMTCand.h:39
EcalBarrel
Definition: EcalSubdetector.h:10
HcalTriggerPrimitiveDigi.h
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
L1DummyProducer::verbose_
int verbose_
Definition: L1DummyProducer.h:55
L1MuDTTrackCand
Definition: L1MuDTTrackCand.h:33
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
L1MuRegionalCand::getDataWord
unsigned getDataWord() const
return data word
Definition: L1MuRegionalCand.h:107
L1MuRegionalCand::setBx
void setBx(int bx)
Set Bunch Crossing.
Definition: L1MuRegionalCand.h:117
MakerMacros.h
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
L1MuRegionalCand::setEtaValue
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuRegionalCand.h:151
L1MuGMTReadoutRecord
Definition: L1MuGMTReadoutRecord.h:44
PVValHelper::eta
Definition: PVValidationHelpers.h:70
emtf::MIN_ENDCAP
constexpr int MIN_ENDCAP
Definition: Common.h:45
L1Track
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
Definition: L1Track.h:8
L1MuRegionalCand::phiValue
float phiValue() const
get phi-value of muon candidate in radians (low edge of bin)
Definition: L1MuRegionalCand.cc:80
L1MuRegionalCand
Definition: L1MuRegionalCand.h:26
L1MuGMTReadoutRecord::setQuietbit
void setQuietbit(int eta, int phi)
set Quiet bit
Definition: L1MuGMTReadoutRecord.cc:306
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
EcalTriggerPrimitiveDigi::setSize
void setSize(int size)
Definition: EcalTriggerPrimitiveDigi.cc:60
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HcalTriggerPrimitiveDigi
Definition: HcalTriggerPrimitiveDigi.h:13
edm::ParameterSet
Definition: ParameterSet.h:47
EgHLTOffHistBins_cfi.nr
nr
Definition: EgHLTOffHistBins_cfi.py:4
L1DummyProducer::beginJob
void beginJob(void) override
Definition: L1DummyProducer.h:45
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
L1MuRegionalCand::setDataWord
void setDataWord(unsigned dataword)
Set data word.
Definition: L1MuRegionalCand.h:166
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
CSCDetId
Definition: CSCDetId.h:26
EcalTriggerPrimitiveDigi::setSample
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
Definition: EcalTriggerPrimitiveDigi.h:36
cand
Definition: decayParser.h:32
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
createfilelist.int
int
Definition: createfilelist.py:10
DEtrait.h
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
edm::EventSetup
Definition: EventSetup.h:58
CSCCorrelatedLCTDigi::clear
void clear()
clear this LCT
Definition: CSCCorrelatedLCTDigi.cc:58
CSCCorrelatedLCTDigiCollection
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1DummyProducer::L1DummyProducer
L1DummyProducer(const edm::ParameterSet &)
Definition: L1DummyProducer.cc:9
alignCSCRings.r
r
Definition: alignCSCRings.py:93
dedefs::DEnsys
const int DEnsys
Definition: DEtrait.h:38
DDAxes::phi
L1MuGMTReadoutRecord::setGMTCand
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
Definition: L1MuGMTReadoutRecord.cc:258
L1DummyProducer::EBase_
double EBase_
Definition: L1DummyProducer.h:62
L1DummyProducer::endJob
void endJob() override
Definition: L1DummyProducer.h:48
L1MuDTChambThDigi
Definition: L1MuDTChambThDigi.h:33
Frameworkfwd.h
EcalTriggerPrimitiveDigi
Definition: EcalTriggerPrimitiveDigi.h:16
L1MuGMTReadoutRecord::setEvNr
void setEvNr(int evnr)
Definition: L1MuGMTReadoutRecord.h:106
Exception
Definition: hltDiff.cc:245
L1DummyProducer::instName
std::string instName[dedefs::DEnsys][5]
Definition: L1DummyProducer.h:60
edm::EDProducer
Definition: EDProducer.h:35
csc::L1Track
Definition: L1Track.h:21
L1MuRegionalCandCollection
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
Definition: RPCRecHitFilter.cc:53
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
L1DummyProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: L1DummyProducer.cc:141
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
EcalTriggerPrimitiveSample
Definition: EcalTriggerPrimitiveSample.h:12
reco::isTau
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:11
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1DummyProducer::verbose
int verbose()
Definition: L1DummyProducer.h:56
L1MuRegionalCand::ptValue
float ptValue() const
get pt-value of muon candidate in GeV
Definition: L1MuRegionalCand.cc:94
edm::Event
Definition: Event.h:73
L1CaloEmCand
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:17
HcalTriggerPrimitiveDigi::setSize
void setSize(int size)
Definition: HcalTriggerPrimitiveDigi.cc:7
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
L1DummyProducer
Definition: L1DummyProducer.h:39
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31
L1Track.h
L1MuGMTReadoutRecord::setBxNr
void setBxNr(int bxnr)
set counters
Definition: L1MuGMTReadoutRecord.h:103
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14
L1DummyProducer::m_doSys
bool m_doSys[dedefs::DEnsys]
Definition: L1DummyProducer.h:59