69 LOG(info) <<
"[HMPID Data Decoder - Init] ( create Raw Stream Decoder for " <<
Geo::MAXEQUIPMENTS <<
" equipments !";
71 mRootStatFile = ic.
options().
get<std::string>(
"result-file");
72 mFastAlgorithm = ic.
options().
get<
bool>(
"fast-decode");
93 LOG(
debug) <<
"Writing Digitis=" << mDeco->
mDigits.size() <<
"/" << mTotalDigits <<
" Frame=" << mTotalFrames <<
" IntRec " << mDeco->
mIntReco;
104 float squareOfCharges;
108 TString
filename = TString::Format(
"%s_stat.root", mRootStatFile.c_str());
109 LOG(info) <<
"Create the stat file " <<
filename.Data();
110 TFile mfileOut(TString::Format(
"%s",
filename.Data()),
"RECREATE");
113 TString tit = TString::Format(
"HMPID Data Decoding Statistic results Mod=%d",
i);
114 theObj[
i] =
new TTree(
"o2hmp", tit);
115 theObj[
i]->Branch(
"x", &xb,
"s");
116 theObj[
i]->Branch(
"y", &yb,
"s");
117 theObj[
i]->Branch(
"Samples", &numOfSamples,
"i");
118 theObj[
i]->Branch(
"Sum_of_charges", &sumOfCharges,
"l");
119 theObj[
i]->Branch(
"Sum_of_square", &squareOfCharges,
"l");
121 theObj[
Geo::N_MODULES] =
new TTree(
"o2hmp",
"HMPID Data Decoding Statistic results");
122 theObj[
Geo::N_MODULES]->Branch(
"Average_Event_Size", &avgEventSize,
"F");
123 theObj[
Geo::N_MODULES]->Branch(
"Average_Busy_Time", &avgBusyTime,
"F");
128 for (
int i = 0;
i < numEqui;
i++) {
133 char summaryFileName[254];
134 snprintf(summaryFileName, 254,
"%s_stat.txt", mRootStatFile.c_str());
136 for (
int e = 0;
e < numEqui;
e++) {
165 LOG(
debug) <<
"*********** In decodeTF **************";
168 auto& inputs = pc.
inputs();
173 static size_t contDeadBeef = 0;
176 const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
178 if (payloadSize == 0) {
180 if (++contDeadBeef <= maxWarn) {
181 LOGP(warning,
"Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF{}",
182 dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, payloadSize,
183 contDeadBeef == maxWarn ? fmt::format(
". {} such inputs in row received, stopping reporting", contDeadBeef) :
"");
193 for (
auto it = parser.
begin(),
end = parser.
end(); it !=
end; ++it) {
195 mDeco->
setUpStream(theBuffer, it.size() + it.offset());
197 if (mFastAlgorithm) {
204 LOG(
debug) <<
"End Page decoding !";
208 mTotalDigits += mDeco->
mDigits.size();
216 LOG(info) <<
"*********** In decode readout **************";
219 auto& inputs = pc.
inputs();
223 for (
auto it = parser.
begin(),
end = parser.
end(); it !=
end; ++it) {
225 mDeco->
setUpStream(theBuffer, it.size() + it.offset());
227 if (mFastAlgorithm) {
234 LOG(
debug) <<
"End Page decoding !";
244 LOG(info) <<
"*********** In decode rawfile **************";
246 for (
auto&& input : pc.
inputs()) {
247 if (input.spec->binding ==
"file") {
253 auto const*
raw = input.payload;
256 LOG(info) <<
" payloadSize=" << payloadSize;
257 if (payloadSize == 0) {
262 int pagesize = payloadSize;
265 if (mFastAlgorithm) {
272 LOG(
debug) <<
"End Page decoding !";
282 std::vector<o2::framework::InputSpec> inputs;
285 inputs.emplace_back(
"stdDist",
"FLP",
"DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
288 std::vector<o2::framework::OutputSpec> outputs;
289 outputs.emplace_back(
"HMP",
"DIGITS", 0, o2::framework::Lifetime::Timeframe);
290 outputs.emplace_back(
"HMP",
"INTRECORDS", 0, o2::framework::Lifetime::Timeframe);
293 "HMP-RawStreamDecoder",
297 Options{{
"result-file", VariantType::String,
"/tmp/hmpRawDecodeResults", {
"Base name of the decoding results files."}},
298 {
"fast-decode", VariantType::Bool,
false, {
"Use the fast algorithm. (error 0.8%)"}}}};
A raw page parser for DPL input.
std::vector< std::string > header
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 run(framework::ProcessingContext &pc) final
void init(framework::InitContext &ic) final
void decodeReadout(framework::ProcessingContext &pc)
void endOfStream(framework::EndOfStreamContext &ec) override
This is invoked whenever we have an EndOfStream event.
void decodeTF(framework::ProcessingContext &pc)
void decodeRawFile(framework::ProcessingContext &pc)
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)
Defining ITS Vertex explicitly as messageable.
std::vector< InputSpec > select(char const *matcher="")
o2::framework::DataProcessorSpec getDecodingSpec(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"