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, TotemAnalysisMaskRcdanalysisMaskToken
 
CTPPSRawToDigiErrorSummary errSummary
 
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 45 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 76 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.

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

◆ ~TotemVFATRawToDigi()

TotemVFATRawToDigi::~TotemVFATRawToDigi ( )
override

Definition at line 155 of file TotemVFATRawToDigi.cc.

155 {}

Member Function Documentation

◆ endStream()

void TotemVFATRawToDigi::endStream ( )
override

Definition at line 226 of file TotemVFATRawToDigi.cc.

References errSummary, RawToDigiConverter::printSummaries(), CTPPSRawToDigiErrorSummary::printSummary(), and rawToDigiConverter.

226  {
229 }
CTPPSRawToDigiErrorSummary errSummary
void printSummaries() const
Print error summaries.
RawToDigiConverter rawToDigiConverter

◆ fillDescriptions()

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

Definition at line 231 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.

231  {
232  // totemVFATRawToDigi
234  desc.add<edm::InputTag>("rawDataTag", edm::InputTag(""));
235  desc.add<std::string>("subSystem", "")->setComment("options: RP");
236  desc.add<std::vector<unsigned int>>("fedIds", {})
237  ->setComment(
238  "IMPORTANT: leave empty to load the default configuration from "
239  "DataFormats/FEDRawData/interface/FEDNumbering.h");
240  {
242  psd0.addUntracked<unsigned int>("verbosity", 0);
243  desc.add<edm::ParameterSetDescription>("RawUnpacking", psd0);
244  }
245  {
247  psd0.addUntracked<unsigned int>("verbosity", 0)
248  ->setComment(
249  "0-3: 1=one line/event with some corrupted VFAT frame, 2=list all corrupt VFAT frames/event, 3=all "
250  "problems with every corrupt frame");
251  psd0.add<unsigned int>("testFootprint", 2)->setComment("0=no test, 1=warn only, 2=warn and skip");
252  psd0.add<unsigned int>("testCRC", 2);
253  psd0.add<unsigned int>("testID", 2)->setComment("compare the ID from data and mapping");
254  psd0.add<unsigned int>("testECMostFrequent", 2)
255  ->setComment("compare frame EC with the most frequent value in the event");
256  psd0.add<unsigned int>("testBCMostFrequent", 2);
257  psd0.addUntracked<unsigned int>("EC_min", 10)
258  ->setComment("minimal number of frames to search for the most frequent counter value");
259  psd0.addUntracked<unsigned int>("BC_min", 10);
260  psd0.addUntracked<double>("EC_fraction", 0.6)
261  ->setComment(
262  "the most frequent counter value is accepted provided its relative occupancy is higher than this fraction");
263  psd0.addUntracked<double>("BC_fraction", 0.6);
264  psd0.add<bool>("useOlderT2TestFile", false)
265  ->setComment("treat hwID field as two separate 8-bit fields instead of one 16-bit");
266  psd0.addUntracked<bool>("printErrorSummary", false)->setComment("per-VFAT error summary at the end of the job");
267  psd0.addUntracked<bool>("printUnknownFrameSummary", false)
268  ->setComment("summary of frames found in data, but not in the mapping");
269  desc.add<edm::ParameterSetDescription>("RawToDigi", psd0);
270  }
271  descriptions.add("totemVFATRawToDigi", desc);
272  // or use the following to generate the label from the module's C++ type
273  //descriptions.addWithDefaultLabel(desc);
274 }
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 157 of file TotemVFATRawToDigi.cc.

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

157  {
158  if (subSystem == ssTrackingStrip)
159  run<DetSetVector<TotemRPDigi>>(event, es);
160 
161  else if (subSystem == ssTimingDiamond)
162  run<DetSetVector<CTPPSDiamondDigi>>(event, es);
163 
164  else if (subSystem == ssTotemTiming)
165  run<DetSetVector<TotemTimingDigi>>(event, es);
166 
167  else if (subSystem == ssTotemT2)
168  run<edmNew::DetSetVector<TotemT2Digi>>(event, es);
169 }
enum TotemVFATRawToDigi::@481 subSystem

◆ run()

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

Definition at line 172 of file TotemVFATRawToDigi.cc.

References CTPPSRawToDigiErrorSummary::add(), analysisMaskToken, data, ALCARECOTkAlDQM_cff::DigiType, errSummary, Exception, edm::ESHandleBase::failedToGet(), fedDataToken, l1tstage2_dqm_sourceclient-live_cfg::fedId, fedIds, dqm-mbProfile::format, edm::EventSetup::getHandle(), edm::ESHandleBase::isValid(), HPSPFTaus_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().

172  {
173  // mapping and analysis mask
175  ESHandle<TotemAnalysisMask> analysisMaskHandle;
176  TotemAnalysisMask analysisMask;
177 
178  // raw data handle
180  event.getByToken(fedDataToken, rawData);
181 
182  // book output products
183  vector<TotemFEDInfo> fedInfo;
184  DigiType digi;
185  DetSetVector<TotemVFATStatus> conversionStatus;
186 
187  // raw-data unpacking
188  bool data_exist = false;
189  SimpleVFATFrameCollection vfatCollection;
190  for (const auto &fedId : fedIds) {
191  const FEDRawData &data = rawData->FEDData(fedId);
192  if (data.size() > 0) {
193  rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection);
194  data_exist = true;
195  }
196  }
197 
198  // get mapping records and do raw-to-digi conversion only if some data exists
199  if (data_exist) {
200  // get DAQ mapping
202  if (!mapping.isValid() || mapping.failedToGet()) {
203  throw cms::Exception("TotemVFATRawToDigi::TotemVFATRawToDigi")
204  << "No DAQMapping found for " << subSystemName << "." << endl;
205  }
206 
207  // get analysis mask to mask channels
208  analysisMaskHandle = es.getHandle(analysisMaskToken);
209  if (analysisMaskHandle.isValid() && !analysisMaskHandle.failedToGet()) {
210  analysisMask = *analysisMaskHandle;
211  } else {
212  errSummary.add(fmt::format("No AnalysisMask found for {0}", subSystemName), "");
213  analysisMask = TotemAnalysisMask();
214  }
215 
216  // raw-to-digi conversion
217  rawToDigiConverter.run(vfatCollection, *mapping, analysisMask, digi, conversionStatus);
218  }
219 
220  // commit products to event
221  event.put(make_unique<vector<TotemFEDInfo>>(fedInfo), subSystemName);
222  event.put(make_unique<DigiType>(digi), subSystemName);
223  event.put(make_unique<DetSetVector<TotemVFATStatus>>(conversionStatus), subSystemName);
224 }
Channel-mask mapping.
pps::RawDataUnpacker rawDataUnpacker
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > totemMappingToken
edm::ESGetToken< TotemAnalysisMask, TotemAnalysisMaskRcd > analysisMaskToken
std::vector< unsigned int > fedIds
CTPPSRawToDigiErrorSummary errSummary
void add(const std::string &message, const std::string &details="")
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.
bool isValid() const
Definition: ESHandle.h:44
bool failedToGet() const
Definition: ESHandle.h:46
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, TotemAnalysisMaskRcd> TotemVFATRawToDigi::analysisMaskToken
private

Definition at line 63 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ errSummary

CTPPSRawToDigiErrorSummary TotemVFATRawToDigi::errSummary
private

Definition at line 67 of file TotemVFATRawToDigi.cc.

Referenced by endStream(), and run().

◆ fedDataToken

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

Definition at line 61 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ fedIds

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

Definition at line 59 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ rawDataUnpacker

pps::RawDataUnpacker TotemVFATRawToDigi::rawDataUnpacker
private

Definition at line 65 of file TotemVFATRawToDigi.cc.

Referenced by run().

◆ rawToDigiConverter

RawToDigiConverter TotemVFATRawToDigi::rawToDigiConverter
private

Definition at line 66 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 55 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().

◆ totemMappingToken

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

Definition at line 62 of file TotemVFATRawToDigi.cc.

Referenced by run(), and TotemVFATRawToDigi().