PandaRoot
PndGFRecoTask.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "PndPersistencyTask.h"
12 #include "PndTrack.h"
13 #include "PndGFRecoFit.h"
14 #include "FairLogger.h"
15 
16 #include "TString.h"
17 #include "TClonesArray.h"
18 #include "TMath.h"
19 
20 #include <vector>
21 //#include "eventDisplay/include/EventDisplay.h"
22 
23 class TClonesArray;
24 class MeasurementFactory;
25 class TDatabasePDG;
26 
27 struct PndGFPidHypo {
28 
30  PndGFPidHypo(int pdgvalue)
31  {
32  switch (TMath::Abs(pdgvalue)) {
33  case 11:
34  fPdgNumber = -11;
35  fParticleName = "Electron";
36  break;
37  case 13:
38  fPdgNumber = -13;
39  fParticleName = "Muon";
40  break;
41  case 211:
42  fPdgNumber = 211;
43  fParticleName = "Pion";
44  break;
45  case 321:
46  fPdgNumber = 321;
47  fParticleName = "Kaon";
48  break;
49  case 2212:
50  fPdgNumber = 2212;
51  fParticleName = "Proton";
52  break;
53  default: LOG(error) << "Wrong particle ID given: " << pdgvalue; LOG(error) << "Allowed values are: 11, 13, 211, 321, 2212";
54  }
55  };
56  int fPdgNumber = 0;
57  TString fParticleName;
58  TClonesArray *fArray = nullptr;
59 };
60 
62  public:
63  // Constructors/Destructors ---------
64  PndGFRecoTask(const char *name = "Genfit", Int_t iVerbose = 0);
65  ~PndGFRecoTask();
66 
72  void AddParticleHypo(int pdgCode);
73 
78  void SetMultiPID();
79 
85  void UseIdealPID(bool val = true, Int_t defaultPID = 211)
86  {
87  fIdealPID = val;
88  fDefaultPID = defaultPID;
89  }
90 
95  void SetTrackInBranchName(TString name) { fInputBranchName = name; }
96 
100  void SetTrackOutBranchName(TString name) { fOutputBranchName = name; }
101 
105  void SetFitter(genfit::AbsKalmanFitter *fitter);
106 
110  void SetNBusyCut(int val) { fNBusyCut = val; }
111 
112  void UseEventDisplay(bool val = true) { fUseEventDisplay = val; }
113 
114  // Operations ----------------------
115  virtual InitStatus Init();
116  void SetParContainers();
117  virtual void Exec(Option_t *opt);
118  virtual void FinishTask() {}
119 
120  protected:
121  int GetIdealPdgCode(PndTrack *track);
123  {
124  for (auto &track : fPidHypothesis) {
125  track.fArray->Delete();
126  }
127  }
128 
129  private:
130  TClonesArray *fPrefitTrack = nullptr; //< Input from track finder
131  TClonesArray *fMCTrack = nullptr; //< MC tracks needed for ideal PID
132  std::vector<PndGFPidHypo> fPidHypothesis; //< Pid Hypothesis to fit with. Can be more than one.
133  TString fInputBranchName = ""; //< Name of branch with prefit track data
134  TString fOutputBranchName = ""; //< Name of output branch with fitted track data
135  bool fIdealPID = false; //< Flag to use ideal PID instead of PID hypothesis
136  bool fMultiPID = true; //< Flag
137  int fDefaultPID = 211; //< PID assumption if no PID hypothesis is given
138  TDatabasePDG *fPdg = nullptr; //< Needed by GetIdealPdgCode
139  int fNBusyCut = 50; //< Events with tracks above NBusyCut are ignored
140  bool fUseEventDisplay = false; //< Enables genfit2 event display for PndGFRecoFit
141  PndGFRecoFit fFit;
142 
143  ClassDef(PndGFRecoTask, 2);
144 };
void UseIdealPID(bool val=true, Int_t defaultPID=211)
Flag to use ideal PID from MC tracks instead of particle hypothesis.
Definition: PndGFRecoTask.h:85
PndGFPidHypo(int pdgvalue)
Definition: PndGFRecoTask.h:30
Abstract base class for Kalman fitter and derived fitting algorithms.
static T Abs(const T &x)
Definition: PndCAMath.h:56
TClonesArray * fArray
Definition: PndGFRecoTask.h:58
void DeleteOldTracks()
Class to perform a kalman fit via genfit2 within PandaRoot.
Definition: PndGFRecoFit.h:21
TString fParticleName
Definition: PndGFRecoTask.h:57
void SetNBusyCut(int val)
Cut to suppress events with too many tracks.
virtual void FinishTask()
Task to perform kalman tracking via genfit2.
Definition: PndGFRecoTask.h:61
void SetTrackOutBranchName(TString name)
Name of the output branch containing the fitted PndTracks.
void SetTrackInBranchName(TString name)
Set the name of the input branch Set the name of the input branch with the prefit PndTracks...
Definition: PndGFRecoTask.h:95
void UseEventDisplay(bool val=true)