Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:26

0001 #ifndef L1_DUMMY_PRODUCER_H
0002 #define L1_DUMMY_PRODUCER_H
0003 
0004 /*\class L1DummyProducer
0005  *\description produces simplified, random L1 trigger digis
0006  *\usage pattern and monitoring software test and validation
0007  *\author Nuno Leonardo (CERN)
0008  *\date 07.07
0009  */
0010 
0011 // system includes
0012 #include <memory>
0013 #include <string>
0014 #include <iostream>
0015 #include <fstream>
0016 #include <iomanip>
0017 #include <vector>
0018 #include <algorithm>
0019 #include "TMath.h"
0020 #include <bitset>
0021 
0022 // common includes
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/EDProducer.h"
0025 #include "FWCore/Framework/interface/Event.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0029 
0030 // l1 dataformats, d|e record includes
0031 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h"
0032 #include "DataFormats/L1CSCTrackFinder/interface/L1Track.h"
0033 #include "L1Trigger/HardwareValidation/interface/DEtrait.h"
0034 
0035 // random # generator
0036 #include "CLHEP/Random/RandomEngine.h"
0037 #include "CLHEP/Random/RandGaussQ.h"
0038 
0039 class L1DummyProducer : public edm::EDProducer {
0040 public:
0041   explicit L1DummyProducer(const edm::ParameterSet&);
0042   ~L1DummyProducer() override;
0043 
0044 private:
0045   void beginJob(void) override{};
0046   //virtual void beginRun(edm::Run&, const edm::EventSetup&);
0047   void produce(edm::Event&, const edm::EventSetup&) override;
0048   void endJob() override{};
0049 
0050 public:
0051   template <class T>
0052   void SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type = 0);
0053 
0054 private:
0055   int verbose_;
0056   int verbose() { return verbose_; }
0057   int nevt_;
0058 
0059   bool m_doSys[dedefs::DEnsys];
0060   std::string instName[dedefs::DEnsys][5];
0061 
0062   double EBase_;
0063   double ESigm_;
0064 };
0065 
0066 template <class T>
0067 void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<T>& data, int type) {
0068   /*collections generated in specializations below*/
0069 }
0070 
0071 template <>
0072 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0073                                         std::unique_ptr<EcalTrigPrimDigiCollection>& data,
0074                                         int type) {
0075   if (verbose())
0076     std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
0077   int side = (engine->flat() > 0.5) ? -1 : 1;
0078   int ieta = (int)(1 + 17 * engine->flat());  //1-17
0079   int iphi = (int)(1 + 72 * engine->flat());  //1-72
0080   const EcalTrigTowerDetId e_id(side, EcalBarrel, ieta, iphi, 0);
0081   EcalTriggerPrimitiveDigi e_digi(e_id);
0082   int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0083   bool fg = (engine->flat() > 0.5);
0084   int ttf = (int)(8 * engine->flat());  //0-7
0085   EcalTriggerPrimitiveSample e_sample(energy, fg, ttf);
0086   e_digi.setSize(1);  //set sampleOfInterest to 0
0087   e_digi.setSample(0, e_sample);
0088   data->push_back(e_digi);
0089   //EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int triggerFlag);
0090   //const EcalTrigTowerDetId e_id( zside , EcalBarrel, etaTT, phiTT, 0);
0091   if (verbose())
0092     std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
0093 }
0094 
0095 template <>
0096 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0097                                         std::unique_ptr<HcalTrigPrimDigiCollection>& data,
0098                                         int type) {
0099   if (verbose())
0100     std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
0101   int side = (engine->flat() > 0.5) ? -1 : 1;
0102   int ieta = (int)(1 + 17 * engine->flat());
0103   int iphi = (int)(1 + 72 * engine->flat());
0104   const HcalTrigTowerDetId h_id(side * ieta, iphi);
0105   HcalTriggerPrimitiveDigi h_digi(h_id);
0106   int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0107   HcalTriggerPrimitiveSample h_sample(energy, false, 0, 0);
0108   h_digi.setSize(1);  //set sampleOfInterest to 0
0109   h_digi.setSample(0, h_sample);
0110   data->push_back(h_digi);
0111   //HcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int slb, int slbchan);
0112   //HcalTrigTowerDetId(int ieta, int iphi);
0113   if (verbose())
0114     std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
0115 }
0116 
0117 template <>
0118 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0119                                         std::unique_ptr<L1CaloEmCollection>& data,
0120                                         int type) {
0121   if (verbose())
0122     std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
0123   int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0124   unsigned rank = energy & 0x3f;
0125   unsigned region = (engine->flat() > 0.5 ? 0 : 1);
0126   unsigned card = (unsigned)(7 * engine->flat());
0127   unsigned crate = (unsigned)(18 * engine->flat());
0128   bool iso = (engine->flat() > 0.4);
0129   uint16_t index = (unsigned)(4 * engine->flat());
0130   int16_t bx = nevt_;
0131   L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
0132   data->push_back(cand);
0133   //L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
0134   if (verbose())
0135     std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
0136 }
0137 
0138 template <>
0139 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0140                                         std::unique_ptr<L1CaloRegionCollection>& data,
0141                                         int type) {
0142   if (verbose())
0143     std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
0144   int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0145   unsigned et = energy & 0x3ff;
0146   bool overFlow = false;  //(engine->flat()>0.4);
0147   bool tauVeto = false;   //(engine->flat()>0.3);
0148   bool mip = false;       //(engine->flat()>0.1);
0149   bool quiet = false;     //(engine->flat()>0.6);
0150   unsigned crate = (unsigned)(18 * engine->flat());
0151   unsigned card = (unsigned)(7 * engine->flat());
0152   unsigned rgn = crate % 2;  //(engine->flat()>0.5?0:1);
0153   L1CaloRegion cand(et, overFlow, tauVeto, mip, quiet, crate, card, rgn);
0154   data->push_back(cand);
0155   //L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
0156   if (verbose())
0157     std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
0158 }
0159 
0160 template <>
0161 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0162                                         std::unique_ptr<L1GctEmCandCollection>& data,
0163                                         int type) {
0164   if (verbose())
0165     std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
0166   bool iso;        //= type==0;
0167   switch (type) {  // 0 iso, 1 noniso
0168     case 0:
0169       iso = true;
0170       break;
0171     case 1:
0172       iso = false;
0173       break;
0174     default:
0175       throw cms::Exception("L1DummyProducerInvalidType")
0176           << "L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
0177           << " invalid type: " << type << std::endl;
0178   }
0179   int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0180   unsigned rank = energy & 0x3f;
0181   unsigned phi = (unsigned)(18 * engine->flat());
0182   unsigned eta = (unsigned)(7 * engine->flat());
0183   if (engine->flat() > 0.5)  //-z (eta sign)
0184     eta = (eta & 0x7) + (0x1 << 3);
0185   L1GctEmCand cand(rank, phi, eta, iso);
0186   data->push_back(cand);
0187   // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
0188   //L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
0189   if (verbose())
0190     std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
0191 }
0192 
0193 template <>
0194 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0195                                         std::unique_ptr<L1GctJetCandCollection>& data,
0196                                         int type) {
0197   if (verbose())
0198     std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
0199   bool isFor, isTau;
0200   switch (type) {  // 0 cen, 1 for, 2 tau
0201     case 0:
0202       isFor = false;
0203       isTau = false;
0204       break;
0205     case 1:
0206       isFor = true;
0207       isTau = false;
0208       break;
0209     case 2:
0210       isFor = false;
0211       isTau = true;
0212       break;
0213     default:
0214       throw cms::Exception("L1DummyProducerInvalidType")
0215           << "L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
0216           << " invalid type: " << type << std::endl;
0217   }
0218 
0219   int energy = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0220   unsigned rank = energy & 0x3f;
0221   unsigned phi = (unsigned)(18 * engine->flat());
0222   unsigned eta = (unsigned)(7 * engine->flat());
0223   if (engine->flat() > 0.5)  //-z (eta sign)
0224     eta = (eta & 0x7) + (0x1 << 3);
0225   L1GctJetCand cand(rank, phi, eta, isTau, isFor);
0226   data->push_back(cand);
0227   //L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor);
0228   if (verbose())
0229     std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
0230 }
0231 
0232 template <>
0233 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0234                                         std::unique_ptr<L1MuRegionalCandCollection>& data,
0235                                         int type) {
0236   if (verbose())
0237     std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
0238   //typedef std::vector<L1MuRegionalCand>     L1MuRegionalCandCollection;
0239   assert(type >= 0 && type < 4);
0240   unsigned type_idx = type;  //tType: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
0241   int bx = 0;
0242   unsigned phi, eta, pt, charge, ch_valid, finehalo, quality;
0243   float phiv(0.), etav(0.), ptv(0.);  //linear translation? 0.2pi,-2.5..2.5,0..100
0244   for (int i = 0; i < 4; i++) {
0245     phi = (int)(144 * engine->flat());  //8bits, 0..143
0246     eta = (int)(63 * engine->flat());   //6bits code
0247     phiv = phi * 2 * TMath::Pi() / 144.;
0248     etav = 2.5 * (-1 + 2 * eta / 63.);
0249     pt = ((int)(32 * engine->flat())) & 0x1f;  //5bits: 0..31
0250     ptv = 100 * (pt / 31.);
0251     charge = (engine->flat() > 0.5 ? 0 : 1);
0252     ;
0253     ch_valid = 0;
0254     finehalo = 0;
0255     quality = (int)(8 * engine->flat());  //3bits: 0..7
0256     L1MuRegionalCand cand(type_idx, phi, eta, pt, charge, ch_valid, finehalo, quality, bx);
0257     cand.setPhiValue(phiv);
0258     cand.setEtaValue(etav);
0259     cand.setPtValue(ptv);
0260     data->push_back(cand);
0261   }
0262   //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt,
0263   //unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
0264   if (verbose())
0265     std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
0266 }
0267 
0268 template <>
0269 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0270                                         std::unique_ptr<L1MuDTTrackContainer>& data,
0271                                         int type) {
0272   assert(type == 0);
0273   int type_idx = type;  //choose data type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
0274   if (verbose())
0275     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
0276   std::unique_ptr<L1MuRegionalCandCollection> tracks(new L1MuRegionalCandCollection());
0277   SimpleDigi(engine, tracks, type_idx);
0278   typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
0279   std::unique_ptr<L1MuDTTrackCandCollection> tracksd(new L1MuDTTrackCandCollection());
0280   for (L1MuRegionalCandCollection::const_iterator it = tracks->begin(); it != tracks->end(); it++) {
0281     L1MuDTTrackCand* cnd = new L1MuDTTrackCand();
0282     cnd->setDataWord(it->getDataWord());
0283     cnd->setBx(it->bx());
0284     tracksd->push_back(L1MuDTTrackCand());
0285     tracksd->push_back(*cnd);
0286   }
0287   data->setContainer(*tracksd);
0288   if (verbose())
0289     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
0290   //L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc, int utag,
0291   //                 int adr1, int adr2, int adr3, int adr4, int utc );
0292 }
0293 
0294 template <>
0295 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0296                                         std::unique_ptr<L1MuDTChambPhContainer>& data,
0297                                         int type) {
0298   if (verbose())
0299     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
0300   typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
0301   int ntrk = 4;
0302   Phi_Container tracks(ntrk);
0303   int ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt;
0304   for (int i = 0; i < ntrk; i++) {
0305     ubx = 0;   //bxNum()  - bx
0306     uwh = 0;   //whNum()  - wheel
0307     usc = 0;   //scNum()  - sector
0308     ust = 0;   //stNum()  - station
0309     uphr = 0;  //phi()    - radialAngle
0310     uphb = 0;  //phiB()   - bendingAngle
0311     uqua = 0;  //code()   - qualityCode
0312     utag = 0;  //Ts2Tag() - Ts2TagCode
0313     ucnt = 0;  //BxCnt()  - BxCntCode
0314     uwh = (int)(-2 + 5 * engine->flat());
0315     usc = (int)(12 * engine->flat());
0316     ust = (int)(1. + 4 * engine->flat());
0317     uqua = (int)(8 * engine->flat());
0318     L1MuDTChambPhDigi cand(ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt);
0319     tracks.push_back(cand);
0320   }
0321   data->setContainer(tracks);
0322   //L1MuDTChambPhDigi( int ubx, int uwh, int usc, int ust,
0323   //    int uphr, int uphb, int uqua, int utag, int ucnt );
0324   if (verbose())
0325     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
0326 }
0327 
0328 template <>
0329 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0330                                         std::unique_ptr<L1MuDTChambThContainer>& data,
0331                                         int type) {
0332   if (verbose())
0333     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
0334   typedef std::vector<L1MuDTChambThDigi> The_Container;
0335   int ntrk = 4;
0336   The_Container tracks(ntrk);
0337   int ubx, uwh, usc, ust, uos[7], uqa[7];
0338   for (int i = 0; i < ntrk; i++) {
0339     ubx = 0;
0340     uwh = (int)(-2 + 5 * engine->flat());
0341     usc = (int)(12 * engine->flat());
0342     ust = (int)(1. + 4 * engine->flat());
0343     for (int j = 0; j < 7; j++) {
0344       uos[j] = (engine->flat() > 0.5 ? 0 : 1);
0345       uqa[j] = (engine->flat() > 0.5 ? 0 : 1);
0346     }
0347     L1MuDTChambThDigi cand(ubx, uwh, usc, ust, uos, uqa);
0348     tracks.push_back(cand);
0349   }
0350   data->setContainer(tracks);
0351   //L1MuDTChambThDigi( int ubx, int uwh, int usc, int ust,
0352   //             int* uos, [int* uqual] );
0353   //"DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
0354   if (verbose())
0355     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
0356 }
0357 
0358 template <>
0359 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0360                                         std::unique_ptr<L1MuGMTCandCollection>& data,
0361                                         int type) {
0362   if (verbose())
0363     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
0364   //typedef std::vector<L1MuGMTCand>          L1MuGMTCandCollection;
0365   L1MuGMTCand cand(0, nevt_);
0366   //cand.setPhiPacked();//8bits
0367   //cand.setPtPacked ();//5bits
0368   //cand.setQuality  ();//3bits
0369   //cand.setEtaPacked();//6bits
0370   //cand.setIsolation();//1bit
0371   //cand.setMIP      ();//1bit
0372   //cand.setChargePacked();//0:+, 1:-, 2:undef, 3:sync
0373   //cand.setBx       (nevt_);
0374   //set physical values
0375   double eng = EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine);
0376   double phi = 2 * TMath::Pi() * engine->flat();
0377   double eta = 2.5 * (-1 + 2 * engine->flat());
0378   cand.setPtValue(eng);
0379   cand.setPhiValue(phi);
0380   cand.setEtaValue(eta);
0381   unsigned engp = (unsigned)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0382   unsigned phip = (unsigned)(255 * engine->flat());
0383   unsigned etap = (unsigned)(63 * engine->flat());
0384   cand.setPtPacked(engp & 0x1f);
0385   cand.setPhiPacked(phip & 0x7f);
0386   cand.setEtaPacked(etap & 0x3f);
0387   double r = engine->flat();
0388   cand.setIsolation(r > 0.2);
0389   cand.setMIP(r > 0.7);
0390   cand.setChargePacked(r > 0.5 ? 0 : 1);
0391   cand.setBx(0);
0392   data->push_back(cand);
0393   if (verbose())
0394     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
0395 }
0396 
0397 template <>
0398 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0399                                         std::unique_ptr<L1MuGMTReadoutCollection>& data,
0400                                         int type) {
0401   if (verbose())
0402     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
0403   L1MuGMTReadoutRecord rec(0);
0404   int bxn = nevt_;
0405   rec.setBxNr(bxn);
0406   rec.setEvNr(bxn);
0407   rec.setBxInEvent(0);
0408   std::unique_ptr<L1MuRegionalCandCollection> trks_dttf(new L1MuRegionalCandCollection);
0409   std::unique_ptr<L1MuRegionalCandCollection> trks_rpcb(new L1MuRegionalCandCollection);
0410   std::unique_ptr<L1MuRegionalCandCollection> trks_csc(new L1MuRegionalCandCollection);
0411   std::unique_ptr<L1MuRegionalCandCollection> trks_rpcf(new L1MuRegionalCandCollection);
0412   SimpleDigi(engine, trks_dttf, 0);
0413   SimpleDigi(engine, trks_rpcb, 1);
0414   SimpleDigi(engine, trks_csc, 2);
0415   SimpleDigi(engine, trks_rpcf, 3);
0416   for (int i = 0; i < 4; i++) {
0417     rec.setInputCand(i, trks_dttf->at(i));       //dt  : 0..3
0418     rec.setInputCand(i + 4, trks_rpcb->at(i));   //rpcb: 4..7
0419     rec.setInputCand(i + 8, trks_csc->at(i));    //csc : 8..11
0420     rec.setInputCand(i + 12, trks_rpcf->at(i));  //rpcf:12..15
0421   }
0422   for (int nr = 0; nr < 4; nr++) {
0423     int eng = (int)(EBase_ + ESigm_ * CLHEP::RandGaussQ::shoot(engine));
0424     rec.setGMTBrlCand(nr, eng & 0x11, eng & 0x11);  //set GMT barrel candidate
0425     rec.setGMTFwdCand(nr, eng & 0x11, eng & 0x11);  //set GMT forward candidate
0426     rec.setGMTCand(nr, eng & 0x11);                 //set GMT candidate (does not store rank)
0427     int eta = (int)(14 * engine->flat());           //0..13
0428     int phi = (int)(18 * engine->flat());           //0..17
0429     rec.setMIPbit(eta, phi);
0430     rec.setQuietbit(eta, phi);
0431   }
0432   data->addRecord(rec);
0433   ///tbd: add GMT extended cand(!)
0434   //rec.setBCERR(int bcerr);
0435   //rec.setGMTBrlCand(int nr, L1MuGMTExtendedCand const& cand);
0436   //rec.setGMTFwdCand(int nr, L1MuGMTExtendedCand const& cand);
0437   //rec.setGMTCand   (int nr, L1MuGMTExtendedCand const& cand);
0438   //rec.setInputCand (int nr, L1MuRegionalCand const& cand);
0439   //L1MuGMTReadoutCollection :: std::vector<L1MuGMTReadoutRecord> m_Records;
0440   //L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
0441   //L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx=0) : L1MuGMTCand (data, bx), m_rank(rank) {}
0442   if (verbose())
0443     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
0444 }
0445 
0446 template <>
0447 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine*, std::unique_ptr<LTCDigiCollection>& data, int type) {
0448   if (verbose())
0449     std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
0450   //LTCs are FED id 816-823
0451   /*  
0452       6 64-bit words
0453       uint64_t *ld = (uint64_t*)data;
0454       
0455       word0: 59:56  4 bit    ld[0]>>56 & 0xf         trigType
0456              55:32 24 bit    ld[0]>>32 & 0x00ffffff  eventID
0457              31:20 12 bit    ld[0]>>20 & 0xfff       bunchNumber
0458              19: 8 12 bit    ld[0]>> 8 & 0x00000fff  sourceID (816-823?)
0459 
0460       word1: 63:32 32 bit    ld[1]>>32 & 0xffffffff  orbitNumber
0461              31:24 8 bit     ld[1]>>24 & 0xff        versionNumber
0462               3: 0 4 bit     ld[1      & 0xf         daqPartition  
0463 
0464       word2: 63:32 32 bit    ld[0]>>32 & 0xffffffff  runNumber
0465              31: 0 32 bit    ld[0]     & 0xffffffff  eventNumber
0466 
0467       word3: 63:32 32 bit    ld[3]>>32 & 0xffffffff  trigInhibitNumber
0468              31: 0 32 bit    ld[3]     & 0xffffffff  trigInputStat  
0469 
0470       word4: 63:0 64 bit     ld[4]                   bstGpsTime
0471 
0472       word5: (empty)
0473   */
0474   //need to make up something meaningfull to produce here..
0475   //LTCDigi(const unsigned char* data);
0476   if (verbose())
0477     std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
0478 }
0479 
0480 template <>
0481 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0482                                         std::unique_ptr<CSCCorrelatedLCTDigiCollection>& data,
0483                                         int type) {
0484   if (verbose())
0485     std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
0486   //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
0487   //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);
0488   CSCCorrelatedLCTDigi dg = CSCCorrelatedLCTDigi();
0489   //tbd: set non-trivial random values
0490   dg.clear();  // set contents to zero
0491   //CSCDetId( int iendcap, int istation, int iring, int ichamber, int ilayer = 0 );
0492   enum eMinNum { MIN_ENDCAP = 1, MIN_STATION = 1, MIN_RING = 1, MIN_CHAMBER = 1, MIN_LAYER = 1 };
0493   enum eMaxNum { MAX_ENDCAP = 2, MAX_STATION = 4, MAX_RING = 4, MAX_CHAMBER = 36, MAX_LAYER = 6 };
0494   float rnd = engine->flat();
0495   int ec = (int)(MIN_ENDCAP + (MAX_ENDCAP - MIN_ENDCAP) * rnd + 1);
0496   int st = (int)(MIN_STATION + (MAX_STATION - MIN_STATION) * rnd + 1);
0497   int rg = (int)(MIN_RING + (MAX_RING - MIN_RING) * rnd + 1);
0498   int ch = (int)(MIN_CHAMBER + (MAX_CHAMBER - MIN_CHAMBER) * rnd + 1);
0499   int lr = (int)(MIN_LAYER + (MAX_LAYER - MIN_LAYER) * rnd + 1);
0500   CSCDetId did = CSCDetId(ec, st, rg, ch, lr);
0501   //CSCDetId did = CSCDetId();   //DetId(DetId::Muon, MuonSubdetId::CSC)
0502   //MuonDigiCollection::insertDigi(const IndexType& index, const DigiType& digi)
0503   data->insertDigi(did, dg);
0504   if (verbose())
0505     std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
0506 }
0507 
0508 template <>
0509 inline void L1DummyProducer::SimpleDigi(CLHEP::HepRandomEngine* engine,
0510                                         std::unique_ptr<L1CSCTrackCollection>& data,
0511                                         int type) {
0512   if (verbose())
0513     std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
0514   std::unique_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
0515   SimpleDigi(engine, dgcoll, 0);
0516   csc::L1Track l1trk = csc::L1Track();
0517   std::unique_ptr<L1MuRegionalCandCollection> regcoll(new L1MuRegionalCandCollection);
0518   SimpleDigi(engine, regcoll, 2);
0519   L1MuRegionalCand regcand = *(regcoll->begin());
0520   l1trk.setDataWord(regcand.getDataWord());
0521   l1trk.setBx(regcand.bx());
0522   l1trk.setPhiValue(regcand.phiValue());
0523   l1trk.setEtaValue(regcand.etaValue());
0524   l1trk.setPtValue(regcand.ptValue());
0525   L1CSCTrack l1csctrk = std::make_pair(l1trk, *dgcoll);
0526   data->push_back(l1csctrk);
0527   //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
0528   //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
0529   //L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { setType(2); setPtPacked(0); }
0530   //L1MuRegionalCand(unsigned dataword = 0, int bx = 0);
0531   if (verbose())
0532     std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
0533 }
0534 
0535 #endif