28 verbosity(conf.getUntrackedParameter<unsigned
int>(
"verbosity", 0)),
29 printErrorSummary(conf.getUntrackedParameter<unsigned
int>(
"printErrorSummary", 1)),
30 printUnknownFrameSummary(conf.getUntrackedParameter<unsigned
int>(
"printUnknownFrameSummary", 1)),
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")),
38 EC_min(conf.getUntrackedParameter<unsigned
int>(
"EC_min", 10)),
39 BC_min(conf.getUntrackedParameter<unsigned
int>(
"BC_min", 10)),
41 EC_fraction(conf.getUntrackedParameter<double>(
"EC_fraction", 0.6)),
42 BC_fraction(conf.getUntrackedParameter<double>(
"BC_fraction", 0.6))
49 map<TotemFramePosition, RawToDigiConverter::Record> &records)
60 records[
p.first] = { &
p.second,
nullptr, st };
72 bool problemsPresent =
false;
73 bool stopProcessing =
false;
76 auto records_it = records.find(fr.Position());
77 if (records_it == records.end())
85 record.
frame = fr.Data();
93 problemsPresent =
true;
96 fes <<
" invalid footprint" << endl;
101 stopProcessing =
true;
108 problemsPresent =
true;
111 fes <<
" CRC failure" << endl;
116 stopProcessing =
true;
123 fes <<
" ID mismatch (data: 0x" << hex << record.
frame->
getChipID()
129 stopProcessing =
true;
136 string message = (stopProcessing) ?
"(and will be dropped)" :
"(but will be used though)";
139 ees <<
" Frame at " << fr.Position() <<
" seems corrupted " << message <<
":" << endl;
142 ees <<
" Frame at " << fr.Position() <<
" seems corrupted " << message <<
"." << endl;
150 if (fr.Data()->isECPresent())
151 ECChecker.
Fill(fr.Data()->getEC(), fr.Position());
153 if (fr.Data()->isBCPresent())
154 BCChecker.
Fill(fr.Data()->getBC(), fr.Position());
167 for (
const auto &
p : records)
169 if (
p.second.status.isMissing())
170 ees <<
"Frame for VFAT " <<
p.first <<
" is not present in the data." << endl;
175 if (
verbosity > 0 && !ees.rdbuf()->str().empty())
178 LogWarning(
"Totem") <<
"Error in RawToDigiConverter::RunCommon > " <<
"event contains the following problems:" << endl << ees.rdbuf() << endl;
180 LogWarning(
"Totem") <<
"Error in RawToDigiConverter::RunCommon > " <<
"event contains problems." << endl;
186 for (
const auto &it : records)
188 if (!it.second.status.isOK())
191 m[it.second.status]++;
204 map<TotemFramePosition, Record> records;
210 for (
auto &
p : records)
216 uint8_t chipPosition = chipId.
chip();
233 anMa = analysisIter->second;
241 unsigned short offset = chipPosition * 128;
244 for (
auto ch : activeChannels)
267 map<TotemFramePosition, Record> records;
273 for (
auto &
p : records)
311 ees << vit.first << endl;
313 for (
const auto &it : vit.second)
314 ees <<
" " << it.first <<
" : " << it.second << endl;
317 LogWarning(
"Totem") <<
"RawToDigiConverter: error summary (error signature : number of such events)\n" << endl << ees.rdbuf();
319 LogInfo(
"Totem") <<
"RawToDigiConverter: no errors to be reported.";
330 ees <<
" " << it.first <<
" : " << it.second << endl;
332 LogWarning(
"Totem") <<
"RawToDigiConverter: frames found in data, but not in the mapping (frame position : number of events)\n" 333 << endl << ees.rdbuf();
335 LogInfo(
"Totem") <<
"RawToDigiConverter: no unknown frames to be reported.";
Detector ID class for TOTEM Si strip detectors.
void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemRPDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
Creates RP digi.
Contains data on masked channels of a VFAT.
void push_back(const T &t)
unsigned int testECMostFrequent
unsigned int printErrorSummary
void setCRCError(bool val=true)
Class for finding the most popular both EC and BC counter, and filling the conversion status 'wrong E...
uint32_t getLeadingEdgeTime() const
get timing infromation
void Analyze(T &status, bool error, std::ostream &es)
summarizes and fill the status (wrong EC and BC progress error for some frames)
TotemSymbID symbolicID
the symbolic id
void setNumberOfClusters(uint8_t v)
bool checkFootprint() const
RawToDigiConverter(const edm::ParameterSet &conf)
virtual bool checkCRC() const
uint8_t getNumberOfClusters() const
uint32_t getThresholdVoltage() const
VFATFrame::word getMultihit() const
unsigned int testFootprint
flags for which tests to run
std::map< TotemSymbID, TotemVFATAnalysisMask > analysisMask
static std::string const input
reference find_or_insert(det_id_type id)
the VFATFrameCollection interator
unsigned int printUnknownFrameSummary
bool isNumberOfClustersPresent() const
Returns true if the CRC word is present in the frame.
The mapping between FramePosition and VFATInfo.
const TotemVFATInfo * info
bool fullMask
whether all channels of the VFAT shall be masked
void setMissing(bool val=true)
unsigned int symbolicID
chip ID, raw integer representation of DetId class
void PrintSummaries() const
Print error summaries.
void setFootprintError(bool val=true)
uint32_t getTrailingEdgeTime() const
void setNumberOfClustersSpecified(bool v)
std::map< TotemFramePosition, unsigned int > unknownSummary
VFATFrame::word getHptdcErrorFlag() const
VFATFrame::word getEC() const
Returns Event Counter (EV<7:0>).
unsigned int hwID
the hardware ID (16 bit)
unsigned int testBCMostFrequent
std::map< TotemFramePosition, TotemVFATInfo > VFATMapping
void setEC(const uint8_t ec)
void Fill(word counter, TotemFramePosition fr)
add new value to map, counter takes value of EC or BC number
void setPartiallyMaskedOut()
std::set< unsigned char > maskedChannels
list of channels to be masked
std::map< TotemFramePosition, std::map< TotemVFATStatus, unsigned int > > errorSummary
error summaries
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
bool IsEnd()
returns whether the iterator points over the end of the collection
void setIDMismatch(bool val=true)
bool isIDPresent() const
Returns true if the ID word is present in the frame.
double EC_fraction
the minimal required (relative) occupancy of the most frequent counter value to be accepted ...
VFATFrame::word getChipID() const
Returns ChipID (ChipID<11:0>).
void setChipPosition(uint8_t _cp)
virtual std::vector< unsigned char > getActiveChannels() const
TotemRPDetId getPlaneId() const
void RunCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map< TotemFramePosition, Record > &records)
Common processing for all VFAT based sub-systems.
unsigned int EC_min
the minimal required number of frames to determine the most frequent counter value ...