CMS 3D CMS Logo

ScalersRawToDigi Class Reference

Description: Unpack FED data to Trigger and Lumi Scalers "bank" These Scalers are in FED id ScalersRaw::SCALERS_FED_ID. More...

#include <EventFilter/ScalersRawToDigi/src/ScalersRawToDigi.cc>

Inheritance diagram for ScalersRawToDigi:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 ScalersRawToDigi (const edm::ParameterSet &)
 ~ScalersRawToDigi ()


Detailed Description

Description: Unpack FED data to Trigger and Lumi Scalers "bank" These Scalers are in FED id ScalersRaw::SCALERS_FED_ID.

Definition at line 33 of file ScalersRawToDigi.cc.


Constructor & Destructor Documentation

ScalersRawToDigi::ScalersRawToDigi ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 43 of file ScalersRawToDigi.cc.

00044 {
00045   produces<L1AcceptBunchCrossingCollection>();
00046   produces<L1TriggerScalersCollection>();
00047   produces<LumiScalersCollection>();
00048 }

ScalersRawToDigi::~ScalersRawToDigi (  ) 

Definition at line 51 of file ScalersRawToDigi.cc.

00051 {}


Member Function Documentation

void ScalersRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Take a reference to this FED's data

Implements edm::EDProducer.

Definition at line 54 of file ScalersRawToDigi.cc.

References FEDRawData::data(), data, edm::Event::getByLabel(), i, index, lumiScalers, edm::Event::put(), ScalersRaw::SCALERS_FED_ID, and FEDRawData::size().

00056 {
00057   using namespace edm;
00058 
00059   // Get a handle to the FED data collection
00060   edm::Handle<FEDRawDataCollection> rawdata;
00061   iEvent.getByLabel("source" , rawdata);
00062 
00063   std::auto_ptr<LumiScalersCollection> pLumi(new LumiScalersCollection());
00064 
00065   std::auto_ptr<L1TriggerScalersCollection> 
00066     pTrigger(new L1TriggerScalersCollection());
00067 
00068   std::auto_ptr<L1AcceptBunchCrossingCollection> 
00069     pBunch(new L1AcceptBunchCrossingCollection());
00070 
00072   const FEDRawData & fedData = rawdata->FEDData(ScalersRaw::SCALERS_FED_ID);
00073   unsigned short int length =  fedData.size();
00074   if ( length > 0 ) 
00075   {
00076     L1TriggerScalers triggerScalers(fedData.data());
00077     pTrigger->push_back(triggerScalers);
00078     iEvent.put(pTrigger); 
00079 
00080     LumiScalers      lumiScalers(fedData.data());
00081     pLumi->push_back(lumiScalers);
00082     iEvent.put(pLumi); 
00083 
00084     int nWords = length / 8;
00085     int nBytesExtra = length - sizeof(struct ScalersEventRecordRaw_v1);
00086     if (( nBytesExtra >= 8 ) && (( nBytesExtra % 8 ) == 0 ))
00087     {
00088       unsigned long long * data = 
00089         (unsigned long long *)fedData.data();
00090 
00091       int nWordsExtra = nBytesExtra / 8;
00092       for ( int i=0; i<nWordsExtra; i++)
00093       {
00094         int index = nWords - 5 + i;
00095         L1AcceptBunchCrossing bc(i,data[index]);
00096         pBunch->push_back(bc);
00097       }
00098       iEvent.put(pBunch); 
00099     }
00100   }
00101 }


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:31:14 2009 for CMSSW by  doxygen 1.5.4