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)
305 map<TotemFramePosition, Record> records;
311 for (
auto &
p : records)
325 auto channelwaveformPtr = records.find(frameposdata);
326 auto eventInfoPtr = records.find(frameposEvtInfo);
328 if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() )
330 Record &channelwaveform = records[frameposdata];
336 if (totemSampicFrame.valid())
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);
346 if ( totemSampicFrame.getFWVersion() < 0x30 )
351 LogWarning(
"Totem") <<
"Error in RawToDigiConverter::TotemTiming > " <<
"HwId not recognized! hwId: " << std::hex << (
unsigned int) totemSampicFrame.getHardwareId() << endl;
355 detId.setPlane( SWpair.
plane % 4);
356 detId.setChannel( SWpair.
channel );
357 detId.setRP( SWpair.
plane / 4 );
362 const int HWplane = totemSampicFrame.getDetPlane() % 16;
363 const int HWchannel = totemSampicFrame.getDetChannel() % 16;
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;
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;
375 detId.setPlane( HWplane % 4 );
376 detId.setChannel( HWchannel );
377 detId.setRP( HWplane / 4 );
401 ees << vit.first << endl;
403 for (
const auto &it : vit.second)
404 ees <<
" " << it.first <<
" : " << it.second << endl;
407 LogWarning(
"Totem") <<
"RawToDigiConverter: error summary (error signature : number of such events)\n" << endl << ees.rdbuf();
409 LogInfo(
"Totem") <<
"RawToDigiConverter: no errors to be reported.";
420 ees <<
" " << it.first <<
" : " << it.second << endl;
422 LogWarning(
"Totem") <<
"RawToDigiConverter: frames found in data, but not in the mapping (frame position : number of events)\n" 423 << endl << ees.rdbuf();
425 LogInfo(
"Totem") <<
"RawToDigiConverter: no unknown frames to be reported.";
Detector ID class for TOTEM Si strip detectors.
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...
uint32_t getLeadingEdgeTime() const
get timing infromation
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
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
unsigned short getSubSystemId() const
the getters and setters below are deprecated
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)
void printSummaries() const
Print error summaries.
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>).
eventInfo
add run, event number and lumi section
void setChipPosition(uint8_t _cp)
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.
TotemRPDetId getPlaneId() const
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 ...