CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/CalibTracker/SiStripCommon/plugins/ShallowEventDataProducer.cc

Go to the documentation of this file.
00001 #include "CalibTracker/SiStripCommon/interface/ShallowEventDataProducer.h"
00002 #include "FWCore/Framework/interface/Event.h"
00003 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00004 
00005 ShallowEventDataProducer::ShallowEventDataProducer(const edm::ParameterSet& iConfig) {
00006   produces <unsigned int> ( "run"      );
00007   produces <unsigned int> ( "event"    );
00008   produces <unsigned int> ( "bx"       );
00009   produces <unsigned int> ( "lumi"       );
00010   produces <std::vector<bool> > ( "TrigTech" );
00011   produces <std::vector<bool> > ( "TrigPh" );
00012 }
00013 
00014 void ShallowEventDataProducer::
00015 produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
00016 
00017 
00018   std::auto_ptr<unsigned int >  run   ( new unsigned int(iEvent.id().run()   ) );
00019   std::auto_ptr<unsigned int >  event ( new unsigned int(iEvent.id().event() ) );
00020   std::auto_ptr<unsigned int >  bx    ( new unsigned int(iEvent.bunchCrossing() ) );
00021   std::auto_ptr<unsigned int >  lumi  ( new unsigned int(iEvent.luminosityBlock() ) );
00022 
00023 
00024   edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord;
00025   iEvent.getByLabel( edm::InputTag("gtDigis"), gtRecord);
00026 
00027   std::vector<bool> TrigTech_(64,0);
00028   std::vector<bool> TrigPh_(128,0);
00029 
00030   // Get dWord after masking disabled bits
00031   DecisionWord dWord = gtRecord->decisionWord();
00032   if ( ! dWord.empty() ) { // if board not there this is zero
00033     // loop over dec. bit to get total rate (no overlap)
00034     for ( int i = 0; i < 64; ++i ) {
00035       TrigPh_[i]= dWord[i];
00036     }
00037   }
00038     
00039   TechnicalTriggerWord tw = gtRecord->technicalTriggerWord();
00040   if ( ! tw.empty() ) {
00041     // loop over dec. bit to get total rate (no overlap)
00042     for ( int i = 0; i < 64; ++i ) {
00043       TrigTech_[i]=tw[i];
00044     }
00045   }
00046 
00047   std::auto_ptr<std::vector<bool> >  TrigTech(new std::vector<bool>(TrigTech_));
00048   std::auto_ptr<std::vector<bool> > TrigPh(new std::vector<bool>(TrigPh_));
00049 
00050   iEvent.put( run,      "run"   );
00051   iEvent.put( event,    "event" );
00052   iEvent.put( bx,       "bx" );
00053   iEvent.put( lumi,       "lumi" );
00054   iEvent.put( TrigTech, "TrigTech" );
00055   iEvent.put( TrigPh,   "TrigPh" );
00056 }