PandaRoot
PndPidCorrelator.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 PID_CORRELATOR_H
14 #define PID_CORRELATOR_H
15 
16 // **************************************************************************
17 // Author: Stefano Spataro e-mail: spataro@to.infn.it
18 //
19 // pid correlator
20 //
21 // Created: 03-07-09
22 // Modified: 2020/21 by Sarah Gaiser (gaiser@hiskp.uni-bonn.de)
23 //
24 // **************************************************************************
25 
26 #include "TString.h"
27 #include "TClonesArray.h"
28 
29 #include "FairLogger.h"
30 #include "FairTask.h"
31 #include "FairRootManager.h"
32 #include "FairGeane.h"
33 #include "PndPropagator.h"
34 
35 #include "PndTrack.h"
36 #include "PndPidCorrPar.h"
37 #include "PndPidCandidate.h"
38 #include "PndPidDetectorInfo.h"
39 #include "PndPidCalorimeterInfo.h"
40 #include "PndPidTrackInfo.h"
42 
43 class TGeant3;
44 
53 class PndPidCorrelator : public FairTask {
54  public:
55  virtual void Exec(Option_t *option);
56  virtual InitStatus Init();
57 
58  void Register();
59  void Reset();
60 
61  PndPidCorrelator(const char *name, const char *title = "Pnd Task",
62  Bool_t use_default_setup = kTRUE);
63  PndPidCorrelator(Bool_t use_default_setup = kTRUE);
64  virtual ~PndPidCorrelator();
65 
66  void SetOption(Option_t *option = " ")
67  {
68  fOption = option;
69  fOption.ToLower();
70  }
71  void SetDebugMode(Bool_t debug) { fDebugMode = debug; };
72  void SetDebugFilename(TString filename) { fDebugFile = filename; };
73  void SetMdtRefit(Bool_t mdt) { fMdtRefit = mdt; };
74  void SetTrackBranch(TString branch) { fTrackBranch = branch; };
75  void SetOutputBranch(TString branch) { fTrackOutBranch = branch; };
76 
77  void SetIdeal(Bool_t id) { fIdeal = id; };
78  void SetFast(Bool_t fast) { fFast = fast; };
79  void SetCorrErrProp(Bool_t err) { fCorrErrorProp = err; };
80  void SetPidHyp(Int_t pid) { fPidHyp = pid; };
81  void SetIdealHyp(Bool_t opt = kTRUE) { fIdealHyp = opt; }
82  void SetFlagCut(Bool_t opt = kTRUE) { fFlagCut = opt; };
83  void SetBackPropagate(Bool_t opt = kTRUE) { fBackPropagate = opt; };
84 
85  void SetUsePropagator(Bool_t use_propagator = kTRUE) { fUsePropagator = use_propagator; };
86 
91  void SetPropagator(PndPropagator* propagator = nullptr);
92 
93  void SetCalorimeterInfo(PndPidCalorimeterInfo *detector_info);
94  void SetBarrelDetectors(std::vector<PndPidDetectorInfo *> barrel_detectors);
95  void AddBarrelDetector(PndPidDetectorInfo *detector_info);
96  void SetForwardDetectors(std::vector<PndPidDetectorInfo *> forward_detectors);
97  void AddForwardDetector(PndPidDetectorInfo *detector_info);
99  void SetTrackingDetectors(std::vector<PndPidTrackingDetectorInfo *> tracking_detectors);
100  void AddTrackingDetector(PndPidTrackingDetectorInfo *detector_info);
101 
102  virtual void SetParContainers();
103  virtual void Finish();
104 
105  protected:
106  TClonesArray *fPidChargedCand = nullptr;
107  TClonesArray *fPidNeutralCand = nullptr;
108 
109  std::map <Int_t, PndPidCandidate *> fCandidateBuffer;
110 
112  FairRootManager *fManager = FairRootManager::Instance();
113 
114  TString fTrackBranch = "";
115  TString fTrackOutBranch = "";
116 
117  Int_t fPidHyp = 0;
118  Bool_t fIdeal = kFALSE;
119  Bool_t fIdealHyp = kFALSE;
120  Bool_t fDoNeutralCand = kFALSE;
121  Bool_t fFast = kFALSE;
122  Bool_t fFlagCut = kFALSE;
123  Bool_t fMdtRefit = kFALSE;
124  Bool_t fCorrErrorProp = kTRUE;
125 
126  Bool_t fDebugMode = kFALSE;
127  TString fDebugDir = "";
128  TString fDebugFile = "";
129  TFile *fFileDebugNtuples = nullptr;
130 
131  Bool_t fUsePropagator = kTRUE;
132  Bool_t fBackPropagate = kTRUE;
134 
137  static Bool_t fHasPrimary;
138 
142 
143  std::vector<PndPidDetectorInfo *> fBarrelDetectors = {};
144  std::vector<PndPidDetectorInfo *> fForwardDetectors = {};
145 
146  // -------
147 
148  void DefaultDetectorSetup();
149  void SetupDetectorParams();
150  void ActivateNeutrals();
151 
156 
157  std::vector<PndPidDetectorInfo *> GetDetectors(const PndTrack::TrackType type);
158 
159  Bool_t CheckTrackProperties(PndTrack *track, const FairTrackParP &par);
160 
167 
173  Int_t FindPidHyp(Int_t pid_hyp);
179  Int_t FindIdealPidHyp(const std::vector<FairLink> *mcTrackLinks);
180 
181  friend class PidCorrelatorHelper;
182 
184 };
185 
186 #endif
void SetPropagator(PndPropagator *propagator=nullptr)
Set propagator for all necessary propagation of tracks.
Int_t FindIdealPidHyp(const std::vector< FairLink > *mcTrackLinks)
Find ideal PID hypothesis from MC information.
friend class PidCorrelatorHelper
needed for unit tests
Bool_t fMdtRefit
Use MDT Kalman refit propagation.
Int_t fEventCounter
Event number.
void SetIdeal(Bool_t id)
void ActivateNeutrals()
void SetBarrelDetectors(std::vector< PndPidDetectorInfo *> barrel_detectors)
virtual void Exec(Option_t *option)
Bool_t fFast
kFALSE: normal; kTRUE: no correlation/extrapolation/neutral
void SetUsePropagator(Bool_t use_propagator=kTRUE)
PndPropagator * fPropagator
Propagator to be used.
virtual void SetParContainers()
Bool_t fCorrErrorProp
Error propagation in correlation.
TFile * fFileDebugNtuples
File for debug ntuples.
TClonesArray * fPidNeutralCand
PndPidCandidate TCA for neutral particles.
PndPidCorrPar * fCorrPar
Correlation parameters.
FairRootManager * fManager
Base class for accessing PID detector information of calorimeter system (EMC, FSC).
virtual ~PndPidCorrelator()
Default destructor.
void AddBarrelDetector(PndPidDetectorInfo *detector_info)
void SetTrackBranch(TString branch)
TString fDebugDir
Ntuple output directory.
void SetPidHyp(Int_t pid)
PndPidCorrelator(const char *name, const char *title="Pnd Task", Bool_t use_default_setup=kTRUE)
Constrcutor setting name and title.
std::vector< PndPidDetectorInfo * > GetDetectors(const PndTrack::TrackType type)
virtual void Finish()
void SetMdtRefit(Bool_t mdt)
Bool_t fBackPropagate
kFALSE -> do not propagate to IP; kTRUE -> propagate to IP
void ConstructChargedCandidates()
Construct PidCandidates by calling GetInfo() on DetectorInfo and TrackInfo classes.
Base class for accessing PID detector information of tracking system (MVD, STT, GEM, FTS).
PndPidTrackingSystemInfo * fTrackingSystemInfo
Class to access pid information from tracking system.
Bool_t fDoNeutralCand
Create neutral candidates.
Bool_t CheckTrackProperties(PndTrack *track, const FairTrackParP &par)
void SetDebugMode(Bool_t debug)
Int_t FindPidHyp(Int_t pid_hyp)
Find PID hypothesis.
void SetTrackingSystemInfo(PndPidTrackingSystemInfo *tracking_info)
PndPidDetectorParams::DetectorParams fDetectorParams
void SetupDetectorParams()
TString fTrackOutBranch
Options to choose output branch.
void AddTrackingDetector(PndPidTrackingDetectorInfo *detector_info)
void SetDebugFilename(TString filename)
PndPidCandidate * AddChargedCandidate(PndPidCandidate *cand)
Add charged candidate to charged candidate TCA.
void AddForwardDetector(PndPidDetectorInfo *detector_info)
ClassDef(PndPidCorrelator, 4)
static Bool_t fHasPrimary
Int_t fPidHyp
particle hypothesis for propagation
Bool_t fDebugMode
If true fill ntuples for debug.
Class for combining all PID track information.
Bool_t fFlagCut
kFALSE: all the tracks; kTRUE: store tracks only if flag>0
TClonesArray * fPidChargedCand
PndPidCandidate TCA for charged particles.
void DefaultDetectorSetup()
TString fTrackBranch
Options to choose PndTrack branches.
void SetCorrErrProp(Bool_t err)
std::vector< PndPidDetectorInfo * > fBarrelDetectors
Vector of barrel detectors.
void SetBackPropagate(Bool_t opt=kTRUE)
Bool_t fUsePropagator
Use propagation.
Bool_t fIdealHyp
Flag to use MC particle hypothesis.
Base class for accessing PID detector information.
void SetTrackingDetectors(std::vector< PndPidTrackingDetectorInfo *> tracking_detectors)
Bool_t fIdeal
Ideal Correlation.
PndPidCalorimeterInfo * fCalorimeterInfo
Class to access EMC/FSC pid information.
Propagator interface class for PandaRoot.
Definition: PndPropagator.h:64
void SetCalorimeterInfo(PndPidCalorimeterInfo *detector_info)
void SetIdealHyp(Bool_t opt=kTRUE)
virtual InitStatus Init()
void SetForwardDetectors(std::vector< PndPidDetectorInfo *> forward_detectors)
The PID Correlator class.
void SetFast(Bool_t fast)
void SetFlagCut(Bool_t opt=kTRUE)
void SetOption(Option_t *option=" ")
void SetOutputBranch(TString branch)
TString fDebugFile
Ntuple output file.
std::vector< PndPidDetectorInfo * > fForwardDetectors
Vector of forward detectors.
std::map< Int_t, PndPidCandidate * > fCandidateBuffer
Bool_t fUseDefaultDetectorSetup
If true DefaultDetectorSetup() is called in constructor.