CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
RawToDigiConverter Class Reference

Collection of code to convert TOTEM raw data into digi. More...

#include <RawToDigiConverter.h>

Classes

struct  Record
 

Public Member Functions

void printSummaries () const
 Print error summaries. More...
 
 RawToDigiConverter (const edm::ParameterSet &conf)
 
void run (const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemRPDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
 Creates RP digi. More...
 
void run (const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< CTPPSDiamondDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
 Creates Diamond digi. More...
 
void run (const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemTimingDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
 Creates Totem Timing digi. More...
 

Private Types

enum  TestFlag { tfNoTest, tfWarn, tfErr }
 

Private Member Functions

void runCommon (const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map< TotemFramePosition, Record > &records)
 Common processing for all VFAT based sub-systems. More...
 

Private Attributes

double BC_fraction
 
unsigned int BC_min
 
double EC_fraction
 the minimal required (relative) occupancy of the most frequent counter value to be accepted More...
 
unsigned int EC_min
 the minimal required number of frames to determine the most frequent counter value More...
 
std::map< TotemFramePosition, std::map< TotemVFATStatus, unsigned int > > errorSummary
 error summaries More...
 
unsigned int printErrorSummary
 
unsigned int printUnknownFrameSummary
 
unsigned int testBCMostFrequent
 
unsigned int testCRC
 
unsigned int testECDAQ
 
unsigned int testECMostFrequent
 
unsigned int testECRaw
 
unsigned int testFootprint
 flags for which tests to run More...
 
unsigned int testID
 
std::map< TotemFramePosition, unsigned int > unknownSummary
 
unsigned char verbosity
 

Detailed Description

Collection of code to convert TOTEM raw data into digi.

Definition at line 26 of file RawToDigiConverter.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

RawToDigiConverter::RawToDigiConverter ( const edm::ParameterSet conf)

Definition at line 27 of file RawToDigiConverter.cc.

27  :
28  verbosity(conf.getUntrackedParameter<unsigned int>("verbosity", 0)),
29  printErrorSummary(conf.getUntrackedParameter<unsigned int>("printErrorSummary", 1)),
30  printUnknownFrameSummary(conf.getUntrackedParameter<unsigned int>("printUnknownFrameSummary", 1)),
31 
32  testFootprint(conf.getParameter<unsigned int>("testFootprint")),
33  testCRC(conf.getParameter<unsigned int>("testCRC")),
34  testID(conf.getParameter<unsigned int>("testID")),
35  testECMostFrequent(conf.getParameter<unsigned int>("testECMostFrequent")),
36  testBCMostFrequent(conf.getParameter<unsigned int>("testBCMostFrequent")),
37 
38  EC_min(conf.getUntrackedParameter<unsigned int>("EC_min", 10)),
39  BC_min(conf.getUntrackedParameter<unsigned int>("BC_min", 10)),
40 
41  EC_fraction(conf.getUntrackedParameter<double>("EC_fraction", 0.6)),
42  BC_fraction(conf.getUntrackedParameter<double>("BC_fraction", 0.6))
43 {
44 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
unsigned int testECMostFrequent
unsigned int printErrorSummary
unsigned int testFootprint
flags for which tests to run
unsigned int printUnknownFrameSummary
unsigned char verbosity
unsigned int testBCMostFrequent
double EC_fraction
the minimal required (relative) occupancy of the most frequent counter value to be accepted ...
unsigned int EC_min
the minimal required number of frames to determine the most frequent counter value ...

Member Function Documentation

void RawToDigiConverter::printSummaries ( ) const

Print error summaries.

Definition at line 391 of file RawToDigiConverter.cc.

References errorSummary, printErrorSummary, printUnknownFrameSummary, and unknownSummary.

Referenced by TotemVFATRawToDigi::endStream().

392 {
393  // print error summary
394  if (printErrorSummary)
395  {
396  if (!errorSummary.empty())
397  {
398  stringstream ees;
399  for (const auto &vit : errorSummary)
400  {
401  ees << vit.first << endl;
402 
403  for (const auto &it : vit.second)
404  ees << " " << it.first << " : " << it.second << endl;
405  }
406 
407  LogWarning("Totem") << "RawToDigiConverter: error summary (error signature : number of such events)\n" << endl << ees.rdbuf();
408  } else {
409  LogInfo("Totem") << "RawToDigiConverter: no errors to be reported.";
410  }
411  }
412 
413  // print summary of unknown frames (found in data but not in the mapping)
415  {
416  if (!unknownSummary.empty())
417  {
418  stringstream ees;
419  for (const auto &it : unknownSummary)
420  ees << " " << it.first << " : " << it.second << endl;
421 
422  LogWarning("Totem") << "RawToDigiConverter: frames found in data, but not in the mapping (frame position : number of events)\n"
423  << endl << ees.rdbuf();
424  } else {
425  LogInfo("Totem") << "RawToDigiConverter: no unknown frames to be reported.";
426  }
427  }
428 }
unsigned int printErrorSummary
unsigned int printUnknownFrameSummary
std::map< TotemFramePosition, unsigned int > unknownSummary
std::map< TotemFramePosition, std::map< TotemVFATStatus, unsigned int > > errorSummary
error summaries
void RawToDigiConverter::run ( const VFATFrameCollection coll,
const TotemDAQMapping mapping,
const TotemAnalysisMask mask,
edm::DetSetVector< TotemRPDigi > &  digi,
edm::DetSetVector< TotemVFATStatus > &  status 
)

Creates RP digi.

Definition at line 199 of file RawToDigiConverter.cc.

References TotemAnalysisMask::analysisMask, TotemRPDetId::chip(), edm::DetSetVector< T >::find_or_insert(), RawToDigiConverter::Record::frame, TotemVFATAnalysisMask::fullMask, VFATFrame::getActiveChannels(), TotemRPDetId::getPlaneId(), RawToDigiConverter::Record::info, TotemVFATStatus::isOK(), TotemVFATAnalysisMask::maskedChannels, PFRecoTauDiscriminationByIsolation_cfi::offset, AlCaHLTBitMon_ParallelJobs::p, edm::DetSet< T >::push_back(), record, runCommon(), TotemVFATStatus::setChipPosition(), TotemVFATStatus::setFullyMaskedOut(), TotemVFATStatus::setPartiallyMaskedOut(), RawToDigiConverter::Record::status, TotemSymbID::symbolicID, and TotemVFATInfo::symbolicID.

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

202 {
203  // structure merging vfat frame data with the mapping
204  map<TotemFramePosition, Record> records;
205 
206  // common processing - frame validation
207  runCommon(input, mapping, records);
208 
209  // second loop over data
210  for (auto &p : records)
211  {
212  Record &record = p.second;
213 
214  // calculate ids
215  TotemRPDetId chipId(record.info->symbolicID.symbolicID);
216  uint8_t chipPosition = chipId.chip();
217  TotemRPDetId detId = chipId.getPlaneId();
218 
219  // update chipPosition in status
220  record.status.setChipPosition(chipPosition);
221 
222  // produce digi only for good frames
223  if (record.status.isOK())
224  {
225  // find analysis mask (needs a default=no mask, if not in present the mapping)
227  anMa.fullMask = false;
228 
229  auto analysisIter = analysisMask.analysisMask.find(record.info->symbolicID);
230  if (analysisIter != analysisMask.analysisMask.end())
231  {
232  // if there is some information about masked channels - save it into conversionStatus
233  anMa = analysisIter->second;
234  if (anMa.fullMask)
235  record.status.setFullyMaskedOut();
236  else
237  record.status.setPartiallyMaskedOut();
238  }
239 
240  // create the digi
241  unsigned short offset = chipPosition * 128;
242  const vector<unsigned char> &activeChannels = record.frame->getActiveChannels();
243 
244  for (auto ch : activeChannels)
245  {
246  // skip masked channels
247  if (!anMa.fullMask && anMa.maskedChannels.find(ch) == anMa.maskedChannels.end())
248  {
249  DetSet<TotemRPDigi> &digiDetSet = rpData.find_or_insert(detId);
250  digiDetSet.push_back(TotemRPDigi(offset + ch));
251  }
252  }
253  }
254 
255  // save status
256  DetSet<TotemVFATStatus> &statusDetSet = finalStatus.find_or_insert(detId);
257  statusDetSet.push_back(record.status);
258  }
259 }
Detector ID class for TOTEM Si strip detectors.
Definition: TotemRPDetId.h:30
Contains data on masked channels of a VFAT.
void push_back(const T &t)
Definition: DetSet.h:68
void runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map< TotemFramePosition, Record > &records)
Common processing for all VFAT based sub-systems.
JetCorrectorParameters::Record record
Definition: classes.h:7
static std::string const input
Definition: EdmProvDump.cc:44
bool fullMask
whether all channels of the VFAT shall be masked
std::set< unsigned char > maskedChannels
list of channels to be masked
TotemRPDetId getPlaneId() const
Definition: TotemRPDetId.h:73
void RawToDigiConverter::run ( const VFATFrameCollection coll,
const TotemDAQMapping mapping,
const TotemAnalysisMask mask,
edm::DetSetVector< CTPPSDiamondDigi > &  digi,
edm::DetSetVector< TotemVFATStatus > &  status 
)

Creates Diamond digi.

Definition at line 263 of file RawToDigiConverter.cc.

References edm::DetSetVector< T >::find_or_insert(), RawToDigiConverter::Record::frame, VFATFrame::getEC(), DiamondVFATFrame::getHptdcErrorFlag(), DiamondVFATFrame::getLeadingEdgeTime(), DiamondVFATFrame::getMultihit(), DiamondVFATFrame::getThresholdVoltage(), DiamondVFATFrame::getTrailingEdgeTime(), RawToDigiConverter::Record::info, TotemVFATStatus::isOK(), AlCaHLTBitMon_ParallelJobs::p, edm::DetSet< T >::push_back(), record, runCommon(), TotemVFATStatus::setEC(), RawToDigiConverter::Record::status, TotemSymbID::symbolicID, and TotemVFATInfo::symbolicID.

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

265 {
266  // structure merging vfat frame data with the mapping
267  map<TotemFramePosition, Record> records;
268 
269  // common processing - frame validation
270  runCommon(coll, mapping, records);
271 
272  // second loop over data
273  for (auto &p : records)
274  {
275  Record &record = p.second;
276 
277  // calculate ids
278  CTPPSDiamondDetId detId(record.info->symbolicID.symbolicID);
279 
280  if (record.status.isOK())
281  {
282  const VFATFrame *fr = record.frame;
283  const DiamondVFATFrame *diamondframe = static_cast<const DiamondVFATFrame*>(fr);
284 
285  // update Event Counter in status
286  record.status.setEC(record.frame->getEC() & 0xFF);
287 
288  // create the digi
289  DetSet<CTPPSDiamondDigi> &digiDetSet = digi.find_or_insert(detId);
290  digiDetSet.push_back(CTPPSDiamondDigi(diamondframe->getLeadingEdgeTime(),diamondframe->getTrailingEdgeTime(),diamondframe->getThresholdVoltage(),diamondframe->getMultihit(),diamondframe->getHptdcErrorFlag()));
291  }
292 
293  // save status
294  DetSet<TotemVFATStatus> &statusDetSet = status.find_or_insert(detId);
295  statusDetSet.push_back(record.status);
296  }
297 }
void push_back(const T &t)
Definition: DetSet.h:68
void runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map< TotemFramePosition, Record > &records)
Common processing for all VFAT based sub-systems.
JetCorrectorParameters::Record record
Definition: classes.h:7
uint32_t getLeadingEdgeTime() const
get timing infromation
uint32_t getThresholdVoltage() const
VFATFrame::word getMultihit() const
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:254
uint32_t getTrailingEdgeTime() const
VFATFrame::word getHptdcErrorFlag() const
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
void RawToDigiConverter::run ( const VFATFrameCollection coll,
const TotemDAQMapping mapping,
const TotemAnalysisMask mask,
edm::DetSetVector< TotemTimingDigi > &  digi,
edm::DetSetVector< TotemVFATStatus > &  status 
)

Creates Totem Timing digi.

Definition at line 301 of file RawToDigiConverter.cc.

References TotemDAQMapping::TotemTimingPlaneChannelPair::channel, TauDecayModes::dec, dumpTauVariables_cfi::eventInfo, edm::DetSetVector< T >::find_or_insert(), RawToDigiConverter::Record::frame, VFATFrame::getData(), TotemFramePosition::getGOHId(), TotemFramePosition::getIdxInFiber(), TotemFramePosition::getOptoRxId(), TotemFramePosition::getSubSystemId(), TotemDAQMapping::getTimingChannel(), TotemFramePosition::getTOTFEDId(), RawToDigiConverter::Record::info, createfilelist::int, TotemVFATStatus::isOK(), AlCaHLTBitMon_ParallelJobs::p, TotemDAQMapping::TotemTimingPlaneChannelPair::plane, edm::DetSet< T >::push_back(), record, runCommon(), RawToDigiConverter::Record::status, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, and verbosity.

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

303 {
304  // structure merging vfat frame data with the mapping
305  map<TotemFramePosition, Record> records;
306 
307  // common processing - frame validation
308  runCommon(coll, mapping, records);
309 
310  // second loop over data
311  for (auto &p : records)
312  {
313  Record &record = p.second;
314  if (!record.status.isOK()) continue;
315 
316  const TotemFramePosition* framepos = &p.first;
317 
318  if(((framepos->getIdxInFiber()%2)==0)&&(framepos->getIdxInFiber()<14))
319  {
320  //corresponding channel data are always in the neighbouring idx in fiber
321 
322  TotemFramePosition frameposdata(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),(framepos->getIdxInFiber()+1));
323  TotemFramePosition frameposEvtInfo(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),0xe);
324 
325  auto channelwaveformPtr = records.find(frameposdata);
326  auto eventInfoPtr = records.find(frameposEvtInfo);
327 
328  if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() )
329  {
330  Record &channelwaveform = records[frameposdata];
331  Record &eventInfo = records[frameposEvtInfo];
332 
333  // Extract all the waveform information from the raw data
334  TotemSampicFrame totemSampicFrame((const uint8_t*) record.frame->getData(), (const uint8_t*) channelwaveform.frame->getData(), (const uint8_t*) eventInfo.frame->getData());
335 
336  if (totemSampicFrame.valid())
337  {
338  // create the digi
339  TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimestamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples(), totemSampicFrame.getPLLInfo() );
340  TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimestamp(), totemSampicFrame.getTimestampA(), totemSampicFrame.getTimestampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp);
341  // calculate ids
342  TotemTimingDetId detId(record.info->symbolicID.symbolicID);
343 
344  const TotemDAQMapping::TotemTimingPlaneChannelPair SWpair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() );
345  // for FW Version > 0 plane and channel are encoded in the dataframe
346  if ( totemSampicFrame.getFWVersion() == 0 ) // Mapping not present in HW, read from SW
347  {
348  if ( SWpair.plane == -1 || SWpair.channel == -1 )
349  {
350  if (verbosity>0)
351  LogWarning("Totem") << "Error in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << endl;
352  }
353  else
354  {
355  detId.setPlane( SWpair.plane % 4);
356  detId.setChannel( SWpair.channel );
357  detId.setRP( SWpair.plane / 4 ); // Top:0 or Bottom:1
358  }
359  }
360  else // Mapping read from HW, checked by SW
361  {
362  const int HWplane = totemSampicFrame.getDetPlane() % 16;
363  const int HWchannel = totemSampicFrame.getDetChannel() % 16;
364 
365  if ( SWpair.plane == -1 || SWpair.channel == -1 )
366  {
367  if ( verbosity>0 )
368  LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "\tUsing plane and ch from HW without check!" << endl;
369  }
370  else
371  {
372  if ( verbosity>0 && ( SWpair.plane != HWplane || SWpair.channel != HWchannel ) )
373  LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "Hw mapping different from SW mapping. hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "HW: " << std::dec << HWplane << ":" << HWchannel << "\tSW " << SWpair.plane << ":" << SWpair.channel << "\tUsing plane and ch from HW!" << endl;
374  }
375  detId.setPlane( HWplane % 4 );
376  detId.setChannel( HWchannel );
377  detId.setRP( HWplane / 4 ); // Top:0 or Bottom:1
378  }
379 
380  DetSet<TotemTimingDigi> &digiDetSet = digi.find_or_insert(detId);
381  digiDetSet.push_back(digiTmp);
382  }
383  }
384  }
385  }
386 }
void push_back(const T &t)
Definition: DetSet.h:68
void runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map< TotemFramePosition, Record > &records)
Common processing for all VFAT based sub-systems.
JetCorrectorParameters::Record record
Definition: classes.h:7
unsigned short getIdxInFiber() const
unsigned short getTOTFEDId() const
unsigned short getOptoRxId() const
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:254
unsigned short getSubSystemId() const
the getters and setters below are deprecated
const TotemTimingPlaneChannelPair getTimingChannel(const uint8_t hwId) const
Given the hardware ID, returns the corresponding Plane, Channel pair (TotemTimingPlaneChannelPair) ...
unsigned short getGOHId() const
Hw Id mapping for Totem Timing (dynamical mapping in Sampic)
unsigned char verbosity
eventInfo
add run, event number and lumi section
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...
void RawToDigiConverter::runCommon ( const VFATFrameCollection input,
const TotemDAQMapping mapping,
std::map< TotemFramePosition, Record > &  records 
)
private

Common processing for all VFAT based sub-systems.

Definition at line 48 of file RawToDigiConverter.cc.

References CounterChecker::Analyze(), BC_fraction, BC_min, CounterChecker::BCChecker, VFATFrame::checkCRC(), VFATFrame::checkFootprint(), TauDecayModes::dec, EC_fraction, EC_min, CounterChecker::ECChecker, errorSummary, CounterChecker::Fill(), RawToDigiConverter::Record::frame, VFATFrame::getChipID(), VFATFrame::getNumberOfClusters(), TotemVFATInfo::hwID, RawToDigiConverter::Record::info, VFATFrameCollection::Iterator::IsEnd(), VFATFrame::isIDPresent(), VFATFrame::isNumberOfClustersPresent(), funct::m, AlCaHLTBitMon_ParallelJobs::p, printErrorSummary, record, TotemVFATStatus::setCRCError(), TotemVFATStatus::setFootprintError(), TotemVFATStatus::setIDMismatch(), TotemVFATStatus::setMissing(), TotemVFATStatus::setNumberOfClusters(), TotemVFATStatus::setNumberOfClustersSpecified(), RawToDigiConverter::Record::status, TotemSymbID::symbolicID, TotemVFATInfo::symbolicID, testBCMostFrequent, testCRC, testECMostFrequent, testFootprint, testID, tfErr, tfNoTest, unknownSummary, verbosity, and TotemDAQMapping::VFATMapping.

Referenced by run().

50 {
51  // EC and BC checks (wrt. the most frequent value), BC checks per subsystem
54 
55  // initialise structure merging vfat frame data with the mapping
56  for (auto &p : mapping.VFATMapping)
57  {
58  TotemVFATStatus st;
59  st.setMissing(true);
60  records[p.first] = { &p.second, nullptr, st };
61  }
62 
63  // event error message buffer
64  stringstream ees;
65 
66  // associate data frames with records
67  for (VFATFrameCollection::Iterator fr(&input); !fr.IsEnd(); fr.Next())
68  {
69  // frame error message buffer
70  stringstream fes;
71 
72  bool problemsPresent = false;
73  bool stopProcessing = false;
74 
75  // skip data frames not listed in the DAQ mapping
76  auto records_it = records.find(fr.Position());
77  if (records_it == records.end())
78  {
79  unknownSummary[fr.Position()]++;
80  continue;
81  }
82 
83  // update record
84  Record &record = records_it->second;
85  record.frame = fr.Data();
86  record.status.setMissing(false);
87  record.status.setNumberOfClustersSpecified(record.frame->isNumberOfClustersPresent());
88  record.status.setNumberOfClusters(record.frame->getNumberOfClusters());
89 
90  // check footprint
91  if (testFootprint != tfNoTest && !record.frame->checkFootprint())
92  {
93  problemsPresent = true;
94 
95  if (verbosity > 0)
96  fes << " invalid footprint" << endl;
97 
98  if (testFootprint == tfErr)
99  {
100  record.status.setFootprintError();
101  stopProcessing = true;
102  }
103  }
104 
105  // check CRC
106  if (testCRC != tfNoTest && !record.frame->checkCRC())
107  {
108  problemsPresent = true;
109 
110  if (verbosity > 0)
111  fes << " CRC failure" << endl;
112 
113  if (testCRC == tfErr)
114  {
115  record.status.setCRCError();
116  stopProcessing = true;
117  }
118  }
119  // check the id mismatch
120  if (testID != tfNoTest && record.frame->isIDPresent() && (record.frame->getChipID() & 0xFFF) != (record.info->hwID & 0xFFF))
121  {
122  if (verbosity > 0)
123  fes << " ID mismatch (data: 0x" << hex << record.frame->getChipID()
124  << ", mapping: 0x" << record.info->hwID << dec << ", symbId: " << record.info->symbolicID.symbolicID << ")" << endl;
125 
126  if (testID == tfErr)
127  {
128  record.status.setIDMismatch();
129  stopProcessing = true;
130  }
131  }
132 
133  // if there were errors, put the information to ees buffer
134  if (verbosity > 0 && problemsPresent)
135  {
136  string message = (stopProcessing) ? "(and will be dropped)" : "(but will be used though)";
137  if (verbosity > 2)
138  {
139  ees << " Frame at " << fr.Position() << " seems corrupted " << message << ":" << endl;
140  ees << fes.rdbuf();
141  } else
142  ees << " Frame at " << fr.Position() << " seems corrupted " << message << "." << endl;
143  }
144 
145  // if there were serious errors, do not process this frame
146  if (stopProcessing)
147  continue;
148 
149  // fill EC and BC values to the statistics
150  if (fr.Data()->isECPresent())
151  ECChecker.Fill(fr.Data()->getEC(), fr.Position());
152 
153  if (fr.Data()->isBCPresent())
154  BCChecker.Fill(fr.Data()->getBC(), fr.Position());
155  }
156 
157  // analyze EC and BC statistics
159  ECChecker.Analyze(records, (testECMostFrequent == tfErr), ees);
160 
162  BCChecker.Analyze(records, (testBCMostFrequent == tfErr), ees);
163 
164  // add error message for missing frames
165  if (verbosity > 1)
166  {
167  for (const auto &p : records)
168  {
169  if (p.second.status.isMissing())
170  ees << "Frame for VFAT " << p.first << " is not present in the data." << endl;
171  }
172  }
173 
174  // print error message
175  if (verbosity > 0 && !ees.rdbuf()->str().empty())
176  {
177  if (verbosity > 1)
178  LogWarning("Totem") << "Error in RawToDigiConverter::runCommon > " << "event contains the following problems:" << endl << ees.rdbuf() << endl;
179  else
180  LogWarning("Totem") << "Error in RawToDigiConverter::runCommon > " << "event contains problems." << endl;
181  }
182 
183  // increase error counters
184  if (printErrorSummary)
185  {
186  for (const auto &it : records)
187  {
188  if (!it.second.status.isOK())
189  {
190  auto &m = errorSummary[it.first];
191  m[it.second.status]++;
192  }
193  }
194  }
195 }
unsigned int testECMostFrequent
unsigned int printErrorSummary
Class for finding the most popular both EC and BC counter, and filling the conversion status &#39;wrong E...
JetCorrectorParameters::Record record
Definition: classes.h:7
unsigned int testFootprint
flags for which tests to run
the VFATFrameCollection interator
void setMissing(bool val=true)
unsigned char verbosity
std::map< TotemFramePosition, unsigned int > unknownSummary
unsigned int testBCMostFrequent
std::map< TotemFramePosition, TotemVFATInfo > VFATMapping
std::map< TotemFramePosition, std::map< TotemVFATStatus, unsigned int > > errorSummary
error summaries
bool IsEnd()
returns whether the iterator points over the end of the collection
double EC_fraction
the minimal required (relative) occupancy of the most frequent counter value to be accepted ...
unsigned int EC_min
the minimal required number of frames to determine the most frequent counter value ...

Member Data Documentation

double RawToDigiConverter::BC_fraction
private

Definition at line 74 of file RawToDigiConverter.h.

Referenced by runCommon().

unsigned int RawToDigiConverter::BC_min
private

Definition at line 71 of file RawToDigiConverter.h.

Referenced by runCommon().

double RawToDigiConverter::EC_fraction
private

the minimal required (relative) occupancy of the most frequent counter value to be accepted

Definition at line 74 of file RawToDigiConverter.h.

Referenced by runCommon().

unsigned int RawToDigiConverter::EC_min
private

the minimal required number of frames to determine the most frequent counter value

Definition at line 71 of file RawToDigiConverter.h.

Referenced by runCommon().

std::map<TotemFramePosition, std::map<TotemVFATStatus, unsigned int> > RawToDigiConverter::errorSummary
private

error summaries

Definition at line 77 of file RawToDigiConverter.h.

Referenced by printSummaries(), and runCommon().

unsigned int RawToDigiConverter::printErrorSummary
private

Definition at line 56 of file RawToDigiConverter.h.

Referenced by printSummaries(), and runCommon().

unsigned int RawToDigiConverter::printUnknownFrameSummary
private

Definition at line 57 of file RawToDigiConverter.h.

Referenced by printSummaries().

unsigned int RawToDigiConverter::testBCMostFrequent
private

Definition at line 68 of file RawToDigiConverter.h.

Referenced by runCommon().

unsigned int RawToDigiConverter::testCRC
private

Definition at line 63 of file RawToDigiConverter.h.

Referenced by runCommon().

unsigned int RawToDigiConverter::testECDAQ
private

Definition at line 66 of file RawToDigiConverter.h.

unsigned int RawToDigiConverter::testECMostFrequent
private

Definition at line 67 of file RawToDigiConverter.h.

Referenced by runCommon().

unsigned int RawToDigiConverter::testECRaw
private

Definition at line 65 of file RawToDigiConverter.h.

unsigned int RawToDigiConverter::testFootprint
private

flags for which tests to run

Definition at line 62 of file RawToDigiConverter.h.

Referenced by runCommon().

unsigned int RawToDigiConverter::testID
private

Definition at line 64 of file RawToDigiConverter.h.

Referenced by runCommon().

std::map<TotemFramePosition, unsigned int> RawToDigiConverter::unknownSummary
private

Definition at line 78 of file RawToDigiConverter.h.

Referenced by printSummaries(), and runCommon().

unsigned char RawToDigiConverter::verbosity
private

Definition at line 54 of file RawToDigiConverter.h.

Referenced by run(), and runCommon().