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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ScalersRawToDigi (const edm::ParameterSet &)
 
 ~ScalersRawToDigi ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< FEDRawDataCollection
fedToken_
 
edm::InputTag inputTag_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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

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

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

Definition at line 71 of file ScalersRawToDigi.cc.

71 {}

Member Function Documentation

void ScalersRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Take a reference to this FED's data

Implements edm::stream::EDProducerBase.

Definition at line 74 of file ScalersRawToDigi.cc.

References data, fedToken_, edm::Event::getByToken(), i, cmsHarvester::index, 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().

76 {
77  using namespace edm;
78 
79  // Get a handle to the FED data collection
81  iEvent.getByToken(fedToken_, rawdata);
82 
83  std::auto_ptr<LumiScalersCollection> pLumi(new LumiScalersCollection());
84 
85  std::auto_ptr<L1TriggerScalersCollection>
86  pOldTrigger(new L1TriggerScalersCollection());
87 
88  std::auto_ptr<Level1TriggerScalersCollection>
89  pTrigger(new Level1TriggerScalersCollection());
90 
91  std::auto_ptr<L1AcceptBunchCrossingCollection>
92  pBunch(new L1AcceptBunchCrossingCollection());
93 
94  std::auto_ptr<BeamSpotOnlineCollection> pBeamSpotOnline(new BeamSpotOnlineCollection());
95  std::auto_ptr<DcsStatusCollection> pDcsStatus(new DcsStatusCollection());
96 
98  const FEDRawData & fedData = rawdata->FEDData(ScalersRaw::SCALERS_FED_ID);
99  unsigned short int length = fedData.size();
100  if ( length > 0 )
101  {
102  int nWords = length / 8;
103  int nBytesExtra = 0;
104 
105  const ScalersEventRecordRaw_v6 * raw
106  = (struct ScalersEventRecordRaw_v6 *)fedData.data();
107  if ( ( raw->version == 1 ) || ( raw->version == 2 ) )
108  {
109  L1TriggerScalers oldTriggerScalers(fedData.data());
110  pOldTrigger->push_back(oldTriggerScalers);
111  nBytesExtra = length - sizeof(struct ScalersEventRecordRaw_v1);
112  }
113  else if ( raw->version >= 3 )
114  {
115  Level1TriggerScalers triggerScalers(fedData.data());
116  pTrigger->push_back(triggerScalers);
117  if ( raw->version >= 6 )
118  {
119  nBytesExtra = ScalersRaw::N_BX_v6 * sizeof(unsigned long long);
120  }
121  else
122  {
123  nBytesExtra = ScalersRaw::N_BX_v2 * sizeof(unsigned long long);
124  }
125  }
126 
127  LumiScalers lumiScalers(fedData.data());
128  pLumi->push_back(lumiScalers);
129 
130  if (( nBytesExtra >= 8 ) && (( nBytesExtra % 8 ) == 0 ))
131  {
132  unsigned long long * data =
133  (unsigned long long *)fedData.data();
134 
135  int nWordsExtra = nBytesExtra / 8;
136  for ( int i=0; i<nWordsExtra; i++)
137  {
138  int index = nWords - (nWordsExtra + 1) + i;
139  L1AcceptBunchCrossing bc(i,data[index]);
140  pBunch->push_back(bc);
141  }
142  }
143 
144  if ( raw->version >= 4 )
145  {
146  BeamSpotOnline beamSpotOnline(fedData.data());
147  pBeamSpotOnline->push_back(beamSpotOnline);
148 
149  DcsStatus dcsStatus(fedData.data());
150  pDcsStatus->push_back(dcsStatus);
151  }
152  }
153  iEvent.put(pOldTrigger);
154  iEvent.put(pTrigger);
155  iEvent.put(pLumi);
156  iEvent.put(pBunch);
157  iEvent.put(pBeamSpotOnline);
158  iEvent.put(pDcsStatus);
159 }
std::vector< BeamSpotOnline > BeamSpotOnlineCollection
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< L1AcceptBunchCrossing > L1AcceptBunchCrossingCollection
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:116
std::vector< Level1TriggerScalers > Level1TriggerScalersCollection
edm::EDGetTokenT< FEDRawDataCollection > fedToken_
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::EDGetTokenT<FEDRawDataCollection> ScalersRawToDigi::fedToken_
private

Definition at line 48 of file ScalersRawToDigi.cc.

Referenced by produce(), and ScalersRawToDigi().

edm::InputTag ScalersRawToDigi::inputTag_
private

Definition at line 47 of file ScalersRawToDigi.cc.

Referenced by ScalersRawToDigi().