PandaRoot
PndSttCellTrackFinderTask.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef PndSttCellTrackFinderTask_H_
14 #define PndSttCellTrackFinderTask_H_
15 
16 #include "FairTask.h"
17 #include "PndGeoSttPar.h"
18 #include "PndSttGeometryMap.h"
19 #include "PndSttStrawMap.h"
20 #include "PndSttCellTrackFinder.h"
21 #include "FairTSBufferFunctional.h"
22 
23 #include <vector>
24 
25 #ifdef RUNCUDA
26 extern "C" int *AllocateStaticData(int *, int);
27 extern "C" void FreeStaticData(int *);
28 #endif
29 
30 class PndSttCellTrackFinderTask : public FairTask {
31  public:
33  : FairTask("Stt Cell Track Finder"), fClusterTime(250.0), fUseGPU(kFALSE), fDev_tubeNeighborings(nullptr), fRunTimeBased(kFALSE), fRunWithSortedHits(kFALSE),
34  fCalcWithCorrectedIsochrones(kFALSE), fVerbose(0), fPersistence(kTRUE), fAnalyseSteps(kFALSE), fTrackFinder(nullptr)
35  {
36  fOutBranchNamePrefix = "";
37  fInBranchNamePrefix = "";
38  };
39 
41 
43  virtual void SetParContainers();
44  virtual InitStatus Init();
45  // virtual InitStatus ReInit();
46 
48  virtual void Exec(Option_t *opt);
49 
50  virtual void FinishEvent();
51 
52  virtual void FinishTask();
53 
54  // void AddHitBranch(TString branchName);//Has to be called before Init() is used otherwise the default names are taken!
55 
56  void SetVerbose(Int_t verbose) { fVerbose = verbose; };
57  void SetPersistence(Bool_t val) { fPersistence = val; };
58  void SetAnalyseSteps(Bool_t val) { fAnalyseSteps = val; };
59  void SetUseGPU(Bool_t val) { fUseGPU = val; };
60  void SetRunTimeBased(Bool_t val) { fRunTimeBased = val; };
61  void SetRunWithSortedHits(Bool_t val) { fRunWithSortedHits = val; };
62  void SetClusterTime(double val) { fClusterTime = val; }; // J.R. 20/04-2018
63  void SetCalcWithCorrectedIsochrones(Bool_t val) { fCalcWithCorrectedIsochrones = val; }
64  // define a Prefix for the Output in case you run more Instances of the CellTrackFinderTask
65  void SetOutBranchNamePrefix(TString prefix) { fOutBranchNamePrefix = prefix + "_"; };
66  // set a prefix for the defoult inbut Branch names
67  void SetInBranchNamePrefix(TString prefix) { fInBranchNamePrefix = prefix + "_"; };
68  // if nothing is defined, the standard STTHit branches are used.
69  // If InputBranches are defined, so far only Branches holding data of type STTHit are further processed (See "initHitArray" method)
70  void AddHitBranch(TString branchName) { fHitBranch.push_back(branchName); };
71  // initialise all STTHit type data, If someone wants to change this also the "Addhit" method of the Trackfinder must be adapted!
72  void InitHitArray(TString branchName);
73 
74  private:
75  BinaryFunctor *fFunctorCellTrack;
76 
77  double fStopTimeValueCellTrack;
78 
79  double fClusterTime;
80  // for GPU computing
81  Bool_t fUseGPU;
82  int *fDev_tubeNeighborings;
83 
84  Bool_t fRunTimeBased;
85  Bool_t fRunWithSortedHits;
86 
87  Bool_t fCalcWithCorrectedIsochrones;
88 
89  TString fOutBranchNamePrefix;
90  TString fInBranchNamePrefix;
91 
92  std::vector<TString> fHitBranch;
93  std::vector<TString> fSTTHitBranch;
94  // TString fTrackBranch;
95 
96  std::vector<TClonesArray *> fSTTHitArray;
97 
98  // first step of trackfinding
99  TClonesArray *fFirstTrackCandArray;
100  TClonesArray *fFirstTrackArray;
101  TClonesArray *fFirstRiemannTrackArray;
102 
103  // second step of trackfinding
104  TClonesArray *fCombiTrackCandArray;
105  TClonesArray *fCombiRiemannTrackArray;
106  TClonesArray *fCombiTrackArray;
107  TClonesArray *fCorrectedIsochronesArray;
108 
109  Int_t fVerbose;
110  Bool_t fPersistence; // safe data?
111  Bool_t fAnalyseSteps; // if true, results of first step (generating tracklets) will be stored for AnalysisTask
112 
113  PndGeoSttPar *fSttParameters; // needed for SttStrawMap
114  TClonesArray *fTubeArray; // needed for SttStrawMap
115 
116  PndSttGeometryMap *fSttGeometryMap;
117  PndSttStrawMap *fSttStrawMap;
118  PndSttCellTrackFinder *fTrackFinder;
119 
120  TClonesArray *fEventHeader;
121 
122  // for runtime analysis: numHits, numHitsWithoutDouble, numUnambiguousHits
123  std::vector<std::vector<int>> fNumHitsPerEvent;
124 
125  int eventNumber; // J.R. For testing purpouses
126 
127  ClassDef(PndSttCellTrackFinderTask, 1);
128 };
129 
130 #endif /*PndSttCellTrackFinderTask_H_*/
virtual void FinishEvent()
virtual void Exec(Option_t *opt)
virtual void SetParContainers()
void SetOutBranchNamePrefix(TString prefix)
virtual InitStatus Init()
void AddHitBranch(TString branchName)
void SetInBranchNamePrefix(TString prefix)
void InitHitArray(TString branchName)
void SetCalcWithCorrectedIsochrones(Bool_t val)
virtual void FinishTask()