25 verbosity(conf.getUntrackedParameter<unsigned int>(
"verbosity", 0)),
26 printErrorSummary(conf.getUntrackedParameter<unsigned int>(
"printErrorSummary", 1)),
27 printUnknownFrameSummary(conf.getUntrackedParameter<unsigned int>(
"printUnknownFrameSummary", 1)),
29 testFootprint(conf.getParameter<unsigned int>(
"testFootprint")),
30 testCRC(conf.getParameter<unsigned int>(
"testCRC")),
31 testID(conf.getParameter<unsigned int>(
"testID")),
32 testECMostFrequent(conf.getParameter<unsigned int>(
"testECMostFrequent")),
33 testBCMostFrequent(conf.getParameter<unsigned int>(
"testBCMostFrequent")),
35 EC_min(conf.getUntrackedParameter<unsigned int>(
"EC_min", 10)),
36 BC_min(conf.getUntrackedParameter<unsigned int>(
"BC_min", 10)),
38 EC_fraction(conf.getUntrackedParameter<double>(
"EC_fraction", 0.6)),
39 BC_fraction(conf.getUntrackedParameter<double>(
"BC_fraction", 0.6))
46 map<TotemFramePosition, RawToDigiConverter::Record> &records)
57 records[
p.first] = { &
p.second,
NULL, st };
69 bool problemsPresent =
false;
70 bool stopProcessing =
false;
73 auto records_it = records.find(fr.Position());
74 if (records_it == records.end())
82 record.
frame = fr.Data();
91 problemsPresent =
true;
94 fes <<
" invalid footprint\n";
99 stopProcessing =
true;
106 problemsPresent =
true;
109 fes <<
" CRC failure\n";
114 stopProcessing =
true;
121 problemsPresent =
true;
124 fes <<
" ID mismatch (data: 0x" << hex << record.
frame->
getChipID()
130 stopProcessing =
true;
137 string message = (stopProcessing) ?
"(and will be dropped)" :
"(but will be used though)";
140 ees <<
" Frame at " << fr.Position() <<
" seems corrupted " << message <<
":\n";
143 ees <<
" Frame at " << fr.Position() <<
" seems corrupted " << message <<
".\n";
151 if (fr.Data()->isECPresent())
152 ECChecker.
Fill(fr.Data()->getEC(), fr.Position());
154 if (fr.Data()->isBCPresent())
155 BCChecker.
Fill(fr.Data()->getBC(), fr.Position());
168 for (
const auto &
p : records)
170 if (
p.second.status.isMissing())
171 ees <<
"Frame for VFAT " <<
p.first <<
" is not present in the data.\n";
176 if (
verbosity > 0 && !ees.rdbuf()->str().empty())
179 LogProblem(
"Totem") <<
"Error in RawToDigiConverter::RunCommon > " <<
"event contains the following problems:\n" << ees.rdbuf() << endl;
181 LogProblem(
"Totem") <<
"Error in RawToDigiConverter::RunCommon > " <<
"event contains problems." << endl;
187 for (
const auto &it : records)
189 if (!it.second.status.isOK())
192 m[it.second.status]++;
205 map<TotemFramePosition, Record> records;
211 for (
auto &
p : records)
218 LogProblem(
"Totem") <<
"Error in RawToDigiConverter::Run > "
230 uint8_t chipPosition = chipId % 10;
246 anMa = analysisIter->second;
254 unsigned short offset = chipPosition * 128;
257 for (
auto ch : activeChannels)
280 LogVerbatim(
"Totem") <<
"* Error summary (error signature : number of such events)" << endl;
285 for (
const auto &it : vit.second)
286 LogVerbatim(
"Totem") <<
" " << it.first <<
" : " << it.second << endl;
292 LogVerbatim(
"Totem") <<
"* Frames found in data, but not in the mapping (frame position : number of events)" << endl;
294 LogVerbatim(
"Totem") <<
" " << it.first <<
" : " << it.second << endl;
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...
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
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
enum TotemVFATInfo::@83 type
is data of coincidence-chip VFAT
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 PrintSummaries()
Print error summaries.
void setMissing(bool val=true)
unsigned int symbolicID
integer-encoded symbolic ID
void setFootprintError(bool val=true)
void setNumberOfClustersSpecified(bool v)
std::map< TotemFramePosition, unsigned int > unknownSummary
unsigned int hwID
the hardware ID (16 bit)
unsigned int testBCMostFrequent
std::map< TotemFramePosition, TotemVFATInfo > VFATMapping
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
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)
enum TotemSymbID::@84 subSystem
identifies the TOTEM subsystem
virtual std::vector< unsigned char > getActiveChannels() const
static unsigned int decToRawId(unsigned int dec)
fast conversion Decimal to Raw ID
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 ...