45#include <fairmq/Device.h>
76 LOG(info) <<
"[HMPID Pedestal Calculation - v.1 - Init] ( create Decoder for " <<
Geo::MAXEQUIPMENTS <<
" equipments !";
83 mSigmaCut = ic.
options().
get<
float>(
"sigmacut");
84 mWriteToFiles = ic.
options().
get<
bool>(
"use-files");
85 mPedestalsBasePath = ic.
options().
get<std::string>(
"files-basepath");
86 mPedestalsCCDBBasePath = mPedestalsBasePath;
88 mWriteToDB = ic.
options().
get<
bool>(
"use-ccdb");
94 mPedestalTag = ic.
options().
get<std::string>(
"pedestals-tag");
95 mFastAlgorithm = ic.
options().
get<
bool>(
"fast-decode");
97 mWriteToDCSDB = ic.
options().
get<
bool>(
"use-dcsccdb");
102 mDcsCcdbAliveHours = ic.
options().
get<
int>(
"dcsccdb-alivehours");
105 LOG(info) <<
"Calculate Ped/Thresh." + (mWriteToDB ?
" Store in DCSCCDB at " + mPedestalsBasePath +
" with Tag:" + mPedestalTag :
" CCDB not used !");
111 if (mPedestalTag ==
"run_number") {
112 const std::string NAStr =
"NA";
126 recordPedInDcsCcdb();
135void PedestalsCalculationTask::recordPedInFiles()
151 auto padsFileName = fmt::format(
"{}_{}.dat", mPedestalsBasePath,
std::to_string(
e));
152 FILE* fpads = fopen(padsFileName.c_str(),
"w");
153 if (fpads ==
nullptr) {
154 mExTimer.
logMes(
"error creating the file = " + std::string(padsFileName));
155 LOG(
error) <<
"error creating the file = " << padsFileName;
166 Average = SumOfCharge / Samples;
167 Variance = sqrt(abs((Samples * SumOfSquares) - (SumOfCharge * SumOfCharge))) / Samples;
173 Threshold = (
uint32_t)(Variance * mSigmaCut + Average);
174 Buffer = ((Threshold & 0x001FF) << 9) | (
Pedestal & 0x001FF);
175 fprintf(fpads,
"%05X\n", Buffer);
177 for (
int h = 48;
h < 64;
h++) {
178 fprintf(fpads,
"%05X\n", 0);
183 fprintf(fpads,
"%05X\n", 0xA0A0A);
190void PedestalsCalculationTask::recordPedInDcsCcdb()
193 LOG(info) <<
"Store Pedestals in DCS CCDB ";
195 float xb, yb, ch, Samples;
196 double SumOfCharge, SumOfSquares, Average, Variance;
198 std::string PedestalFixedTag =
"Latest";
203#define PEDTHFORMAT "%05X,"
204#define COLUMNTAIL false
207 char* outBuffer =
new char[bufferDim];
209 char* endPtr = outBuffer + bufferDim;
215 inserPtr = outBuffer;
224 Average = SumOfCharge / Samples;
225 Variance = sqrt(abs((Samples * SumOfSquares) - (SumOfCharge * SumOfCharge))) / Samples;
231 Threshold = (
uint32_t)(Variance * mSigmaCut + Average);
232 PedThr = ((Threshold & 0x001FF) << 9) | (
Pedestal & 0x001FF);
233 assert(inserPtr < endPtr);
234 snprintf(inserPtr, endPtr - inserPtr,
PEDTHFORMAT, PedThr);
238 for (
int h = 48;
h < 64;
h++) {
239 assert(inserPtr < endPtr);
240 snprintf(inserPtr, endPtr - inserPtr,
PEDTHFORMAT, 0);
247 assert(inserPtr < endPtr);
248 snprintf(inserPtr, endPtr - inserPtr,
"%05X\n", 0xA0A0A);
255 long maxTimeStamp = minTimeStamp + (3600L * mDcsCcdbAliveHours * 1000);
257 auto filename = fmt::format(
"{}_{}.dat", mPedestalsBasePath, PedestalFixedTag);
258 mExTimer.
logMes(
"File name = >" +
filename +
"< (" + mPedestalsCCDBBasePath +
"," + PedestalFixedTag);
260 mDbMetadata.emplace(
"Tag", PedestalFixedTag.c_str());
268void PedestalsCalculationTask::recordPedInCcdb()
271 LOG(info) <<
"Store Pedestals in ccdb ";
274 double Samples, SumOfCharge, SumOfSquares, Average, Variance;
288 TMatrixF* pS = (TMatrixF*)aSigmas.At(
m);
289 TMatrixF* pP = (TMatrixF*)aPedestals.At(
m);
298 (*pP)(
x,
y) = SumOfCharge / Samples;
299 (*pS)(
x,
y) = sqrt(abs((Samples * SumOfSquares) - (SumOfCharge * SumOfCharge))) / Samples;
309 long maxTimeStamp = minTimeStamp + (3600L * 24 * (5 * 365) * 1000);
315 TString
filename = TString::Format(
"%s/%s/Mean_%d", mPedestalsCCDBBasePath.c_str(), mPedestalTag.c_str(),
i);
316 mDbMetadata.emplace(
"Tag", mPedestalTag.c_str());
323 TString
filename = TString::Format(
"%s/%s/Sigma_%d", mPedestalsCCDBBasePath.c_str(), mPedestalTag.c_str(),
i);
324 mDbMetadata.emplace(
"Tag", mPedestalTag.c_str());
334 LOG(
debug) <<
"*********** In decodeTF **************";
336 auto& inputs = pc.
inputs();
338 for (
auto it = parser.
begin(),
end = parser.
end(); it !=
end; ++it) {
340 mDeco->
setUpStream(theBuffer, it.size() + it.offset());
342 if (mFastAlgorithm) {
349 LOG(
debug) <<
"End Page decoding !";
352 mTotalDigits += mDeco->
mDigits.size();
361 std::vector<o2::framework::InputSpec> inputs;
364 std::vector<o2::framework::OutputSpec> outputs;
367 "HMP-PestalsCalculation",
371 Options{{
"files-basepath", VariantType::String,
"HMP/Config", {
"Name of the Base Path of Pedestals/Thresholds files."}},
372 {
"use-files", VariantType::Bool,
false, {
"Register the Pedestals/Threshold values into ASCII files"}},
373 {
"use-ccdb", VariantType::Bool,
false, {
"Register the Pedestals/Threshold values into the CCDB"}},
374 {
"ccdb-uri", VariantType::String,
"http://ccdb-test.cern.ch:8080", {
"URI for the CCDB access."}},
375 {
"use-dcsccdb", VariantType::Bool,
false, {
"Register the Pedestals/Threshold values into the DCS-CCDB"}},
376 {
"dcsccdb-uri", VariantType::String,
"http://ccdb-test.cern.ch:8080", {
"URI for the DCS-CCDB access."}},
377 {
"dcsccdb-alivehours", VariantType::Int, 3, {
"Alive hours in DCS-CCDB."}},
378 {
"fast-decode", VariantType::Bool,
true, {
"Use the fast algorithm. (error 0.8%)"}},
379 {
"pedestals-tag", VariantType::String,
"Latest", {
"The tag applied to this set of pedestals/threshold values"}},
380 {
"sigmacut", VariantType::Float, 4.0f, {
"Sigma values for the Thresholds calculation."}}}};
A raw page parser for DPL input.
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
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 Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder Print launch bounds used for RTC code as debugging for exit after Allow RTC with slave GPUReconstruction instances with optConstexpr and optSpecialcode Maximum number of RTC cache files per backend in the cache the oldest are Prepend RTC compilation commands by this string Load a parameter object containing the launch bounds from a file h configStandalone Processing proc_param TPC Cluster Z Error Parameterization h configStandalone Processing settings for neural network proc_nn std::string Specify inference device(cpu(default), rocm, cuda)") AddOption(nnInferenceDeviceId
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc true
char error[CURL_ERROR_SIZE]
Definition of the Names Generator class.
Class for time synchronization of RawReader instances.
int storeAsTFileAny(const T *obj, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
void init(std::string const &hosts)
bool isHostReachable() const
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
ConfigParamRegistry const & options()
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
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_COLUMNS
static constexpr int N_XROWS
static constexpr int N_MODULES
static constexpr int N_DILOGICS
static constexpr int N_CHANNELS
static constexpr int N_YCOLS
static constexpr int MAXEQUIPMENTS
float getAverageEventSize(int Equipment)
void decodePageFast(uint32_t **streamBuf)
void init()
Init all the members variables.
std::vector< o2::hmpid::Digit > mDigits
double getChannelSquare(int Equipment, int Column, int Dilogic, int Channel)
void decodePage(uint32_t **streamBuffer)
uint16_t getChannelSamples(int Equipment, int Column, int Dilogic, int Channel)
bool setUpStream(void *Buffer, long BufferLen)
double getPadSum(int Module, int Row, int Column)
uint16_t getPadSamples(int Module, int Row, int Column)
double getPadSquares(int Module, int Row, int Column)
double getChannelSum(int Equipment, int Column, int Dilogic, int Channel)
void decodeTF(framework::ProcessingContext &pc)
void init(framework::InitContext &ic) final
void run(framework::ProcessingContext &pc) final
void endOfStream(framework::EndOfStreamContext &ec) override
This is invoked whenever we have an EndOfStream event.
long getCurrentTimestamp()
returns the timestamp in long corresponding to "now"
std::vector< char > DCSconfigObject_t
void addConfigItem(DCSconfigObject_t &configVector, std::string key, const T value)
Defining ITS Vertex explicitly as messageable.
std::vector< InputSpec > select(char const *matcher="")
o2::framework::DataProcessorSpec getPedestalsCalculationSpec(std::string inputSpec="TF:HMP/RAWDATA")
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)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"