13#include <unordered_map>
16#include "fmt/format.h"
55 mMaxEvents =
static_cast<uint32_t>(ic.options().get<
int>(
"max-events"));
56 mSyncOffsetReference = ic.options().get<
uint32_t>(
"sync-offset-reference");
57 mDecoderType = ic.options().get<
uint32_t>(
"decoder-type");
58 mUseTrigger = !ic.options().get<
bool>(
"ignore-trigger");
59 mUseOldSubspec = ic.options().get<
bool>(
"use-old-subspec");
60 const bool createOccupancyMaps = ic.options().get<
bool>(
"create-occupancy-maps");
61 mForceQuit = ic.options().get<
bool>(
"force-quit");
62 mCheckDuplicates = ic.options().get<
bool>(
"check-for-duplicates");
63 mApplyTailCancellation = ic.options().get<
bool>(
"apply-ion-tail-cancellation");
64 mRemoveDuplicates = ic.options().get<
bool>(
"remove-duplicates");
66 mRemoveCEdigits =
true;
68 mRemoveCEdigits = ic.options().get<
bool>(
"remove-ce-digits");
72 LOGP(info,
"Using old subspecification (CruId << 16) | ((LinkId + 1) << (CruEndPoint == 1 ? 8 : 0))");
78 if (!ic.options().get<
bool>(
"ignore-grp")) {
82 const auto nhbf = (int)grp->getNHBFPerTF();
83 const int lastTimeBin = nhbf * 891 / 2;
85 LOGP(info,
"Using GRP NHBF = {} to set last time bin to {}, might be overwritte via --configKeyValues", nhbf, lastTimeBin);
91 const auto pedestalFile = ic.options().get<std::string>(
"pedestal-url");
92 if (pedestalFile.length()) {
93 if (pedestalFile.find(
"ccdb") != std::string::npos) {
94 LOGP(info,
"Loading pedestals from ccdb: {}", pedestalFile);
96 cdb.setURL(pedestalFile);
97 if (cdb.isHostReachable()) {
98 auto pedestalNoise = cdb.get<std::unordered_map<std::string, CalPad>>(
"TPC/Calib/PedestalNoise");
99 CalPad* pedestal =
nullptr;
101 pedestal = &pedestalNoise->at(
"Pedestals");
106 LOGP(
error,
"could not load pedestals from {}", pedestalFile);
109 LOGP(
error,
"ccdb access to {} requested, but host is not reachable. Cannot load Pedestals", pedestalFile);
112 LOGP(info,
"Setting pedestal file: {}", pedestalFile);
118 if (createOccupancyMaps) {
119 mClusterQC = std::make_unique<qc::Clusters>();
123 const int timeBins = mDigitDump.
update(padROCPos, cru,
data);
128 mRawReader.
setLinkZSCallback([
this](
int cru,
int rowInSector,
int padInRow,
int timeBin,
float adcValue) ->
bool {
133 mClusterQC->fillADCValue(cru, rowInSector, padInRow, timeBin, adcValue);
155 snapshotDigits(pc.outputs());
158 LOGP(info,
"Maximm number of events reached ({}), no more processing will be done", mMaxEvents);
162 pc.services().get<
ControlService>().readyToQuit(QuitRequest::All);
171 LOGP(info,
"endOfStream");
172 if (mActiveSectors) {
173 snapshotDigits(ec.outputs());
184 std::unique_ptr<qc::Clusters> mClusterQC;
189 bool mReadyToQuit{
false};
190 bool mCalibDumped{
false};
191 bool mUseOldSubspec{
false};
192 bool mForceQuit{
false};
193 bool mCheckDuplicates{
false};
194 bool mApplyTailCancellation{
false};
195 bool mRemoveDuplicates{
false};
196 bool mRemoveCEdigits{
false};
197 bool mSendCEdigits{
false};
198 bool mUseTrigger{
false};
200 std::vector<int> mSectors{};
205 if (mCheckDuplicates || mRemoveDuplicates) {
213 if (mRemoveCEdigits) {
217 if (mApplyTailCancellation) {
219 IonTailCorrection itCorr;
220 for (
auto isector : mSectors) {
221 itCorr.filterDigitsDirect(
digits[isector]);
225 for (
auto isector : mSectors) {
227 header.activeSectors = mActiveSectors;
243 mClusterQC->normalize();
244 mClusterQC->dumpToFile(
"ClusterQC.root", 2);
252 std::vector<OutputSpec> outputs;
253 for (
auto isector : tpcSectors) {
254 outputs.emplace_back(
"TPC",
"DIGITS",
static_cast<SubSpecificationType>(isector), Lifetime::Timeframe);
256 outputs.emplace_back(
"TPC",
"CEDIGITS",
static_cast<SubSpecificationType>(isector), Lifetime::Timeframe);
260 std::vector<InputSpec> inputs;
261 if (inputSpec !=
"") {
262 inputs =
select(inputSpec.data());
265 if (!ignoreDistStf) {
266 inputs.emplace_back(
"stdDist",
"FLP",
"DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
271 fmt::format(
"tpc-raw-to-digits-{}", channel),
274 AlgorithmSpec{adaptFromTask<device>(tpcSectors, sendCEdigits)},
276 {
"max-events", VariantType::Int, 0, {
"maximum number of events to process"}},
277 {
"use-old-subspec", VariantType::Bool,
false, {
"use old subsecifiation definition"}},
278 {
"force-quit", VariantType::Bool,
false, {
"force quit after max-events have been reached"}},
279 {
"pedestal-url", VariantType::String,
"", {
"file with pedestals and noise or ccdb url for zero suppression"}},
280 {
"create-occupancy-maps", VariantType::Bool,
false, {
"create occupancy maps and store them to local root file for debugging"}},
281 {
"check-for-duplicates", VariantType::Bool,
false, {
"check if duplicate digits exist and only report them"}},
282 {
"apply-ion-tail-cancellation", VariantType::Bool,
false, {
"Apply ion tail cancellation"}},
283 {
"remove-duplicates", VariantType::Bool,
false, {
"check if duplicate digits exist and remove them"}},
284 {
"remove-ce-digits", VariantType::Bool,
false, {
"find CE position and remove digits around it"}},
285 {
"ignore-grp", VariantType::Bool,
false, {
"ignore GRP file"}},
286 {
"sync-offset-reference", VariantType::UInt32, 144u, {
"Reference BCs used for the global sync offset in the CRUs"}},
287 {
"decoder-type", VariantType::UInt32, 1u, {
"Decoder to use: 0 - TPC, 1 - GPU"}},
288 {
"ignore-trigger", VariantType::Bool,
false, {
"Ignore the trigger information"}},
Utils and constants for calibration and related workflows.
std::vector< std::string > header
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate sectors
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 Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
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
Header of the General Run Parameters object.
char error[CURL_ERROR_SIZE]
Implementation of the ion tail correction from TPC digits.
Definition of the Names Generator class.
static std::string getGRPFileName(const std::string_view prefix=STANDARDSIMPREFIX)
static BasicCCDBManager & instance()
o2::header::DataHeader::SubSpecificationType SubSpecificationType
static GRPObject * loadFrom(const std::string &grpFileName="")
unsigned char region() const
void setNumberOfProcessedTimeBins(size_t timeBins)
number of processed time bins in last event
Int_t update(const PadROCPos &padROCPos, const CRU &cru, const gsl::span< const uint32_t > data)
void incrementNEvents()
increment number of events
size_t getNumberOfProcessedEvents() const
number of processed events
size_t getNumberOfProcessedTimeBins() const
number of processed time bins in last event
Pedestal calibration class.
void clearDigits()
clear the digits
void setTimeBinRange(int first, int last)
set the timeBin range
void checkDuplicates(bool removeDuplicates=false)
check duplicates and remove the if removeDuplicates is true
void sortDigits()
sort the digits
void removeCEdigits(uint32_t removeNtimeBinsBefore=10, uint32_t removeNtimeBinsAfter=100, std::array< std::vector< Digit >, Sector::MAXSECTOR > *removedDigits=nullptr)
remove digits close to the CE
void setPedestals(const CalPad *pedestal)
Set a custom pedestal object.
void init()
initialize DigitDump from DigitDumpParam
std::vector< Digit > & getDigits(int sector)
return digits for specific sector
void setPedestalAndNoiseFile(std::string_view fileName)
pedestal file name
void setInMemoryOnly(bool mode=true)
set in memory only mode
Int_t updateCRU(const CRU &cru, const Int_t row, const Int_t pad, const Int_t timeBin, const Float_t signal) final
not used
static Mapper & instance(const std::string mappingDir="")
const PadRegionInfo & getPadRegionInfo(const unsigned char region) const
Pad and row inside a ROC.
unsigned char getGlobalRowOffset() const
static constexpr int MAXSECTOR
void init(o2::framework::InitContext &ic) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
TPCDigitDumpDevice(const std::vector< int > §ors, bool sendCEdigits)
void run(o2::framework::ProcessingContext &pc) final
RawReaderCRU & createReader(const std::string_view inputFileName, uint32_t numTimeBins=0, uint32_t link=0, uint32_t stream=0, uint32_t debugLevel=0, uint32_t verbosity=0, const std::string_view outputFilePrefix="")
create a new raw reader
auto & getReaders()
return vector of readers
void setLinkZSCallback(LinkZSCallback function)
set a callback function for decoded LinkZS data
void setADCDataCallback(ADCDataCallback function)
set a callback function
Defining ITS Vertex explicitly as messageable.
std::vector< InputSpec > select(char const *matcher="")
uint64_t processRawData(o2::framework::InputRecord &inputs, std::unique_ptr< o2::tpc::rawreader::RawReaderCRU > &reader, bool useOldSubspec=false, const std::vector< int > §ors={}, size_t *nerrors=nullptr, uint32_t syncOffsetReference=144, uint32_t decoderType=1, bool useTrigger=true, bool returnOnNoTrigger=false)
o2::framework::DataProcessorSpec getRawToDigitsSpec(int channel, const std::string inputSpec, bool ignoreDistStf, std::vector< int > const &tpcSectors, bool sendCEdigits=false)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< Digit > digits