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, Cornelius Feier-Riesen */
4
5#ifndef LMVM_TASK_H
6#define LMVM_TASK_H
7
8#include "CbmDigiManager.h"
9#include "CbmGlobalTrack.h"
10#include "CbmKFVertex.h"
11#include "CbmStsKFTrackFitter.h"
12#include "FairMCEventHeader.h"
13#include "FairRootManager.h"
14#include "FairTask.h"
15#include "LmvmCand.h"
16#include "LmvmCuts.h"
17#include "LmvmDef.h"
18#include "LmvmHist.h"
19#include "LmvmKinePar.h"
20
21#include <fstream>
22#include <map>
23#include <string>
24#include <vector>
25
26class TClonesArray;
27class TH2D;
28class TH1D;
29class TH2F;
30class TRandom3;
31
32
33class LmvmTask : public FairTask {
34
35 public:
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) {
61 LOG(fatal) << "LmvmTask::Init No FairRootManager!";
62 }
63 T* array = static_cast<T*>(ioman->GetObject(name.c_str()));
64 if (array == nullptr) {
65 LOG(fatal) << "LmvmTask::Init No " << name << " object!";
66 }
67 return array;
68 }
69
70 /*
71 * \brief Fills histograms for pairs.
72 * \param[in] candP Positive candidate.
73 * \param[in] candM Negative candidate.
74 * \param[in] step Enumeration AnalysisSteps, specify analysis step.
75 * \param[in] parRec Kinematic parameters for reconstructed pair.
76 */
77 void PairSource(const LmvmCand& candP, const LmvmCand& candM, ELmvmAnaStep step, const LmvmKinePar& parRec);
78
79 /*
80 * \brief Fills minv, pty, mom histograms for specified analysis step.
81 * \param[in] candP Positive candidate.
82 * \param[in] candM Negative candidate.
83 * \param[in] parMc MC kinematic parameters.
84 * \param[in] parRec Reconstructed kinematic parameters.
85 * \param[in] step Enumeration AnalysisSteps, specify analysis step.
86 */
87 void FillPairHists(const LmvmCand& candP, const LmvmCand& candM, const LmvmKinePar& parMc, const LmvmKinePar& parRec,
88 ELmvmAnaStep step);
89 void FillMomHists(const CbmMCTrack* mct, const LmvmCand* cand, ELmvmSrc src, ELmvmAnaStep step);
91 void TrackSource(const LmvmCand& cand, ELmvmAnaStep step, int pdg);
92 void BgPairPdg(const LmvmCand& candP, const LmvmCand& candM, ELmvmAnaStep step);
93 void DoMcTrack();
94 void DoMcPair();
96 bool IsRecoTrackAccepted(const CbmGlobalTrack* gTrack);
97 void RichPmtXY();
98 void FillTopologyCands();
99 void FillCands();
100 void AssignMcToCands(std::vector<LmvmCand>& cands);
101 void AssignMcToTopologyCands(std::vector<LmvmCand>& topoCands);
102 void FillSourceHistos(const LmvmCand& cand);
103
104 /*
105 * \brief Initialize all histograms.
106 */
107 void InitHists();
108
109 double MinvScale(const CbmMCTrack* mct, const std::string& signal);
110
111 void AnalyseCandidates();
112 void AnalyseGlobalTracks();
113 void AnalyseRichRings();
114 void AnalyseProperties();
115
116 std::string fhrep;
117 std::string fhrec;
119
121
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 PidVsMom(const CbmGlobalTrack* gTrack, int iGTrack, int pdg, double mom, bool isAcc);
125
126 CbmMCTrack* GetMcTrackSts(int stsIndex);
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 RatioMomentum(const CbmMCTrack* mct, const LmvmCand& cand, ELmvmAnaStep step, int pdg);
150
151 void CheckTofId(const CbmMCTrack* mcTrack, const LmvmCand& cand, ELmvmAnaStep step, int pdg);
152 bool IsInTofPile(double mom, double m2);
153 bool IsInBox(double boxX, double boxY, double xVal, double yVal, double width);
154
155 std::string GetPidString(const CbmMCTrack* mct, const LmvmCand* cand);
156 std::string GetPidString(double vertexZ, int pdg);
157
158 /*
159 * \brief Check if global track has entries in all detectors.
160 */
161 bool IsInAllDets(const CbmGlobalTrack* gTrack);
162
163 bool IsPrimary(double vertexZ) { return (vertexZ < fZ + 0.1 && vertexZ > fZ - 0.1); }
164
165 virtual void Finish();
166
168
169 private:
172
173 FairMCEventHeader* fMCEventHeader = nullptr;
174 TClonesArray* fCbmEvents = nullptr;
175 TClonesArray* fMCTracks = nullptr;
176 TClonesArray* fRichRings = nullptr;
177 TClonesArray* fRichProj = nullptr;
178 TClonesArray* fRichPoints = nullptr;
179 TClonesArray* fRichRingMatches = nullptr;
180 TClonesArray* fRichHits = nullptr;
181 TClonesArray* fGlobalTracks = nullptr;
182 TClonesArray* fStsTracks = nullptr;
183 TClonesArray* fStsTrackMatches = nullptr;
184 TClonesArray* fStsHits = nullptr;
185 TClonesArray* fMvdHits = nullptr;
186 TClonesArray* fMvdPoints = nullptr;
187 TClonesArray* fMvdHitMatches = nullptr;
188 TClonesArray* fTrdTracks = nullptr;
189 TClonesArray* fTrdHits = nullptr;
190 TClonesArray* fTrdTrackMatches = nullptr;
191 TClonesArray* fTofHits = nullptr;
192 TClonesArray* fTofHitsMatches = nullptr;
193 TClonesArray* fTofPoints = nullptr;
194 TClonesArray* fTofTracks = nullptr;
196 CbmDigiManager* fDigiManager = nullptr; // Interface to digi branches
199
200 bool fUseMvd = false;
201
202 std::vector<LmvmCand> fCands;
203 std::vector<LmvmCand> fCandsTotal;
204 std::vector<LmvmCand>
205 fCandsMix; // will be filled with cands >= chi2prim and inserted into 'fCandsTotal' to avoid too many unnecessary candidates in event mixing
206 // STCut Segmented tracks, reconstructed only in STS
207 std::vector<LmvmCand> fSTCands;
208 // TTCut Reconstructed tracks, reconstructed in all detectors but not identified as electrons
209 std::vector<LmvmCand> fTTCands;
210 // RTCut Reconstructed tracks, reconstructed in STS + at least in one of the detectro (RICH, TRD, TOF)
211 std::vector<LmvmCand> fRTCands;
212
213 double fW = 0.; //Multiplicity*BR
214
215 double fPionMisidLevel = -1.; // For the ideal particle identification cases, set to -1 for real PID
216
217 Int_t fEventNumber = 0; // number of current event
218 LmvmCuts fCuts; // electorn identification and analisys cuts
219
220 LmvmHist fH; // histogram manager
221
222 std::map<int, int> fNofHitsInRingMap; // Number of hits in the MC RICH ring
223
224 double fZ = -44.; // z-position of target in cm
225
230
231 std::string fParticle = "";
232 std::string fTaskId = "";
233
234 public:
235 void SetUseMvd(bool use) { fUseMvd = use; }
236 void SetWeight(double w) { fW = w; }
237 void SetEnergyAndPlutoParticle(const std::string& energy, const std::string& particle);
238 void SetTaskId(const std::string& taskId) { fTaskId = taskId; }
239 void SetPionMisidLevel(double level) { fPionMisidLevel = level; }
240};
241
242#endif
ELmvmSrc
Definition LmvmDef.h:23
ELmvmAnaStep
Definition LmvmDef.h:34
ELmvmTopologyCut
Definition LmvmDef.h:15
int Int_t
CbmDigiManager.
TClonesArray * fRichHits
Definition LmvmTask.h:180
void CombinatorialPairs()
void CheckGammaConvAndPi0()
void AnalyseCandidates()
virtual ~LmvmTask()
Definition LmvmTask.cxx:60
std::map< int, int > fNofHitsInRingMap
Definition LmvmTask.h:222
CbmDigiManager * fDigiManager
Definition LmvmTask.h:196
void InitHists()
Definition LmvmTask.cxx:63
void RichPmtXY()
Definition LmvmTask.cxx:933
std::string fParticle
Definition LmvmTask.h:231
TClonesArray * fRichRingMatches
Definition LmvmTask.h:179
TClonesArray * fCbmEvents
Definition LmvmTask.h:174
int fNofMinHitsRich
Definition LmvmTask.h:227
FairMCEventHeader * fMCEventHeader
Definition LmvmTask.h:173
std::string fTaskId
Definition LmvmTask.h:232
std::vector< LmvmCand > fSTCands
Definition LmvmTask.h:207
TClonesArray * fRichProj
Definition LmvmTask.h:177
void AssignMcToTopologyCands(std::vector< LmvmCand > &topoCands)
void RatioMomentum(const CbmMCTrack *mct, const LmvmCand &cand, ELmvmAnaStep step, int pdg)
TClonesArray * fMCTracks
Definition LmvmTask.h:175
TClonesArray * fMvdHitMatches
Definition LmvmTask.h:187
std::string fhrep
Definition LmvmTask.h:116
TClonesArray * fRichRings
Definition LmvmTask.h:176
void DoMcTrack()
Definition LmvmTask.cxx:834
double fPionMisidLevel
Definition LmvmTask.h:215
LmvmCuts fCuts
Definition LmvmTask.h:218
TClonesArray * fTofPoints
Definition LmvmTask.h:193
TClonesArray * fTofHitsMatches
Definition LmvmTask.h:192
void CheckLikeSignCorrelations()
Definition LmvmTask.cxx:500
void SetWeight(double w)
Definition LmvmTask.h:236
std::vector< LmvmCand > fCandsTotal
Definition LmvmTask.h:203
TClonesArray * fMvdPoints
Definition LmvmTask.h:186
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)
Int_t fEventNumber
Definition LmvmTask.h:217
void AnalyseRichRings()
Definition LmvmTask.cxx:726
void CalculateNofTopologyPairs(const std::string &name, ELmvmSrc src)
void FillCandsForEventMix()
Definition LmvmTask.cxx:443
double MinvScale(const CbmMCTrack *mct, const std::string &signal)
Definition LmvmTask.cxx:482
void DoMcPair()
Definition LmvmTask.cxx:903
int fNofMinHitsStsMvd
Definition LmvmTask.h:226
LmvmTask(const LmvmTask &)
CbmKFVertex fKFVertex
Definition LmvmTask.h:197
void SetEnergyAndPlutoParticle(const std::string &energy, const std::string &particle)
TClonesArray * fRichPoints
Definition LmvmTask.h:178
bool IsPrimary(double vertexZ)
Definition LmvmTask.h:163
std::vector< LmvmCand > fTTCands
Definition LmvmTask.h:209
std::vector< LmvmCand > fCands
Definition LmvmTask.h:202
void FillCands()
void MvdCutMcDistance()
void TrackSource(const LmvmCand &cand, ELmvmAnaStep step, int pdg)
TClonesArray * fMvdHits
Definition LmvmTask.h:185
bool fUseMvd
Definition LmvmTask.h:200
bool IsInTofPile(double mom, double m2)
CbmMCTrack * GetMcTrackSts(int stsIndex)
std::string fhrec
Definition LmvmTask.h:117
void AssignMcToCands(std::vector< LmvmCand > &cands)
void AnalyseGlobalTracks()
Definition LmvmTask.cxx:994
TClonesArray * fStsHits
Definition LmvmTask.h:184
LmvmHist fH
Definition LmvmTask.h:220
void CheckClosestMvdHit(int mvdStationNum, const std::string &hist, const std::string &histQa)
void FillSourceHistos(const LmvmCand &cand)
TClonesArray * fTofTracks
Definition LmvmTask.h:194
void AnalyseProperties()
TClonesArray * fStsTrackMatches
Definition LmvmTask.h:183
virtual InitStatus Init()
Definition LmvmTask.cxx:354
int fNofMinHitsTof
Definition LmvmTask.h:229
bool IsRecoTrackAccepted(const CbmGlobalTrack *gTrack)
Definition LmvmTask.cxx:966
virtual void Exec(Option_t *option)
Definition LmvmTask.cxx:392
TClonesArray * fTofHits
Definition LmvmTask.h:191
ClassDef(LmvmTask, 1)
void BetaMom(const CbmMCTrack *mct, const CbmGlobalTrack *gTrack, const std::string &ptcl)
std::vector< LmvmCand > fCandsMix
Definition LmvmTask.h:205
TClonesArray * fTrdHits
Definition LmvmTask.h:189
TClonesArray * fTrdTracks
Definition LmvmTask.h:188
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:239
LmvmTask & operator=(const LmvmTask &)
CbmStsKFTrackFitter fKFFitter
Definition LmvmTask.h:198
int fNofMinHitsTrd
Definition LmvmTask.h:228
TClonesArray * fTrdTrackMatches
Definition LmvmTask.h:190
bool IsInBox(double boxX, double boxY, double xVal, double yVal, double width)
void CheckTopologyCut(ELmvmTopologyCut cut, const std::string &name)
TClonesArray * fGlobalTracks
Definition LmvmTask.h:181
void FillTopologyCands()
double fW
Definition LmvmTask.h:213
double fZ
Definition LmvmTask.h:224
std::vector< LmvmCand > fRTCands
Definition LmvmTask.h:211
CbmVertex * fPrimVertex
Definition LmvmTask.h:195
void FillMomHists(const CbmMCTrack *mct, const LmvmCand *cand, ELmvmSrc src, ELmvmAnaStep step)
Definition LmvmTask.cxx:804
virtual void Finish()
void PidVsMom(const CbmGlobalTrack *gTrack, int iGTrack, int pdg, double mom, bool isAcc)
void FillHistosForFastSim()
Definition LmvmTask.cxx:549
void FillRichRingNofHits()
Definition LmvmTask.cxx:452
void PairSource(const LmvmCand &candP, const LmvmCand &candM, ELmvmAnaStep step, const LmvmKinePar &parRec)
void SetUseMvd(bool use)
Definition LmvmTask.h:235
bool IsInAllDets(const CbmGlobalTrack *gTrack)
void CheckMismatches(const CbmGlobalTrack *gTrack, int pdg, bool isElectron, const std::string &ptcl, double weight)
TClonesArray * fStsTracks
Definition LmvmTask.h:182
void SetTaskId(const std::string &taskId)
Definition LmvmTask.h:238