#include <LaserSorter.h>
Classes | |
struct | IndexRecord |
class | OutStreamRecord |
struct | stats_t |
Private Types | |
typedef std::list < std::unique_ptr < OutStreamRecord > > | OutStreamList |
Private Member Functions | |
void | closeAllStreams () |
void | closeOldStreams (edm::LuminosityBlockNumber_t lumiBlock) |
OutStreamList::iterator | closeOutStream (OutStreamList::iterator streamRecord) |
OutStreamList::iterator | createOutStream (int fedId, edm::LuminosityBlockNumber_t lumiBlock) |
int | dcc2Lme (int dccNum, int dccSide) |
int | getDetailedTriggerType (const edm::Handle< FEDRawDataCollection > &rawdata, double *proba=nullptr) |
std::vector< int > | getFullyReadoutDccs (const FEDRawDataCollection &data) const |
int | getOrbitFromDcc (const edm::Handle< FEDRawDataCollection > &rawdata) const |
void | getOutputFedList (const edm::Event &event, const FEDRawDataCollection &data, std::vector< unsigned > &fedIds) const |
std::unique_ptr < OutStreamRecord > & | getStream (int fedId, edm::LuminosityBlockNumber_t lumiBlock) |
bool | isDccEventEmpty (const FEDRawData &data, size_t *dccLen=nullptr, int *nTowerBlocks=nullptr) const |
int | readFormatVersion (std::ifstream &in, const std::string &fileName) |
bool | readIndexTable (std::ifstream &in, std::string &inName, OutStreamRecord &outRcd, std::string *err) |
bool | renameAsBackup (const std::string &fileName, std::string &newFileName) |
void | restoreStreamsOfLumiBlock (int lumiBlock) |
void | streamFileName (int fedId, edm::LuminosityBlockNumber_t lumiBlock, std::string &tmpName, std::string &finalName) |
bool | writeEvent (OutStreamRecord &out, const edm::Event &event, int detailedTriggerType, const FEDRawDataCollection &data) |
bool | writeEventHeader (std::ofstream &out, const edm::Event &evt, int fedId, unsigned nFeds) |
bool | writeFedBlock (std::ofstream &out, const FEDRawData &data) |
void | writeFileHeader (std::ofstream &out) |
bool | writeIndexTable (std::ofstream &out, std::vector< IndexRecord > &indices) |
Static Private Member Functions | |
static std::string | toString (uint64_t t) |
Private Attributes | |
int | detailedTrigType_ |
bool | disableOutput_ |
bool | doOutputList_ |
edm::InputTag | fedRawDataCollectionTag_ |
edm::EDGetTokenT < FEDRawDataCollection > | fedRawDataCollectionToken_ |
std::vector< std::string > | fedSubDirs_ |
unsigned char | formatVersion_ |
int | iNoEcalDataMess_ |
int | iNoFullReadoutDccError_ |
std::ofstream | logFile_ |
edm::LuminosityBlockNumber_t | lumiBlock_ |
edm::LuminosityBlockNumber_t | lumiBlockPrev_ |
int | lumiBlockSpan_ |
int | maxFullReadoutDccError_ |
int | maxNoEcalDataMess_ |
int | orbit_ |
int | orbitCountInALumiBlock_ |
struct timeval | orbitZeroTime_ |
std::string | outputDir_ |
std::ofstream | outputList_ |
std::string | outputListFile_ |
OutStreamList | outStreamList_ |
bool | overWriteLumiBlockId_ |
edm::RunNumber_t | runNumber_ |
struct LaserSorter::stats_t | stats_ |
std::ofstream | timeLog_ |
std::string | timeLogFile_ |
timeval | timer_ |
bool | timing_ |
int | verbosity_ |
Static Private Attributes | |
static const int | ecalDccFedIdMax_ = 654 |
static const int | ecalDccFedIdMin_ = 601 |
static const int | indexOffset32_ = 1 |
static const int | matacqFedId_ = 655 |
static const unsigned | maxEvents_ = 1 << 20 |
static const stats_t | stats_init = {0, 0, 0, 0, 0} |
Additional Inherited Members | |
Public Types inherited from edm::one::EDAnalyzerBase | |
typedef EDAnalyzerBase | ModuleType |
Public Types inherited from edm::EDConsumerBase | |
typedef ProductLabels | Labels |
Static Public Member Functions inherited from edm::one::EDAnalyzerBase | |
static const std::string & | baseType () |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
static void | prevalidate (ConfigurationDescriptions &descriptions) |
Protected Member Functions inherited from edm::EDConsumerBase | |
template<typename ProductType , BranchType B = InEvent> | |
EDGetTokenT< ProductType > | consumes (edm::InputTag const &tag) |
template<BranchType B = InEvent> | |
EDConsumerBaseAdaptor< B > | consumes (edm::InputTag tag) noexcept |
EDGetToken | consumes (const TypeToGet &id, edm::InputTag const &tag) |
template<BranchType B> | |
EDGetToken | consumes (TypeToGet const &id, edm::InputTag const &tag) |
ConsumesCollector | consumesCollector () |
Use a ConsumesCollector to gather consumes information from helper functions. More... | |
template<typename ProductType , BranchType B = InEvent> | |
void | consumesMany () |
void | consumesMany (const TypeToGet &id) |
template<BranchType B> | |
void | consumesMany (const TypeToGet &id) |
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event> | |
auto | esConsumes () |
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event> | |
auto | esConsumes (ESInputTag const &tag) |
template<Transition Tr = Transition::Event> | |
constexpr auto | esConsumes () |
template<Transition Tr = Transition::Event> | |
auto | esConsumes (ESInputTag tag) |
template<Transition Tr = Transition::Event> | |
ESGetTokenGeneric | esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey) |
Used with EventSetupRecord::doGet. More... | |
template<typename ProductType , BranchType B = InEvent> | |
EDGetTokenT< ProductType > | mayConsume (edm::InputTag const &tag) |
EDGetToken | mayConsume (const TypeToGet &id, edm::InputTag const &tag) |
template<BranchType B> | |
EDGetToken | mayConsume (const TypeToGet &id, edm::InputTag const &tag) |
void | resetItemsToGetFrom (BranchType iType) |
This module is used to classify events of laser sequence acquired in a global run. Sorting: Events are grouped by bunch of consecutive events from the same FED. A file of such a bunch of events is identified by the FED or ECAL sector and the luminosity block id of the first event.
Sorting strategy: It is assumes that:
File completion: while being feeding, .part is appended at the end of the each output file.Once a file is completed (see above), it is renamed without the enclosing .part suffix.
Definition at line 44 of file LaserSorter.h.
|
private |
Definition at line 114 of file LaserSorter.h.
LaserSorter::LaserSorter | ( | const edm::ParameterSet & | pset | ) |
Definition at line 72 of file LaserSorter.cc.
References gather_cfg::cout, doOutputList_, Exception, fedRawDataCollectionTag_, fedRawDataCollectionToken_, fedSubDirs_, logFile_, eostools::mkdir(), now(), submitPVResolutionJobs::out, outputDir_, outputList_, outputListFile_, edm_modernize_messagelogger::stat, timeLog_, timeLogFile_, timer_, and timing_.
|
override |
Definition at line 154 of file LaserSorter.cc.
References logFile_, LaserSorter::stats_t::nInvalidDccStrict, LaserSorter::stats_t::nInvalidDccWeak, LaserSorter::stats_t::nRead, LaserSorter::stats_t::nRestoredDcc, LaserSorter::stats_t::nWritten, and stats_.
|
overridevirtual |
Implements edm::one::EDAnalyzerBase.
Definition at line 161 of file LaserSorter.cc.
References closeAllStreams(), closeOldStreams(), colorNames, gather_cfg::cout, ecaldqm::dccId(), detailedTrigNames, detailedTrigType_, disableOutput_, ecalDccFedIdMax_, fedRawDataCollectionToken_, getDetailedTriggerType(), getFullyReadoutDccs(), getOrbitFromDcc(), getStream(), mps_fire::i, edm::EventBase::id(), iNoEcalDataMess_, iNoFullReadoutDccError_, logFile_, lumiBlock_, lumiBlockPrev_, lumiBlockSpan_, maxFullReadoutDccError_, LaserSorter::stats_t::nInvalidDccStrict, LaserSorter::stats_t::nInvalidDccWeak, now(), LaserSorter::stats_t::nRead, LaserSorter::stats_t::nRestoredDcc, LaserSorter::stats_t::nWritten, orbit_, orbitCountInALumiBlock_, submitPVResolutionJobs::out, overWriteLumiBlockId_, restoreStreamsOfLumiBlock(), edm::EventID::run(), runNumber_, stats_, submitPVValidationJobs::t, timeLog_, timer_, timing_, verbosity_, and writeEvent().
|
overridevirtual |
|
override |
Definition at line 1157 of file LaserSorter.cc.
|
private |
Closes all opened output streams.
Definition at line 446 of file LaserSorter.cc.
References closeOutStream(), and outStreamList_.
Referenced by analyze(), and endJob().
|
private |
Closes output stream 2 lumi block older than the input 'lumiBlock' ID.
lumiBlock | ID of the reference luminosity block. |
Definition at line 452 of file LaserSorter.cc.
References closeOutStream(), gather_cfg::cout, lumiBlockSpan_, now(), outStreamList_, and verbosity_.
Referenced by analyze().
|
private |
Closes an output stream and removed it from opened stream records. Beware: this methode modifies outStreamList_.
streamRecord | record of the output stream to close. |
Definition at line 839 of file LaserSorter.cc.
References visDQMUpload::buf, gather_cfg::cout, doOutputList_, validate-o2o-wbm::f, writeEcalDQMStatus::inputFile, now(), outputList_, outStreamList_, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, verbosity_, and writeIndexTable().
Referenced by closeAllStreams(), and closeOldStreams().
|
private |
Creates an output stream. It must be ensured before calling this method that the output stream is not already opened (See outStreamList_).
fedId | FED ID of the event to stream out. |
lumiBlock | starting lumi block of the event group to write to the stream. |
Definition at line 610 of file LaserSorter.cc.
References edmScanValgrind::buffer, c, gather_cfg::cout, TauDecayModes::dec, dataset::end, Exception, formatVersion_, recoMuon::in, SiStripPI::min, now(), submitPVResolutionJobs::out, outStreamList_, readFormatVersion(), readIndexTable(), renameAsBackup(), streamFileName(), AlCaHLTBitMon_QueryRunRegistry::string, pileupReCalc_HLTpaths::trunc, verbosity_, and writeFileHeader().
Referenced by getStream().
|
private |
|
overridevirtual |
Reimplemented from edm::one::EDAnalyzerBase.
Definition at line 886 of file LaserSorter.cc.
References closeAllStreams().
Referenced by o2olib.O2ORunMgr::executeJob().
|
override |
Definition at line 1159 of file LaserSorter.cc.
|
private |
Retrieve detailed trigger type (trigger type, DCC, side) from raw event
rawdata | FED data collection |
proba | if not null used to store the maximum of occurence frequency of the detailed trigger types (DTT) appearing in each DCC block. In normal condition every DCC indicated the same DTT and this value is 1. |
Definition at line 402 of file LaserSorter.cc.
References Majority< T >::add(), gather_cfg::cout, FEDRawData::data(), data, ecalDccFedIdMax_, ecalDccFedIdMin_, gpuClustering::id, iNoEcalDataMess_, FEDNumbering::inRange(), maxNoEcalDataMess_, now(), AlCaHLTBitMon_ParallelJobs::p, Majority< T >::result(), FEDRawData::size(), edm_modernize_messagelogger::stat, and verbosity_.
Referenced by analyze().
|
private |
Retrieves DCCs which were fully read out (>=68 readout channels).
data | DCC data collection |
Definition at line 965 of file LaserSorter.cc.
References ecalDccFedIdMax_, ecalDccFedIdMin_, FEDRawDataCollection::FEDData(), isDccEventEmpty(), ecaldqm::nTowers, and mps_fire::result.
Referenced by analyze().
|
private |
Retrieves the orbit ID from DCC headers. The first header found is used. the raw data where to read the orbit id.
Definition at line 379 of file LaserSorter.cc.
References FEDRawData::data(), data, ecalDccFedIdMax_, ecalDccFedIdMin_, gpuClustering::id, FEDNumbering::inRange(), and FEDRawData::size().
Referenced by analyze().
|
private |
Computes the list of FEDs which data must be written out.
data | CMS raw event |
fedIds | [out] list of FEDs to keep |
Definition at line 940 of file LaserSorter.cc.
References ecalDccFedIdMax_, ecalDccFedIdMin_, FEDRawDataCollection::FEDData(), gpuClustering::id, isDccEventEmpty(), matacqFedId_, and FEDRawData::size().
Referenced by writeEvent().
|
private |
Gets and eventually creates the output stream for writing the events of a given FED and luminosity block.
fedId | ID of the FED the event is issued from |
lumiBlock | luminositu block of the event |
Definition at line 472 of file LaserSorter.cc.
References funct::abs(), gather_cfg::cout, createOutStream(), ecalDccFedIdMax_, lumiBlockSpan_, now(), outStreamList_, and verbosity_.
Referenced by analyze(), and restoreStreamsOfLumiBlock().
|
private |
Checks if an ECAL DCC event is empty. It is considered as empty if it does not contains FE data ("tower" block). So an event containing SRP or TCC data can be tagged as empty by this method. , if not null filled with the event length read from the DCC header. if not null, filled with number of tower blocks
Definition at line 894 of file LaserSorter.cc.
References FEDRawData::data(), dtTPAnalyzer_cfg::dataType, and FEDRawData::size().
Referenced by getFullyReadoutDccs(), and getOutputFedList().
|
private |
Gets format version of an LMF file. Position of file is preserved.
in | stream to read the file |
fileName | name of the file. Used in error message. |
Definition at line 1092 of file LaserSorter.cc.
References data, AlCaHLTBitMon_ParallelJobs::p, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by createOutStream().
|
private |
Read index table of an LMF file.
in | LMF file whose index table must be read. |
inName | name of the in file |
outRcd | record of the output file. whose the index table must be copied to. |
err | if not nul, in case of failure filled with the error message. |
Definition at line 1019 of file LaserSorter.cc.
References gather_cfg::cout, LaserSorter::OutStreamRecord::excludedOrbit(), mps_fire::i, recoMuon::in, LaserSorter::OutStreamRecord::indices(), maxEvents_, jetmet_cfg::nevts, now(), alignCSCRings::s, and verbosity_.
Referenced by createOutStream().
|
private |
Definition at line 589 of file LaserSorter.cc.
References submitPVValidationJobs::err, mps_fire::i, and MainPageGenerator::link.
Referenced by createOutStream().
|
private |
Opens output streams associated to a lumi block according to already existing files. To be used when previously processed luminosity block is not
lumiBlock | ID of the luminosity block whose output streams must be reopened. |
Definition at line 1137 of file LaserSorter.cc.
References ecalDccFedIdMax_, ecalDccFedIdMin_, l1tstage2_dqm_sourceclient-live_cfg::fedId, MillePedeFileConverter_cfg::fileName, getStream(), alignCSCRings::s, edm_modernize_messagelogger::stat, and streamFileName().
Referenced by analyze().
|
private |
Builds the file names for the group of event corresponding to a FED and a starting lumi block.
fedId | FED ID of the event set | |
lumiBlock | starting luminoisty block of the event set | |
[out] | tmpName | name of the file to use when filling it. |
[out] | finalName | name of the file once completed. |
Definition at line 792 of file LaserSorter.cc.
References visDQMUpload::buf, gather_cfg::cout, DeadROC_duringRun::dir, ecalDccFedIdMax_, ecalDccFedIdMin_, Exception, fedSubDirs_, MillePedeFileConverter_cfg::fileName, eostools::mkdir(), now(), outputDir_, runNumber_, edm_modernize_messagelogger::stat, and verbosity_.
Referenced by createOutStream(), and restoreStreamsOfLumiBlock().
|
staticprivate |
Help function to format a date
Definition at line 1122 of file LaserSorter.cc.
References visDQMUpload::buf, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by writeEventHeader().
|
private |
Writes a monitoring events to an output stream.
out | stream to write the event out |
event | EDM event, used to retrieve meta information like timestamp and ID. |
ID | of the unique FED block of the event |
data | DCC data |
Definition at line 500 of file LaserSorter.cc.
References gather_cfg::cout, FEDRawData::data(), dt, FEDRawDataCollection::FEDData(), ctppsDiamondRawToDigi_cfi::fedIds, getOutputFedList(), MatacqRawEvent::getTimeStamp(), dqmdumpme::indices, LaserSorter::OutStreamRecord::indices(), matacqFedId_, now(), orbit_, orbitZeroTime_, LaserSorter::OutStreamRecord::out(), submitPVResolutionJobs::out, FEDRawData::size(), edm::Event::size(), verbosity_, writeEventHeader(), and writeFedBlock().
Referenced by analyze().
|
private |
Write event header with event identification and timestamp.
out | output stream to write to |
evt | event |
Definition at line 749 of file LaserSorter.cc.
References edm::EventBase::bunchCrossing(), colorNames, gather_cfg::cout, TauDecayModes::dec, detailedTrigNames, dt, edm::EventID::event(), edm::EventBase::id(), edm::EventBase::luminosityBlock(), now(), orbit_, orbitZeroTime_, edm::Event::run(), edm::EventBase::time(), toString(), groupFilesInBlocks::tt, edm::Timestamp::value(), and verbosity_.
Referenced by writeEvent().
|
private |
Writes out data of a FED
out | stream to write the event out |
data | FED data |
Definition at line 553 of file LaserSorter.cc.
References gather_cfg::cout, FEDRawData::data(), Exception, now(), FEDRawData::size(), and verbosity_.
Referenced by writeEvent().
|
private |
Writing file header for an LMF binary file
out | stream of the output file |
Definition at line 733 of file LaserSorter.cc.
References Exception, formatVersion_, and SiPixelPI::zero.
Referenced by createOutStream().
|
private |
Writes index table in LMF output file. stream must be positionned to the place for the index table (end of file).
out | stream of output file. |
indices | index table |
Definition at line 977 of file LaserSorter.cc.
References dataset::end, mps_fire::i, indexOffset32_, and jetmet_cfg::nevts.
Referenced by closeOutStream().
|
private |
Trigger type of calibration event. -1 if unkown.
Definition at line 299 of file LaserSorter.h.
Referenced by analyze().
|
private |
Switch to disable writing output file (for test purpose).
Definition at line 336 of file LaserSorter.h.
Referenced by analyze().
|
private |
Switch for logging paths of the output files
Definition at line 360 of file LaserSorter.h.
Referenced by closeOutStream(), and LaserSorter().
|
staticprivate |
Lower bound of ECAL DCC FED ID
Definition at line 295 of file LaserSorter.h.
Referenced by analyze(), getDetailedTriggerType(), getFullyReadoutDccs(), getOrbitFromDcc(), getOutputFedList(), getStream(), restoreStreamsOfLumiBlock(), and streamFileName().
|
staticprivate |
Lower bound of ECAL DCC FED ID
Definition at line 291 of file LaserSorter.h.
Referenced by getDetailedTriggerType(), getFullyReadoutDccs(), getOrbitFromDcc(), getOutputFedList(), restoreStreamsOfLumiBlock(), and streamFileName().
|
private |
Definition at line 418 of file LaserSorter.h.
Referenced by LaserSorter().
|
private |
Definition at line 419 of file LaserSorter.h.
Referenced by analyze(), and LaserSorter().
|
private |
Subdirectories for output file of each FED
Definition at line 328 of file LaserSorter.h.
Referenced by LaserSorter(), and streamFileName().
|
private |
Data format version of lmf output file
Definition at line 320 of file LaserSorter.h.
Referenced by createOutStream(), and writeFileHeader().
|
staticprivate |
Definition at line 427 of file LaserSorter.h.
Referenced by writeIndexTable().
|
private |
number of "ECAL DCC data" message in a run
Definition at line 399 of file LaserSorter.h.
Referenced by analyze(), and getDetailedTriggerType().
|
private |
Number of "No fully readout DCC error"
Definition at line 391 of file LaserSorter.h.
Referenced by analyze().
|
private |
File for logging
Definition at line 303 of file LaserSorter.h.
Referenced by analyze(), LaserSorter(), and ~LaserSorter().
|
private |
Luminosity block of event under processing
Definition at line 307 of file LaserSorter.h.
Referenced by analyze().
|
private |
Luminosity block of previous processed event
Definition at line 311 of file LaserSorter.h.
Referenced by analyze().
|
private |
Tolerance on lumi block spanning of a FED sequence. Subsequent events of a same FED must span at most on 2*lumiBlockSpan_+1 luminosity blocks.
Definition at line 416 of file LaserSorter.h.
Referenced by analyze(), closeOldStreams(), and getStream().
|
staticprivate |
FED ID associated to Matacq data
Definition at line 423 of file LaserSorter.h.
Referenced by getOutputFedList(), and writeEvent().
|
staticprivate |
Limit of number of events to prevent exhausting memory with indexTable_ in case of file corruption.
Definition at line 432 of file LaserSorter.h.
Referenced by readIndexTable().
|
private |
Maximum number of "No fully readout DCC error" message in a run
Definition at line 395 of file LaserSorter.h.
Referenced by analyze().
|
private |
Maximum number of "ECAL DCC data" message in a run
Definition at line 403 of file LaserSorter.h.
Referenced by getDetailedTriggerType().
|
private |
Definition at line 462 of file LaserSorter.h.
Referenced by analyze(), writeEvent(), and writeEventHeader().
|
private |
Length of a lumi block in number of orbits used when overWriteLumiBlockId is set to true; LB = orbit_id / orbitCountInALumiBlock_
Definition at line 460 of file LaserSorter.h.
Referenced by analyze().
|
private |
Time stamp offset to use to calculate calibration time from the orbit id. It is obtained from the matacq block (time originates from the PC hosting the laser supervisor). and used in case the event is missing timestamp, in principle for data acquired with the minidaq Calibration event time = orbitZeroTime_ + orbit_ * (89.1 microsec).
Definition at line 471 of file LaserSorter.h.
Referenced by writeEvent(), and writeEventHeader().
|
private |
Top directory for output files
Definition at line 324 of file LaserSorter.h.
Referenced by LaserSorter(), batchmanager.BatchManager::PrepareJob(), and streamFileName().
|
private |
stream where list of output file is listed to
Definition at line 368 of file LaserSorter.h.
Referenced by closeOutStream(), and LaserSorter().
|
private |
name of file where list of output file is listed to
Definition at line 356 of file LaserSorter.h.
Referenced by LaserSorter().
|
private |
List of output stream to write sorted data
Definition at line 316 of file LaserSorter.h.
Referenced by closeAllStreams(), closeOldStreams(), closeOutStream(), createOutStream(), and getStream().
|
private |
Switch to recompute and overwrite the lumi block ID
Definition at line 454 of file LaserSorter.h.
Referenced by analyze().
|
private |
Run number of event under process
Definition at line 340 of file LaserSorter.h.
Referenced by analyze(), and streamFileName().
|
private |
Referenced by analyze(), and ~LaserSorter().
|
staticprivate |
Definition at line 450 of file LaserSorter.h.
|
private |
Output stream to log code timing
Definition at line 348 of file LaserSorter.h.
Referenced by analyze(), and LaserSorter().
|
private |
Name of the file to log the processing time
Definition at line 332 of file LaserSorter.h.
Referenced by LaserSorter().
|
private |
Buffer for timing
Definition at line 344 of file LaserSorter.h.
Referenced by analyze(), and LaserSorter().
|
private |
Switch for code timing.
Definition at line 352 of file LaserSorter.h.
Referenced by analyze(), and LaserSorter().
|
private |
Debugging message verbosity level
Definition at line 364 of file LaserSorter.h.
Referenced by analyze(), closeOldStreams(), closeOutStream(), createOutStream(), getDetailedTriggerType(), getStream(), readIndexTable(), streamFileName(), writeEvent(), writeEventHeader(), and writeFedBlock().