CMS 3D CMS Logo

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

Generated on Tue Jun 9 17:40:15 2009 for CMSSW by  doxygen 1.5.4