Project
Loading...
Searching...
No Matches
DigitizerTask.cxx
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
16
19#include "MFTBase/GeometryTGeo.h"
20#include "MathUtils/Utils.h"
21
22#include <fairlogger/Logger.h> // for LOG
23#include "FairRootManager.h" // for FairRootManager
24
26
27using namespace o2::mft;
28using namespace o2::detectors;
29using namespace o2::utils;
30
32
33//_____________________________________________________________________________
34DigitizerTask::DigitizerTask() : FairTask("MFTDigitizerTask"), mDigitizer() {}
35//_____________________________________________________________________________
37{
38 mDigitsArray.clear();
39 mMCTruthArray.clear();
40 delete mHitsArrayQED; // this special branch is managed by the task
41}
42
47{
49 if (!mgr) {
50 LOG(error) << "Could not instantiate FairRootManager. Exiting ...";
51 return kERROR;
52 }
53
54 mHitsArray = mgr->InitObjectAs<const std::vector<o2::itsmft::Hit>*>("MFTHit");
55 if (!mHitsArray) {
56 LOG(error) << "MFT hits not registered in the FairRootManager. Exiting ...";
57 return kERROR;
58 }
59
60 // Register output container
61 mgr->RegisterAny("MFTDigit", mDigitsArrayPtr, kTRUE);
62 mgr->RegisterAny("MFTDigitMCTruth", mMCTruthArrayPtr, kTRUE);
63
65 geom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::L2G)); // make sure L2G matrices are loaded
66 mDigitizer.setGeometry(geom);
67
68 mDigitizer.setDigits(mDigitsArrayPtr);
69 mDigitizer.setMCLabels(mMCTruthArrayPtr);
70
71 mDigitizer.init();
72
73 return kSUCCESS;
74}
75
76//________________________________________________________
78{
80
81 mDigitsArray.clear();
82 mMCTruthArray.clear();
83
84 double tEvent = mgr->GetEventTime() * mFairTimeUnitInNS; // event time in ns
85
86 // is there QED backgroung provided? Fill QED slots until provided collision time
87 if (mQEDBranch) {
88 processQEDBackground(tEvent);
89 }
90 //
91 mDigitizer.setEventTime(tEvent);
92 // the type of digitization is steered by the DigiParams object of the Digitizer
93 LOG(debug) << "Running digitization on new event " << mEventID << " from source " << mSourceID;
94
95 mDigitizer.process(mHitsArray, mEventID, mSourceID);
96
97 mEventID++;
98}
99
100//________________________________________________________
102{
103 // finalize digitization, if needed, flash remaining digits
104
105 if (!mDigitizer.getParams().isContinuous()) {
106 return;
107 }
108
109 // is there QED backgroung provided? Fill QED slots up to the end of reserved ROFrames
110 if (mQEDBranch) {
111 processQEDBackground(mDigitizer.getEndTimeOfROFMax());
112 }
113
115 mgr->SetLastFill(kTRUE);
116 mDigitsArray.clear();
117 mMCTruthArray.clear();
118 mDigitizer.fillOutputContainer();
119}
120
121//________________________________________________________
122void DigitizerTask::processQEDBackground(double tMax)
123{
124 // process QED time-slots until provided collision time (in ns)
125
126 double tQEDNext = mLastQEDTimeNS + mQEDEntryTimeBinNS;
127
128 while (tQEDNext < tMax) {
129 mLastQEDTimeNS = tQEDNext; // time used for current QED slot
130 tQEDNext += mQEDEntryTimeBinNS; // prepare time for next QED slot
131 if (++mLastQEDEntry >= mQEDBranch->GetEntries()) {
132 mLastQEDEntry = 0; // wrapp if needed
133 }
134 mQEDBranch->GetEntry(mLastQEDEntry);
135 mDigitizer.setEventTime(mLastQEDTimeNS);
136 mDigitizer.process(mHitsArrayQED, mLastQEDEntry, mQEDSourceID);
137 //
138 }
139}
140
141//________________________________________________________
142void DigitizerTask::setQEDInput(TBranch* qed, float timebin, UChar_t srcID)
143{
144 // assign the branch containing hits from QED electrons, whith every entry integrating
145 // timebin ns of collisions
146
147 LOG(info) << "Attaching QED ITS hits as sourceID=" << int(srcID) << ", entry integrates "
148 << timebin << " ns";
149
150 mQEDBranch = qed;
151 mQEDEntryTimeBinNS = timebin;
152 if (mQEDBranch) {
153 assert(mQEDEntryTimeBinNS >= 1.0);
154 mLastQEDTimeNS = -mQEDEntryTimeBinNS / 2; // time will be assigned to the middle of the bin
155 mQEDBranch->SetAddress(&mHitsArrayQED);
156 mLastQEDEntry = -1;
157 mQEDSourceID = srcID;
158 assert(mHitsArrayQED);
159 assert(srcID < o2::MCCompLabel::maxSourceID());
160 }
161}
General auxilliary methods.
Definition of the ITSMFT Hit class.
ClassImp(o2::mft::DigitizerTask)
Task driving the conversion from points to digits (MFT)
std::ostringstream debug
InitStatus
Definition FairTask.h:34
@ kERROR
Definition FairTask.h:36
@ kSUCCESS
Definition FairTask.h:35
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 option
char error[CURL_ERROR_SIZE]
void SetLastFill(Bool_t val=kTRUE)
T InitObjectAs(const char *BrName)
void RegisterAny(const char *name, T *&obj, Bool_t toFile)
static FairRootManager * Instance()
static constexpr int maxSourceID()
bool isContinuous() const
Definition DigiParams.h:54
double getEndTimeOfROFMax() const
Definition Digitizer.h:74
void fillOutputContainer(uint32_t maxFrame=0xffffffff, int layer=-1)
void setGeometry(const o2::itsmft::GeometryTGeo *gm)
Definition Digitizer.h:88
void setMCLabels(o2::dataformats::MCTruthContainer< o2::MCCompLabel > *mclb)
Definition Digitizer.h:59
void setDigits(std::vector< o2::itsmft::Digit > *dig)
Definition Digitizer.h:58
o2::itsmft::DigiParams & getParams()
Definition Digitizer.h:61
void setEventTime(const o2::InteractionTimeRecord &irt, int layer=-1)
void process(const std::vector< Hit > *hits, int evID, int srcID, int layer=-1)
Steer conversion of hits to digits.
void FinishTask() override
InitStatus Init() override
Init function.
void setQEDInput(TBranch *qed, float timebin, UChar_t srcID)
void Exec(Option_t *option) override
void fillMatrixCache(Int_t mask) override
static GeometryTGeo * Instance()
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"