CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/L1Trigger/HardwareValidation/plugins/L1DummyProducer.h

Go to the documentation of this file.
00001 #ifndef L1_DUMMY_PRODUCER_H
00002 #define L1_DUMMY_PRODUCER_H
00003 
00004 /*\class L1DummyProducer
00005  *\description produces simplified, random L1 trigger digis
00006  *\usage pattern and monitoring software test and validation
00007  *\author Nuno Leonardo (CERN)
00008  *\date 07.07
00009  */
00010 
00011 // system includes
00012 #include <memory>
00013 #include <string>
00014 #include <iostream>
00015 #include <fstream>
00016 #include <iomanip>
00017 #include <vector>
00018 #include <algorithm>
00019 #include "TMath.h"
00020 #include <bitset>
00021 
00022 // common includes
00023 #include "FWCore/ServiceRegistry/interface/Service.h"
00024 #include "FWCore/Framework/interface/Frameworkfwd.h"
00025 #include "FWCore/Framework/interface/EDProducer.h"
00026 #include "FWCore/Framework/interface/Event.h"
00027 #include "FWCore/Framework/interface/MakerMacros.h"
00028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00030 
00031 // l1 dataformats, d|e record includes
00032 #include "L1Trigger/HardwareValidation/interface/DEtrait.h"
00033 
00034 // random # generator
00035 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00036 #include "CLHEP/Random/RandFlat.h"
00037 #include "CLHEP/Random/RandGaussQ.h"
00038 
00039 
00040 class L1DummyProducer : public edm::EDProducer {
00041 
00042  public:
00043 
00044   explicit L1DummyProducer(const edm::ParameterSet&);
00045   ~L1DummyProducer();
00046   
00047  private:
00048 
00049   virtual void beginJob(void) {};
00050   //virtual void beginRun(edm::Run&, const edm::EventSetup&);
00051   virtual void produce(edm::Event&, const edm::EventSetup&);
00052   virtual void endJob() {};
00053 
00054  public:
00055 
00056   template <class T> 
00057     void SimpleDigi(std::auto_ptr<T>& data, int type=0); 
00058 
00059  private:
00060 
00061   int verbose_;
00062   int verbose() {return verbose_;}
00063   int nevt_;
00064 
00065   bool m_doSys[dedefs::DEnsys];
00066   std::string instName[dedefs::DEnsys][5];
00067 
00068   CLHEP::RandFlat   *rndFlat_;
00069   CLHEP::RandGaussQ *rndGaus_;
00070   double EBase_;
00071   double ESigm_;
00072 
00073 };
00074 
00075 
00076 template <class T> void 
00077 L1DummyProducer::SimpleDigi(std::auto_ptr<T>& data, int type) {
00078   /*collections generated in specializations below*/
00079 } 
00080 
00081 template <> inline void 
00082 L1DummyProducer::SimpleDigi(std::auto_ptr<EcalTrigPrimDigiCollection>& data, 
00083                                int type) {
00084   if(verbose())
00085     std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection>....\n" << std::flush;
00086   int side = (rndFlat_->fire()>0.5)?-1:1;
00087   int ieta =  (int) (1 + 17*rndFlat_->fire()); //1-17
00088   int iphi =  (int) (1 + 72*rndFlat_->fire()); //1-72
00089   const EcalTrigTowerDetId e_id( side , EcalBarrel, ieta, iphi, 0);
00090   EcalTriggerPrimitiveDigi e_digi(e_id);
00091   int energy = (int) (EBase_ + ESigm_*rndGaus_->fire());
00092   bool fg = (rndFlat_->fire()>0.5);
00093   int ttf = (int)(8*rndFlat_->fire()); //0-7
00094   EcalTriggerPrimitiveSample e_sample(energy, fg, ttf);
00095   e_digi.setSize(1); //set sampleOfInterest to 0
00096   e_digi.setSample(0,e_sample);
00097   data->push_back(e_digi);
00098   //EcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int triggerFlag);
00099   //const EcalTrigTowerDetId e_id( zside , EcalBarrel, etaTT, phiTT, 0);
00100   if(verbose())
00101     std::cout << "L1DummyProducer::SimpleDigi<EcalTrigPrimDigiCollection> end.\n" << std::flush;
00102 }
00103 
00104 template <> inline void 
00105 L1DummyProducer::SimpleDigi(std::auto_ptr<HcalTrigPrimDigiCollection>& data,
00106                                int type) {
00107   if(verbose())
00108     std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection>....\n" << std::flush;
00109   int side = (rndFlat_->fire()>0.5)?-1:1;
00110   int ieta =  (int) (1 + 17*rndFlat_->fire());
00111   int iphi =  (int) (1 + 72*rndFlat_->fire());
00112   const HcalTrigTowerDetId h_id(side*ieta, iphi);
00113   HcalTriggerPrimitiveDigi h_digi(h_id);
00114   int energy = (int) (EBase_ + ESigm_*rndGaus_->fire());
00115   HcalTriggerPrimitiveSample h_sample(energy, 0, 0, 0);
00116   h_digi.setSize(1); //set sampleOfInterest to 0
00117   h_digi.setSample(0,h_sample);
00118   data->push_back(h_digi);
00119   //HcalTriggerPrimitiveSample(int encodedEt, bool finegrain, int slb, int slbchan);
00120   //HcalTrigTowerDetId(int ieta, int iphi);
00121   if(verbose())
00122     std::cout << "L1DummyProducer::SimpleDigi<HcalTrigPrimDigiCollection> end.\n" << std::flush;
00123 }
00124 
00125 template <> inline void 
00126 L1DummyProducer::SimpleDigi(std::auto_ptr<L1CaloEmCollection>& data, 
00127                                int type) { 
00128   if(verbose())
00129     std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection>....\n" << std::flush;
00130   int      energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
00131   unsigned rank  = energy & 0x3f;
00132   unsigned region= (rndFlat_->fire()>0.5?0:1);
00133   unsigned card  = (unsigned)(7*rndFlat_->fire()); 
00134   unsigned crate = (unsigned)(18*rndFlat_->fire());
00135   bool iso       = (rndFlat_->fire()>0.4); 
00136   uint16_t index = (unsigned)(4*rndFlat_->fire());
00137   int16_t  bx    = nevt_;
00138   L1CaloEmCand cand(rank, region, card, crate, iso, index, bx);
00139   data->push_back(cand);
00140   //L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx);
00141   if(verbose())
00142     std::cout << "L1DummyProducer::SimpleDigi<L1CaloEmCollection> end.\n" << std::flush;
00143  }
00144 
00145 template <> inline void 
00146 L1DummyProducer::SimpleDigi(std::auto_ptr<L1CaloRegionCollection>& data, 
00147                                int type) { 
00148   if(verbose())
00149     std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection>....\n" << std::flush;
00150   int     energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
00151   unsigned et   = energy & 0x3ff;
00152   bool overFlow = 0; //(rndFlat_->fire()>0.4);
00153   bool tauVeto  = 0; //(rndFlat_->fire()>0.3);
00154   bool mip      = 0; //(rndFlat_->fire()>0.1);
00155   bool quiet    = 0; //(rndFlat_->fire()>0.6);
00156   unsigned crate= (unsigned)(18*rndFlat_->fire());
00157   unsigned card = (unsigned)(7*rndFlat_->fire());
00158   unsigned rgn  = crate%2; //(rndFlat_->fire()>0.5?0:1);
00159   L1CaloRegion cand( et, overFlow, tauVeto, mip, quiet, crate, card, rgn );
00160   data->push_back(cand);
00161   //L1CaloRegion(unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn);
00162   if(verbose())
00163     std::cout << "L1DummyProducer::SimpleDigi<L1CaloRegionCollection> end.\n" << std::flush;
00164 }
00165 
00166 template <> inline void 
00167 L1DummyProducer::SimpleDigi(std::auto_ptr<L1GctEmCandCollection>& data, 
00168                                int type) { 
00169   if(verbose())
00170     std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection>....\n" << std::flush;
00171   bool iso; //= type==0;
00172   switch(type) { // 0 iso, 1 noniso
00173   case 0:  
00174     iso = true;
00175     break;
00176   case 1:  
00177     iso = false;
00178     break;
00179   default:
00180     throw cms::Exception("L1DummyProducerInvalidType")
00181       << "L1DummyProducer::SimpleDigi production of L1GctEmCandCollection "
00182       << " invalid type: " << type << std::endl;
00183   }
00184   int      energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
00185   unsigned rank  = energy & 0x3f;
00186   unsigned phi   = (unsigned)(18*rndFlat_->fire());
00187   unsigned eta   = (unsigned)( 7*rndFlat_->fire());
00188   if(rndFlat_->fire()>0.5) //-z (eta sign)
00189     eta = (eta&0x7) + (0x1<<3);
00190   L1GctEmCand cand(rank, phi, eta, iso);
00191   data->push_back(cand);
00192   // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z
00193   //L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso);
00194   if(verbose())
00195     std::cout << "L1DummyProducer::SimpleDigi<L1GctEmCandCollection> end.\n" << std::flush;
00196 }
00197 
00198 template <> inline void 
00199 L1DummyProducer::SimpleDigi(std::auto_ptr<L1GctJetCandCollection>& data, 
00200                                int type) { 
00201   if(verbose())
00202     std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection>....\n" << std::flush;
00203   bool isFor, isTau;
00204   switch(type) { // 0 cen, 1 for, 2 tau
00205   case 0:  
00206     isFor = false;
00207     isTau = false;
00208     break;
00209   case 1:  
00210     isFor = true;
00211     isTau = false;
00212     break;
00213   case 2:  
00214     isFor = false;
00215     isTau = true;
00216     break;
00217   default:
00218     throw cms::Exception("L1DummyProducerInvalidType")
00219       << "L1DummyProducer::SimpleDigi production of L1GctJetCandCollection "
00220       << " invalid type: " << type << std::endl;
00221   }
00222 
00223   int      energy= (int) (EBase_ + ESigm_*rndGaus_->fire());
00224   unsigned rank  = energy & 0x3f;
00225   unsigned phi   = (unsigned)(18*rndFlat_->fire());
00226   unsigned eta   = (unsigned)( 7*rndFlat_->fire());
00227   if(rndFlat_->fire()>0.5) //-z (eta sign)
00228     eta = (eta&0x7) + (0x1<<3);
00229   L1GctJetCand cand(rank, phi, eta, isTau, isFor);
00230   data->push_back(cand);
00231   //L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor);
00232   if(verbose())
00233     std::cout << "L1DummyProducer::SimpleDigi<L1GctJetCandCollection> end.\n" << std::flush;
00234 }
00235 
00236 template <> inline void 
00237 L1DummyProducer::SimpleDigi ( std::auto_ptr<L1MuRegionalCandCollection>& data, 
00238                                  int type) {
00239   if(verbose())
00240     std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection>....\n" << std::flush;
00241   //typedef std::vector<L1MuRegionalCand>     L1MuRegionalCandCollection;
00242   assert(type>=0 && type<4);
00243   unsigned type_idx=type; //tType: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
00244   int bx = 0;
00245   unsigned phi, eta, pt, charge, ch_valid, finehalo, quality;
00246   float phiv(0.), etav(0.), ptv(0.); //linear translation? 0.2pi,-2.5..2.5,0..100
00247   for(int i=0; i<4; i++) {
00248     phi     = (int)(144*rndFlat_->fire()); //8bits, 0..143
00249     eta     = (int)( 63*rndFlat_->fire()); //6bits code
00250     phiv    = phi*2*TMath::Pi()/144.; 
00251     etav    = 2.5*(-1+2*eta/63.);
00252     pt      = ((int)(32*rndFlat_->fire())) & 0x1f; //5bits: 0..31
00253     ptv     = 100*(pt/31.);
00254     charge  = (rndFlat_->fire()>0.5?0:1);;
00255     ch_valid=0;
00256     finehalo=0;
00257     quality = (int)(8*rndFlat_->fire()); //3bits: 0..7
00258     L1MuRegionalCand cand(type_idx, phi, eta, pt, charge, 
00259                           ch_valid, finehalo, quality, bx);
00260     cand.setPhiValue(phiv);
00261     cand.setEtaValue(etav);
00262     cand.setPtValue (ptv);
00263     data->push_back(cand);
00264   }
00265   //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt, 
00266   //unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
00267   if(verbose())
00268     std::cout << "L1DummyProducer::SimpleDigi<L1MuRegionalCandCollection> end.\n" << std::flush;
00269 }
00270 
00271 template <> inline void 
00272 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuDTTrackContainer> & data, 
00273                                int type) { 
00274   assert(type==0);
00275   int type_idx = type; //choose data type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC 
00276   if(verbose())
00277     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer>....\n" << std::flush;
00278   std::auto_ptr<L1MuRegionalCandCollection> tracks(new L1MuRegionalCandCollection());
00279   SimpleDigi(tracks, type_idx);
00280   typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
00281   std::auto_ptr<L1MuDTTrackCandCollection> tracksd (new L1MuDTTrackCandCollection());
00282   for(L1MuRegionalCandCollection::const_iterator it=tracks->begin(); it!=tracks->end(); it++) {
00283     L1MuDTTrackCand * cnd = new L1MuDTTrackCand();
00284     cnd->setDataWord(it->getDataWord());
00285     cnd->setBx(it->bx());
00286     tracksd->push_back(L1MuDTTrackCand());
00287     tracksd->push_back(*cnd);
00288   }
00289   data->setContainer(*tracksd);
00290   if(verbose())
00291     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTTrackContainer> end.\n" << std::flush;
00292   //L1MuDTTrackCand( unsigned dataword, int bx, int uwh, int usc, int utag,
00293   //                 int adr1, int adr2, int adr3, int adr4, int utc );
00294 
00295 }
00296 
00297 template <> inline void 
00298 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuDTChambPhContainer>& data, 
00299                                int type) { 
00300   if(verbose())
00301     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer>....\n" << std::flush;
00302   typedef std::vector<L1MuDTChambPhDigi>  Phi_Container;
00303   int ntrk = 4;
00304   Phi_Container tracks(ntrk);
00305   int ubx, uwh, usc, ust,uphr, uphb, uqua, utag, ucnt;
00306   for (int i=0; i<ntrk; i++) {  
00307     ubx  = 0;   //bxNum()  - bx
00308     uwh  = 0;   //whNum()  - wheel
00309     usc  = 0;   //scNum()  - sector
00310     ust  = 0;   //stNum()  - station
00311     uphr = 0;   //phi()    - radialAngle
00312     uphb = 0;   //phiB()   - bendingAngle
00313     uqua = 0;   //code()   - qualityCode
00314     utag = 0;   //Ts2Tag() - Ts2TagCode
00315     ucnt = 0;   //BxCnt()  - BxCntCode
00316     uwh = (int)(-2+5*rndFlat_->fire());
00317     usc = (int)(  12*rndFlat_->fire());
00318     ust = (int)(1.+4*rndFlat_->fire());
00319     uqua= (int)(   8*rndFlat_->fire());
00320     L1MuDTChambPhDigi cand(ubx, uwh, usc, ust, uphr, uphb, uqua, utag, ucnt);
00321     tracks.push_back(cand);
00322   }
00323   data->setContainer(tracks);
00324   //L1MuDTChambPhDigi( int ubx, int uwh, int usc, int ust,
00325   //    int uphr, int uphb, int uqua, int utag, int ucnt );
00326   if(verbose())
00327     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambPhContainer> end.\n" << std::flush;
00328 }
00329 
00330 template <> inline void 
00331 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuDTChambThContainer>& data, 
00332                                int type) { 
00333   if(verbose())
00334     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer>....\n" << std::flush;
00335   typedef std::vector<L1MuDTChambThDigi>  The_Container;
00336   int ntrk = 4;
00337   The_Container tracks(ntrk);
00338   int ubx, uwh, usc, ust, uos[7], uqa[7];
00339   for (int i=0; i<ntrk; i++) {  
00340     ubx = 0;
00341     uwh = (int)(-2+5*rndFlat_->fire());
00342     usc = (int)(  12*rndFlat_->fire());
00343     ust = (int)(1.+4*rndFlat_->fire());
00344     for(int j=0; j<7; j++) {
00345       uos[j]=(rndFlat_->fire()>0.5?0:1); 
00346       uqa[j]=(rndFlat_->fire()>0.5?0:1); 
00347     }
00348     L1MuDTChambThDigi cand(ubx, uwh, usc, ust, uos, uqa);
00349     tracks.push_back(cand);
00350   }
00351   data->setContainer(tracks);
00352   //L1MuDTChambThDigi( int ubx, int uwh, int usc, int ust,
00353   //             int* uos, [int* uqual] );
00354   //"DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
00355   if(verbose())
00356     std::cout << "L1DummyProducer::SimpleDigi<L1MuDTChambThContainer> end.\n" << std::flush;
00357 }
00358 
00359 template <> inline void 
00360 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuGMTCandCollection>& data, 
00361                                int type) { 
00362   if(verbose())
00363     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection>....\n" << std::flush;
00364   //typedef std::vector<L1MuGMTCand>          L1MuGMTCandCollection;
00365   L1MuGMTCand cand(0,nevt_);
00366   //cand.setPhiPacked();//8bits
00367   //cand.setPtPacked ();//5bits
00368   //cand.setQuality  ();//3bits
00369   //cand.setEtaPacked();//6bits
00370   //cand.setIsolation();//1bit
00371   //cand.setMIP      ();//1bit
00372   //cand.setChargePacked();//0:+, 1:-, 2:undef, 3:sync
00373   //cand.setBx       (nevt_);
00374   //set physical values
00375   double eng = EBase_+ESigm_*rndGaus_->fire();
00376   double phi = 2*TMath::Pi()*rndFlat_->fire();
00377   double eta = 2.5*(-1+2*rndFlat_->fire());
00378   cand.setPtValue (eng); 
00379   cand.setPhiValue(phi);
00380   cand.setEtaValue(eta);
00381   unsigned engp = (unsigned)(EBase_ + ESigm_*rndGaus_->fire());
00382   unsigned phip = (unsigned)(255*rndFlat_->fire());
00383   unsigned etap = (unsigned)( 63*rndFlat_->fire());
00384   cand.setPtPacked (engp&0x1f);
00385   cand.setPhiPacked(phip&0x7f);
00386   cand.setEtaPacked(etap&0x3f);
00387   double r = rndFlat_->fire();
00388   cand.setIsolation(r>0.2);
00389   cand.setMIP(r>0.7);
00390   cand.setChargePacked(r>0.5?0:1);
00391   cand.setBx(0);
00392   data->push_back(cand);
00393   if(verbose())
00394     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTCandCollection> end.\n" << std::flush;
00395 
00396 }
00397 
00398 template <> inline void 
00399 L1DummyProducer::SimpleDigi(std::auto_ptr<L1MuGMTReadoutCollection>& data, 
00400                                int type) { 
00401   if(verbose())
00402     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection>....\n" << std::flush;
00403   L1MuGMTReadoutRecord rec(0);
00404   int bxn = nevt_;
00405   rec.setBxNr(bxn);
00406   rec.setEvNr(bxn);
00407   rec.setBxInEvent(0); 
00408   std::auto_ptr<L1MuRegionalCandCollection> trks_dttf(new L1MuRegionalCandCollection);
00409   std::auto_ptr<L1MuRegionalCandCollection> trks_rpcb(new L1MuRegionalCandCollection);
00410   std::auto_ptr<L1MuRegionalCandCollection> trks_csc (new L1MuRegionalCandCollection);
00411   std::auto_ptr<L1MuRegionalCandCollection> trks_rpcf(new L1MuRegionalCandCollection);
00412   SimpleDigi(trks_dttf,0);
00413   SimpleDigi(trks_rpcb,1);
00414   SimpleDigi(trks_csc ,2);
00415   SimpleDigi(trks_rpcf,3);
00416   for(int i=0; i<4; i++) {
00417     rec.setInputCand(i   ,trks_dttf->at(i));//dt  : 0..3
00418     rec.setInputCand(i+ 4,trks_rpcb->at(i));//rpcb: 4..7
00419     rec.setInputCand(i+ 8,trks_csc ->at(i));//csc : 8..11
00420     rec.setInputCand(i+12,trks_rpcf->at(i));//rpcf:12..15
00421   }
00422   for(int nr=0; nr<4; nr++) {
00423     int eng = (int)(EBase_ + ESigm_*rndGaus_->fire());
00424     rec.setGMTBrlCand(nr, eng&0x11, eng&0x11); //set GMT barrel candidate
00425     rec.setGMTFwdCand(nr, eng&0x11, eng&0x11); //set GMT forward candidate
00426     rec.setGMTCand   (nr, eng&0x11);           //set GMT candidate (does not store rank)
00427     int eta = (int)(14*rndFlat_->fire());      //0..13
00428     int phi = (int)(18*rndFlat_->fire());      //0..17
00429     rec.setMIPbit  (eta, phi);
00430     rec.setQuietbit(eta, phi);
00431   }
00432   data->addRecord(rec);
00434   //rec.setBCERR(int bcerr);
00435   //rec.setGMTBrlCand(int nr, L1MuGMTExtendedCand const& cand);
00436   //rec.setGMTFwdCand(int nr, L1MuGMTExtendedCand const& cand);
00437   //rec.setGMTCand   (int nr, L1MuGMTExtendedCand const& cand);
00438   //rec.setInputCand (int nr, L1MuRegionalCand const& cand);
00439   //L1MuGMTReadoutCollection :: std::vector<L1MuGMTReadoutRecord> m_Records;
00440   //L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); };
00441   //L1MuGMTExtendedCand(unsigned data, unsigned rank, int bx=0) : L1MuGMTCand (data, bx), m_rank(rank) {}
00442   if(verbose())
00443     std::cout << "L1DummyProducer::SimpleDigi<L1MuGMTReadoutCollection> end.\n" << std::flush;
00444 }
00445 
00446 template <> inline void 
00447 L1DummyProducer::SimpleDigi(std::auto_ptr<LTCDigiCollection> & data, 
00448                                int type) { 
00449   if(verbose())
00450     std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection>....\n" << std::flush;
00451   //LTCs are FED id 816-823
00452   /*  
00453       6 64-bit words
00454       uint64_t *ld = (uint64_t*)data;
00455       
00456       word0: 59:56  4 bit    ld[0]>>56 & 0xf         trigType
00457              55:32 24 bit    ld[0]>>32 & 0x00ffffff  eventID
00458              31:20 12 bit    ld[0]>>20 & 0xfff       bunchNumber
00459              19: 8 12 bit    ld[0]>> 8 & 0x00000fff  sourceID (816-823?)
00460 
00461       word1: 63:32 32 bit    ld[1]>>32 & 0xffffffff  orbitNumber
00462              31:24 8 bit     ld[1]>>24 & 0xff        versionNumber
00463               3: 0 4 bit     ld[1      & 0xf         daqPartition  
00464 
00465       word2: 63:32 32 bit    ld[0]>>32 & 0xffffffff  runNumber
00466              31: 0 32 bit    ld[0]     & 0xffffffff  eventNumber
00467 
00468       word3: 63:32 32 bit    ld[3]>>32 & 0xffffffff  trigInhibitNumber
00469              31: 0 32 bit    ld[3]     & 0xffffffff  trigInputStat  
00470 
00471       word4: 63:0 64 bit     ld[4]                   bstGpsTime
00472 
00473       word5: (empty)
00474   */
00475   //need to make up something meaningfull to produce here..
00476   //LTCDigi(const unsigned char* data);
00477   if(verbose())
00478     std::cout << "L1DummyProducer::SimpleDigi<LTCDigiCollection> end.\n" << std::flush;
00479 }
00480 
00481 template <> inline void L1DummyProducer::SimpleDigi(std::auto_ptr<CSCCorrelatedLCTDigiCollection>& data, 
00482                                                        int type) { 
00483   if(verbose())
00484     std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection>....\n" << std::flush;
00485   //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
00486   //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);
00487   CSCCorrelatedLCTDigi dg = CSCCorrelatedLCTDigi();
00488   //tbd: set non-trivial random values
00489   dg.clear(); // set contents to zero
00490   //CSCDetId( int iendcap, int istation, int iring, int ichamber, int ilayer = 0 );
00491   enum eMinNum{ MIN_ENDCAP=1, MIN_STATION=1, MIN_RING=1, MIN_CHAMBER= 1, MIN_LAYER=1 };
00492   enum eMaxNum{ MAX_ENDCAP=2, MAX_STATION=4, MAX_RING=4, MAX_CHAMBER=36, MAX_LAYER=6 };
00493   float rnd = rndFlat_->fire();
00494   int ec = (int)( MIN_ENDCAP  + (MAX_ENDCAP -MIN_ENDCAP )*rnd +1);
00495   int st = (int)( MIN_STATION + (MAX_STATION-MIN_STATION)*rnd +1);
00496   int rg = (int)( MIN_RING    + (MAX_RING   -MIN_RING   )*rnd +1);
00497   int ch = (int)( MIN_CHAMBER + (MAX_CHAMBER-MIN_CHAMBER)*rnd +1);
00498   int lr = (int)( MIN_LAYER   + (MAX_LAYER  -MIN_LAYER  )*rnd +1);
00499   CSCDetId did = CSCDetId(ec,st,rg,ch,lr);
00500   //CSCDetId did = CSCDetId();   //DetId(DetId::Muon, MuonSubdetId::CSC) 
00501   //MuonDigiCollection::insertDigi(const IndexType& index, const DigiType& digi)
00502   data->insertDigi(did,dg);
00503   if(verbose())
00504     std::cout << "L1DummyProducer::SimpleDigi<CSCCorrelatedLCTDigiCollection> end.\n" << std::flush;
00505 }
00506 
00507 template <> inline void L1DummyProducer::SimpleDigi(std::auto_ptr<L1CSCTrackCollection>& data, 
00508                                                        int type) { 
00509   if(verbose())
00510     std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection>...\n" << std::flush;
00511   std::auto_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
00512   SimpleDigi(dgcoll,0);
00513   csc::L1Track l1trk = csc::L1Track();
00514   std::auto_ptr<L1MuRegionalCandCollection> regcoll(new L1MuRegionalCandCollection);
00515   SimpleDigi(regcoll,2);
00516   L1MuRegionalCand regcand = *(regcoll->begin());
00517   l1trk.setDataWord(regcand.getDataWord());
00518   l1trk.setBx(regcand.bx());
00519   l1trk.setPhiValue(regcand.phiValue());
00520   l1trk.setEtaValue(regcand.etaValue());
00521   l1trk.setPtValue (regcand.ptValue());
00522   L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
00523   data->push_back(l1csctrk);
00524   //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
00525   //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
00526   //L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { setType(2); setPtPacked(0); }
00527   //L1MuRegionalCand(unsigned dataword = 0, int bx = 0); 
00528   if(verbose())
00529     std::cout << "L1DummyProducer::SimpleDigi<L1CSCTrackCollection> end.\n" << std::flush;
00530  }
00531 
00532 #endif