CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ScalersRawToDigi Class Reference

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

Inheritance diagram for ScalersRawToDigi:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ScalersRawToDigi (const edm::ParameterSet &)
 
 ~ScalersRawToDigi ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

edm::InputTag inputTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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 38 of file ScalersRawToDigi.cc.

Constructor & Destructor Documentation

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

Definition at line 51 of file ScalersRawToDigi.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and inputTag_.

51  :
52  inputTag_((char const *)"source")
53 {
54  produces<L1AcceptBunchCrossingCollection>();
55  produces<L1TriggerScalersCollection>();
56  produces<Level1TriggerScalersCollection>();
57  produces<LumiScalersCollection>();
58  produces<BeamSpotOnlineCollection>();
59  produces<DcsStatusCollection>();
60  if ( iConfig.exists("scalersInputTag") )
61  {
62  inputTag_ = iConfig.getParameter<edm::InputTag>("scalersInputTag");
63  }
64 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::InputTag inputTag_
ScalersRawToDigi::~ScalersRawToDigi ( )

Definition at line 67 of file ScalersRawToDigi.cc.

67 {}

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 70 of file ScalersRawToDigi.cc.

References runTheMatrix::data, edm::Event::getByLabel(), i, getHLTprescales::index, inputTag_, ScalersRaw::N_BX_v2, edm::Event::put(), runTheMatrix_dev::raw, ScalersRaw::SCALERS_FED_ID, FEDRawData::size(), and ScalersEventRecordRaw_v5::version.

Referenced by python.JSONExport.JsonExport::export(), and python.HTMLExport.HTMLExport::export().

72 {
73  using namespace edm;
74 
75  // Get a handle to the FED data collection
77  iEvent.getByLabel(inputTag_, rawdata);
78 
79  std::auto_ptr<LumiScalersCollection> pLumi(new LumiScalersCollection());
80 
81  std::auto_ptr<L1TriggerScalersCollection>
82  pOldTrigger(new L1TriggerScalersCollection());
83 
84  std::auto_ptr<Level1TriggerScalersCollection>
85  pTrigger(new Level1TriggerScalersCollection());
86 
87  std::auto_ptr<L1AcceptBunchCrossingCollection>
88  pBunch(new L1AcceptBunchCrossingCollection());
89 
90  std::auto_ptr<BeamSpotOnlineCollection> pBeamSpotOnline(new BeamSpotOnlineCollection());
91  std::auto_ptr<DcsStatusCollection> pDcsStatus(new DcsStatusCollection());
92 
94  const FEDRawData & fedData = rawdata->FEDData(ScalersRaw::SCALERS_FED_ID);
95  unsigned short int length = fedData.size();
96  if ( length > 0 )
97  {
98  int nWords = length / 8;
99  int nBytesExtra = 0;
100 
102  = (struct ScalersEventRecordRaw_v5 *)fedData.data();
103  if ( ( raw->version == 1 ) || ( raw->version == 2 ) )
104  {
105  L1TriggerScalers oldTriggerScalers(fedData.data());
106  pOldTrigger->push_back(oldTriggerScalers);
107  nBytesExtra = length - sizeof(struct ScalersEventRecordRaw_v1);
108  }
109  else if ( raw->version >= 3 )
110  {
111  Level1TriggerScalers triggerScalers(fedData.data());
112  pTrigger->push_back(triggerScalers);
113  nBytesExtra = ScalersRaw::N_BX_v2 * sizeof(unsigned long long);
114  }
115 
116  LumiScalers lumiScalers(fedData.data());
117  pLumi->push_back(lumiScalers);
118 
119  if (( nBytesExtra >= 8 ) && (( nBytesExtra % 8 ) == 0 ))
120  {
121  unsigned long long * data =
122  (unsigned long long *)fedData.data();
123 
124  int nWordsExtra = nBytesExtra / 8;
125  for ( int i=0; i<nWordsExtra; i++)
126  {
127  int index = nWords - 5 + i;
128  L1AcceptBunchCrossing bc(i,data[index]);
129  pBunch->push_back(bc);
130  }
131  }
132 
133  if ( raw->version >= 4 )
134  {
135  BeamSpotOnline beamSpotOnline(fedData.data());
136  pBeamSpotOnline->push_back(beamSpotOnline);
137 
138  DcsStatus dcsStatus(fedData.data());
139  pDcsStatus->push_back(dcsStatus);
140  }
141  }
142  iEvent.put(pOldTrigger);
143  iEvent.put(pTrigger);
144  iEvent.put(pLumi);
145  iEvent.put(pBunch);
146  iEvent.put(pBeamSpotOnline);
147  iEvent.put(pDcsStatus);
148 }
std::vector< BeamSpotOnline > BeamSpotOnlineCollection
int i
Definition: DBlmapReader.cc:9
edm::InputTag inputTag_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
std::vector< L1AcceptBunchCrossing > L1AcceptBunchCrossingCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:116
std::vector< Level1TriggerScalers > Level1TriggerScalersCollection
std::vector< LumiScalers > LumiScalersCollection
Definition: LumiScalers.h:150
std::vector< L1TriggerScalers > L1TriggerScalersCollection

Member Data Documentation

edm::InputTag ScalersRawToDigi::inputTag_
private

Definition at line 47 of file ScalersRawToDigi.cc.

Referenced by produce(), and ScalersRawToDigi().