69 LOG(info) <<
"[HMPID Data Decoder - Init] ( create Raw Stream Decoder for " <<
Geo::MAXEQUIPMENTS <<
" equipments !";
71 mProduceResults = ic.
options().
get<
bool>(
"get-results-statistics");
72 mRootStatFile = ic.
options().
get<std::string>(
"result-file");
73 mFastAlgorithm = ic.
options().
get<
bool>(
"fast-decode");
87 LOG(info) <<
"[HMPID Data Decoder - Run] !";
110 float squareOfCharges;
114 if (!mProduceResults) {
115 LOG(info) <<
"Skip the Stat file creation ! ";
117 TString
filename = TString::Format(
"%s_stat.root", mRootStatFile.c_str());
118 LOG(info) <<
"Create the stat file " <<
filename.Data();
119 TFile mfileOut(TString::Format(
"%s",
filename.Data()),
"RECREATE");
122 TString tit = TString::Format(
"HMPID Data Decoding Statistic results Mod=%d",
i);
123 theObj[
i] =
new TTree(
"o2hmp", tit);
124 theObj[
i]->Branch(
"x", &xb,
"s");
125 theObj[
i]->Branch(
"y", &yb,
"s");
126 theObj[
i]->Branch(
"Samples", &numOfSamples,
"i");
127 theObj[
i]->Branch(
"Sum_of_charges", &sumOfCharges,
"l");
128 theObj[
i]->Branch(
"Sum_of_square", &squareOfCharges,
"l");
130 theObj[
Geo::N_MODULES] =
new TTree(
"o2hmp",
"HMPID Data Decoding Statistic results");
131 theObj[
Geo::N_MODULES]->Branch(
"Average_Event_Size", &avgEventSize,
"F");
132 theObj[
Geo::N_MODULES]->Branch(
"Average_Busy_Time", &avgBusyTime,
"F");
137 for (
int i = 0;
i < numEqui;
i++) {
142 char summaryFileName[254];
143 snprintf(summaryFileName, 254,
"%s_stat.txt", mRootStatFile.c_str());
145 for (
int e = 0;
e < numEqui;
e++) {
174 LOG(info) <<
"*********** In decodeTF **************";
177 auto& inputs = pc.
inputs();
182 static size_t contDeadBeef = 0;
185 const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
187 if (payloadSize == 0) {
189 if (++contDeadBeef <= maxWarn) {
190 LOGP(warning,
"Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF{}",
191 dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, payloadSize,
192 contDeadBeef == maxWarn ? fmt::format(
". {} such inputs in row received, stopping reporting", contDeadBeef) :
"");
202 for (
auto it = parser.
begin(),
end = parser.
end(); it !=
end; ++it) {
203 int pointerToTheFirst = mDeco->
mDigits.size();
205 mDeco->
setUpStream(theBuffer, it.size() + it.offset());
207 if (mFastAlgorithm) {
214 LOG(
debug) <<
"End Page decoding !";
221 mTotalDigits += mDeco->
mDigits.size();
222 LOG(info) <<
"Writing Digitis=" << mDeco->
mDigits.size() <<
"/" << mTotalDigits <<
" Frame=" << mTotalFrames <<
" IntRec " << mDeco->
mIntReco;
231 LOG(info) <<
"*********** In decode readout **************";
234 auto& inputs = pc.
inputs();
238 for (
auto it = parser.
begin(),
end = parser.
end(); it !=
end; ++it) {
240 mDeco->
setUpStream(theBuffer, it.size() + it.offset());
242 if (mFastAlgorithm) {
249 LOG(
debug) <<
"End Page decoding !";
259 LOG(info) <<
"*********** In decode rawfile **************";
261 for (
auto&& input : pc.
inputs()) {
262 if (input.spec->binding ==
"file") {
264 auto const*
raw = input.payload;
267 LOG(info) <<
" payloadSize=" << payloadSize;
268 if (payloadSize == 0) {
273 int pagesize = payloadSize;
276 if (mFastAlgorithm) {
283 LOG(
debug) <<
"End Page decoding !";
292 std::vector<o2::hmpid::Digit> dig;
294 std::vector<o2::hmpid::Trigger> trg;
298 std::sort(mTriggers.begin(), mTriggers.end());
305 while (
i < mTriggers.size()) {
308 firstEntry = dig.size();
309 while (k < mTriggers.size() && mTriggers[
i].getTriggerID() == mTriggers[k].getTriggerID()) {
310 for (
int j = mTriggers[k].getFirstEntry();
j <= mTriggers[k].getLastEntry();
j++) {
322 for (
int i = 0;
i < trg.size();
i++) {
323 if (trg[
i].getFirstEntry() > trg[
i].getLastEntry()) {
326 std::sort(dig.begin() + trg[
i].getFirstEntry(), dig.begin() + trg[
i].getLastEntry());
338 std::vector<o2::framework::InputSpec> inputs;
341 inputs.emplace_back(
"stdDist",
"FLP",
"DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
344 std::vector<o2::framework::OutputSpec> outputs;
345 outputs.emplace_back(
"HMP",
"DIGITS", 0, o2::framework::Lifetime::Timeframe);
346 outputs.emplace_back(
"HMP",
"INTRECORDS", 0, o2::framework::Lifetime::Timeframe);
349 "HMP-RawStreamDecoder",
353 Options{{
"get-results-statistics", VariantType::Bool,
false, {
"Generate intermediat output results."}},
354 {
"result-file", VariantType::String,
"/tmp/hmpRawDecodeResults", {
"Base name of the decoding results files."}},
355 {
"fast-decode", VariantType::Bool,
false, {
"Use the fast algorithm. (error 0.8%)"}}}};
A raw page parser for DPL input.
o2::raw::RawFileWriter * raw
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
static const VerbosityConfig & Instance()
T get(const char *key) const
The parser handles transparently input in the format of raw pages.
const_iterator end() const
const_iterator begin() const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
void decodeTF(framework::ProcessingContext &pc)
void endOfStream(framework::EndOfStreamContext &ec) override
This is invoked whenever we have an EndOfStream event.
void decodeReadout(framework::ProcessingContext &pc)
void decodeRawFile(framework::ProcessingContext &pc)
void run(framework::ProcessingContext &pc) final
void init(framework::InitContext &ic) final
void stop()
stop : stops the timer
void elapseMes(std::string const message)
void start()
start : starts the timer
void logMes(std::string const message)
static constexpr int N_XROWS
static constexpr int N_MODULES
static constexpr int N_YCOLS
static constexpr int MAXEQUIPMENTS
float getAverageEventSize(int Equipment)
void decodePageFast(uint32_t **streamBuf)
std::vector< o2::hmpid::Digit > mDigits
void decodePage(uint32_t **streamBuffer)
o2::InteractionRecord mIntReco
bool setUpStream(void *Buffer, long BufferLen)
void writeSummaryFile(char *summaryFileName)
double getPadSum(int Module, int Row, int Column)
HmpidEquipment * mTheEquipments[Geo::MAXEQUIPMENTS]
int getNumberOfEquipments()
uint16_t getPadSamples(int Module, int Row, int Column)
void updateStatistics(HmpidEquipment *eq)
float getAverageBusyTime(int Equipment)
double getPadSquares(int Module, int Row, int Column)
HMPID Trigger declaration.
void setDataRange(int firstentry, int nentries)
Defining ITS Vertex explicitly as messageable.
std::vector< InputSpec > select(char const *matcher="")
o2::framework::DataProcessorSpec getDecodingSpec2(bool askSTFDist)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
static o2::header::DataHeader::PayloadSizeType getPayloadSize(const DataRef &ref)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"