CMS 3D CMS Logo

ScalersRawToDigi.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EventFilter/ScalersRawToDigi
4 // Class: ScalersRawToDigi
5 //
12 //
13 // Original Author: William Badgett
14 // Created: Wed Nov 14 07:47:59 CDT 2006
15 //
16 
17 #include <memory>
18 
25 
26 // FEDRawData
29 
30 // Scalers classes
39 
41 public:
42  explicit ScalersRawToDigi(const edm::ParameterSet&);
43 
44  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
45 
46  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
47 
48 private:
56 };
57 
58 // Constructor
60  : fedToken_{consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("scalersInputTag"))},
61  bunchPutToken_{produces<L1AcceptBunchCrossingCollection>()},
62  l1ScalerPutToken_{produces<L1TriggerScalersCollection>()},
63  lvl1ScalerPutToken_{produces<Level1TriggerScalersCollection>()},
64  lumiScalerPutToken_{produces<LumiScalersCollection>()},
65  beamSpotPutToken_{produces<BeamSpotOnlineCollection>()},
66  dcsPutToken_{produces<DcsStatusCollection>()} {}
67 
70  desc.add<edm::InputTag>("scalersInputTag", edm::InputTag("rawDataCollector"));
71  descriptions.add("scalersRawToDigi", desc);
72 }
73 
74 // Method called to produce the data
76  using namespace edm;
77 
78  // Get the FED data collection
79  auto const& rawdata = iEvent.get(fedToken_);
80 
82 
83  L1TriggerScalersCollection pOldTrigger;
84 
86 
88 
89  BeamSpotOnlineCollection pBeamSpotOnline;
90  DcsStatusCollection pDcsStatus;
91 
93  const FEDRawData& fedData = rawdata.FEDData(ScalersRaw::SCALERS_FED_ID);
94  unsigned short int length = fedData.size();
95  if (length > 0) {
96  int nWords = length / 8;
97  int nBytesExtra = 0;
98 
99  const ScalersEventRecordRaw_v6* raw = (struct ScalersEventRecordRaw_v6*)fedData.data();
100  if ((raw->version == 1) || (raw->version == 2)) {
101  pOldTrigger.emplace_back(fedData.data());
102  nBytesExtra = length - sizeof(struct ScalersEventRecordRaw_v1);
103  } else if (raw->version >= 3) {
104  pTrigger.emplace_back(fedData.data());
105  if (raw->version >= 6) {
106  nBytesExtra = ScalersRaw::N_BX_v6 * sizeof(unsigned long long);
107  } else {
108  nBytesExtra = ScalersRaw::N_BX_v2 * sizeof(unsigned long long);
109  }
110  }
111 
112  pLumi.emplace_back(fedData.data());
113 
114  if ((nBytesExtra >= 8) && ((nBytesExtra % 8) == 0)) {
115  unsigned long long const* data = (unsigned long long const*)fedData.data();
116 
117  int nWordsExtra = nBytesExtra / 8;
118  for (int i = 0; i < nWordsExtra; i++) {
119  int index = nWords - (nWordsExtra + 1) + i;
120  pBunch.emplace_back(i, data[index]);
121  }
122  }
123 
124  if (raw->version >= 4) {
125  pBeamSpotOnline.emplace_back(fedData.data());
126 
127  pDcsStatus.emplace_back(fedData.data());
128  }
129  }
130  iEvent.emplace(l1ScalerPutToken_, std::move(pOldTrigger));
131  iEvent.emplace(lvl1ScalerPutToken_, std::move(pTrigger));
132  iEvent.emplace(lumiScalerPutToken_, std::move(pLumi));
133  iEvent.emplace(bunchPutToken_, std::move(pBunch));
134  iEvent.emplace(beamSpotPutToken_, std::move(pBeamSpotOnline));
135  iEvent.emplace(dcsPutToken_, std::move(pDcsStatus));
136 }
137 
138 // Define this as a plug-in
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
LumiScalers.h
mps_fire.i
i
Definition: mps_fire.py:428
DcsStatus.h
L1TriggerScalersCollection
std::vector< L1TriggerScalers > L1TriggerScalersCollection
Definition: L1TriggerScalers.h:132
edm::EDGetTokenT< FEDRawDataCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT< L1AcceptBunchCrossingCollection >
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
L1AcceptBunchCrossing.h
ScalersRaw::N_BX_v2
Definition: ScalersRaw.h:33
ScalersEventRecordRaw_v6::version
int version
Definition: ScalersRaw.h:241
BeamSpotOnline.h
ScalersRaw.h
FEDRawData.h
ScalersRawToDigi::ScalersRawToDigi
ScalersRawToDigi(const edm::ParameterSet &)
Definition: ScalersRawToDigi.cc:59
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
MakerMacros.h
ScalersRaw::N_BX_v6
Definition: ScalersRaw.h:34
Level1TriggerScalers.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ScalersEventRecordRaw_v1
Definition: ScalersRaw.h:181
L1TriggerScalers.h
L1AcceptBunchCrossingCollection
std::vector< L1AcceptBunchCrossing > L1AcceptBunchCrossingCollection
Definition: L1AcceptBunchCrossing.h:83
ParameterSetDescription.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ScalersRawToDigi::dcsPutToken_
const edm::EDPutTokenT< DcsStatusCollection > dcsPutToken_
Definition: ScalersRawToDigi.cc:55
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
LumiScalersCollection
std::vector< LumiScalers > LumiScalersCollection
Definition: LumiScalers.h:144
ScalersRawToDigi::fedToken_
const edm::EDGetTokenT< FEDRawDataCollection > fedToken_
Definition: ScalersRawToDigi.cc:49
ScalersRaw::SCALERS_FED_ID
Definition: ScalersRaw.h:40
ScalersEventRecordRaw_v6
Definition: ScalersRaw.h:239
iEvent
int iEvent
Definition: GenABIO.cc:224
ScalersRawToDigi::lvl1ScalerPutToken_
const edm::EDPutTokenT< Level1TriggerScalersCollection > lvl1ScalerPutToken_
Definition: ScalersRawToDigi.cc:52
FEDRawDataCollection.h
edm::EventSetup
Definition: EventSetup.h:57
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
InputTag.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
ScalersRawToDigi::lumiScalerPutToken_
const edm::EDPutTokenT< LumiScalersCollection > lumiScalerPutToken_
Definition: ScalersRawToDigi.cc:53
ScalersRawToDigi
Definition: ScalersRawToDigi.cc:40
BeamSpotOnlineCollection
std::vector< BeamSpotOnline > BeamSpotOnlineCollection
Definition: BeamSpotOnline.h:101
Level1TriggerRates.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ScalersRawToDigi::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: ScalersRawToDigi.cc:75
ScalersRawToDigi::beamSpotPutToken_
const edm::EDPutTokenT< BeamSpotOnlineCollection > beamSpotPutToken_
Definition: ScalersRawToDigi.cc:54
Level1TriggerScalersCollection
std::vector< Level1TriggerScalers > Level1TriggerScalersCollection
Definition: Level1TriggerScalers.h:183
EDProducer.h
edm::Event
Definition: Event.h:73
ScalersRawToDigi::bunchPutToken_
const edm::EDPutTokenT< L1AcceptBunchCrossingCollection > bunchPutToken_
Definition: ScalersRawToDigi.cc:50
DcsStatusCollection
std::vector< DcsStatus > DcsStatusCollection
Definition: DcsStatus.h:110
edm::InputTag
Definition: InputTag.h:15
ScalersRawToDigi::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ScalersRawToDigi.cc:68
ScalersRawToDigi::l1ScalerPutToken_
const edm::EDPutTokenT< L1TriggerScalersCollection > l1ScalerPutToken_
Definition: ScalersRawToDigi.cc:51