53#include <unordered_map>
66namespace reco_workflow
69static std::shared_ptr<o2::gpu::GPURecoWorkflowSpec> gTask;
76const std::unordered_map<std::string, InputType>
InputMap{
87const std::unordered_map<std::string, OutputType>
OutputMap{
103 const o2::tpc::CorrectionMapsGloOpts& sclOpts,
bool propagateMC,
unsigned nLanes, std::string
const& cfgInput, std::string
const& cfgOutput,
bool disableRootInput,
104 int caClusterer,
int zsOnTheFly,
bool askDISTSTF,
const std::string& ctfdictOpt,
bool selIR,
bool filteredInp,
int deadMapSources,
bool useMCTimeGain)
109 }
catch (std::out_of_range&) {
110 throw std::invalid_argument(std::string(
"invalid input type: ") + cfgInput);
112 std::vector<OutputType> outputTypes;
114 outputTypes = RangeTokenizer::tokenize<OutputType>(cfgOutput, [](std::string
const& token) {
return OutputMap.at(token); });
115 }
catch (std::out_of_range&) {
116 throw std::invalid_argument(std::string(
"invalid output type: ") + cfgOutput);
119 return std::find(outputTypes.begin(), outputTypes.end(),
type) != outputTypes.end();
123 throw std::invalid_argument(
"filtered-input option must be provided only with pass-through input");
151 throw std::invalid_argument(
"input/output type mismatch, can not produce 'digits' from 'clustershardware'");
154 throw std::invalid_argument(
"input/output type mismatch, can not produce 'digits', nor 'clustershardware' from 'clusters'");
157 throw std::invalid_argument(
"input/output type mismatch, can not produce 'clustershardware' from 'zsraw'");
160 throw std::invalid_argument(
"ca-clusterer requires digits as input");
163 throw std::invalid_argument(
"ca-clusterer cannot produce clustershardware output");
174 if (TString(
name.data()).Contains(
"TPCDigitMCTruth") || TString(
name.data()).Contains(
"TPCClusterHwMCTruth") || TString(
name.data()).Contains(
"TPCClusterNativeMCTruth")) {
177 storedlabels->copyandflatten(flatlabels);
179 context.outputs().snapshot(
output, flatlabels);
190 using Type = std::vector<o2::tpc::Digit>;
192 specs.emplace_back(o2::tpc::getPublisherSpec<Type>(
PublisherConf{
196 {
"digitbranch",
"TPCDigit",
"Digit branch"},
197 {
"mcbranch",
"TPCDigitMCTruth",
"MC label branch"},
210 "tpc-clusterhardware-reader",
211 "tpc-clusterhardware.root",
212 "tpcclustershardware",
213 {
"databranch",
"TPCClusterHw",
"Branch with TPC ClustersHardware"},
214 {
"mcbranch",
"TPCClusterHwMCTruth",
"MC label branch"},
223 if (!getenv(
"DPL_DISABLE_TPC_TRIGGER_READER") || atoi(getenv(
"DPL_DISABLE_TPC_TRIGGER_READER")) != 1) {
236 "tpc-compressed-cluster-reader",
237 "tpc-compclusters.root",
239 {
"clusterbranch",
"TPCCompClusters",
"Branch with TPC compressed clusters"},
243 std::vector<int>(1, 0),
244 std::vector<int>(1, 0),
264 runGPUReco &= caClusterer || runHWDecoder || inputType ==
InputType::Clusters || decompressTPC;
271 runGPUReco = runHWDecoder = runClusterer = runClusterEncoder = zsToDigit =
false;
301 parallelProcessors, nLanes,
302 [&laneConfiguration]() {
return laneConfiguration.size(); },
303 [&laneConfiguration](
size_t index) {
return laneConfiguration[
index]; });
304 specs.insert(specs.end(), parallelProcessors.begin(), parallelProcessors.end());
318 auto const* tpcSectorHeader = o2::framework::DataRefUtils::getHeader<o2::tpc::TPCSectorHeader*>(
ref);
319 if (!tpcSectorHeader) {
320 throw std::runtime_error(
"TPC sector header missing in header stack");
322 if (tpcSectorHeader->sector() < 0) {
327 for (
auto const&
sector : tpcSectors) {
328 if (
sector == tpcSectorHeader->sector()) {
333 throw std::runtime_error(
"sector " +
std::to_string(tpcSectorHeader->sector()) +
" not configured for writing");
335 auto getName = [tpcSectors](std::string base,
size_t index) {
341 auto fillLabels = [](TBranch& branch, std::vector<char>
const& labelbuffer,
DataRef const& ) {
344 auto ptr = &outputcontainer;
346 outputcontainer.
adopt(labelbuffer);
351 auto makeWriterSpec = [tpcSectors, laneConfiguration, propagateMC, getIndex,
getName](
const char* processName,
352 const char* defaultFileName,
353 const char* defaultTreeName,
356 bool singleBranch =
false) {
357 if (tpcSectors.size() == 0) {
358 throw std::invalid_argument(std::string(
"writer process configuration needs list of TPC sectors"));
361 auto amendInput = [tpcSectors, laneConfiguration](
InputSpec& input,
size_t index) {
365 auto amendBranchDef = [laneConfiguration, amendInput, tpcSectors, getIndex,
getName, singleBranch](
auto&&
def,
bool enableMC =
true) {
369 def.nofBranches = enableMC ? tpcSectors.size() : 0;
370 def.getIndex = getIndex;
374 def.nofBranches = enableMC ? 1 : 0;
376 return std::move(
def);
380 std::move(amendBranchDef(databranch)),
381 std::move(amendBranchDef(mcbranch, propagateMC)))());
390 using DigitOutputType = std::vector<o2::tpc::Digit>;
391 specs.push_back(makeWriterSpec(
"tpc-digits-writer",
397 "digit-branch-name"},
400 "digitmc-branch-name"}));
409 specs.push_back(makeWriterSpec(
"tpc-clusterhardware-writer",
411 "tpcclustershardware",
416 "TPCClusterHwMCTruth",
428 specs.push_back(makeWriterSpec(filteredInp ?
"tpc-native-cluster-writer_filtered" :
"tpc-native-cluster-writer",
429 (inputType ==
InputType::Clusters || filteredInp) ?
"tpc-filtered-native-clusters.root" :
"tpc-native-clusters.root",
435 "TPCClusterNativeMCTruth",
436 "mcbranch", fillLabels},
481 auto task = std::make_shared<o2::gpu::GPURecoWorkflowSpec>(policyData, cfg, tpcSectors, tpcSectorMask, ggRequest);
483 Inputs taskInputs = task->inputs();
484 Options taskOptions = task->options();
485 std::move(ggInputs.begin(), ggInputs.end(), std::back_inserter(taskInputs));
491 AlgorithmSpec{adoptTask<o2::gpu::GPURecoWorkflowSpec>(task)},
500 if (runClusterEncoder) {
513 const char* processName = filteredInp ?
"tpc-track-writer_filtered" :
"tpc-track-writer";
514 const char* defaultFileName = filteredInp ?
"tpctracks_filtered.root" :
"tpctracks.root";
515 const char* defaultTreeName =
"tpcrec";
518 using TrackOutputType = std::vector<o2::tpc::TrackTPC>;
520 using ClusRefsOutputType = std::vector<o2::tpc::TPCClRefElem>;
524 LOG(info) <<
"writing " <<
tracks.size() <<
" track(s)";
527 "TPCTracks",
"track-branch-name",
531 "ClusRefs",
"trackclusref-branch-name"};
534 (propagateMC ? 1 : 0),
535 "trackmc-branch-name"};
539 std::move(tracksdef), std::move(clrefdef),
540 std::move(mcdef))());
552 const char* processName =
"tpc-compcluster-writer";
553 const char* defaultFileName =
"tpc-compclusters.root";
554 const char* defaultTreeName =
"tpcrec";
559 "TPCCompClusters_0",
"compcluster-branch-name"};
562 std::move(ccldef))());
565 return std::move(specs);
571 gTask->deinitialize();
Processor spec for decoder of TPC raw cluster data.
Meta data for a group describing it by sector number and global padrow.
Container to store compressed TPC cluster data.
std::string getName(const TDataMember *dm, int index, int size)
A const (ready only) version of MCTruthContainer.
Helper class to access load maps from CCDB.
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 sector
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 def(1)) AddOption(allowOptimizedSlaveReconstruction
Helper for geometry and GRP related CCDB requests.
A special IO container - splitting a given vector to enable ROOT IO.
std::vector< o2::MCCompLabel > labels
std::vector< o2::its::TrackITS > tracks
Configurable generator for RootTreeWriter processor spec.
Helper function to tokenize sequences and ranges of integral numbers.
spec definition for a TPC clusterer process
ProcessorSpec for the TPC cluster entropy encoding.
Workflow definition for the TPC reconstruction.
Definitions of TPC Zero Suppression Data Headers.
Generate a processor spec for the RootTreeWriter utility.
static TBranch * remapBranch(TBranch &branchRef, T **newdata)
GLuint const GLchar * name
GLint GLint GLsizei GLint GLenum GLenum type
framework::DataProcessorSpec getDigitsReaderSpec(bool propagateMC=true, const std::string &defFile="ctpdigits.root")
WorkflowSpec parallelPipeline(const WorkflowSpec &specs, size_t nPipelines, std::function< size_t()> getNumberOfSubspecs, std::function< size_t(size_t)> getSubSpec)
Inputs mergeInputs(InputSpec original, size_t maxIndex, std::function< void(InputSpec &, size_t)> amendCallback)
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > Inputs
std::vector< framework::InputSpec > CompletionPolicyData
InputType
define input and output types of the workflow
@ CompClustersFlatForEncode
const std::unordered_map< std::string, InputType > InputMap
framework::WorkflowSpec getWorkflow(CompletionPolicyData *policyData, std::vector< int > const &tpcSectors, unsigned long tpcSectorMask, std::vector< int > const &laneConfiguration, const o2::tpc::CorrectionMapsGloOpts &sclOpts, bool propagateMC=true, unsigned nLanes=1, std::string const &cfgInput="digitizer", std::string const &cfgOutput="tracks", bool disableRootInput=false, int caClusterer=0, int zsOnTheFly=0, bool askDISTSTF=true, const std::string &ctfdictOpt="none", bool selIR=false, bool filteredInp=false, int deadMapSources=-1, bool useMCTimeGain=false)
create the workflow for TPC reconstruction
const std::unordered_map< std::string, OutputType > OutputMap
framework::DataProcessorSpec getClusterReaderSpec(bool useMC, const std::vector< int > *tpcSectors=nullptr, const std::vector< int > *laneConfiguration=nullptr)
framework::DataProcessorSpec getZSEncoderSpec(std::vector< int > const &tpcSectors, bool outRaw, unsigned long tpcSectorMask)
create a processor spec
o2::framework::DataProcessorSpec getTPCTriggerWriterSpec()
framework::DataProcessorSpec getZStoDigitsSpec(std::vector< int > const &tpcSectors)
o2::framework::DataProcessorSpec getTPCScalerSpec(const o2::tpc::CorrectionMapsGloOpts &sclOpts)
framework::DataProcessorSpec getClustererSpec(bool sendMC)
framework::DataProcessorSpec getPublisherSpec(PublisherConf const &config, bool propagateMC=true)
framework::DataProcessorSpec getEntropyEncoderSpec(bool inputFromFile, bool selIR=false, const std::string &ctfdictOpt="none")
create a processor spec
framework::DataProcessorSpec getTPCTriggerReaderSpec()
framework::DataProcessorSpec getClusterDecoderRawSpec(bool sendMC=false)
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 void updateMatchingSubspec(InputSpec &in, header::DataHeader::SubSpecificationType subSpec)
std::function< void(T const &)> Spectator
int32_t tpcDeadMapSources
bool decompressTPCFromROOT
bool outputCompClustersRoot
bool sendClustersPerSector
bool outputSharedClusterMap
bool outputCompClustersFlat
bool requestCTPLumi
request CTP Lumi regardless of what is used for corrections scaling
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"