Project
Loading...
Searching...
No Matches
TRDGlobalTrackingQCSpec.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_TRD_GLOBALTRACKINGQCSPEC_H
13#define O2_TRD_GLOBALTRACKINGQCSPEC_H
14
18
19// input TRD tracks, TRD tracklets, TRD calibrated tracklets, ITS-TPC tracks, TPC tracks
20// output QC histograms
21
22#include "Headers/DataHeader.h"
24#include "Framework/Task.h"
35#include "TRDQC/Tracking.h"
36#include <cstring>
37
39
40using namespace o2::framework;
41using namespace o2::globaltracking;
43
44namespace o2
45{
46namespace trd
47{
48
50{
51 public:
52 TRDGlobalTrackingQC(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool tpcAvailable, o2::dataformats::GlobalTrackID::mask_t src) : mDataRequest(dr), mGGCCDBRequest(gr), mTPCavailable(tpcAvailable), mTrkMask(src) {}
53 ~TRDGlobalTrackingQC() override = default;
54 void init(InitContext& ic) final
55 {
57 if (!mTPCavailable) {
58 mQC.disablePID();
59 }
60 if (getenv("ALIEN_JDL_LPMPRODUCTIONTYPE") && std::strcmp(getenv("ALIEN_JDL_LPMPRODUCTIONTYPE"), "MC") == 0) {
61 // apply artificial pad shift in case non-ideal alignment is used to compensate for shift in current alignment from real data
62 mQC.setApplyShift(false);
63 }
64 }
65 void run(ProcessingContext& pc) final
66 {
67 RecoContainer recoData;
68 recoData.collectData(pc, *mDataRequest.get());
69 updateTimeDependentParams(pc); // Make sure this is called after recoData.collectData, which may load some conditions
70 mQC.reset();
71 mQC.setInput(recoData);
72 std::vector<int> triggeredBCFT0;
73 if (mTrkMask[GTrackID::FT0]) { // pile-up tagging was requested
74 auto ft0recPoints = recoData.getFT0RecPoints();
75 uint32_t firstOrbit = 0;
76 for (size_t ft0id = 0; ft0id < ft0recPoints.size(); ft0id++) {
77 const auto& f0rec = ft0recPoints[ft0id];
78 if (ft0id == 0) {
79 firstOrbit = f0rec.getInteractionRecord().orbit;
80 mQC.setFirstOrbit(firstOrbit);
81 }
82 if (o2::ft0::InteractionTag::Instance().isSelected(f0rec)) {
83 triggeredBCFT0.push_back(f0rec.getInteractionRecord().differenceInBC({0, firstOrbit}));
84 }
85 }
86 }
87 mQC.setTriggeredBCFT0(triggeredBCFT0);
88 mQC.run();
89 pc.outputs().snapshot(Output{"TRD", "TRACKINGQC", 0}, mQC.getTrackQC());
90 }
92 void finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj) final
93 {
95 return;
96 }
97 }
98
99 private:
100 void updateTimeDependentParams(framework::ProcessingContext& pc)
101 {
103 static bool initOnceDone = false;
104 if (!initOnceDone) { // these params need to be queried only once
105 initOnceDone = true;
106
107 mQC.init();
108
109 // Local pad gain calibration from krypton run
110 auto localGain = *(pc.inputs().get<o2::trd::LocalGainFactor*>("localgainfactors"));
111 mQC.setLocalGainFactors(localGain);
112 }
113 }
114
116 std::shared_ptr<DataRequest> mDataRequest;
117 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
118 bool mTPCavailable{false};
119 Tracking mQC;
120};
121
123{
124 std::vector<OutputSpec> outputs;
125 outputs.emplace_back("TRD", "TRACKINGQC", 0, Lifetime::Timeframe);
126 auto dataRequest = std::make_shared<DataRequest>();
127 bool isTPCavailable = false;
128
129 if (GTrackID::includesSource(GTrackID::Source::ITSTPC, src)) {
130 LOGF(debug, "Found ITS-TPC tracks as input, loading ITS-TPC-TRD");
131 src |= GTrackID::getSourcesMask("ITS-TPC-TRD");
132 }
133 if (GTrackID::includesSource(GTrackID::Source::TPC, src)) {
134 LOGF(debug, "Found TPC tracks as input, loading TPC-TRD");
135 src |= GTrackID::getSourcesMask("TPC-TRD");
136 isTPCavailable = true;
137 }
138 GTrackID::mask_t srcClu = GTrackID::getSourcesMask("TRD"); // we don't need all clusters, only TRD tracklets
139
140 dataRequest->requestTracks(src, false);
141 dataRequest->requestClusters(srcClu, false);
142 dataRequest->inputs.emplace_back("localgainfactors", "TRD", "LOCALGAINFACTORS", 0, Lifetime::Condition, ccdbParamSpec("TRD/Calib/LocalGainFactor"));
143 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
144 false, // GRPECS=true
145 false, // GRPLHCIF
146 true, // GRPMagField
147 true, // askMatLUT
149 dataRequest->inputs,
150 true);
151 return DataProcessorSpec{
152 "trd-tracking-qc",
153 dataRequest->inputs,
154 outputs,
155 AlgorithmSpec{adaptFromTask<TRDGlobalTrackingQC>(dataRequest, ggRequest, isTPCavailable, src)}};
156}
157
158template <typename T>
160
162{
163 return framework::MakeRootTreeWriterSpec("trd-tracking-qc-writer",
164 "trdQC.root",
165 "qc",
166 BranchDefinition<std::vector<TrackQC>>{InputSpec{"trackingqc", "TRD", "TRACKINGQC"}, "trackQC"})();
167};
168
169} // namespace trd
170} // namespace o2
171
172#endif // O2_TRD_GLOBALTRACKINGQCSPEC_H
Wrapper container for different reconstructed object types.
Definition of the GeometryManager class.
std::ostringstream debug
Definition of the FIT RecPoints class.
unsigned int uint32_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 trd
Helper for geometry and GRP related CCDB requests.
Header of the General Run Parameters object.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Configurable generator for RootTreeWriter processor spec.
Check the performance of the TRD in global tracking.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static mask_t getSourcesMask(const std::string_view srcList)
decltype(auto) get(R binding, int part=0) const
Generate a processor spec for the RootTreeWriter utility.
InputRecord & inputs()
The inputs associated with this processing context.
~TRDGlobalTrackingQC() override=default
TRDGlobalTrackingQC(std::shared_ptr< DataRequest > dr, std::shared_ptr< o2::base::GRPGeomRequest > gr, bool tpcAvailable, o2::dataformats::GlobalTrackID::mask_t src)
void run(ProcessingContext &pc) final
void finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj) final
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void init(InitContext &ic) final
void setInput(const o2::globaltracking::RecoContainer &input)
Initialize the input arrays.
Definition Tracking.cxx:32
void run()
Main processing function.
Definition Tracking.cxx:44
std::vector< TrackQC > & getTrackQC()
Definition Tracking.h:99
void disablePID()
Disable TPC dEdx information.
Definition Tracking.h:96
void setTriggeredBCFT0(std::vector< int > t)
Definition Tracking.h:108
void reset()
Reset the output vector.
Definition Tracking.h:90
void setLocalGainFactors(const o2::trd::LocalGainFactor &localGain)
Definition Tracking.h:102
void init()
Load geometry and apply magnetic field setting.
Definition Tracking.cxx:27
void setApplyShift(bool f)
Definition Tracking.h:84
void setFirstOrbit(uint32_t o)
Definition Tracking.h:109
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
DataProcessorSpec getTRDTrackingQCWriterSpec()
DataProcessorSpec getTRDGlobalTrackingQCSpec(o2::dataformats::GlobalTrackID::mask_t src)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)