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)
 
static void prevalidate (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 data, edm::Event::getByLabel(), i, getHLTprescales::index, inputTag_, ScalersRaw::N_BX_v2, ScalersRaw::N_BX_v6, edm::Event::put(), lumiPlot::rawdata, ScalersRaw::SCALERS_FED_ID, and ScalersEventRecordRaw_v6::version.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::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 
101  const ScalersEventRecordRaw_v6 * raw
102  = (struct ScalersEventRecordRaw_v6 *)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  if ( raw->version >= 6 )
114  {
115  nBytesExtra = ScalersRaw::N_BX_v6 * sizeof(unsigned long long);
116  }
117  else
118  {
119  nBytesExtra = ScalersRaw::N_BX_v2 * sizeof(unsigned long long);
120  }
121  }
122 
123  LumiScalers lumiScalers(fedData.data());
124  pLumi->push_back(lumiScalers);
125 
126  if (( nBytesExtra >= 8 ) && (( nBytesExtra % 8 ) == 0 ))
127  {
128  unsigned long long * data =
129  (unsigned long long *)fedData.data();
130 
131  int nWordsExtra = nBytesExtra / 8;
132  for ( int i=0; i<nWordsExtra; i++)
133  {
134  int index = nWords - (nWordsExtra + 1) + i;
135  L1AcceptBunchCrossing bc(i,data[index]);
136  pBunch->push_back(bc);
137  }
138  }
139 
140  if ( raw->version >= 4 )
141  {
142  BeamSpotOnline beamSpotOnline(fedData.data());
143  pBeamSpotOnline->push_back(beamSpotOnline);
144 
145  DcsStatus dcsStatus(fedData.data());
146  pDcsStatus->push_back(dcsStatus);
147  }
148  }
149  iEvent.put(pOldTrigger);
150  iEvent.put(pTrigger);
151  iEvent.put(pLumi);
152  iEvent.put(pBunch);
153  iEvent.put(pBeamSpotOnline);
154  iEvent.put(pDcsStatus);
155 }
std::vector< BeamSpotOnline > BeamSpotOnlineCollection
int i
Definition: DBlmapReader.cc:9
edm::InputTag inputTag_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
std::vector< L1AcceptBunchCrossing > L1AcceptBunchCrossingCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:116
std::vector< Level1TriggerScalers > Level1TriggerScalersCollection
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::vector< LumiScalers > LumiScalersCollection
Definition: LumiScalers.h:160
std::vector< L1TriggerScalers > L1TriggerScalersCollection
dictionary rawdata
Definition: lumiPlot.py:393

Member Data Documentation

edm::InputTag ScalersRawToDigi::inputTag_
private

Definition at line 47 of file ScalersRawToDigi.cc.

Referenced by produce(), and ScalersRawToDigi().