CbmRoot
Loading...
Searching...
No Matches
LmvmTask.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2021 UGiessen, JINR-LIT
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer], Elena Lebedeva, Florian Uhlig */
4
5#ifndef LMVM_TASK_H
6#define LMVM_TASK_H
7
8#include "CbmGlobalTrack.h"
9#include "CbmKFVertex.h"
10
11#include "FairMCEventHeader.h"
12#include "FairRootManager.h"
13#include "FairTask.h"
14
15#include <fstream>
16#include <map>
17#include <string>
18#include <vector>
19
20#include "LmvmCand.h"
21#include "LmvmCuts.h"
22#include "LmvmDef.h"
23#include "LmvmHist.h"
24#include "LmvmKinePar.h"
25
26class TClonesArray;
27class TH2D;
28class TH1D;
29class TH2F;
30class TRandom3;
31
32
33class LmvmTask : public FairTask {
34
35public:
36 /*
37 * \brief Standard constructor.
38 */
39 LmvmTask();
40
41 /*
42 * \brief Standard destructor.
43 */
44 virtual ~LmvmTask();
45
46 /*
47 * \brief Inherited from FairTask.
48 */
49 virtual InitStatus Init();
50
51 /*
52 * \brief Inherited from FairTask.
53 */
54 virtual void Exec(Option_t* option);
55
56 template<typename T>
57 T* InitOrFatal(const std::string& name)
58 {
59 FairRootManager* ioman = FairRootManager::Instance();
60 if (ioman == nullptr) { LOG(fatal) << "LmvmTask::Init No FairRootManager!"; }
61 T* array = static_cast<T*>(ioman->GetObject(name.c_str()));
62 if (array == nullptr) { LOG(fatal) << "LmvmTask::Init No " << name << " object!"; }
63 return array;
64 }
65
66 /*
67 * \brief Fills histograms for pairs.
68 * \param[in] candP Positive candidate.
69 * \param[in] candM Negative candidate.
70 * \param[in] step Enumeration AnalysisSteps, specify analysis step.
71 * \param[in] parRec Kinematic parameters for reconstructed pair.
72 */
73 void PairSource(const LmvmCand& candP, const LmvmCand& candM, ELmvmAnaStep step, const LmvmKinePar& parRec);
74
75 /*
76 * \brief Fills minv, pty, mom histograms for specified analysis step.
77 * \param[in] candP Positive candidate.
78 * \param[in] candM Negative candidate.
79 * \param[in] parMc MC kinematic parameters.
80 * \param[in] parRec Reconstructed kinematic parameters.
81 * \param[in] step Enumeration AnalysisSteps, specify analysis step.
82 */
83 void FillPairHists(const LmvmCand& candP, const LmvmCand& candM, const LmvmKinePar& parMc, const LmvmKinePar& parRec,
84 ELmvmAnaStep step);
85
86 void FillMomHists(const CbmMCTrack* mct, const LmvmCand* cand, ELmvmSrc src, ELmvmAnaStep step);
87
88 void TrackSource(const LmvmCand& cand, ELmvmAnaStep step, int pdg);
89
90 void BgPairPdg(const LmvmCand& candP, const LmvmCand& candM, ELmvmAnaStep step);
91
92 void DoMcTrack();
93
94 void DoMcPair();
95
97
98 bool IsMcTrackAccepted(int mcTrackInd);
99
100 void RichPmtXY();
101
102 void FillTopologyCands();
103
104 void FillCands();
105
106 void AssignMcToCands(std::vector<LmvmCand>& cands);
107
108 void AssignMcToTopologyCands(std::vector<LmvmCand>& topoCands);
109
110 void DifferenceSignalAndBg(const LmvmCand& cand);
111
112 /*
113 * \brief Initialize all histograms.
114 */
115 void InitHists();
116
117 double MinvScale(double minv);
118
119 void AnalyseCandidates();
120
121 void AnalyseGlobalTracks();
122 void CheckMismatches(const CbmGlobalTrack* gTrack, int pdg, bool isElectron, const std::string& ptcl, double weight);
123 void BetaMom(const CbmMCTrack* mct, const CbmGlobalTrack* gTrack, const std::string& ptcl);
124 void CheckTofIdentification(const CbmGlobalTrack* gTrack, const std::string& pidString, double mom, double m2,
125 int pdg, bool isTofEl);
126 void PidVsMom(const CbmGlobalTrack* gTrack, int iGTrack, int pdg, double mom);
127
129
130 /*
131 * \brief
132 * \param[in] mvdStationNum MVD station number.
133 * \param[in, out] hist Vector of histograms for different source types.
134 */
135 void CheckClosestMvdHit(int mvdStationNum, const std::string& hist, const std::string& histQa);
136
137 /*
138 * \brief Set cut values and fill histograms for topology cut
139 * \param[in] cutName ST or TT
140 */
141 void CheckTopologyCut(ELmvmTopologyCut cut, const std::string& name);
142
143 void CalculateNofTopologyPairs(const std::string& name, ELmvmSrc src);
144
145 void MvdCutMcDistance();
146
147 void CombinatorialPairs();
148
149 void FillCandPidValues(const CbmMCTrack* mcTrack, const LmvmCand& cand, ELmvmAnaStep step);
150
151 void CheckTofId(const CbmMCTrack* mcTrack, const LmvmCand& cand, ELmvmAnaStep step, int pdg);
152 bool IsInTofPile(double mom, double m2);
153
154 std::string GetPidString(const CbmMCTrack* mct, const LmvmCand* cand);
155 std::string GetPidString(double vertexMag, int pdg);
156
157 /*
158 * \brief Check if global track has entries in all detectors.
159 */
160 bool IsInAllDets(const CbmGlobalTrack* gTrack);
161
162 bool IsPrimary(double vertexMag);
163
164 virtual void Finish();
165
167
168private:
171
172 FairMCEventHeader* fMCEventHeader = nullptr;
173 TClonesArray* fMCTracks = nullptr;
174 TClonesArray* fRichRings = nullptr;
175 TClonesArray* fRichProj = nullptr;
176 TClonesArray* fRichPoints = nullptr;
177 TClonesArray* fRichRingMatches = nullptr;
178 TClonesArray* fRichHits = nullptr;
179 TClonesArray* fGlobalTracks = nullptr;
180 TClonesArray* fStsTracks = nullptr;
181 TClonesArray* fStsTrackMatches = nullptr;
182 TClonesArray* fStsHits = nullptr;
183 TClonesArray* fMvdHits = nullptr;
184 TClonesArray* fMvdPoints = nullptr;
185 TClonesArray* fMvdHitMatches = nullptr;
186 TClonesArray* fTrdTracks = nullptr;
187 TClonesArray* fTrdHits = nullptr;
188 TClonesArray* fTrdTrackMatches = nullptr;
189 TClonesArray* fTofHits = nullptr;
190 TClonesArray* fTofHitsMatches = nullptr;
191 TClonesArray* fTofPoints = nullptr;
192 TClonesArray* fTofTracks = nullptr;
195
196 bool fUseMvd = false;
197
198 std::vector<LmvmCand> fCands;
199 std::vector<LmvmCand> fCandsTotal;
200 // STCut Segmented tracks, reconstructed only in STS
201 std::vector<LmvmCand> fSTCands;
202 // TTCut Reconstructed tracks, reconstructed in all detectors but not identified as electrons
203 std::vector<LmvmCand> fTTCands;
204 // RTCut Reconstructed tracks, reconstructed in STS + at least in one of the detectro (RICH, TRD, TOF)
205 std::vector<LmvmCand> fRTCands;
206
207 double fW = 0.; //Multiplicity*BR
208
209 double fPionMisidLevel = -1.; // For the ideal particle identification cases, set to -1 for real PID
210
211 int fEventNumber = 0; // number of current event
212 LmvmCuts fCuts; // electorn identification and analisys cuts
213
214 LmvmHist fH; // histogram manager
215
216 std::map<int, int> fNofHitsInRingMap; // Number of hits in the MC RICH ring
217
218 double fZ = -44.; // z-position of target
219
220 std::string fParticle = "";
221
222public:
223 void SetUseMvd(bool use) { fUseMvd = use; }
224 void SetWeight(double w) { fW = w; }
225 void SetEnergyAndPlutoParticle(const std::string& energy, const std::string& particle);
226 void SetPionMisidLevel(double level) { fPionMisidLevel = level; }
227};
228
229#endif
ELmvmSrc
Definition LmvmDef.h:23
ELmvmAnaStep
Definition LmvmDef.h:34
ELmvmTopologyCut
Definition LmvmDef.h:15
TClonesArray * fRichHits
Definition LmvmTask.h:178
void CombinatorialPairs()
void CheckGammaConvAndPi0()
void AnalyseCandidates()
virtual ~LmvmTask()
Definition LmvmTask.cxx:58
std::map< int, int > fNofHitsInRingMap
Definition LmvmTask.h:216
void InitHists()
Definition LmvmTask.cxx:61
void RichPmtXY()
Definition LmvmTask.cxx:490
std::string fParticle
Definition LmvmTask.h:220
TClonesArray * fRichRingMatches
Definition LmvmTask.h:177
FairMCEventHeader * fMCEventHeader
Definition LmvmTask.h:172
std::vector< LmvmCand > fSTCands
Definition LmvmTask.h:201
TClonesArray * fRichProj
Definition LmvmTask.h:175
void AssignMcToTopologyCands(std::vector< LmvmCand > &topoCands)
TClonesArray * fMCTracks
Definition LmvmTask.h:173
TClonesArray * fMvdHitMatches
Definition LmvmTask.h:185
TClonesArray * fRichRings
Definition LmvmTask.h:174
void DoMcTrack()
Definition LmvmTask.cxx:396
double fPionMisidLevel
Definition LmvmTask.h:209
LmvmCuts fCuts
Definition LmvmTask.h:212
TClonesArray * fTofPoints
Definition LmvmTask.h:191
bool IsPrimary(double vertexMag)
double MinvScale(double minv)
Definition LmvmTask.cxx:363
TClonesArray * fTofHitsMatches
Definition LmvmTask.h:190
void SetWeight(double w)
Definition LmvmTask.h:224
std::vector< LmvmCand > fCandsTotal
Definition LmvmTask.h:199
TClonesArray * fMvdPoints
Definition LmvmTask.h:184
void FillPairHists(const LmvmCand &candP, const LmvmCand &candM, const LmvmKinePar &parMc, const LmvmKinePar &parRec, ELmvmAnaStep step)
void BgPairPdg(const LmvmCand &candP, const LmvmCand &candM, ELmvmAnaStep step)
void CalculateNofTopologyPairs(const std::string &name, ELmvmSrc src)
void DoMcPair()
Definition LmvmTask.cxx:450
LmvmTask(const LmvmTask &)
CbmKFVertex fKFVertex
Definition LmvmTask.h:194
void SetEnergyAndPlutoParticle(const std::string &energy, const std::string &particle)
TClonesArray * fRichPoints
Definition LmvmTask.h:176
std::vector< LmvmCand > fTTCands
Definition LmvmTask.h:203
std::vector< LmvmCand > fCands
Definition LmvmTask.h:198
int fEventNumber
Definition LmvmTask.h:211
void FillCands()
Definition LmvmTask.cxx:977
void MvdCutMcDistance()
void TrackSource(const LmvmCand &cand, ELmvmAnaStep step, int pdg)
TClonesArray * fMvdHits
Definition LmvmTask.h:183
bool fUseMvd
Definition LmvmTask.h:196
bool IsInTofPile(double mom, double m2)
Definition LmvmTask.cxx:653
void AssignMcToCands(std::vector< LmvmCand > &cands)
void AnalyseGlobalTracks()
Definition LmvmTask.cxx:520
TClonesArray * fStsHits
Definition LmvmTask.h:182
LmvmHist fH
Definition LmvmTask.h:214
void CheckClosestMvdHit(int mvdStationNum, const std::string &hist, const std::string &histQa)
TClonesArray * fTofTracks
Definition LmvmTask.h:192
bool IsMcTrackAccepted(int mcTrackInd)
Definition LmvmTask.cxx:511
TClonesArray * fStsTrackMatches
Definition LmvmTask.h:181
virtual InitStatus Init()
Definition LmvmTask.cxx:270
virtual void Exec(Option_t *option)
Definition LmvmTask.cxx:308
TClonesArray * fTofHits
Definition LmvmTask.h:189
ClassDef(LmvmTask, 1)
void BetaMom(const CbmMCTrack *mct, const CbmGlobalTrack *gTrack, const std::string &ptcl)
Definition LmvmTask.cxx:754
TClonesArray * fTrdHits
Definition LmvmTask.h:187
TClonesArray * fTrdTracks
Definition LmvmTask.h:186
std::string GetPidString(const CbmMCTrack *mct, const LmvmCand *cand)
void CheckTofId(const CbmMCTrack *mcTrack, const LmvmCand &cand, ELmvmAnaStep step, int pdg)
T * InitOrFatal(const std::string &name)
Definition LmvmTask.h:57
void SetPionMisidLevel(double level)
Definition LmvmTask.h:226
LmvmTask & operator=(const LmvmTask &)
void DifferenceSignalAndBg(const LmvmCand &cand)
void FillCandPidValues(const CbmMCTrack *mcTrack, const LmvmCand &cand, ELmvmAnaStep step)
TClonesArray * fTrdTrackMatches
Definition LmvmTask.h:188
void CheckTopologyCut(ELmvmTopologyCut cut, const std::string &name)
TClonesArray * fGlobalTracks
Definition LmvmTask.h:179
void FillTopologyCands()
Definition LmvmTask.cxx:910
void CheckTofIdentification(const CbmGlobalTrack *gTrack, const std::string &pidString, double mom, double m2, int pdg, bool isTofEl)
Definition LmvmTask.cxx:677
void PidVsMom(const CbmGlobalTrack *gTrack, int iGTrack, int pdg, double mom)
Definition LmvmTask.cxx:655
double fW
Definition LmvmTask.h:207
double fZ
Definition LmvmTask.h:218
std::vector< LmvmCand > fRTCands
Definition LmvmTask.h:205
CbmVertex * fPrimVertex
Definition LmvmTask.h:193
void FillMomHists(const CbmMCTrack *mct, const LmvmCand *cand, ELmvmSrc src, ELmvmAnaStep step)
Definition LmvmTask.cxx:375
virtual void Finish()
void FillRichRingNofHits()
Definition LmvmTask.cxx:348
void PairSource(const LmvmCand &candP, const LmvmCand &candM, ELmvmAnaStep step, const LmvmKinePar &parRec)
void SetUseMvd(bool use)
Definition LmvmTask.h:223
bool IsInAllDets(const CbmGlobalTrack *gTrack)
Definition LmvmTask.cxx:888
void CheckMismatches(const CbmGlobalTrack *gTrack, int pdg, bool isElectron, const std::string &ptcl, double weight)
Definition LmvmTask.cxx:772
TClonesArray * fStsTracks
Definition LmvmTask.h:180