CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
TotemVFATRawToDigi Class Reference
Inheritance diagram for TotemVFATRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

void endStream () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 TotemVFATRawToDigi (const edm::ParameterSet &)
 
 ~TotemVFATRawToDigi () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Types

enum  {
  ssUndefined, ssTrackingStrip, ssTimingDiamond, ssTotemTiming,
  ssTotemT2
}
 

Private Member Functions

template<typename DigiType >
void run (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcdanalysisMaskToken
 
edm::EDGetTokenT< FEDRawDataCollectionfedDataToken
 
std::vector< unsigned int > fedIds
 
pps::RawDataUnpacker rawDataUnpacker
 
RawToDigiConverter rawToDigiConverter
 
enum TotemVFATRawToDigi:: { ... }  subSystem
 
std::string subSystemName
 
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcdtotemMappingToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 43 of file TotemVFATRawToDigi.cc.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ TotemVFATRawToDigi()

TotemVFATRawToDigi::TotemVFATRawToDigi ( const edm::ParameterSet conf)
explicit

Definition at line 73 of file TotemVFATRawToDigi.cc.

References analysisMaskToken, Exception, fedDataToken, l1tstage2_dqm_sourceclient-live_cfg::fedId, fedIds, edm::ParameterSet::getParameter(), l1ctLayer2EG_cff::id, dqm-mbProfile::log, LogDebug, FEDNumbering::MAXCTPPSDiamondFEDID, FEDNumbering::MAXTotemRPHorizontalFEDID, FEDNumbering::MAXTotemRPTimingVerticalFEDID, FEDNumbering::MAXTotemRPVerticalFEDID, FEDNumbering::MAXTotemT2FEDID, FEDNumbering::MINCTPPSDiamondFEDID, FEDNumbering::MINTotemRPHorizontalFEDID, FEDNumbering::MINTotemRPTimingVerticalFEDID, FEDNumbering::MINTotemRPVerticalFEDID, FEDNumbering::MINTotemT2FEDID, ssTimingDiamond, ssTotemT2, ssTotemTiming, ssTrackingStrip, ssUndefined, subSystem, subSystemName, and totemMappingToken.

74  : subSystemName(conf.getParameter<string>("subSystem")),
76  fedIds(conf.getParameter<vector<unsigned int>>("fedIds")),
77  rawDataUnpacker(conf.getParameterSet("RawUnpacking")),
78  rawToDigiConverter(conf.getParameterSet("RawToDigi")) {
79  fedDataToken = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("rawDataTag"));
80 
81  // validate chosen subSystem
82  if (subSystemName == "TrackingStrip")
84  else if (subSystemName == "TimingDiamond")
86  else if (subSystemName == "TotemTiming")
88  else if (subSystemName == "TotemT2")
90 
91  if (subSystem == ssUndefined)
92  throw cms::Exception("TotemVFATRawToDigi::TotemVFATRawToDigi")
93  << "Unknown sub-system string " << subSystemName << "." << endl;
94 
95  // FED (OptoRx) headers and footers
96  produces<vector<TotemFEDInfo>>(subSystemName);
97 
98  // declare products
100  produces<DetSetVector<TotemRPDigi>>(subSystemName);
101 
102  else if (subSystem == ssTimingDiamond)
103  produces<DetSetVector<CTPPSDiamondDigi>>(subSystemName);
104 
105  else if (subSystem == ssTotemTiming)
106  produces<DetSetVector<TotemTimingDigi>>(subSystemName);
107 
108  else if (subSystem == ssTotemT2)
109  produces<edmNew::DetSetVector<TotemT2Digi>>(subSystemName);
110 
111  // set default IDs
112  if (fedIds.empty()) {
113  if (subSystem == ssTrackingStrip) {
115  fedIds.push_back(id);
116 
118  fedIds.push_back(id);
119  }
120 
121  else if (subSystem == ssTimingDiamond) {
123  fedIds.push_back(id);
124  }
125 
126  else if (subSystem == ssTotemTiming) {
128  ++id)
129  fedIds.push_back(id);
130  }
131 
132  else if (subSystem == ssTotemT2) {
134  fedIds.push_back(id);
135  }
136  }
137  LogDebug("TotemVFATRawToDigi").log([this](auto &log) {
138  log << "List of FEDs handled by this instance: ";
139  string sep;
140  for (const auto &fedId : fedIds)
141  log << sep << fedId, sep = ", ";
142  });
143 
144  // conversion status
145  produces<DetSetVector<TotemVFATStatus>>(subSystemName);
146 
147  totemMappingToken = esConsumes<TotemDAQMapping, TotemReadoutRcd>(ESInputTag("", subSystemName));
148  analysisMaskToken = esConsumes<TotemAnalysisMask, TotemReadoutRcd>(ESInputTag("", subSystemName));
149 }
enum TotemVFATRawToDigi::@510 subSystem
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcd > analysisMaskToken
pps::RawDataUnpacker rawDataUnpacker
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > totemMappingToken
ParameterSet const & getParameterSet(std::string const &) const
std::vector< unsigned int > fedIds
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken
RawToDigiConverter rawToDigiConverter
#define LogDebug(id)

◆ ~TotemVFATRawToDigi()

TotemVFATRawToDigi::~TotemVFATRawToDigi ( )
override

Definition at line 151 of file TotemVFATRawToDigi.cc.

151 {}

Member Function Documentation

◆ endStream()

void TotemVFATRawToDigi::endStream ( )
override

Definition at line 201 of file TotemVFATRawToDigi.cc.

References RawToDigiConverter::printSummaries(), and rawToDigiConverter.

void printSummaries() const
Print error summaries.
RawToDigiConverter rawToDigiConverter

◆ fillDescriptions()

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

Definition at line 203 of file TotemVFATRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

203  {
204  // totemVFATRawToDigi
206  desc.add<edm::InputTag>("rawDataTag", edm::InputTag(""));
207  desc.add<std::string>("subSystem", "")->setComment("options: RP");
208  desc.add<std::vector<unsigned int>>("fedIds", {})
209  ->setComment(
210  "IMPORTANT: leave empty to load the default configuration from "
211  "DataFormats/FEDRawData/interface/FEDNumbering.h");
212  {
214  psd0.addUntracked<unsigned int>("verbosity", 0);
215  desc.add<edm::ParameterSetDescription>("RawUnpacking", psd0);
216  }
217  {
219  psd0.addUntracked<unsigned int>("verbosity", 0)
220  ->setComment(
221  "0-3: 1=one line/event with some corrupted VFAT frame, 2=list all corrupt VFAT frames/event, 3=all "
222  "problems with every corrupt frame");
223  psd0.add<unsigned int>("testFootprint", 2)->setComment("0=no test, 1=warn only, 2=warn and skip");
224  psd0.add<unsigned int>("testCRC", 2);
225  psd0.add<unsigned int>("testID", 2)->setComment("compare the ID from data and mapping");
226  psd0.add<unsigned int>("testECMostFrequent", 2)
227  ->setComment("compare frame EC with the most frequent value in the event");
228  psd0.add<unsigned int>("testBCMostFrequent", 2);
229  psd0.addUntracked<unsigned int>("EC_min", 10)
230  ->setComment("minimal number of frames to search for the most frequent counter value");
231  psd0.addUntracked<unsigned int>("BC_min", 10);
232  psd0.addUntracked<double>("EC_fraction", 0.6)
233  ->setComment(
234  "the most frequent counter value is accepted provided its relative occupancy is higher than this fraction");
235  psd0.addUntracked<double>("BC_fraction", 0.6);
236  psd0.add<bool>("useOlderT2TestFile", false)
237  ->setComment("treat hwID field as two separate 8-bit fields instead of one 16-bit");
238  psd0.addUntracked<bool>("printErrorSummary", false)->setComment("per-VFAT error summary at the end of the job");
239  psd0.addUntracked<bool>("printUnknownFrameSummary", false)
240  ->setComment("summary of frames found in data, but not in the mapping");
241  desc.add<edm::ParameterSetDescription>("RawToDigi", psd0);
242  }
243  descriptions.add("totemVFATRawToDigi", desc);
244  // or use the following to generate the label from the module's C++ type
245  //descriptions.addWithDefaultLabel(desc);
246 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void TotemVFATRawToDigi::produce ( edm::Event event,
const edm::EventSetup es 
)
override

Definition at line 153 of file TotemVFATRawToDigi.cc.

References edmPickEvents::event, ssTimingDiamond, ssTotemT2, ssTotemTiming, ssTrackingStrip, and subSystem.

153  {
154  if (subSystem == ssTrackingStrip)
155  run<DetSetVector<TotemRPDigi>>(event, es);
156 
157  else if (subSystem == ssTimingDiamond)
158  run<DetSetVector<CTPPSDiamondDigi>>(event, es);
159 
160  else if (subSystem == ssTotemTiming)
161  run<DetSetVector<TotemTimingDigi>>(event, es);
162 
163  else if (subSystem == ssTotemT2)
164  run<edmNew::DetSetVector<TotemT2Digi>>(event, es);
165 }
enum TotemVFATRawToDigi::@510 subSystem

◆ run()

template<typename DigiType >
void TotemVFATRawToDigi::run ( edm::Event event,
const edm::EventSetup es 
)
private

Definition at line 168 of file TotemVFATRawToDigi.cc.

References analysisMaskToken, data, ALCARECOTkAlDQM_cff::DigiType, fedDataToken, l1tstage2_dqm_sourceclient-live_cfg::fedId, fedIds, edm::EventSetup::getHandle(), taus_updatedMVAIds_cff::mapping, l1tstage2_dqm_sourceclient-live_cfg::rawData, rawDataUnpacker, rawToDigiConverter, RawToDigiConverter::run(), pps::RawDataUnpacker::run(), subSystemName, and totemMappingToken.

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

168  {
169  // get DAQ mapping
171 
172  // get analysis mask to mask channels
174 
175  // raw data handle
177  event.getByToken(fedDataToken, rawData);
178 
179  // book output products
180  vector<TotemFEDInfo> fedInfo;
181  DigiType digi;
182  DetSetVector<TotemVFATStatus> conversionStatus;
183 
184  // raw-data unpacking
185  SimpleVFATFrameCollection vfatCollection;
186  for (const auto &fedId : fedIds) {
187  const FEDRawData &data = rawData->FEDData(fedId);
188  if (data.size() > 0)
189  rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection);
190  }
191 
192  // raw-to-digi conversion
193  rawToDigiConverter.run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus);
194 
195  // commit products to event
196  event.put(make_unique<vector<TotemFEDInfo>>(fedInfo), subSystemName);
197  event.put(make_unique<DigiType>(digi), subSystemName);
198  event.put(make_unique<DetSetVector<TotemVFATStatus>>(conversionStatus), subSystemName);
199 }
edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcd > analysisMaskToken
pps::RawDataUnpacker rawDataUnpacker
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > totemMappingToken
std::vector< unsigned int > fedIds
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
int run(int fedId, const FEDRawData &data, std::vector< TotemFEDInfo > &fedInfoColl, SimpleVFATFrameCollection &coll) const
Unpack data from FED with fedId into ‘coll’ collection.
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
RawToDigiConverter rawToDigiConverter
void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemRPDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
Creates RP digi.

Member Data Documentation

◆ analysisMaskToken

edm::ESGetToken<TotemAnalysisMask, TotemReadoutRcd> TotemVFATRawToDigi::analysisMaskToken
private

Definition at line 61 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ fedDataToken

edm::EDGetTokenT<FEDRawDataCollection> TotemVFATRawToDigi::fedDataToken
private

Definition at line 59 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ fedIds

std::vector<unsigned int> TotemVFATRawToDigi::fedIds
private

Definition at line 57 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ rawDataUnpacker

pps::RawDataUnpacker TotemVFATRawToDigi::rawDataUnpacker
private

Definition at line 63 of file TotemVFATRawToDigi.cc.

Referenced by run().

◆ rawToDigiConverter

RawToDigiConverter TotemVFATRawToDigi::rawToDigiConverter
private

Definition at line 64 of file TotemVFATRawToDigi.cc.

Referenced by endStream(), and run().

◆ subSystem

enum { ... } TotemVFATRawToDigi::subSystem

Referenced by produce(), and TotemVFATRawToDigi().

◆ subSystemName

std::string TotemVFATRawToDigi::subSystemName
private

Definition at line 53 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ totemMappingToken

edm::ESGetToken<TotemDAQMapping, TotemReadoutRcd> TotemVFATRawToDigi::totemMappingToken
private

Definition at line 60 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().