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
32 
33 // random # generator
34 #include "CLHEP/Random/RandomEngine.h"
35 #include "CLHEP/Random/RandGaussQ.h"
36 
37 
39 
40  public:
41 
42  explicit L1DummyProducer(const edm::ParameterSet&);
44 
45  private:
46 
47  virtual void beginJob(void) {};
48  //virtual void beginRun(edm::Run&, const edm::EventSetup&);
49  virtual void produce(edm::Event&, const edm::EventSetup&);
50  virtual void endJob() {};
51 
52  public:
53 
54  template <class T>
55  void SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type=0);
56 
57  private:
58 
59  int verbose_;
60  int verbose() {return verbose_;}
61  int nevt_;
62 
65 
66  double EBase_;
67  double ESigm_;
68 
69 };
70 
71 
72 template <class T> void
73 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type) {
74  /*collections generated in specializations below*/
75 }
76 
77 template <> inline void
78 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<EcalTrigPrimDigiCollection>& data,
79  int type) {
80  if(verbose())
81  std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
82  int side = (engine->flat()>0.5)?-1:1;
83  int ieta = (int) (1 + 17*engine->flat()); //1-17
84  int iphi = (int) (1 + 72*engine->flat()); //1-72
85  const EcalTrigTowerDetId e_id( side , EcalBarrel, ieta, iphi, 0);
86  EcalTriggerPrimitiveDigi e_digi(e_id);
87  int energy = (int) (EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
88  bool fg = (engine->flat()>0.5);
89  int ttf = (int)(8*engine->flat()); //0-7
90  EcalTriggerPrimitiveSample e_sample(energy, fg, ttf);
91  e_digi.setSize(1); //set sampleOfInterest to 0
92  e_digi.setSample(0,e_sample);
93  data->push_back(e_digi);
94  //EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int triggerFlag);
95  //const EcalTrigTowerDetId e_id( zside , EcalBarrel, etaTT, phiTT, 0);
96  if(verbose())
97  std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
98 }
99 
100 template <> inline void
101 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<HcalTrigPrimDigiCollection>& data,
102  int type) {
103  if(verbose())
104  std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
105  int side = (engine->flat()>0.5)?-1:1;
106  int ieta = (int) (1 + 17*engine->flat());
107  int iphi = (int) (1 + 72*engine->flat());
108  const HcalTrigTowerDetId h_id(side*ieta, iphi);
109  HcalTriggerPrimitiveDigi h_digi(h_id);
110  int energy = (int) (EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
111  HcalTriggerPrimitiveSample h_sample(energy, 0, 0, 0);
112  h_digi.setSize(1); //set sampleOfInterest to 0
113  h_digi.setSample(0,h_sample);
114  data->push_back(h_digi);
115  //HcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int slb, int slbchan);
116  //HcalTrigTowerDetId(int ieta, int iphi);
117  if(verbose())
118  std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
119 }
120 
121 template <> inline void
122 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1CaloEmCollection>& data,
123  int type) {
124  if(verbose())
125  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
126  int energy= (int) (EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
127  unsigned rank = energy & 0x3f;
128  unsigned region= (engine->flat()>0.5?0:1);
129  unsigned card = (unsigned)(7*engine->flat());
130  unsigned crate = (unsigned)(18*engine->flat());
131  bool iso = (engine->flat()>0.4);
132  uint16_t index = (unsigned)(4*engine->flat());
133  int16_t bx = nevt_;
134  L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
135  data->push_back(cand);
136  //L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
137  if(verbose())
138  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
139  }
140 
141 template <> inline void
142 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1CaloRegionCollection>& data,
143  int type) {
144  if(verbose())
145  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
146  int energy= (int) (EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
147  unsigned et = energy & 0x3ff;
148  bool overFlow = 0; //(engine->flat()>0.4);
149  bool tauVeto = 0; //(engine->flat()>0.3);
150  bool mip = 0; //(engine->flat()>0.1);
151  bool quiet = 0; //(engine->flat()>0.6);
152  unsigned crate= (unsigned)(18*engine->flat());
153  unsigned card = (unsigned)(7*engine->flat());
154  unsigned rgn = crate%2; //(engine->flat()>0.5?0:1);
155  L1CaloRegion cand( et, overFlow, tauVeto, mip, quiet, crate, card, rgn );
156  data->push_back(cand);
157  //L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
158  if(verbose())
159  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
160 }
161 
162 template <> inline void
163 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1GctEmCandCollection>& data,
164  int type) {
165  if(verbose())
166  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
167  bool iso; //= type==0;
168  switch(type) { // 0 iso, 1 noniso
169  case 0:
170  iso = true;
171  break;
172  case 1:
173  iso = false;
174  break;
175  default:
176  throw cms::Exception("L1DummyProducerInvalidType")
177  << "L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
178  << " invalid type: " << type << std::endl;
179  }
180  int energy= (int) (EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
181  unsigned rank = energy & 0x3f;
182  unsigned phi = (unsigned)(18*engine->flat());
183  unsigned eta = (unsigned)( 7*engine->flat());
184  if(engine->flat()>0.5) //-z (eta sign)
185  eta = (eta&0x7) + (0x1<<3);
186  L1GctEmCand cand(rank, phi, eta, iso);
187  data->push_back(cand);
188  // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
189  //L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
190  if(verbose())
191  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
192 }
193 
194 template <> inline void
195 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, 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 <> inline void
233 L1DummyProducer::SimpleDigi (CLHEP::HepRandomEngine* engine, std::unique_ptr<L1MuRegionalCandCollection>& data,
234  int type) {
235  if(verbose())
236  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
237  //typedef std::vector<L1MuRegionalCand> L1MuRegionalCandCollection;
238  assert(type>=0 && type<4);
239  unsigned type_idx=type; //tType: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
240  int bx = 0;
241  unsigned phi, eta, pt, charge, ch_valid, finehalo, quality;
242  float phiv(0.), etav(0.), ptv(0.); //linear translation? 0.2pi,-2.5..2.5,0..100
243  for(int i=0; i<4; i++) {
244  phi = (int)(144*engine->flat()); //8bits, 0..143
245  eta = (int)( 63*engine->flat()); //6bits code
246  phiv = phi*2*TMath::Pi()/144.;
247  etav = 2.5*(-1+2*eta/63.);
248  pt = ((int)(32*engine->flat())) & 0x1f; //5bits: 0..31
249  ptv = 100*(pt/31.);
250  charge = (engine->flat()>0.5?0:1);;
251  ch_valid=0;
252  finehalo=0;
253  quality = (int)(8*engine->flat()); //3bits: 0..7
254  L1MuRegionalCand cand(type_idx, phi, eta, pt, charge,
255  ch_valid, finehalo, quality, bx);
256  cand.setPhiValue(phiv);
257  cand.setEtaValue(etav);
258  cand.setPtValue (ptv);
259  data->push_back(cand);
260  }
261  //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt,
262  //unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
263  if(verbose())
264  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
265 }
266 
267 template <> inline void
268 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1MuDTTrackContainer> & data,
269  int type) {
270  assert(type==0);
271  int type_idx = type; //choose data type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
272  if(verbose())
273  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
274  std::unique_ptr<L1MuRegionalCandCollection> tracks(new L1MuRegionalCandCollection());
275  SimpleDigi(engine, tracks, type_idx);
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++) {
279  L1MuDTTrackCand * cnd = new L1MuDTTrackCand();
280  cnd->setDataWord(it->getDataWord());
281  cnd->setBx(it->bx());
282  tracksd->push_back(L1MuDTTrackCand());
283  tracksd->push_back(*cnd);
284  }
285  data->setContainer(*tracksd);
286  if(verbose())
287  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
288  //L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc, int utag,
289  // int adr1, int adr2, int adr3, int adr4, int utc );
290 
291 }
292 
293 template <> inline void
294 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1MuDTChambPhContainer>& data,
295  int type) {
296  if(verbose())
297  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
298  typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
299  int ntrk = 4;
300  Phi_Container tracks(ntrk);
301  int ubx, uwh, usc, ust,uphr, uphb, uqua, utag, ucnt;
302  for (int i=0; i<ntrk; i++) {
303  ubx = 0; //bxNum() - bx
304  uwh = 0; //whNum() - wheel
305  usc = 0; //scNum() - sector
306  ust = 0; //stNum() - station
307  uphr = 0; //phi() - radialAngle
308  uphb = 0; //phiB() - bendingAngle
309  uqua = 0; //code() - qualityCode
310  utag = 0; //Ts2Tag() - Ts2TagCode
311  ucnt = 0; //BxCnt() - BxCntCode
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());
316  L1MuDTChambPhDigi cand(ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt);
317  tracks.push_back(cand);
318  }
319  data->setContainer(tracks);
320  //L1MuDTChambPhDigi( int ubx, int uwh, int usc, int ust,
321  // int uphr, int uphb, int uqua, int utag, int ucnt );
322  if(verbose())
323  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
324 }
325 
326 template <> inline void
327 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1MuDTChambThContainer>& data,
328  int type) {
329  if(verbose())
330  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
331  typedef std::vector<L1MuDTChambThDigi> The_Container;
332  int ntrk = 4;
333  The_Container tracks(ntrk);
334  int ubx, uwh, usc, ust, uos[7], uqa[7];
335  for (int i=0; i<ntrk; i++) {
336  ubx = 0;
337  uwh = (int)(-2+5*engine->flat());
338  usc = (int)( 12*engine->flat());
339  ust = (int)(1.+4*engine->flat());
340  for(int j=0; j<7; j++) {
341  uos[j]=(engine->flat()>0.5?0:1);
342  uqa[j]=(engine->flat()>0.5?0:1);
343  }
344  L1MuDTChambThDigi cand(ubx, uwh, usc, ust, uos, uqa);
345  tracks.push_back(cand);
346  }
347  data->setContainer(tracks);
348  //L1MuDTChambThDigi( int ubx, int uwh, int usc, int ust,
349  // int* uos, [int* uqual] );
350  //"DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
351  if(verbose())
352  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
353 }
354 
355 template <> inline void
356 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1MuGMTCandCollection>& data,
357  int type) {
358  if(verbose())
359  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
360  //typedef std::vector<L1MuGMTCand> L1MuGMTCandCollection;
362  //cand.setPhiPacked();//8bits
363  //cand.setPtPacked ();//5bits
364  //cand.setQuality ();//3bits
365  //cand.setEtaPacked();//6bits
366  //cand.setIsolation();//1bit
367  //cand.setMIP ();//1bit
368  //cand.setChargePacked();//0:+, 1:-, 2:undef, 3:sync
369  //cand.setBx (nevt_);
370  //set physical values
371  double eng = EBase_+ESigm_*CLHEP::RandGaussQ::shoot(engine);
372  double phi = 2*TMath::Pi()*engine->flat();
373  double eta = 2.5*(-1+2*engine->flat());
374  cand.setPtValue (eng);
375  cand.setPhiValue(phi);
376  cand.setEtaValue(eta);
377  unsigned engp = (unsigned)(EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
378  unsigned phip = (unsigned)(255*engine->flat());
379  unsigned etap = (unsigned)( 63*engine->flat());
380  cand.setPtPacked (engp&0x1f);
381  cand.setPhiPacked(phip&0x7f);
382  cand.setEtaPacked(etap&0x3f);
383  double r = engine->flat();
384  cand.setIsolation(r>0.2);
385  cand.setMIP(r>0.7);
386  cand.setChargePacked(r>0.5?0:1);
387  cand.setBx(0);
388  data->push_back(cand);
389  if(verbose())
390  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
391 
392 }
393 
394 template <> inline void
395 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1MuGMTReadoutCollection>& data,
396  int type) {
397  if(verbose())
398  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
399  L1MuGMTReadoutRecord rec(0);
400  int bxn = nevt_;
401  rec.setBxNr(bxn);
402  rec.setEvNr(bxn);
403  rec.setBxInEvent(0);
404  std::unique_ptr<L1MuRegionalCandCollection> trks_dttf(new L1MuRegionalCandCollection);
405  std::unique_ptr<L1MuRegionalCandCollection> trks_rpcb(new L1MuRegionalCandCollection);
406  std::unique_ptr<L1MuRegionalCandCollection> trks_csc (new L1MuRegionalCandCollection);
407  std::unique_ptr<L1MuRegionalCandCollection> trks_rpcf(new L1MuRegionalCandCollection);
408  SimpleDigi(engine, trks_dttf,0);
409  SimpleDigi(engine, trks_rpcb,1);
410  SimpleDigi(engine, trks_csc ,2);
411  SimpleDigi(engine, trks_rpcf,3);
412  for(int i=0; i<4; i++) {
413  rec.setInputCand(i ,trks_dttf->at(i));//dt : 0..3
414  rec.setInputCand(i+ 4,trks_rpcb->at(i));//rpcb: 4..7
415  rec.setInputCand(i+ 8,trks_csc ->at(i));//csc : 8..11
416  rec.setInputCand(i+12,trks_rpcf->at(i));//rpcf:12..15
417  }
418  for(int nr=0; nr<4; nr++) {
419  int eng = (int)(EBase_ + ESigm_*CLHEP::RandGaussQ::shoot(engine));
420  rec.setGMTBrlCand(nr, eng&0x11, eng&0x11); //set GMT barrel candidate
421  rec.setGMTFwdCand(nr, eng&0x11, eng&0x11); //set GMT forward candidate
422  rec.setGMTCand (nr, eng&0x11); //set GMT candidate (does not store rank)
423  int eta = (int)(14*engine->flat()); //0..13
424  int phi = (int)(18*engine->flat()); //0..17
425  rec.setMIPbit (eta, phi);
426  rec.setQuietbit(eta, phi);
427  }
428  data->addRecord(rec);
430  //rec.setBCERR(int bcerr);
431  //rec.setGMTBrlCand(int nr, L1MuGMTExtendedCand const& cand);
432  //rec.setGMTFwdCand(int nr, L1MuGMTExtendedCand const& cand);
433  //rec.setGMTCand (int nr, L1MuGMTExtendedCand const& cand);
434  //rec.setInputCand (int nr, L1MuRegionalCand const& cand);
435  //L1MuGMTReadoutCollection :: std::vector<L1MuGMTReadoutRecord> m_Records;
436  //L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
437  //L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx=0) : L1MuGMTCand (data, bx), m_rank(rank) {}
438  if(verbose())
439  std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
440 }
441 
442 template <> inline void
443 L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<LTCDigiCollection> & data,
444  int type) {
445  if(verbose())
446  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
447  //LTCs are FED id 816-823
448  /*
449  6 64-bit words
450  uint64_t *ld = (uint64_t*)data;
451 
452  word0: 59:56 4 bit ld[0]>>56 & 0xf trigType
453  55:32 24 bit ld[0]>>32 & 0x00ffffff eventID
454  31:20 12 bit ld[0]>>20 & 0xfff bunchNumber
455  19: 8 12 bit ld[0]>> 8 & 0x00000fff sourceID (816-823?)
456 
457  word1: 63:32 32 bit ld[1]>>32 & 0xffffffff orbitNumber
458  31:24 8 bit ld[1]>>24 & 0xff versionNumber
459  3: 0 4 bit ld[1 & 0xf daqPartition
460 
461  word2: 63:32 32 bit ld[0]>>32 & 0xffffffff runNumber
462  31: 0 32 bit ld[0] & 0xffffffff eventNumber
463 
464  word3: 63:32 32 bit ld[3]>>32 & 0xffffffff trigInhibitNumber
465  31: 0 32 bit ld[3] & 0xffffffff trigInputStat
466 
467  word4: 63:0 64 bit ld[4] bstGpsTime
468 
469  word5: (empty)
470  */
471  //need to make up something meaningfull to produce here..
472  //LTCDigi(const unsigned char* data);
473  if(verbose())
474  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
475 }
476 
477 template <> inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<CSCCorrelatedLCTDigiCollection>& data,
478  int type) {
479  if(verbose())
480  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
481  //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
482  //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);
484  //tbd: set non-trivial random values
485  dg.clear(); // set contents to zero
486  //CSCDetId( int iendcap, int istation, int iring, int ichamber, int ilayer = 0 );
487  enum eMinNum{ MIN_ENDCAP=1, MIN_STATION=1, MIN_RING=1, MIN_CHAMBER= 1, MIN_LAYER=1 };
488  enum eMaxNum{ MAX_ENDCAP=2, MAX_STATION=4, MAX_RING=4, MAX_CHAMBER=36, MAX_LAYER=6 };
489  float rnd = engine->flat();
490  int ec = (int)( MIN_ENDCAP + (MAX_ENDCAP -MIN_ENDCAP )*rnd +1);
491  int st = (int)( MIN_STATION + (MAX_STATION-MIN_STATION)*rnd +1);
492  int rg = (int)( MIN_RING + (MAX_RING -MIN_RING )*rnd +1);
493  int ch = (int)( MIN_CHAMBER + (MAX_CHAMBER-MIN_CHAMBER)*rnd +1);
494  int lr = (int)( MIN_LAYER + (MAX_LAYER -MIN_LAYER )*rnd +1);
495  CSCDetId did = CSCDetId(ec,st,rg,ch,lr);
496  //CSCDetId did = CSCDetId(); //DetId(DetId::Muon, MuonSubdetId::CSC)
497  //MuonDigiCollection::insertDigi(const IndexType& index, const DigiType& digi)
498  data->insertDigi(did,dg);
499  if(verbose())
500  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
501 }
502 
503 template <> inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine, std::unique_ptr<L1CSCTrackCollection>& data,
504  int type) {
505  if(verbose())
506  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
507  std::unique_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
508  SimpleDigi(engine, dgcoll,0);
509  csc::L1Track l1trk = csc::L1Track();
510  std::unique_ptr<L1MuRegionalCandCollection> regcoll(new L1MuRegionalCandCollection);
511  SimpleDigi(engine, regcoll,2);
512  L1MuRegionalCand regcand = *(regcoll->begin());
513  l1trk.setDataWord(regcand.getDataWord());
514  l1trk.setBx(regcand.bx());
515  l1trk.setPhiValue(regcand.phiValue());
516  l1trk.setEtaValue(regcand.etaValue());
517  l1trk.setPtValue (regcand.ptValue());
518  L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
519  data->push_back(l1csctrk);
520  //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
521  //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
522  //L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { setType(2); setPtPacked(0); }
523  //L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
524  if(verbose())
525  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
526  }
527 
528 #endif
const double Pi
type
Definition: HCALResponse.h:21
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:154
void setSample(int i, const HcalTriggerPrimitiveSample &sam)
bool m_doSys[dedefs::DEnsys]
const int DEnsys
Definition: DEtrait.h:38
virtual void endJob()
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:166
float etaValue() const
get eta-value of muon candidate
int MIN_ENDCAP
Definition: Common.h:47
void setGMTBrlCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT barrel candidate
virtual void beginJob(void)
Level-1 Trigger jet candidate.
Definition: L1GctJetCand.h:18
void setGMTFwdCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT forward candidate
Level-1 Region Calorimeter Trigger EM candidate.
Definition: L1CaloEmCand.h:18
void setInputCand(int nr, unsigned data)
set Input muon
void setPtValue(float ptVal)
Set Pt Value.
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
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.
Definition: L1MuGMTCand.h:177
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
Definition: L1MuGMTCand.h:172
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) ...
Definition: L1MuGMTCand.h:169
virtual void produce(edm::Event &, const edm::EventSetup &)
void SimpleDigi(CLHEP::HepRandomEngine *, std::unique_ptr< T > &data, int type=0)
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:160
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuGMTCand.h:183
void setBxNr(int bxnr)
set counters
et
define resolution functions of each parameter
int MAX_ENDCAP
Definition: Common.h:48
int bx() const
return bunch crossing identifier
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:22
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuGMTCand.h:180
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:151
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:163
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:15