CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
30 
31 // l1 dataformats, d|e record includes
33 
34 // random # generator
36 #include "CLHEP/Random/RandFlat.h"
37 #include "CLHEP/Random/RandGaussQ.h"
38 
39 
41 
42  public:
43 
44  explicit L1DummyProducer(const edm::ParameterSet&);
46 
47  private:
48 
49  virtual void beginJob(void) {};
50  //virtual void beginRun(edm::Run&, const edm::EventSetup&);
51  virtual void produce(edm::Event&, const edm::EventSetup&);
52  virtual void endJob() {};
53 
54  public:
55 
56  template <class T>
57  void SimpleDigi(std::auto_ptr<T>& data, int type=0);
58 
59  private:
60 
61  int verbose_;
62  int verbose() {return verbose_;}
63  int nevt_;
64 
66  std::string instName[dedefs::DEnsys][5];
67 
68  CLHEP::RandFlat *rndFlat_;
69  CLHEP::RandGaussQ *rndGaus_;
70  double EBase_;
71  double ESigm_;
72 
73 };
74 
75 
76 template <class T> void
77 L1DummyProducer::SimpleDigi(std::auto_ptr<T>& data, int type) {
78  /*collections generated in specializations below*/
79 }
80 
81 template <> inline void
82 L1DummyProducer::SimpleDigi(std::auto_ptr<EcalTrigPrimDigiCollection>& data,
83  int type) {
84  if(verbose())
85  std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
86  int side = (rndFlat_->fire()>0.5)?-1:1;
87  int ieta = (int) (1 + 17*rndFlat_->fire()); //1-17
88  int iphi = (int) (1 + 72*rndFlat_->fire()); //1-72
89  const EcalTrigTowerDetId e_id( side , EcalBarrel, ieta, iphi, 0);
90  EcalTriggerPrimitiveDigi e_digi(e_id);
91  int energy = (int) (EBase_ + ESigm_*rndGaus_->fire());
92  bool fg = (rndFlat_->fire()>0.5);
93  int ttf = (int)(8*rndFlat_->fire()); //0-7
94  EcalTriggerPrimitiveSample e_sample(energy, fg, ttf);
95  e_digi.setSize(1); //set sampleOfInterest to 0
96  e_digi.setSample(0,e_sample);
97  data->push_back(e_digi);
98  //EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int triggerFlag);
99  //const EcalTrigTowerDetId e_id( zside , EcalBarrel, etaTT, phiTT, 0);
100  if(verbose())
101  std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
102 }
103 
104 template <> inline void
105 L1DummyProducer::SimpleDigi(std::auto_ptr<HcalTrigPrimDigiCollection>& data,
106  int type) {
107  if(verbose())
108  std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
109  int side = (rndFlat_->fire()>0.5)?-1:1;
110  int ieta = (int) (1 + 17*rndFlat_->fire());
111  int iphi = (int) (1 + 72*rndFlat_->fire());
112  const HcalTrigTowerDetId h_id(side*ieta, iphi);
113  HcalTriggerPrimitiveDigi h_digi(h_id);
114  int energy = (int) (EBase_ + ESigm_*rndGaus_->fire());
115  HcalTriggerPrimitiveSample h_sample(energy, 0, 0, 0);
116  h_digi.setSize(1); //set sampleOfInterest to 0
117  h_digi.setSample(0,h_sample);
118  data->push_back(h_digi);
119  //HcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int slb, int slbchan);
120  //HcalTrigTowerDetId(int ieta, int iphi);
121  if(verbose())
122  std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
123 }
124 
125 template <> inline void
126 L1DummyProducer::SimpleDigi(std::auto_ptr<L1CaloEmCollection>& data,
127  int type) {
128  if(verbose())
129  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
130  int energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
131  unsigned rank = energy & 0x3f;
132  unsigned region= (rndFlat_->fire()>0.5?0:1);
133  unsigned card = (unsigned)(7*rndFlat_->fire());
134  unsigned crate = (unsigned)(18*rndFlat_->fire());
135  bool iso = (rndFlat_->fire()>0.4);
136  uint16_t index = (unsigned)(4*rndFlat_->fire());
137  int16_t bx = nevt_;
138  L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
139  data->push_back(cand);
140  //L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
141  if(verbose())
142  std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
143  }
144 
145 template <> inline void
146 L1DummyProducer::SimpleDigi(std::auto_ptr<L1CaloRegionCollection>& data,
147  int type) {
148  if(verbose())
149  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
150  int energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
151  unsigned et = energy & 0x3ff;
152  bool overFlow = 0; //(rndFlat_->fire()>0.4);
153  bool tauVeto = 0; //(rndFlat_->fire()>0.3);
154  bool mip = 0; //(rndFlat_->fire()>0.1);
155  bool quiet = 0; //(rndFlat_->fire()>0.6);
156  unsigned crate= (unsigned)(18*rndFlat_->fire());
157  unsigned card = (unsigned)(7*rndFlat_->fire());
158  unsigned rgn = crate%2; //(rndFlat_->fire()>0.5?0:1);
159  L1CaloRegion cand( et, overFlow, tauVeto, mip, quiet, crate, card, rgn );
160  data->push_back(cand);
161  //L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
162  if(verbose())
163  std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
164 }
165 
166 template <> inline void
167 L1DummyProducer::SimpleDigi(std::auto_ptr<L1GctEmCandCollection>& data,
168  int type) {
169  if(verbose())
170  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
171  bool iso; //= type==0;
172  switch(type) { // 0 iso, 1 noniso
173  case 0:
174  iso = true;
175  break;
176  case 1:
177  iso = false;
178  break;
179  default:
180  throw cms::Exception("L1DummyProducerInvalidType")
181  << "L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
182  << " invalid type: " << type << std::endl;
183  }
184  int energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
185  unsigned rank = energy & 0x3f;
186  unsigned phi = (unsigned)(18*rndFlat_->fire());
187  unsigned eta = (unsigned)( 7*rndFlat_->fire());
188  if(rndFlat_->fire()>0.5) //-z (eta sign)
189  eta = (eta&0x7) + (0x1<<3);
190  L1GctEmCand cand(rank, phi, eta, iso);
191  data->push_back(cand);
192  // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
193  //L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
194  if(verbose())
195  std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
196 }
197 
198 template <> inline void
199 L1DummyProducer::SimpleDigi(std::auto_ptr<L1GctJetCandCollection>& data,
200  int type) {
201  if(verbose())
202  std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
203  bool isFor, isTau;
204  switch(type) { // 0 cen, 1 for, 2 tau
205  case 0:
206  isFor = false;
207  isTau = false;
208  break;
209  case 1:
210  isFor = true;
211  isTau = false;
212  break;
213  case 2:
214  isFor = false;
215  isTau = true;
216  break;
217  default:
218  throw cms::Exception("L1DummyProducerInvalidType")
219  << "L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
220  << " invalid type: " << type << std::endl;
221  }
222 
223  int energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
224  unsigned rank = energy & 0x3f;
225  unsigned phi = (unsigned)(18*rndFlat_->fire());
226  unsigned eta = (unsigned)( 7*rndFlat_->fire());
227  if(rndFlat_->fire()>0.5) //-z (eta sign)
228  eta = (eta&0x7) + (0x1<<3);
229  L1GctJetCand cand(rank, phi, eta, isTau, isFor);
230  data->push_back(cand);
231  //L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor);
232  if(verbose())
233  std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
234 }
235 
236 template <> inline void
237 L1DummyProducer::SimpleDigi ( std::auto_ptr<L1MuRegionalCandCollection>& data,
238  int type) {
239  if(verbose())
240  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
241  //typedef std::vector<L1MuRegionalCand> L1MuRegionalCandCollection;
242  assert(type>=0 && type<4);
243  unsigned type_idx=type; //tType: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
244  int bx = 0;
245  unsigned phi, eta, pt, charge, ch_valid, finehalo, quality;
246  float phiv(0.), etav(0.), ptv(0.); //linear translation? 0.2pi,-2.5..2.5,0..100
247  for(int i=0; i<4; i++) {
248  phi = (int)(144*rndFlat_->fire()); //8bits, 0..143
249  eta = (int)( 63*rndFlat_->fire()); //6bits code
250  phiv = phi*2*TMath::Pi()/144.;
251  etav = 2.5*(-1+2*eta/63.);
252  pt = ((int)(32*rndFlat_->fire())) & 0x1f; //5bits: 0..31
253  ptv = 100*(pt/31.);
254  charge = (rndFlat_->fire()>0.5?0:1);;
255  ch_valid=0;
256  finehalo=0;
257  quality = (int)(8*rndFlat_->fire()); //3bits: 0..7
258  L1MuRegionalCand cand(type_idx, phi, eta, pt, charge,
259  ch_valid, finehalo, quality, bx);
260  cand.setPhiValue(phiv);
261  cand.setEtaValue(etav);
262  cand.setPtValue (ptv);
263  data->push_back(cand);
264  }
265  //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt,
266  //unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
267  if(verbose())
268  std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
269 }
270 
271 template <> inline void
272 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuDTTrackContainer> & data,
273  int type) {
274  assert(type==0);
275  int type_idx = type; //choose data type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
276  if(verbose())
277  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
278  std::auto_ptr<L1MuRegionalCandCollection> tracks(new L1MuRegionalCandCollection());
279  SimpleDigi(tracks, type_idx);
280  typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
281  std::auto_ptr<L1MuDTTrackCandCollection> tracksd (new L1MuDTTrackCandCollection());
282  for(L1MuRegionalCandCollection::const_iterator it=tracks->begin(); it!=tracks->end(); it++) {
283  L1MuDTTrackCand * cnd = new L1MuDTTrackCand();
284  cnd->setDataWord(it->getDataWord());
285  cnd->setBx(it->bx());
286  tracksd->push_back(L1MuDTTrackCand());
287  tracksd->push_back(*cnd);
288  }
289  data->setContainer(*tracksd);
290  if(verbose())
291  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
292  //L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc, int utag,
293  // int adr1, int adr2, int adr3, int adr4, int utc );
294 
295 }
296 
297 template <> inline void
298 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuDTChambPhContainer>& data,
299  int type) {
300  if(verbose())
301  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
302  typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
303  int ntrk = 4;
304  Phi_Container tracks(ntrk);
305  int ubx, uwh, usc, ust,uphr, uphb, uqua, utag, ucnt;
306  for (int i=0; i<ntrk; i++) {
307  ubx = 0; //bxNum() - bx
308  uwh = 0; //whNum() - wheel
309  usc = 0; //scNum() - sector
310  ust = 0; //stNum() - station
311  uphr = 0; //phi() - radialAngle
312  uphb = 0; //phiB() - bendingAngle
313  uqua = 0; //code() - qualityCode
314  utag = 0; //Ts2Tag() - Ts2TagCode
315  ucnt = 0; //BxCnt() - BxCntCode
316  uwh = (int)(-2+5*rndFlat_->fire());
317  usc = (int)( 12*rndFlat_->fire());
318  ust = (int)(1.+4*rndFlat_->fire());
319  uqua= (int)( 8*rndFlat_->fire());
320  L1MuDTChambPhDigi cand(ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt);
321  tracks.push_back(cand);
322  }
323  data->setContainer(tracks);
324  //L1MuDTChambPhDigi( int ubx, int uwh, int usc, int ust,
325  // int uphr, int uphb, int uqua, int utag, int ucnt );
326  if(verbose())
327  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
328 }
329 
330 template <> inline void
331 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuDTChambThContainer>& data,
332  int type) {
333  if(verbose())
334  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
335  typedef std::vector<L1MuDTChambThDigi> The_Container;
336  int ntrk = 4;
337  The_Container tracks(ntrk);
338  int ubx, uwh, usc, ust, uos[7], uqa[7];
339  for (int i=0; i<ntrk; i++) {
340  ubx = 0;
341  uwh = (int)(-2+5*rndFlat_->fire());
342  usc = (int)( 12*rndFlat_->fire());
343  ust = (int)(1.+4*rndFlat_->fire());
344  for(int j=0; j<7; j++) {
345  uos[j]=(rndFlat_->fire()>0.5?0:1);
346  uqa[j]=(rndFlat_->fire()>0.5?0:1);
347  }
348  L1MuDTChambThDigi cand(ubx, uwh, usc, ust, uos, uqa);
349  tracks.push_back(cand);
350  }
351  data->setContainer(tracks);
352  //L1MuDTChambThDigi( int ubx, int uwh, int usc, int ust,
353  // int* uos, [int* uqual] );
354  //"DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
355  if(verbose())
356  std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
357 }
358 
359 template <> inline void
360 L1DummyProducer::SimpleDigi(std::auto_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_*rndGaus_->fire();
376  double phi = 2*TMath::Pi()*rndFlat_->fire();
377  double eta = 2.5*(-1+2*rndFlat_->fire());
378  cand.setPtValue (eng);
379  cand.setPhiValue(phi);
380  cand.setEtaValue(eta);
381  unsigned engp = (unsigned)(EBase_ + ESigm_*rndGaus_->fire());
382  unsigned phip = (unsigned)(255*rndFlat_->fire());
383  unsigned etap = (unsigned)( 63*rndFlat_->fire());
384  cand.setPtPacked (engp&0x1f);
385  cand.setPhiPacked(phip&0x7f);
386  cand.setEtaPacked(etap&0x3f);
387  double r = rndFlat_->fire();
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 
398 template <> inline void
399 L1DummyProducer::SimpleDigi(std::auto_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::auto_ptr<L1MuRegionalCandCollection> trks_dttf(new L1MuRegionalCandCollection);
409  std::auto_ptr<L1MuRegionalCandCollection> trks_rpcb(new L1MuRegionalCandCollection);
410  std::auto_ptr<L1MuRegionalCandCollection> trks_csc (new L1MuRegionalCandCollection);
411  std::auto_ptr<L1MuRegionalCandCollection> trks_rpcf(new L1MuRegionalCandCollection);
412  SimpleDigi(trks_dttf,0);
413  SimpleDigi(trks_rpcb,1);
414  SimpleDigi(trks_csc ,2);
415  SimpleDigi(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_*rndGaus_->fire());
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*rndFlat_->fire()); //0..13
428  int phi = (int)(18*rndFlat_->fire()); //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 <> inline void
447 L1DummyProducer::SimpleDigi(std::auto_ptr<LTCDigiCollection> & data,
448  int type) {
449  if(verbose())
450  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
451  //LTCs are FED id 816-823
452  /*
453  6 64-bit words
454  uint64_t *ld = (uint64_t*)data;
455 
456  word0: 59:56 4 bit ld[0]>>56 & 0xf trigType
457  55:32 24 bit ld[0]>>32 & 0x00ffffff eventID
458  31:20 12 bit ld[0]>>20 & 0xfff bunchNumber
459  19: 8 12 bit ld[0]>> 8 & 0x00000fff sourceID (816-823?)
460 
461  word1: 63:32 32 bit ld[1]>>32 & 0xffffffff orbitNumber
462  31:24 8 bit ld[1]>>24 & 0xff versionNumber
463  3: 0 4 bit ld[1 & 0xf daqPartition
464 
465  word2: 63:32 32 bit ld[0]>>32 & 0xffffffff runNumber
466  31: 0 32 bit ld[0] & 0xffffffff eventNumber
467 
468  word3: 63:32 32 bit ld[3]>>32 & 0xffffffff trigInhibitNumber
469  31: 0 32 bit ld[3] & 0xffffffff trigInputStat
470 
471  word4: 63:0 64 bit ld[4] bstGpsTime
472 
473  word5: (empty)
474  */
475  //need to make up something meaningfull to produce here..
476  //LTCDigi(const unsigned char* data);
477  if(verbose())
478  std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
479 }
480 
481 template <> inline void L1DummyProducer::SimpleDigi(std::auto_ptr<CSCCorrelatedLCTDigiCollection>& data,
482  int type) {
483  if(verbose())
484  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
485  //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
486  //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);
488  //tbd: set non-trivial random values
489  dg.clear(); // set contents to zero
490  //CSCDetId( int iendcap, int istation, int iring, int ichamber, int ilayer = 0 );
491  enum eMinNum{ MIN_ENDCAP=1, MIN_STATION=1, MIN_RING=1, MIN_CHAMBER= 1, MIN_LAYER=1 };
492  enum eMaxNum{ MAX_ENDCAP=2, MAX_STATION=4, MAX_RING=4, MAX_CHAMBER=36, MAX_LAYER=6 };
493  float rnd = rndFlat_->fire();
494  int ec = (int)( MIN_ENDCAP + (MAX_ENDCAP -MIN_ENDCAP )*rnd +1);
495  int st = (int)( MIN_STATION + (MAX_STATION-MIN_STATION)*rnd +1);
496  int rg = (int)( MIN_RING + (MAX_RING -MIN_RING )*rnd +1);
497  int ch = (int)( MIN_CHAMBER + (MAX_CHAMBER-MIN_CHAMBER)*rnd +1);
498  int lr = (int)( MIN_LAYER + (MAX_LAYER -MIN_LAYER )*rnd +1);
499  CSCDetId did = CSCDetId(ec,st,rg,ch,lr);
500  //CSCDetId did = CSCDetId(); //DetId(DetId::Muon, MuonSubdetId::CSC)
501  //MuonDigiCollection::insertDigi(const IndexType& index, const DigiType& digi)
502  data->insertDigi(did,dg);
503  if(verbose())
504  std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
505 }
506 
507 template <> inline void L1DummyProducer::SimpleDigi(std::auto_ptr<L1CSCTrackCollection>& data,
508  int type) {
509  if(verbose())
510  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
511  std::auto_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
512  SimpleDigi(dgcoll,0);
513  csc::L1Track l1trk = csc::L1Track();
514  std::auto_ptr<L1MuRegionalCandCollection> regcoll(new L1MuRegionalCandCollection);
515  SimpleDigi(regcoll,2);
516  L1MuRegionalCand regcand = *(regcoll->begin());
517  l1trk.setDataWord(regcand.getDataWord());
518  l1trk.setBx(regcand.bx());
519  l1trk.setPhiValue(regcand.phiValue());
520  l1trk.setEtaValue(regcand.etaValue());
521  l1trk.setPtValue (regcand.ptValue());
522  L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
523  data->push_back(l1csctrk);
524  //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
525  //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
526  //L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { setType(2); setPtPacked(0); }
527  //L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
528  if(verbose())
529  std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
530  }
531 
532 #endif
const double Pi
type
Definition: HCALResponse.h:22
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:156
int i
Definition: DBlmapReader.cc:9
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:168
float etaValue() const
get eta-value of muon candidate
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
T eta() const
void setPtValue(float ptVal)
Set Pt Value.
Level-1 Trigger EM candidate at output of GCT.
Definition: L1GctEmCand.h:22
double charge(const std::vector< uint8_t > &Ampls)
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.
CLHEP::RandFlat * rndFlat_
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.
CLHEP::RandGaussQ * rndGaus_
void setSample(int i, const EcalTriggerPrimitiveSample &sam)
void setPhiValue(float phiVal)
Setters for physical values.
Definition: L1MuGMTCand.h:179
unsigned getDataWord() const
return data word
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
int j
Definition: DBlmapReader.cc:9
std::string instName[dedefs::DEnsys][5]
void setBx(int bx)
set bunch crossing identifier
Definition: L1MuGMTCand.h:174
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:171
virtual void produce(edm::Event &, const edm::EventSetup &)
void SimpleDigi(std::auto_ptr< T > &data, int type=0)
tuple tracks
Definition: testEve_cfg.py:39
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:162
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuGMTCand.h:185
void setBxNr(int bxnr)
set counters
int bx() const
return bunch crossing identifier
std::pair< csc::L1Track, CSCCorrelatedLCTDigiCollection > L1CSCTrack
A calorimeter trigger region (sum of 4x4 trigger towers)
Definition: L1CaloRegion.h:22
tuple cout
Definition: gather_cfg.py:41
void setGMTCand(int nr, L1MuGMTExtendedCand const &cand)
set GMT candidate (does not store rank)
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuGMTCand.h:182
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:153
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:165
list at
Definition: asciidump.py:428
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:15
Definition: DDAxes.h:10