Project
Loading...
Searching...
No Matches
FairTask.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3 * *
4 * This software is distributed under the terms of the *
5 * GNU Lesser General Public Licence (LGPL) version 3, *
6 * copied verbatim in the file "LICENSE" *
7 ********************************************************************************/
8// ----- FairTask source file -----
9// ----- Created 12/01/04 by M. Al-Turany / D. Bertini -----
10
11#include "FairTask.h"
12
13#include "FairLogger.h" // for FairLogger, MESSAGE_ORIGIN
14#include "FairMonitor.h" // for FairMonitor
15
16#include <TCollection.h> // for TIter
17#include <TList.h> // for TList
18#include <TObject.h> // for TObject
19#include <cstdio> // printf
20#include <utility> // pair
21
23 : TTask()
24 , fVerbose(0)
25 , fInputPersistance(-1)
26 , fLogger(FairLogger::GetLogger())
27 , fStreamProcessing(kFALSE)
28 , fOutputPersistance()
29{}
30
31FairTask::FairTask(const char* name, Int_t iVerbose)
32 : TTask(name, "FairTask")
33 , fVerbose(iVerbose)
34 , fInputPersistance(-1)
35 , fLogger(FairLogger::GetLogger())
36 , fOutputPersistance()
37{}
38
40
42{
44 if (!fActive) {
45 return;
46 }
47 InitStatus tStat = Init();
48 if (tStat == kFATAL) {
49 LOG(fatal) << "Initialization of Task " << fName.Data() << " failed fatally";
50 }
51 if (tStat == kERROR) {
52 fActive = kFALSE;
53 }
55 InitTasks();
56}
57
59{
60 if (!fActive) {
61 return;
62 }
63 InitStatus tStat = ReInit();
64 if (tStat == kFATAL) {
65 LOG(fatal) << "Reinitialization of Task " << fName.Data() << " failed fatally";
66 }
67 if (tStat == kERROR) {
68 fActive = kFALSE;
69 }
71}
72
74{
75 if (!fActive) {
76 return;
77 }
80}
81
83{
84 if (!fActive) {
85 return;
86 }
88}
89
91{
92 if (!fActive) {
93 return;
94 }
95 Finish();
97}
98
99void FairTask::SetVerbose(Int_t iVerbose)
100{
101 fVerbose = iVerbose;
102 TIter next(GetListOfTasks());
103 FairTask* task;
104 while ((task = dynamic_cast<FairTask*>(next()))) {
105 task->SetVerbose(iVerbose);
106 }
107}
108
110{
111 TIter next(GetListOfTasks());
112 FairTask* task;
113 while ((task = dynamic_cast<FairTask*>(next()))) {
114 task->InitTask();
115 }
116}
117
119{
120 // Execute main task and its subtasks.
121 // When calling this function, the Exec function of the corresponding class
122 // is invoked, then the list of its subtasks is executed calling recursively
123 // all the subtasks, etc.
124 //
125 // The option parameter may be used to select different execution steps
126 // within a task. This parameter is passed also to all the subtasks.
127
128 if (fgBeginTask) {
129 Error("ExecuteTask", "Cannot execute task:%s, already running task: %s", GetName(), fgBeginTask->GetName());
130 return;
131 }
132 if (!IsActive())
133 return;
134
135 fOption = option;
136 fgBeginTask = this;
137 fgBreakPoint = 0;
138
139 if (fBreakin)
140 return;
141 if (gDebug > 1) {
142 LOG(info) << "Execute task:" << GetName() << " : " << GetTitle();
143 }
145 Exec(option);
147
148 fHasExecuted = kTRUE;
150
151 if (fBreakout)
152 return;
153
154 if (!fgBreakPoint) {
155 fgBeginTask->CleanTasks();
156 fgBeginTask = 0;
157 }
158}
159
161{
162 // Execute all the subtasks of a task.
163
164 TIter next(fTasks);
165 FairTask* task;
166 while ((task = static_cast<FairTask*>(next()))) {
167 if (fgBreakPoint)
168 return;
169 if (!task->IsActive())
170 continue;
171 if (task->fHasExecuted) {
172 task->ExecuteTasks(option);
173 continue;
174 }
175 if (task->fBreakin == 1) {
176 printf("Break at entry of task: %s\n", task->GetName());
177 fgBreakPoint = this;
178 task->fBreakin++;
179 return;
180 }
181
182 if (gDebug > 1) {
183 LOG(info) << "Execute task:" << task->GetName() << " : " << task->GetTitle();
184 }
186 task->Exec(option);
188
189 task->fHasExecuted = kTRUE;
190 task->ExecuteTasks(option);
191 if (task->fBreakout == 1) {
192 printf("Break at exit of task: %s\n", task->GetName());
193 fgBreakPoint = this;
194 task->fBreakout++;
195 return;
196 }
197 }
198}
199
201{
202 TIter next(GetListOfTasks());
203 FairTask* task;
204 while ((task = dynamic_cast<FairTask*>(next()))) {
205 task->ReInitTask();
206 }
207}
208
210{
211 TIter next(GetListOfTasks());
212 FairTask* task;
213 while ((task = dynamic_cast<FairTask*>(next()))) {
214 task->SetParTask();
215 }
216}
217
219{
220 TIter next(GetListOfTasks());
221 FairTask* task;
222 while ((task = dynamic_cast<FairTask*>(next()))) {
223 task->FinishTask();
224 }
225}
226
228{
229 TIter next(GetListOfTasks());
230 FairTask* task;
231 while ((task = dynamic_cast<FairTask*>(next()))) {
232 task->FinishEvent();
233 }
234}
235
236void FairTask::SetOutputBranchPersistent(TString branchName, Bool_t persistence)
237{
238 fOutputPersistance.insert(std::pair<TString, Bool_t>(branchName, persistence));
239}
240
241Bool_t FairTask::IsOutputBranchPersistent(TString branchName)
242{
243 std::map<TString, Bool_t>::iterator it = fOutputPersistance.find(branchName);
244 if (it != fOutputPersistance.end()) {
245 return it->second;
246 } else {
247 return kTRUE;
248 }
249}
250
ClassImp(FairTask)
InitStatus
Definition FairTask.h:34
@ kFATAL
Definition FairTask.h:37
@ kERROR
Definition FairTask.h:36
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
void StartMonitoring(const TTask *tTask, const char *identStr)
Definition FairMonitor.h:42
void StopMonitoring(const TTask *tTask, const char *identStr)
Definition FairMonitor.h:47
static FairMonitor * GetMonitor()
void SetCurrentTask(TTask *tTask)
Definition FairMonitor.h:64
void FinishTasks()
Definition FairTask.cxx:218
void SetOutputBranchPersistent(TString, Bool_t)
Definition FairTask.cxx:236
void SetParTasks()
Definition FairTask.cxx:209
virtual void Finish()
Definition FairTask.h:123
virtual void ExecuteTasks(Option_t *option)
Definition FairTask.cxx:160
virtual InitStatus ReInit()
Definition FairTask.h:113
void SetVerbose(Int_t iVerbose)
Definition FairTask.cxx:99
void InitTasks()
Definition FairTask.cxx:109
virtual void ExecuteTask(Option_t *option="0")
Definition FairTask.cxx:118
void FinishEvents()
Definition FairTask.cxx:227
virtual void FinishTask()
Definition FairTask.cxx:90
virtual InitStatus Init()
Definition FairTask.h:108
void SetParTask()
Definition FairTask.cxx:73
void ReInitTasks()
Definition FairTask.cxx:200
void InitTask()
Definition FairTask.cxx:41
Int_t fVerbose
Definition FairTask.h:100
Bool_t IsOutputBranchPersistent(TString)
Definition FairTask.cxx:241
virtual void SetParContainers()
Definition FairTask.h:118
void ReInitTask()
Definition FairTask.cxx:58
virtual ~FairTask()
Definition FairTask.cxx:39
virtual void FinishEvent()
Definition FairTask.cxx:82
GLuint const GLchar * name
Definition glcorearb.h:781
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"