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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 54 of file ScalersRawToDigi.cc.

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

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

68 {}

Member Function Documentation

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

Definition at line 70 of file ScalersRawToDigi.cc.

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

70  {
72  desc.add<edm::InputTag>("scalersInputTag", edm::InputTag("rawDataCollector"));
73  descriptions.add("scalersRawToDigi", desc);
74 }
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 77 of file ScalersRawToDigi.cc.

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

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

77  {
78  using namespace edm;
79 
80  // Get a handle to the FED data collection
82  iEvent.getByToken(fedToken_, rawdata);
83 
84  auto pLumi = std::make_unique<LumiScalersCollection>();
85 
86  auto pOldTrigger = std::make_unique<L1TriggerScalersCollection>();
87 
88  auto pTrigger = std::make_unique<Level1TriggerScalersCollection>();
89 
90  auto pBunch = std::make_unique<L1AcceptBunchCrossingCollection>();
91 
92  auto pBeamSpotOnline = std::make_unique<BeamSpotOnlineCollection>();
93  auto pDcsStatus = std::make_unique<DcsStatusCollection>();
94 
96  const FEDRawData& fedData = rawdata->FEDData(ScalersRaw::SCALERS_FED_ID);
97  unsigned short int length = fedData.size();
98  if (length > 0) {
99  int nWords = length / 8;
100  int nBytesExtra = 0;
101 
102  const ScalersEventRecordRaw_v6* raw = (struct ScalersEventRecordRaw_v6*)fedData.data();
103  if ((raw->version == 1) || (raw->version == 2)) {
104  L1TriggerScalers oldTriggerScalers(fedData.data());
105  pOldTrigger->push_back(oldTriggerScalers);
106  nBytesExtra = length - sizeof(struct ScalersEventRecordRaw_v1);
107  } else if (raw->version >= 3) {
108  Level1TriggerScalers triggerScalers(fedData.data());
109  pTrigger->push_back(triggerScalers);
110  if (raw->version >= 6) {
111  nBytesExtra = ScalersRaw::N_BX_v6 * sizeof(unsigned long long);
112  } else {
113  nBytesExtra = ScalersRaw::N_BX_v2 * sizeof(unsigned long long);
114  }
115  }
116 
117  LumiScalers lumiScalers(fedData.data());
118  pLumi->push_back(lumiScalers);
119 
120  if ((nBytesExtra >= 8) && ((nBytesExtra % 8) == 0)) {
121  unsigned long long* data = (unsigned long long*)fedData.data();
122 
123  int nWordsExtra = nBytesExtra / 8;
124  for (int i = 0; i < nWordsExtra; i++) {
125  int index = nWords - (nWordsExtra + 1) + i;
126  L1AcceptBunchCrossing bc(i, data[index]);
127  pBunch->push_back(bc);
128  }
129  }
130 
131  if (raw->version >= 4) {
132  BeamSpotOnline beamSpotOnline(fedData.data());
133  pBeamSpotOnline->push_back(beamSpotOnline);
134 
135  DcsStatus dcsStatus(fedData.data());
136  pDcsStatus->push_back(dcsStatus);
137  }
138  }
139  iEvent.put(std::move(pOldTrigger));
140  iEvent.put(std::move(pTrigger));
141  iEvent.put(std::move(pLumi));
142  iEvent.put(std::move(pBunch));
143  iEvent.put(std::move(pBeamSpotOnline));
144  iEvent.put(std::move(pDcsStatus));
145 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
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:79
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 50 of file ScalersRawToDigi.cc.

Referenced by produce(), and ScalersRawToDigi().

edm::InputTag ScalersRawToDigi::inputTag_
private

Definition at line 49 of file ScalersRawToDigi.cc.

Referenced by ScalersRawToDigi().