CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
ScalersRawToDigi Class Reference

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

Inheritance diagram for ScalersRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 ScalersRawToDigi (const edm::ParameterSet &)
 
 ~ScalersRawToDigi () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< FEDRawDataCollectionfedToken_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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

Constructor & Destructor Documentation

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

Definition at line 56 of file ScalersRawToDigi.cc.

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

56  :
57  inputTag_((char const *)"rawDataCollector")
58 {
59  produces<L1AcceptBunchCrossingCollection>();
60  produces<L1TriggerScalersCollection>();
61  produces<Level1TriggerScalersCollection>();
62  produces<LumiScalersCollection>();
63  produces<BeamSpotOnlineCollection>();
64  produces<DcsStatusCollection>();
65  if ( iConfig.exists("scalersInputTag") )
66  {
67  inputTag_ = iConfig.getParameter<edm::InputTag>("scalersInputTag");
68  }
69  fedToken_=consumes<FEDRawDataCollection>(inputTag_);
70 
71 }
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 ( )
override

Definition at line 74 of file ScalersRawToDigi.cc.

74 {}

Member Function Documentation

void ScalersRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 76 of file ScalersRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

76  {
78  desc.add<edm::InputTag>("scalersInputTag",edm::InputTag("rawDataCollector"));
79  descriptions.add("scalersRawToDigi",desc);
80 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void ScalersRawToDigi::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Take a reference to this FED's data

Definition at line 83 of file ScalersRawToDigi.cc.

References data, DEFINE_FWK_MODULE, FEDRawDataCollection::FEDData(), fedToken_, edm::Event::getByToken(), mps_fire::i, eostools::move(), ScalersRaw::N_BX_v2, ScalersRaw::N_BX_v6, edm::Event::put(), matplotRender::rawdata, ScalersRaw::SCALERS_FED_ID, FEDRawData::size(), and ScalersEventRecordRaw_v6::version.

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

85 {
86  using namespace edm;
87 
88  // Get a handle to the FED data collection
90  iEvent.getByToken(fedToken_, rawdata);
91 
92  auto pLumi = std::make_unique<LumiScalersCollection>();
93 
94  auto pOldTrigger = std::make_unique<L1TriggerScalersCollection>();
95 
96  auto pTrigger = std::make_unique<Level1TriggerScalersCollection>();
97 
98  auto pBunch = std::make_unique<L1AcceptBunchCrossingCollection>();
99 
100  auto pBeamSpotOnline = std::make_unique<BeamSpotOnlineCollection>();
101  auto pDcsStatus = std::make_unique<DcsStatusCollection>();
102 
104  const FEDRawData & fedData = rawdata->FEDData(ScalersRaw::SCALERS_FED_ID);
105  unsigned short int length = fedData.size();
106  if ( length > 0 )
107  {
108  int nWords = length / 8;
109  int nBytesExtra = 0;
110 
111  const ScalersEventRecordRaw_v6 * raw
112  = (struct ScalersEventRecordRaw_v6 *)fedData.data();
113  if ( ( raw->version == 1 ) || ( raw->version == 2 ) )
114  {
115  L1TriggerScalers oldTriggerScalers(fedData.data());
116  pOldTrigger->push_back(oldTriggerScalers);
117  nBytesExtra = length - sizeof(struct ScalersEventRecordRaw_v1);
118  }
119  else if ( raw->version >= 3 )
120  {
121  Level1TriggerScalers triggerScalers(fedData.data());
122  pTrigger->push_back(triggerScalers);
123  if ( raw->version >= 6 )
124  {
125  nBytesExtra = ScalersRaw::N_BX_v6 * sizeof(unsigned long long);
126  }
127  else
128  {
129  nBytesExtra = ScalersRaw::N_BX_v2 * sizeof(unsigned long long);
130  }
131  }
132 
133  LumiScalers lumiScalers(fedData.data());
134  pLumi->push_back(lumiScalers);
135 
136  if (( nBytesExtra >= 8 ) && (( nBytesExtra % 8 ) == 0 ))
137  {
138  unsigned long long * data =
139  (unsigned long long *)fedData.data();
140 
141  int nWordsExtra = nBytesExtra / 8;
142  for ( int i=0; i<nWordsExtra; i++)
143  {
144  int index = nWords - (nWordsExtra + 1) + i;
145  L1AcceptBunchCrossing bc(i,data[index]);
146  pBunch->push_back(bc);
147  }
148  }
149 
150  if ( raw->version >= 4 )
151  {
152  BeamSpotOnline beamSpotOnline(fedData.data());
153  pBeamSpotOnline->push_back(beamSpotOnline);
154 
155  DcsStatus dcsStatus(fedData.data());
156  pDcsStatus->push_back(dcsStatus);
157  }
158  }
159  iEvent.put(std::move(pOldTrigger));
160  iEvent.put(std::move(pTrigger));
161  iEvent.put(std::move(pLumi));
162  iEvent.put(std::move(pBunch));
163  iEvent.put(std::move(pBeamSpotOnline));
164  iEvent.put(std::move(pDcsStatus));
165 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
edm::EDGetTokenT< FEDRawDataCollection > fedToken_
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<FEDRawDataCollection> ScalersRawToDigi::fedToken_
private

Definition at line 51 of file ScalersRawToDigi.cc.

Referenced by produce(), and ScalersRawToDigi().

edm::InputTag ScalersRawToDigi::inputTag_
private

Definition at line 50 of file ScalersRawToDigi.cc.

Referenced by ScalersRawToDigi().