24 :
verbosity(conf.getUntrackedParameter<unsigned int>(
"verbosity", 0)),
25 printErrorSummary(conf.getUntrackedParameter<unsigned int>(
"printErrorSummary", 1)),
26 printUnknownFrameSummary(conf.getUntrackedParameter<unsigned int>(
"printUnknownFrameSummary", 1)),
28 testFootprint(conf.getParameter<unsigned int>(
"testFootprint")),
29 testCRC(conf.getParameter<unsigned int>(
"testCRC")),
30 testID(conf.getParameter<unsigned int>(
"testID")),
31 testECMostFrequent(conf.getParameter<unsigned int>(
"testECMostFrequent")),
32 testBCMostFrequent(conf.getParameter<unsigned int>(
"testBCMostFrequent")),
34 EC_min(conf.getUntrackedParameter<unsigned int>(
"EC_min", 10)),
35 BC_min(conf.getUntrackedParameter<unsigned int>(
"BC_min", 10)),
37 EC_fraction(conf.getUntrackedParameter<double>(
"EC_fraction", 0.6)),
38 BC_fraction(conf.getUntrackedParameter<double>(
"BC_fraction", 0.6)) {}
42 map<TotemFramePosition, RawToDigiConverter::Record> &records) {
51 records[
p.first] = {&
p.second,
nullptr, st};
62 bool problemsPresent =
false;
63 bool stopProcessing =
false;
66 auto records_it = records.find(fr.Position());
67 if (records_it == records.end()) {
74 record.
frame = fr.Data();
81 problemsPresent =
true;
84 fes <<
" invalid footprint" << endl;
88 stopProcessing =
true;
94 problemsPresent =
true;
97 fes <<
" CRC failure" << endl;
101 stopProcessing =
true;
108 fes <<
" ID mismatch (data: 0x" << hex << record.
frame->
getChipID() <<
", mapping: 0x" << record.
info->
hwID
113 stopProcessing =
true;
119 string message = (stopProcessing) ?
"(and will be dropped)" :
"(but will be used though)";
121 ees <<
" Frame at " << fr.Position() <<
" seems corrupted " << message <<
":" << endl;
124 ees <<
" Frame at " << fr.Position() <<
" seems corrupted " << message <<
"." << endl;
132 if (fr.Data()->isECPresent())
133 ECChecker.
Fill(fr.Data()->getEC(), fr.Position());
135 if (fr.Data()->isBCPresent())
136 BCChecker.
Fill(fr.Data()->getBC(), fr.Position());
148 for (
const auto &
p : records) {
149 if (
p.second.status.isMissing())
150 ees <<
"Frame for VFAT " <<
p.first <<
" is not present in the data." << endl;
155 if (
verbosity > 0 && !ees.rdbuf()->str().empty()) {
157 LogWarning(
"Totem") <<
"Error in RawToDigiConverter::runCommon > "
158 <<
"event contains the following problems:" << endl
159 << ees.rdbuf() << endl;
161 LogWarning(
"Totem") <<
"Error in RawToDigiConverter::runCommon > "
162 <<
"event contains problems." << endl;
167 for (
const auto &it : records) {
168 if (!it.second.status.isOK()) {
170 m[it.second.status]++;
182 map<TotemFramePosition, Record> records;
188 for (
auto &
p : records) {
193 uint8_t chipPosition = chipId.
chip();
208 anMa = analysisIter->second;
216 unsigned short offset = chipPosition * 128;
219 for (
auto ch : activeChannels) {
240 map<TotemFramePosition, Record> records;
246 for (
auto &
p : records) {
277 map<TotemFramePosition, Record> records;
283 for (
auto &
p : records) {
301 auto channelwaveformPtr = records.find(frameposdata);
302 auto eventInfoPtr = records.find(frameposEvtInfo);
304 if (channelwaveformPtr != records.end() && eventInfoPtr != records.end()) {
305 Record &channelwaveform = records[frameposdata];
306 Record &eventInfo = records[frameposEvtInfo];
313 if (totemSampicFrame.valid()) {
316 totemSampicFrame.getL1ATimestamp(),
317 totemSampicFrame.getBunchNumber(),
318 totemSampicFrame.getOrbitNumber(),
319 totemSampicFrame.getEventNumber(),
320 totemSampicFrame.getChannelMap(),
321 totemSampicFrame.getL1ALatency(),
322 totemSampicFrame.getNumberOfSentSamples(),
323 totemSampicFrame.getOffsetOfSamples(),
324 totemSampicFrame.getPLLInfo());
326 totemSampicFrame.getFPGATimestamp(),
327 totemSampicFrame.getTimestampA(),
328 totemSampicFrame.getTimestampB(),
329 totemSampicFrame.getCellInfo(),
330 totemSampicFrame.getSamples(),
338 if (totemSampicFrame.getFWVersion() < 0x30)
342 LogWarning(
"Totem") <<
"Error in RawToDigiConverter::TotemTiming > "
343 <<
"HwId not recognized! hwId: " << std::hex
344 << (
unsigned int)totemSampicFrame.getHardwareId() << endl;
346 detId.setPlane(SWpair.
plane % 4);
347 detId.setChannel(SWpair.
channel);
348 detId.setRP(SWpair.
plane / 4);
352 const int HWplane = totemSampicFrame.getDetPlane() % 16;
353 const int HWchannel = totemSampicFrame.getDetChannel() % 16;
357 LogWarning(
"Totem") <<
"Warning in RawToDigiConverter::TotemTiming > "
358 <<
"HwId not recognized! hwId: " << std::hex
359 << (
unsigned int)totemSampicFrame.getHardwareId()
360 <<
"\tUsing plane and ch from HW without check!" << endl;
363 LogWarning(
"Totem") <<
"Warning in RawToDigiConverter::TotemTiming > "
364 <<
"Hw mapping different from SW mapping. hwId: " << std::hex
365 << (
unsigned int)totemSampicFrame.getHardwareId() <<
"HW: " <<
std::dec << HWplane
366 <<
":" << HWchannel <<
"\tSW " << SWpair.
plane <<
":" << SWpair.
channel
367 <<
"\tUsing plane and ch from HW!" << endl;
369 detId.setPlane(HWplane % 4);
370 detId.setChannel(HWchannel);
371 detId.setRP(HWplane / 4);
388 ees << vit.first << endl;
390 for (
const auto &it : vit.second)
391 ees <<
" " << it.first <<
" : " << it.second << endl;
394 LogWarning(
"Totem") <<
"RawToDigiConverter: error summary (error signature : number of such events)\n"
398 LogInfo(
"Totem") <<
"RawToDigiConverter: no errors to be reported.";
407 ees <<
" " << it.first <<
" : " << it.second << endl;
410 <<
"RawToDigiConverter: frames found in data, but not in the mapping (frame position : number of events)\n"
414 LogInfo(
"Totem") <<
"RawToDigiConverter: no unknown frames to be reported.";
Detector ID class for TOTEM Si strip detectors.
uint32_t getLeadingEdgeTime(const VFATFrame &frame)
get timing information for single leading edge
Contains data on masked channels of a VFAT.
void push_back(const T &t)
unsigned int testECMostFrequent
unsigned int printErrorSummary
VFATFrame::word * getData()
void runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map< TotemFramePosition, Record > &records)
Common processing for all VFAT based sub-systems.
void setCRCError(bool val=true)
Class for finding the most popular both EC and BC counter, and filling the conversion status 'wrong E...
unsigned short getIdxInFiber() const
void Analyze(T &status, bool error, std::ostream &es)
summarizes and fill the status (wrong EC and BC progress error for some frames)
unsigned short getTOTFEDId() const
TotemSymbID symbolicID
the symbolic id
void setNumberOfClusters(uint8_t v)
bool checkFootprint() const
RawToDigiConverter(const edm::ParameterSet &conf)
virtual bool checkCRC() const
unsigned short getOptoRxId() 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)
VFATFrame::word getMultihit(const VFATFrame &frame)
flag stating whether the HPTDC channel encountered multiple hits
uint32_t getTrailingEdgeTime(const VFATFrame &frame)
get timing information for single trailing edge
VFATFrame::word getHptdcErrorFlag(const VFATFrame &frame)
retrieve the list of error/status flags for the HPTDC when the frame was recorded ...
the VFATFrameCollection interator
decltype(auto) emplace_back(Args &&...args)
unsigned int printUnknownFrameSummary
bool isNumberOfClustersPresent() const
Returns true if the CRC word is present in the frame.
The mapping between FramePosition and VFATInfo.
uint32_t getThresholdVoltage(const VFATFrame &frame)
retrieve the threshold voltage for this channel
TotemRPDetId planeId() const
const TotemVFATInfo * info
unsigned short getSubSystemId() const
the getters and setters below are deprecated
void setChipPosition(uint8_t cp)
bool fullMask
whether all channels of the VFAT shall be masked
const TotemTimingPlaneChannelPair getTimingChannel(const uint8_t hwId) const
Given the hardware ID, returns the corresponding Plane, Channel pair (TotemTimingPlaneChannelPair) ...
void setMissing(bool val=true)
unsigned short getGOHId() const
unsigned int symbolicID
chip ID, raw integer representation of DetId class
void setFootprintError(bool val=true)
Hw Id mapping for Totem Timing (dynamical mapping in Sampic)
Log< level::Info, false > LogInfo
void printSummaries() const
Print error summaries.
void setNumberOfClustersSpecified(bool v)
std::map< TotemFramePosition, unsigned int > unknownSummary
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>).
Log< level::Warning, false > LogWarning
virtual std::vector< unsigned char > getActiveChannels() const
void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemRPDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
Creates RP digi.
unsigned int EC_min
the minimal required number of frames to determine the most frequent counter value ...
Detector ID class for CTPPS Totem Timing detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bits ...