CbmRoot
Loading...
Searching...
No Matches
CbmAnaJpsiTask.cxx
Go to the documentation of this file.
1/* Copyright (C) 2015-2021 Justus-Liebig-Universitaet Giessen, Giessen
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Elena Lebedeva [committer], Adrian Amatus Weber, Semen Lebedev */
4
5#include "CbmAnaJpsiTask.h"
6
8#include "CbmAnaJpsiCuts.h"
9#include "CbmAnaJpsiHist.h"
11#include "CbmAnaJpsiUtils.h"
12#include "CbmDrawHist.h"
13#include "CbmGlobalTrack.h"
14#include "CbmHistManager.h"
15#include "CbmMCTrack.h"
16#include "CbmRichHit.h"
17#include "CbmRichPoint.h"
18#include "CbmRichRing.h"
19#include "CbmStsHit.h"
20#include "CbmStsTrack.h"
21#include "CbmTofHit.h"
22#include "CbmTrackMatchNew.h"
23#include "CbmTrdHit.h"
24#include "CbmTrdTrack.h"
26
27#include <FairRootManager.h>
28
29#include "TCanvas.h"
30#include "TFile.h"
31#include "TMath.h"
32
33#include <iostream>
34
35using namespace std;
36
38 : FairTask("CbmAnaJpsiTask")
39 , fEventNum(0)
40 , fMcTracks(NULL)
41 , fStsPoints(NULL)
42 , fStsHits(NULL)
43 , fStsTracks(NULL)
44 , fStsTrackMatches(NULL)
45 , fRichPoints(NULL)
46 , fRichHits(NULL)
47 , fRichRings(NULL)
48 , fRichRingMatches(NULL)
49 , fTrdPoints(NULL)
50 , fTrdHits(NULL)
51 , fTrdTracks(NULL)
52 , fTrdTrackMatches(NULL)
53 , fTofPoints(NULL)
54 , fTofHits(NULL)
55 , fTofHitsMatches(NULL)
56 , fGlobalTracks(NULL)
57 , fJpsiCandidates(NULL)
58 , fNofHitsInRingMap()
59 , fPrimVertex(NULL)
60 , fKFVertex()
61 , fCandidates()
62 , fCuts()
63 , fWeight(1.14048e-6)
64 , fHM(NULL)
65 , fUseTrd(kTRUE)
66 , fUseTof(kFALSE)
67{
68 /*
69 fUseTrd=true;
70 fUseTof=false;
71 fWeight=1.14048e-6;
72*/
73}
74
76
78{
79 //cout << "CbmRichUrqmdTest::Init"<<endl;
80 FairRootManager* ioman = FairRootManager::Instance();
81 if (NULL == ioman) { Fatal("CbmAnaJpsiTask::Init", "RootManager not instantised!"); }
82
83 fMcTracks = (TClonesArray*) ioman->GetObject("MCTrack");
84 if (NULL == fMcTracks) { Fatal("CbmAnaJpsiTask::Init", "No MCtrack Array! "); }
85
86 fStsPoints = (TClonesArray*) ioman->GetObject("StsPoint");
87 if (NULL == fStsPoints) { Fatal("CbmAnaJpsiTask::Init", "No StsPoint Array! "); }
88
89 fStsHits = (TClonesArray*) ioman->GetObject("StsHit");
90 if (NULL == fStsHits) { Fatal("CbmAnaJpsiTask::Init", "No StsHit Array! "); }
91
92 fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
93 if (NULL == fStsTracks) { Fatal("CbmAnaJpsiTask::Init", "No StsTracks Array! "); }
94
95 fStsTrackMatches = (TClonesArray*) ioman->GetObject("StsTrackMatch");
96 if (NULL == fStsTrackMatches) { Fatal("CbmAnaJpsiTask::Init", "No StsTrackMatches Array!"); }
97
98 fRichHits = (TClonesArray*) ioman->GetObject("RichHit");
99 if (NULL == fRichHits) { Fatal("CbmAnaJpsiTask::Init", "No RichHits Array! "); }
100
101 fRichPoints = (TClonesArray*) ioman->GetObject("RichPoint");
102 if (NULL == fRichPoints) { Fatal("CbmAnaJpsiTask::Init", "No RichPoint Array! "); }
103
104 fRichRings = (TClonesArray*) ioman->GetObject("RichRing");
105 if (NULL == fRichRings) { Fatal("CbmAnaJpsiTask::Init", "No RichRings Array! "); }
106
107 fRichRingMatches = (TClonesArray*) ioman->GetObject("RichRingMatch");
108 if (NULL == fRichRingMatches) { Fatal("CbmAnaJpsiTask::Init", "No RichRingMatch array!"); }
109
110 if (fUseTrd == true) {
111 fTrdHits = (TClonesArray*) ioman->GetObject("TrdHit");
112 if (NULL == fTrdHits) { Fatal("CbmAnaJpsiTask::Init", "No TrdHits Array! "); }
113
114 fTrdPoints = (TClonesArray*) ioman->GetObject("TrdPoint");
115 if (NULL == fTrdPoints) { Fatal("CbmAnaJpsiTask::Init", "No TrdPoint Array! "); }
116
117 fTrdTrackMatches = (TClonesArray*) ioman->GetObject("TrdTrackMatch");
118 if (NULL == fTrdTrackMatches) { Fatal("CbmAnaDielectronTask::Init", "No TrdTrackMatch array!"); }
119
120 fTrdTracks = (TClonesArray*) ioman->GetObject("TrdTrack");
121 if (NULL == fTrdTracks) { Fatal("CbmAnaJpsiTask::Init", "No TrdTracks Array!"); }
122 }
123
124 fTofHits = (TClonesArray*) ioman->GetObject("TofHit");
125 if (NULL == fTofHits) { Fatal("CbmAnaJpsiTask::Init", "No TofHits Array! "); }
126
127 fTofHitsMatches = (TClonesArray*) ioman->GetObject("TofHitMatch");
128 if (NULL == fTofHitsMatches) { Fatal("CbmAnaJpsiTask::Init", "No TofHitMatch Array! "); }
129
130 fTofPoints = (TClonesArray*) ioman->GetObject("TofPoint");
131 if (NULL == fTofPoints) { Fatal("CbmAnaJpsiTask::Init", "No TofPoint Array! "); }
132
133 fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
134 if (NULL == fGlobalTracks) { Fatal("CbmAnaJpsiTask::Init", "No GlobalTracks Array!"); }
135
136 // fPrimVertex = (CbmVertex*) ioman->GetObject("PrimaryVertex");
137 // Get pointer to PrimaryVertex object from IOManager if it exists
138 // The old name for the object is "PrimaryVertex" the new one
139 // "PrimaryVertex." Check first for the new name
140 fPrimVertex = dynamic_cast<CbmVertex*>(ioman->GetObject("PrimaryVertex."));
141 if (nullptr == fPrimVertex) { fPrimVertex = dynamic_cast<CbmVertex*>(ioman->GetObject("PrimaryVertex")); }
142 if (nullptr == fPrimVertex) { LOG(fatal) << "No PrimaryVertex array!"; }
143
144 fJpsiCandidates = new TClonesArray("CbmAnaJpsiCandidate");
145 ioman->Register("JpsiCandidates", "Jpsi", fJpsiCandidates, IsOutputBranchPersistent("JpsiCandidates"));
146
147 InitHist();
148
149 return kSUCCESS;
150}
151
152
153void CbmAnaJpsiTask::CreateAnalysisStepsH1(const string& name, const string& axisX, const string& axisY, double nBins,
154 double min, double max)
155{
156 for (Int_t i = 0; i < CbmAnaJpsiHist::fNofAnaSteps; i++) {
157 string hname = name + "_" + CbmAnaJpsiHist::fAnaSteps[i];
158 fHM->Create1<TH1D>(hname, hname + ";" + axisX + ";" + axisY, nBins, min, max);
159 }
160}
161
162void CbmAnaJpsiTask::CreateAnalysisStepsH2(const string& name, const string& axisX, const string& axisY,
163 const string& axisZ, double nBinsX, double minX, double maxX, double nBinsY,
164 double minY, double maxY)
165{
166 for (Int_t i = 0; i < CbmAnaJpsiHist::fNofAnaSteps; i++) {
167 string hname = name + "_" + CbmAnaJpsiHist::fAnaSteps[i];
168 fHM->Create2<TH2D>(hname, hname + ";" + axisX + ";" + axisY + ";" + axisZ, nBinsX, minX, maxX, nBinsY, minY, maxY);
169 }
170}
171
172void CbmAnaJpsiTask::CreateSourceTypesH1(const string& name, const string& axisX, const string& axisY, double nBins,
173 double min, double max)
174{
175 for (Int_t i = 0; i < CbmAnaJpsiHist::fNofSourceTypes; i++) {
176 string hname = name + "_" + CbmAnaJpsiHist::fSourceTypes[i];
177 fHM->Create1<TH1D>(hname, hname + ";" + axisX + ";" + axisY, nBins, min, max);
178 }
179}
180
181void CbmAnaJpsiTask::CreateSourceTypesH2(const string& name, const string& axisX, const string& axisY,
182 const string& axisZ, double nBinsX, double minX, double maxX, double nBinsY,
183 double minY, double maxY)
184{
185 string hname = "";
186 for (Int_t i = 0; i < CbmAnaJpsiHist::fNofSourceTypes; i++) {
187 hname = name + "_" + CbmAnaJpsiHist::fSourceTypes[i];
188 fHM->Create2<TH2D>(hname, hname + ";" + axisX + ";" + axisY + ";" + axisZ, nBinsX, minX, maxX, nBinsY, minY, maxY);
189 }
190}
191
192void CbmAnaJpsiTask::CreateAnaStepsPairSourceH1(const string& name, const string& axisX, const string& axisY,
193 double nBins, double min, double max)
194{
195 for (Int_t i = 0; i < CbmAnaJpsiHist::fNofAnaSteps - 2; i++) {
196 string hname1 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "gg";
197 fHM->Create1<TH1D>(hname1, hname1 + ";" + axisX + ";" + axisY, nBins, min, max);
198 string hname2 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "gp";
199 fHM->Create1<TH1D>(hname2, hname2 + ";" + axisX + ";" + axisY, nBins, min, max);
200 string hname3 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "go";
201 fHM->Create1<TH1D>(hname3, hname3 + ";" + axisX + ";" + axisY, nBins, min, max);
202 string hname4 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "pg";
203 fHM->Create1<TH1D>(hname4, hname4 + ";" + axisX + ";" + axisY, nBins, min, max);
204 string hname5 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "pp";
205 fHM->Create1<TH1D>(hname5, hname5 + ";" + axisX + ";" + axisY, nBins, min, max);
206 string hname6 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "po";
207 fHM->Create1<TH1D>(hname6, hname6 + ";" + axisX + ";" + axisY, nBins, min, max);
208 string hname7 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "og";
209 fHM->Create1<TH1D>(hname7, hname7 + ";" + axisX + ";" + axisY, nBins, min, max);
210 string hname8 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "op";
211 fHM->Create1<TH1D>(hname8, hname8 + ";" + axisX + ";" + axisY, nBins, min, max);
212 string hname9 = name + "_" + CbmAnaJpsiHist::fAnaSteps[i + 2] + "_" + "oo";
213 fHM->Create1<TH1D>(hname9, hname9 + ";" + axisX + ";" + axisY, nBins, min, max);
214 }
215}
216
218{
219 fHM = new CbmHistManager();
220
221 // Event number counter
222 fHM->Create1<TH1D>("fh_event_number", "fh_event_number;a.u.;Number of events", 1, 0, 1.);
223
224 //RICH PMT plane XY
225 CreateSourceTypesH2("fh_rich_pmt_xy", "X [cm]", "Y [cm]", "Hits/cm^{2}/event", 220, -110, 110, 400, -200, 200);
226
227 //distributions of ID and analysis cuts
228 CreateSourceTypesH1("fh_track_chi2prim", "#chi^{2}_{prim}", "particles/event", 200, 0., 20.);
229 CreateSourceTypesH1("fh_track_mom", "P [GeV/c]", "particles/event", 160, 0., 16.);
230 CreateSourceTypesH1("fh_track_chi2sts", "#chi^{2}_{STS}", "particles/event", 80, 0., 8.);
231 CreateSourceTypesH1("fh_track_rapidity", "Rapidity", "particles/event", 40, 0., 4.);
232 CreateSourceTypesH1("fh_track_pt", "P_{t} [GeV/c]", "particles/event", 40, 0., 4.);
233 CreateSourceTypesH1("fh_track_rich_ann", "RICH ANN output", "particles/event", 120, -1.2, 1.2);
234 CreateSourceTypesH1("fh_track_trd_ann", "TRD ANN output", "particles/event", 120, -1.2, 1.2);
235 CreateSourceTypesH2("fh_track_tof_m2", "P [GeV/c]", "m^{2} [GeV/c^{2}]^{2}", "particles/event", 900, 0., 9., 360,
236 -0.4, 1.4);
237
238 //vertex of the secondary electrons from gamma conversion
239 fHM->Create2<TH2D>("fh_vertex_el_gamma_xz", "fh_vertex_el_gamma_xz;Z [cm];X [cm];Counter per event", 200, -10., 190.,
240 400, -130., 130.);
241 fHM->Create2<TH2D>("fh_vertex_el_gamma_yz", "fh_vertex_el_gamma_yz;Z [cm];Y [cm];Counter per event", 200, -10., 190.,
242 400, -130., 130.);
243 fHM->Create2<TH2D>("fh_vertex_el_gamma_xy", "fh_vertex_el_gamma_xy;X [cm];Y [cm];Counter per event", 400, -130., 130.,
244 400, -130., 130.);
245 fHM->Create2<TH2D>("fh_vertex_el_gamma_rz", "fh_vertex_el_gamma_rz;Z [cm];#sqrt{X^{2}+Y^{2}} [cm];Counter per event",
246 300, -10., 190., 300, 0., 150.);
247
248 // Number of BG and signal tracks after each cut
249 fHM->Create1<TH1D>("fh_nof_bg_tracks", "fh_nof_bg_tracks;Analysis steps;Number of BG particles/event",
251 fHM->Create1<TH1D>("fh_nof_el_tracks", "fh_nof_el_tracks;Analysis steps;Number of signal particles/event",
253 fHM->Create2<TH2D>("fh_source_tracks", "fh_source_tracks;Analysis steps;Particle", CbmAnaJpsiHist::fNofAnaSteps, 0.,
255
256 //Create invariant mass histograms
257 CreateAnalysisStepsH1("fh_signal_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0, 4.);
258 CreateAnalysisStepsH1("fh_bg_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
259 CreateAnalysisStepsH1("fh_pi0_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
260 CreateAnalysisStepsH1("fh_gamma_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
261
262 // minv for true matched and mismatched tracks
263 CreateAnalysisStepsH1("fh_bg_truematch_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
264 CreateAnalysisStepsH1("fh_bg_truematch_el_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
265 CreateAnalysisStepsH1("fh_bg_truematch_notel_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
266 CreateAnalysisStepsH1("fh_bg_mismatch_minv", "M_{ee} [GeV/c^{2}]", "particles/event", 4000, 0., 4.);
267
268 //Invariant mass vs. Mc Pt
269 CreateAnalysisStepsH2("fh_signal_minv_pt", "M_{ee} [GeV/c^{2}]", "P_{t} [GeV/c]", "particles/event", 100, 0., 4., 20,
270 0., 2.);
271
272 // Momentum distribution of the signal
273 CreateAnalysisStepsH1("fh_signal_mom", "P [GeV/c]", "particles/event", 250, 0., 25.);
274 //Pt/y distibution of the signal
275 CreateAnalysisStepsH2("fh_signal_pty", "Rapidity", "P_{t} [GeV/c]", "particles/event", 80, 0., 4., 80, 0., 4.);
276
277 //Number of mismatches after each cut
278 fHM->Create1<TH1D>("fh_nof_mismatches", "fh_nof_mismatches;Analysis steps;particles/event",
280 fHM->Create1<TH1D>("fh_nof_mismatches_rich", "fh_nof_mismatches_rich;Analysis steps;particles/event",
282 fHM->Create1<TH1D>("fh_nof_mismatches_trd", "fh_nof_mismatches_trd;Analysis steps;particles/event",
284 fHM->Create1<TH1D>("fh_nof_mismatches_tof", "fh_nof_mismatches_tof;Analysis steps;particles/event",
286
287 //Momentum distribution of signal electrons
288 CreateAnalysisStepsH1("fh_track_el_mom", "P [GeV/c]", "particles/event", 250, 0., 25.);
289 fHM->Create2<TH2D>("fh_track_el_mom_mc_rec", "fh_track_el_mom_mc_rec;P_{mc};P_{rec};Entries", 250, 0., 25., 250, 0.,
290 25.);
291
292 CreateAnaStepsPairSourceH1("fh_bg_participants_minv", "m_{inv}", "particles/event", 4000, 0., 4.);
293
294 CreateAnalysisStepsH1("fh_PdgCode_of Others_BG", "PDGCode", "particles/event", 500, -0.5, 499.5);
295
296 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_0",
297 "fh_ee_signal_minv_diff_ptcuts_0;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
298 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_1",
299 "fh_ee_signal_minv_diff_ptcuts_1;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
300 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_2",
301 "fh_ee_signal_minv_diff_ptcuts_2;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
302 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_3",
303 "fh_ee_signal_minv_diff_ptcuts_3;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
304 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_4",
305 "fh_ee_signal_minv_diff_ptcuts_4;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
306 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_5",
307 "fh_ee_signal_minv_diff_ptcuts_5;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
308 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_6",
309 "fh_ee_signal_minv_diff_ptcuts_6;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
310 fHM->Create1<TH1D>("fh_ee_signal_minv_diff_ptcuts_7",
311 "fh_ee_signal_minv_diff_ptcuts_7;M_{ee} [GeV/c^{2}];particles/event", 4000, 0., 4.);
312}
313
314
315void CbmAnaJpsiTask::Exec(Option_t*)
316{
317 fJpsiCandidates->Clear();
318
319 fHM->H1("fh_event_number")->Fill(0.5);
320
321 fEventNum++;
322 cout << "CbmAnaJpsiTask, event No. " << fEventNum << endl;
323
324 if (fPrimVertex != NULL) { fKFVertex = CbmKFVertex(*fPrimVertex); }
325 else {
326 Fatal("CbmAnaJpsiTask::Exec", "No PrimaryVertex array!");
327 }
328
329 if (fPrimVertex != NULL) { fKFVertex = CbmKFVertex(*fPrimVertex); }
330 else {
331 Fatal("CbmAnaDielectronTask::Exec", "No PrimaryVertex array!");
332 }
333
335
336 MCPairs();
337
338 RichPmtXY();
339
341
343
345
347
349
351
353}
354
356{
357 fNofHitsInRingMap.clear();
358 Int_t nofRichHits = fRichHits->GetEntriesFast();
359 for (Int_t iHit = 0; iHit < nofRichHits; iHit++) {
360 CbmRichHit* hit = static_cast<CbmRichHit*>(fRichHits->At(iHit));
361 if (NULL == hit) continue;
362
363 Int_t iPoint = hit->GetRefId();
364 if (iPoint < 0) continue;
365
366 FairMCPoint* point = static_cast<FairMCPoint*>(fRichPoints->At(iPoint));
367 if (NULL == point) continue;
368
369 Int_t iMCTrack = point->GetTrackID();
370 CbmMCTrack* track = static_cast<CbmMCTrack*>(fMcTracks->At(iMCTrack));
371 if (NULL == track) continue;
372
373 Int_t iMother = track->GetMotherId();
374 if (iMother == -1) continue;
375
376 fNofHitsInRingMap[iMother]++;
377 }
378}
379
381{
382 Int_t nMcTracks = fMcTracks->GetEntriesFast();
383 for (Int_t i = 0; i < nMcTracks; i++) {
384 CbmMCTrack* mctrack = (CbmMCTrack*) fMcTracks->At(i);
385 Bool_t isMcGammaElectron = CbmAnaJpsiUtils::IsMcGammaElectron(mctrack, fMcTracks);
386 if (isMcGammaElectron) {
387 TVector3 v;
388 mctrack->GetStartVertex(v);
389 fHM->H2("fh_vertex_el_gamma_xz")->Fill(v.Z(), v.X());
390 fHM->H2("fh_vertex_el_gamma_yz")->Fill(v.Z(), v.Y());
391 fHM->H2("fh_vertex_el_gamma_xy")->Fill(v.X(), v.Y());
392 fHM->H2("fh_vertex_el_gamma_rz")->Fill(v.Z(), sqrt(v.X() * v.X() + v.Y() * v.Y()));
393 }
394 } // nMcTracks
395} //MC Pairs
396
398{
399 fCandidates.clear();
400 Int_t nofGlobalTracks = fGlobalTracks->GetEntriesFast();
401
402 for (Int_t iGTrack = 0; iGTrack < nofGlobalTracks; iGTrack++) {
403 // create candidate, in which we will store some parameters of reconstructed global track
405
406 //get GlobalTrack from array
407 CbmGlobalTrack* globalTrack = (CbmGlobalTrack*) fGlobalTracks->At(iGTrack);
408 if (NULL == globalTrack) continue;
409
410 // get StsTrack from global track
411 cand.fStsInd = globalTrack->GetStsTrackIndex();
412 if (cand.fStsInd < 0) continue;
413 CbmStsTrack* stsTrack = (CbmStsTrack*) fStsTracks->At(cand.fStsInd);
414 if (NULL == stsTrack) continue;
415
416 //calculate and get track parameters
418
419 // RICH
420 cand.fRichInd = globalTrack->GetRichRingIndex();
421 if (cand.fRichInd < 0) continue;
422 CbmRichRing* richRing = (CbmRichRing*) fRichRings->At(cand.fRichInd);
423 if (NULL == richRing) continue;
424
425 // TRD
426 CbmTrdTrack* trdTrack = NULL;
427 if (fUseTrd == true) {
428 cand.fTrdInd = globalTrack->GetTrdTrackIndex();
429 if (cand.fTrdInd < 0) continue;
430 trdTrack = (CbmTrdTrack*) fTrdTracks->At(cand.fTrdInd);
431 if (trdTrack == NULL) continue;
432 }
433
434 // ToF
435 cand.fTofInd = globalTrack->GetTofHitIndex();
436 if (cand.fTofInd < 0) continue;
437 CbmTofHit* tofHit = (CbmTofHit*) fTofHits->At(cand.fTofInd);
438 if (tofHit == NULL) continue;
439
440 IsElectron(iGTrack, cand.fMomentum.Mag(), &cand);
441 IsRecoTrackAccepted(&cand);
442 if (!cand.fIsRecoTrackAccepted) continue;
443 // push candidate to the array
444 // we store only candidate which have all local segments: STS, RICH, TRD, TOF
445 fCandidates.push_back(cand);
446 }
447}
448
450{
451 int nCand = fCandidates.size();
452 for (int i = 0; i < nCand; i++) {
453 //reset MC information
454 fCandidates[i].ResetMcParams();
455
456 //STS
457 //MCTrackId of the candidate is defined by STS track
458 int stsInd = fCandidates[i].fStsInd;
459 CbmTrackMatchNew* stsMatch = (CbmTrackMatchNew*) fStsTrackMatches->At(stsInd);
460 if (stsMatch == NULL) continue;
461 fCandidates[i].fStsMcTrackId = stsMatch->GetMatchedLink().GetIndex();
462 if (fCandidates[i].fStsMcTrackId < 0) continue;
463 CbmMCTrack* mcTrack1 = (CbmMCTrack*) fMcTracks->At(fCandidates[i].fStsMcTrackId);
464 if (mcTrack1 == NULL) continue;
465 fCandidates[i].fStsMcMotherId = mcTrack1->GetMotherId();
466 fCandidates[i].fMcPdg = TMath::Abs(mcTrack1->GetPdgCode());
467 fCandidates[i].fIsMcSignalElectron = CbmAnaJpsiUtils::IsMcSignalElectron(mcTrack1);
468 fCandidates[i].fIsMcGammaElectron = CbmAnaJpsiUtils::IsMcGammaElectron(mcTrack1, fMcTracks);
469 fCandidates[i].fIsMcPi0Electron = CbmAnaJpsiUtils::IsMcPi0Electron(mcTrack1, fMcTracks);
470
471 // RICH
472 int richInd = fCandidates[i].fRichInd;
473 CbmTrackMatchNew* richMatch = (CbmTrackMatchNew*) fRichRingMatches->At(richInd);
474 if (richMatch == NULL) continue;
475 fCandidates[i].fRichMcTrackId = richMatch->GetMatchedLink().GetIndex();
476
477 // TRD
478 // CbmTrdTrack* trdTrack = NULL;
479 if (fUseTrd == true) {
480 int trdInd = fCandidates[i].fTrdInd;
481 CbmTrackMatchNew* trdMatch = (CbmTrackMatchNew*) fTrdTrackMatches->At(trdInd);
482 if (trdMatch == NULL) continue;
483 fCandidates[i].fTrdMcTrackId = trdMatch->GetMatchedLink().GetIndex();
484 }
485
486 // ToF
487 int tofInd = fCandidates[i].fTofInd;
488 if (tofInd < 0) continue;
489 CbmTofHit* tofHit = (CbmTofHit*) fTofHits->At(tofInd);
490 if (tofHit == NULL) continue;
491 CbmMatch* tofHitMatch = static_cast<CbmMatch*>(fTofHitsMatches->At(tofInd));
492 if (tofHitMatch == NULL) { continue; }
493 Int_t tofPointIndex = tofHitMatch->GetMatchedLink().GetIndex();
494 if (tofPointIndex < 0) continue;
495 FairMCPoint* tofPoint = (FairMCPoint*) fTofPoints->At(tofPointIndex);
496 if (tofPoint == NULL) continue;
497 fCandidates[i].fTofMcTrackId = tofPoint->GetTrackID();
498
499
501 } // candidates
502}
503
505{
506 Int_t nCand = fCandidates.size();
507 for (Int_t i = 0; i < nCand; i++) {
508 if (fCandidates[i].fIsMcSignalElectron) {
509 fHM->H1("fh_track_chi2prim_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])
510 ->Fill(fCandidates[i].fChi2Prim, fWeight);
511 }
512 else {
513 fHM->H1("fh_track_chi2prim_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fChi2Prim);
514 }
515 if (fCandidates[i].fIsMcGammaElectron) {
516 fHM->H1("fh_track_chi2prim_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fChi2Prim);
517 }
518 if (fCandidates[i].fIsMcPi0Electron) {
519 fHM->H1("fh_track_chi2prim_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fChi2Prim);
520 }
521 if (fCandidates[i].fChi2Prim >= fCuts.fChiPrimCut) continue;
522
523
524 if (fCandidates[i].fIsMcSignalElectron) {
525 fHM->H1("fh_track_rich_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])->Fill(fCandidates[i].fRichAnn, fWeight);
526 }
527 else {
528 fHM->H1("fh_track_rich_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fRichAnn);
529 }
530 if (fCandidates[i].fIsMcGammaElectron) {
531 fHM->H1("fh_track_rich_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fRichAnn);
532 }
533 if (fCandidates[i].fIsMcPi0Electron) {
534 fHM->H1("fh_track_rich_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fRichAnn);
535 }
536 if (!fCandidates[i].fIsRichEl) continue;
537
538 if (fCandidates[i].fIsMcSignalElectron) {
539 fHM->H1("fh_track_trd_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])->Fill(fCandidates[i].fTrdAnn, fWeight);
540 }
541 else {
542 fHM->H1("fh_track_trd_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fTrdAnn);
543 }
544 if (fCandidates[i].fIsMcGammaElectron) {
545 fHM->H1("fh_track_trd_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fTrdAnn);
546 }
547 if (fCandidates[i].fIsMcPi0Electron) {
548 fHM->H1("fh_track_trd_ann_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fTrdAnn);
549 }
550 if (!fCandidates[i].fIsTrdEl) continue;
551
552 if (fCandidates[i].fIsMcSignalElectron) {
553 fHM->H2("fh_track_tof_m2_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])
554 ->Fill(fCandidates[i].fMomentum.Mag(), fCandidates[i].fMass2, fWeight);
555 }
556 else {
557 fHM->H2("fh_track_tof_m2_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])
558 ->Fill(fCandidates[i].fMomentum.Mag(), fCandidates[i].fMass2);
559 }
560 if (fCandidates[i].fIsMcGammaElectron) {
561 fHM->H2("fh_track_tof_m2_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])
562 ->Fill(fCandidates[i].fMomentum.Mag(), fCandidates[i].fMass2);
563 }
564 if (fCandidates[i].fIsMcPi0Electron) {
565 fHM->H2("fh_track_tof_m2_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])
566 ->Fill(fCandidates[i].fMomentum.Mag(), fCandidates[i].fMass2);
567 }
568 if (!fCandidates[i].fIsElectron) continue;
569
570 if (fCandidates[i].fIsMcSignalElectron) {
572 ->Fill(fCandidates[i].fMomentum.Perp(), fWeight);
573 }
574 else {
575 fHM->H1("fh_track_pt_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fMomentum.Perp());
576 }
577 if (fCandidates[i].fIsMcGammaElectron) {
578 fHM->H1("fh_track_pt_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fMomentum.Perp());
579 }
580 if (fCandidates[i].fIsMcPi0Electron) {
581 fHM->H1("fh_track_pt_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fMomentum.Perp());
582 }
583
584 } // loop over candidates
585
586 for (Int_t i = 0; i < nCand; i++) {
587 if (fCandidates[i].fIsMcSignalElectron) {
589 ->Fill(fCandidates[i].fMomentum.Mag(), fWeight);
590 fHM->H1("fh_track_chi2sts_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])->Fill(fCandidates[i].fChi2sts, fWeight);
591 fHM->H1("fh_track_rapidity_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])
592 ->Fill(fCandidates[i].fRapidity, fWeight);
593 }
594 else {
595 fHM->H1("fh_track_mom_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fMomentum.Mag());
596 fHM->H1("fh_track_chi2sts_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fChi2sts);
597 fHM->H1("fh_track_rapidity_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(fCandidates[i].fRapidity);
598 }
599 if (fCandidates[i].fIsMcGammaElectron) {
600 fHM->H1("fh_track_mom_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fMomentum.Mag());
601 fHM->H1("fh_track_chi2sts_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fChi2sts);
602 fHM->H1("fh_track_rapidity_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(fCandidates[i].fRapidity);
603 }
604 if (fCandidates[i].fIsMcPi0Electron) {
605 fHM->H1("fh_track_mom_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fMomentum.Mag());
606 fHM->H1("fh_track_chi2sts_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fChi2sts);
607 fHM->H1("fh_track_rapidity_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(fCandidates[i].fRapidity);
608 }
609 } // loop over candidates
610}
611
612Bool_t CbmAnaJpsiTask::IsMcTrackAccepted(Int_t mcTrackInd)
613{
614 CbmMCTrack* tr = (CbmMCTrack*) fMcTracks->At(mcTrackInd);
615 if (tr == NULL) return false;
616 Int_t nRichPoints = fNofHitsInRingMap[mcTrackInd];
617 //TVector3 v;
618 //tr->GetStartVertex(v);
619 return (tr->GetNPoints(ECbmModuleId::kMvd) + tr->GetNPoints(ECbmModuleId::kSts) >= 4 && nRichPoints >= 7
620 && tr->GetNPoints(ECbmModuleId::kTrd) >= 6
621 && tr->GetNPoints(ECbmModuleId::kTof) > 0 /*&& tr->GetPt()>fCuts.fPtCut && v.Mag()<0.01*/);
622}
623
624
626{
627 CbmStsTrack* stsTrack = (CbmStsTrack*) fStsTracks->At(cand->fStsInd);
628 if (stsTrack == NULL) cand->fIsRecoTrackAccepted = false;
629 int nStsHits = stsTrack->GetNofStsHits();
630 int nMvdHits = stsTrack->GetNofMvdHits();
631 CbmRichRing* richRing = (CbmRichRing*) fRichRings->At(cand->fRichInd);
632 if (richRing == NULL) cand->fIsRecoTrackAccepted = false;
633 int nRichHits = richRing->GetNofHits();
634 CbmTrdTrack* trdTrack = (CbmTrdTrack*) fTrdTracks->At(cand->fTrdInd);
635 if (trdTrack == NULL) cand->fIsRecoTrackAccepted = false;
636 int nTrdHits = trdTrack->GetNofHits();
637 CbmTofHit* tofHit = (CbmTofHit*) fTofHits->At(cand->fTofInd);
638 bool nTofHitsGreaterZero = false;
639 if (tofHit == NULL) { cand->fIsRecoTrackAccepted = false; }
640 else {
641 nTofHitsGreaterZero = true;
642 }
643 if ((nMvdHits + nStsHits) >= 4 && nRichHits >= 7 && nTrdHits >= 6 && nTofHitsGreaterZero)
644 cand->fIsRecoTrackAccepted = true;
645}
646
648{
649 Int_t nMcTracks = fMcTracks->GetEntriesFast();
650 for (Int_t i = 0; i < nMcTracks; i++) {
651 CbmMCTrack* mctrack = (CbmMCTrack*) fMcTracks->At(i);
653 double_t mom = mctrack->GetP();
654 fHM->H1("fh_nof_el_tracks")->Fill(kJpsiMc + 0.5, fWeight);
655 fHM->H1("fh_track_el_mom_" + CbmAnaJpsiHist::fAnaSteps[kJpsiMc])->Fill(mom, fWeight);
656 if (IsMcTrackAccepted(i)) {
657 fHM->H1("fh_nof_el_tracks")->Fill(kJpsiAcc + 0.5, fWeight);
658 fHM->H1("fh_track_el_mom_" + CbmAnaJpsiHist::fAnaSteps[kJpsiAcc])->Fill(mom, fWeight);
659 }
660 }
661 }
662}
663
665{
666 Int_t nMcTracks = fMcTracks->GetEntriesFast();
667 for (Int_t iP = 0; iP < nMcTracks; iP++) {
668 CbmMCTrack* mctrackP = (CbmMCTrack*) fMcTracks->At(iP);
669 Bool_t isMcSignalElectronP = CbmAnaJpsiUtils::IsMcSignalElectron(mctrackP);
670 if (!isMcSignalElectronP) continue;
671 if (mctrackP->GetPdgCode() != 11) continue;
672 Bool_t isAccP = IsMcTrackAccepted(iP);
673 for (Int_t iM = 0; iM < nMcTracks; iM++) {
674 if (iP == iM) continue;
675 CbmMCTrack* mctrackM = (CbmMCTrack*) fMcTracks->At(iM);
676 Bool_t isMcSignalElectronM = CbmAnaJpsiUtils::IsMcSignalElectron(mctrackM);
677 if (!isMcSignalElectronM) continue;
678 if (mctrackM->GetPdgCode() != -11) continue;
679 Bool_t isAccM = IsMcTrackAccepted(iM);
681
682 if (isMcSignalElectronM && isMcSignalElectronP) {
683 fHM->H2("fh_signal_pty_" + CbmAnaJpsiHist::fAnaSteps[kJpsiMc])->Fill(p.fRapidity, p.fPt, fWeight);
684 fHM->H1("fh_signal_mom_" + CbmAnaJpsiHist::fAnaSteps[kJpsiMc])->Fill(p.fMomentumMag, fWeight);
685 fHM->H1("fh_signal_minv_" + CbmAnaJpsiHist::fAnaSteps[kJpsiMc])->Fill(p.fMinv, fWeight);
686 fHM->H2("fh_signal_minv_pt_" + CbmAnaJpsiHist::fAnaSteps[kJpsiMc])->Fill(p.fMinv, p.fPt, fWeight);
687 //accepted e+/-
688 if (isAccP && isAccM) {
689 //no FillPairHists because we have not declared KinematicParamCand jet
690 fHM->H2("fh_signal_pty_" + CbmAnaJpsiHist::fAnaSteps[kJpsiAcc])->Fill(p.fRapidity, p.fPt, fWeight);
691 fHM->H1("fh_signal_mom_" + CbmAnaJpsiHist::fAnaSteps[kJpsiAcc])->Fill(p.fMomentumMag, fWeight);
692 fHM->H1("fh_signal_minv_" + CbmAnaJpsiHist::fAnaSteps[kJpsiAcc])->Fill(p.fMinv, fWeight);
693 fHM->H2("fh_signal_minv_pt_" + CbmAnaJpsiHist::fAnaSteps[kJpsiAcc])->Fill(p.fMinv, p.fPt, fWeight);
694 }
695 }
696 }
697 }
698} // PairsAcceptance
699
700
703{
704 Bool_t isBG = !(candP->fIsMcSignalElectron && candM->fIsMcSignalElectron);
705 Double_t weight = 1.;
706 if (candP->fIsMcSignalElectron || candM->fIsMcSignalElectron) weight = fWeight;
707 if (isBG) {
708 if (candM->fIsMcGammaElectron) {
709 if (candP->fIsMcGammaElectron) {
710 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_gg")
711 ->Fill(parRec->fMinv, weight); //gamma + gamma
712 }
713 else if (candP->fIsMcPi0Electron) {
714 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_gp")
715 ->Fill(parRec->fMinv, weight); //gamma + Pi0
716 }
717 else {
718 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_go")
719 ->Fill(parRec->fMinv, weight); //gamma + other
720 fHM->H1("fh_PdgCode_of Others_BG_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill((double) candP->fMcPdg - 0.5);
721 }
722 }
723 else if (candM->fIsMcPi0Electron) {
724 if (candP->fIsMcGammaElectron) {
725 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_gp")
726 ->Fill(parRec->fMinv, weight); //pi0 + gamma
727 }
728 else if (candP->fIsMcPi0Electron) {
729 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_pp")
730 ->Fill(parRec->fMinv, weight); //pi0 + Pi0
731 }
732 else {
733 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_po")
734 ->Fill(parRec->fMinv, weight); //pi0 + other
735 fHM->H1("fh_PdgCode_of Others_BG_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill((double) candP->fMcPdg - 0.5);
736 }
737 }
738 else {
739 fHM->H1("fh_PdgCode_of Others_BG_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill((double) candM->fMcPdg - 0.5);
740 if (candP->fIsMcGammaElectron) {
741 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_og")
742 ->Fill(parRec->fMinv, weight); //other + gamma
743 }
744 else if (candP->fIsMcPi0Electron) {
745 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_po")
746 ->Fill(parRec->fMinv, weight); //other + Pi0
747 }
748 else {
749 fHM->H1("fh_bg_participants_minv_" + CbmAnaJpsiHist::fAnaSteps[step] + "_oo")
750 ->Fill(parRec->fMinv, weight); //other + other
751 fHM->H1("fh_PdgCode_of Others_BG_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill((double) candP->fMcPdg - 0.5);
752 }
753 }
754 }
755}
756
757
759{
760 int binNum = (double) step + 0.5;
761 // Double_t mom = cand->fMomentum.Mag();
762 // Double_t pt = cand->fMomentum.Perp();
763
764
765 if (cand->fIsMcSignalElectron) {
766 fHM->H1("fh_nof_el_tracks")->Fill(binNum, fWeight);
767
768 CbmMCTrack* mcCand = (CbmMCTrack*) fMcTracks->At(cand->fStsMcTrackId);
769 if (mcCand != NULL) {
770 fHM->H1("fh_track_el_mom_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(mcCand->GetP(), fWeight);
771 if (step == kJpsiReco) fHM->H2("fh_track_el_mom_mc_rec")->Fill(mcCand->GetP(), cand->fMomentum.Mag(), fWeight);
772 }
773 }
774 else {
775 fHM->H1("fh_nof_bg_tracks")->Fill(binNum);
776
777 if (cand->fIsMismatch) fHM->H1("fh_nof_mismatches")->Fill(binNum);
778 if (cand->fStsMcTrackId != cand->fRichMcTrackId) fHM->H1("fh_nof_mismatches_rich")->Fill(binNum);
779 if (fUseTrd && cand->fStsMcTrackId != cand->fTrdMcTrackId) fHM->H1("fh_nof_mismatches_trd")->Fill(binNum);
780 if (cand->fStsMcTrackId != cand->fTofMcTrackId) fHM->H1("fh_nof_mismatches_tof")->Fill(binNum);
781
782
783 if (cand->fIsMcGammaElectron) { fHM->H2("fh_source_tracks")->Fill(binNum, 0.5); }
784 else if (cand->fIsMcPi0Electron) {
785 fHM->H2("fh_source_tracks")->Fill(binNum, 1.5);
786 }
787 else if (pdg == 211 || pdg == -211) { //Pi+-
788 fHM->H2("fh_source_tracks")->Fill(binNum, 2.5);
789 }
790 else if (pdg == 2212) { //P
791 fHM->H2("fh_source_tracks")->Fill(binNum, 3.5);
792 }
793 else if (pdg == 321 || pdg == -321) {
794 fHM->H2("fh_source_tracks")->Fill(binNum, 4.5);
795 }
796 else if ((pdg == 11 || pdg == -11) && !cand->fIsMcGammaElectron && !cand->fIsMcPi0Electron
797 && !cand->fIsMcSignalElectron) {
798 fHM->H2("fh_source_tracks")->Fill(binNum, 5.5);
799 }
800 else {
801 fHM->H2("fh_source_tracks")->Fill(binNum, 6.5);
802 }
803 } //Signal or not
804} //TrackSource
805
806
810{
811 Bool_t isSignal = candP->fIsMcSignalElectron && candM->fIsMcSignalElectron;
812 Bool_t isPi0 = (candP->fIsMcPi0Electron && candM->fIsMcPi0Electron && candP->fStsMcMotherId == candM->fStsMcMotherId);
813 Bool_t isGamma =
814 (candP->fIsMcGammaElectron && candM->fIsMcGammaElectron && candP->fStsMcMotherId == candM->fStsMcMotherId);
815 Bool_t isBG = !isSignal; //(!isGamma) && (!isPi0) && (!(candP->fIsMcSignalElectron || candM->fIsMcSignalElectron));
816 Bool_t isMismatch = (candP->fIsMismatch || candM->fIsMismatch);
817
818 if (isSignal)
819 fHM->H2("fh_signal_pty_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parMc->fRapidity, parMc->fPt, fWeight);
820 if (isSignal) fHM->H1("fh_signal_mom_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parMc->fMomentumMag, fWeight);
821 if (isSignal) fHM->H1("fh_signal_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv, fWeight);
822 if (isSignal)
823 fHM->H2("fh_signal_minv_pt_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv, parMc->fPt, fWeight);
824 if (isBG) {
825 if (candP->fIsMcSignalElectron || candM->fIsMcSignalElectron) {
826 fHM->H1("fh_bg_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv, fWeight);
827 }
828 else {
829 fHM->H1("fh_bg_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
830 }
831 }
832 PairSource(candP, candM, step, parRec);
833 if (isPi0) fHM->H1("fh_pi0_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
834 if (isGamma) fHM->H1("fh_gamma_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
835 if (isBG && isMismatch) fHM->H1("fh_bg_mismatch_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
836 if (isBG && !isMismatch) {
837 fHM->H1("fh_bg_truematch_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
838 if (candP->fMcPdg == 11 && candM->fMcPdg == 11)
839 fHM->H1("fh_bg_truematch_el_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
840 if (candP->fMcPdg != 11 || candM->fMcPdg != 11)
841 fHM->H1("fh_bg_truematch_notel_minv_" + CbmAnaJpsiHist::fAnaSteps[step])->Fill(parRec->fMinv);
842 }
843}
844
845
847{
848 Int_t ncand = fCandidates.size();
849
850 for (Int_t i = 0; i < ncand; i++) {
851 Int_t pdg = 0;
852 if (fCandidates[i].fStsMcTrackId > 0) {
853 CbmMCTrack* mcTrack = (CbmMCTrack*) fMcTracks->At(fCandidates[i].fStsMcTrackId);
854 if (NULL != mcTrack) pdg = mcTrack->GetPdgCode();
855 }
856
857 Bool_t isChi2Prim = (fCandidates[i].fChi2Prim < fCuts.fChiPrimCut);
858 Bool_t isEl = (fCandidates[i].fIsElectron);
859 Bool_t isPtCut = (fCandidates[i].fMomentum.Perp() > fCuts.fPtCut);
860
862 if (isChi2Prim) TrackSource(&fCandidates[i], kJpsiChi2Prim, pdg);
863 if (isChi2Prim && isEl) TrackSource(&fCandidates[i], kJpsiElId, pdg);
864 if (isChi2Prim && isEl && isPtCut) TrackSource(&fCandidates[i], kJpsiPtCut, pdg);
865 }
866
867 for (Int_t iM = 0; iM < ncand; iM++) {
868 if (fCandidates[iM].fCharge < 0) continue;
869 CbmMCTrack* mctrackM = NULL;
870 if (fCandidates[iM].fStsMcTrackId >= 0) mctrackM = (CbmMCTrack*) fMcTracks->At(fCandidates[iM].fStsMcTrackId);
871
872 for (Int_t iP = 0; iP < ncand; iP++) {
873 if (fCandidates[iP].fCharge > 0) continue;
874 CbmMCTrack* mctrackP = NULL;
875 if (fCandidates[iP].fStsMcTrackId >= 0) mctrackP = (CbmMCTrack*) fMcTracks->At(fCandidates[iP].fStsMcTrackId);
876 if (iM == iP) continue;
877
879 if (mctrackP != NULL && mctrackM != NULL)
881
884
885 Bool_t isChiPrimary =
886 (fCandidates[iP].fChi2Prim < fCuts.fChiPrimCut && fCandidates[iM].fChi2Prim < fCuts.fChiPrimCut);
887 Bool_t isEl = (fCandidates[iP].fIsElectron && fCandidates[iM].fIsElectron);
888 Bool_t isPtCut =
889 (fCandidates[iP].fMomentum.Perp() > fCuts.fPtCut && fCandidates[iM].fMomentum.Perp() > fCuts.fPtCut);
890 Bool_t isSignal = (fCandidates[iP].fIsMcSignalElectron && fCandidates[iM].fIsMcSignalElectron);
891
892 FillPairHists(&fCandidates[iP], &fCandidates[iM], &pMC, &pRec, kJpsiReco);
893 if (isChiPrimary) { FillPairHists(&fCandidates[iP], &fCandidates[iM], &pMC, &pRec, kJpsiChi2Prim); }
894 if (isChiPrimary && isEl) { FillPairHists(&fCandidates[iP], &fCandidates[iM], &pMC, &pRec, kJpsiElId); }
895 if (isChiPrimary && isEl && isPtCut) {
896 FillPairHists(&fCandidates[iP], &fCandidates[iM], &pMC, &pRec, kJpsiPtCut);
897 }
898
899 if (isSignal && isChiPrimary && isEl && pRec.fPt < 0.4) {
900 fHM->H1("fh_ee_signal_minv_diff_ptcuts_0")->Fill(pRec.fMinv, fWeight);
901 }
902 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 0.4 && pRec.fPt < 0.8) {
903 fHM->H1("fh_ee_signal_minv_diff_ptcuts_1")->Fill(pRec.fMinv, fWeight);
904 }
905 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 0.8 && pRec.fPt < 1.2) {
906 fHM->H1("fh_ee_signal_minv_diff_ptcuts_2")->Fill(pRec.fMinv, fWeight);
907 }
908 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 1.2 && pRec.fPt < 1.6) {
909 fHM->H1("fh_ee_signal_minv_diff_ptcuts_3")->Fill(pRec.fMinv, fWeight);
910 }
911 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 1.6 && pRec.fPt < 2.0) {
912 fHM->H1("fh_ee_signal_minv_diff_ptcuts_4")->Fill(pRec.fMinv, fWeight);
913 }
914 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 2.0 && pRec.fPt < 2.4) {
915 fHM->H1("fh_ee_signal_minv_diff_ptcuts_5")->Fill(pRec.fMinv, fWeight);
916 }
917 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 2.4 && pRec.fPt < 3.0) {
918 fHM->H1("fh_ee_signal_minv_diff_ptcuts_6")->Fill(pRec.fMinv, fWeight);
919 }
920 if (isSignal && isChiPrimary && isEl && pRec.fPt >= 3.0 && pRec.fPt < 6.0) {
921 fHM->H1("fh_ee_signal_minv_diff_ptcuts_7")->Fill(pRec.fMinv, fWeight);
922 }
923
924 } //iM
925 } //iP
926}
927
928void CbmAnaJpsiTask::IsElectron(Int_t globalTrackIndex, Double_t momentum, CbmAnaJpsiCandidate* cand)
929{
930 Bool_t richEl = CbmLitGlobalElectronId::GetInstance().IsRichElectron(globalTrackIndex, momentum);
931 cand->fRichAnn = CbmLitGlobalElectronId::GetInstance().GetRichAnn(globalTrackIndex, momentum);
932
933 Bool_t trdEl = CbmLitGlobalElectronId::GetInstance().IsTrdElectron(globalTrackIndex, momentum);
934 cand->fTrdAnn = CbmLitGlobalElectronId::GetInstance().GetTrdAnn(globalTrackIndex, momentum);
935
936 Bool_t tofEl = CbmLitGlobalElectronId::GetInstance().IsTofElectron(globalTrackIndex, momentum);
937 //Bool_t momCut = (fCuts.fMomentumCut > 0.)?(momentum < fCuts.fMomentumCut):true;
938
939 cand->fIsRichEl = richEl;
940 cand->fIsTrdEl = trdEl;
941 cand->fIsTofEl = (fUseTof) ? tofEl : true;
942 cand->fIsElectron = (richEl && trdEl && tofEl);
943}
944
945
947{
948 Bool_t IsTrdMcTrackId = (fUseTrd) ? (cand->fStsMcTrackId == cand->fTrdMcTrackId) : true;
949 if (cand->fStsMcTrackId == cand->fRichMcTrackId && IsTrdMcTrackId && cand->fStsMcTrackId == cand->fTofMcTrackId
950 && cand->fStsMcTrackId != -1)
951 cand->fIsMismatch = false;
952 else {
953 cand->fIsMismatch = true;
954 }
955}
956
958{
959 Int_t nofRichHits = fRichHits->GetEntriesFast();
960 for (Int_t i = 0; i < nofRichHits; i++) {
961 // get the RichHit from array
962 CbmRichHit* richHit = (CbmRichHit*) fRichHits->At(i);
963 if (NULL == richHit) continue;
964 Int_t PointInd = richHit->GetRefId();
965 if (PointInd < 0) continue;
966
967 // get the McRichPoint of the RichHit
968 CbmRichPoint* richMcPoint = (CbmRichPoint*) fRichPoints->At(PointInd);
969 if (NULL == richMcPoint) continue;
970
971 // get the RICH photon MC Track
972 Int_t photonMcTrackId = richMcPoint->GetTrackID();
973 if (photonMcTrackId == -1) continue;
974 CbmMCTrack* photonMcTrack = (CbmMCTrack*) fMcTracks->At(photonMcTrackId);
975 if (NULL == photonMcTrack) continue;
976
977 // get photon mother MC Track (electron, pion etc.)
978 Int_t photonMotherId = photonMcTrack->GetMotherId();
979 if (photonMotherId == -1) continue;
980 CbmMCTrack* photonMotherMcTrack = (CbmMCTrack*) fMcTracks->At(photonMotherId);
981 if (NULL == photonMotherMcTrack) continue;
982
983 Bool_t isMcSignalElectron = CbmAnaJpsiUtils::IsMcSignalElectron(photonMotherMcTrack);
984 Bool_t isMcGammaElectron = CbmAnaJpsiUtils::IsMcGammaElectron(photonMotherMcTrack, fMcTracks);
985 Bool_t isMcPi0Electron = CbmAnaJpsiUtils::IsMcPi0Electron(photonMotherMcTrack, fMcTracks);
986 if (isMcSignalElectron) {
987 fHM->H2("fh_rich_pmt_xy_" + CbmAnaJpsiHist::fSourceTypes[kJpsiSignal])
988 ->Fill(richHit->GetX(), richHit->GetY(), fWeight);
989 }
990 else {
991 fHM->H2("fh_rich_pmt_xy_" + CbmAnaJpsiHist::fSourceTypes[kJpsiBg])->Fill(richHit->GetX(), richHit->GetY());
992 }
993 if (isMcGammaElectron)
994 fHM->H2("fh_rich_pmt_xy_" + CbmAnaJpsiHist::fSourceTypes[kJpsiGamma])->Fill(richHit->GetX(), richHit->GetY());
995 if (isMcPi0Electron)
996 fHM->H2("fh_rich_pmt_xy_" + CbmAnaJpsiHist::fSourceTypes[kJpsiPi0])->Fill(richHit->GetX(), richHit->GetY());
997 }
998}
999
1001{
1002 for (UInt_t i = 0; i < fCandidates.size(); i++) {
1003 new ((*fJpsiCandidates)[i]) CbmAnaJpsiCandidate(fCandidates[i]);
1004 }
1005}
1006
1007
1009{
1010 TDirectory* oldir = gDirectory;
1011 TFile* outFile = FairRootManager::Instance()->GetOutFile();
1012 if (outFile != NULL) {
1013 outFile->cd();
1014 fHM->WriteToFile();
1015 }
1016 gDirectory->cd(oldir->GetPath());
1017}
1018
1019
CbmAnaJpsiAnalysisSteps
@ kJpsiReco
@ kJpsiPtCut
@ kJpsiElId
@ kJpsiAcc
@ kJpsiChi2Prim
@ kJpsiMc
@ kJpsiSignal
@ kJpsiPi0
@ kJpsiBg
@ kJpsiGamma
ClassImp(CbmConverterManager)
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
Helper functions for drawing 1D and 2D histograms and graphs.
Int_t nStsHits
Histogram manager.
Data class for a reconstructed hit in the STS.
Data class for STS tracks.
Class for hits in TRD detector.
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
fscal v[fmask::Size]
Definition KfSimdPseudo.h:4
Double_t fChiPrimCut
static const std::vector< std::string > fSourceTypes
static const int fNofAnaSteps
static const std::vector< std::string > fAnaSteps
static const int fNofSourceTypes
static CbmAnaJpsiKinematicParams KinematicParamsWithCandidates(const CbmAnaJpsiCandidate *candP, const CbmAnaJpsiCandidate *candM)
static CbmAnaJpsiKinematicParams KinematicParamsWithMcTracks(const CbmMCTrack *mctrackP, const CbmMCTrack *mctrackM)
CbmVertex * fPrimVertex
TClonesArray * fGlobalTracks
TClonesArray * fRichHits
void CreateAnalysisStepsH1(const string &name, const string &axisX, const string &axisY, double nBins, double min, double max)
TClonesArray * fStsHits
TClonesArray * fTrdTrackMatches
TClonesArray * fStsPoints
virtual void Exec(Option_t *option)
Inherited from FairTask.
std::vector< CbmAnaJpsiCandidate > fCandidates
void AssignMcToCandidates()
Assign MC info to the candidates.
CbmHistManager * fHM
TClonesArray * fTofHits
TClonesArray * fTrdTracks
TClonesArray * fMcTracks
void CreateSourceTypesH2(const string &name, const string &axisX, const string &axisY, const string &axisZ, double nBinsX, double minX, double maxX, double nBinsY, double minY, double maxY)
TClonesArray * fRichRingMatches
void FillPairHists(CbmAnaJpsiCandidate *candP, CbmAnaJpsiCandidate *candM, CbmAnaJpsiKinematicParams *parMc, CbmAnaJpsiKinematicParams *parRec, CbmAnaJpsiAnalysisSteps step)
CbmKFVertex fKFVertex
void CreateAnaStepsPairSourceH1(const string &name, const string &axisX, const string &axisY, double nBins, double min, double max)
void CopyCandidatesToOutputArray()
virtual void Finish()
Inherited from FairTask.
TClonesArray * fRichPoints
void PairMcAndAcceptance()
Fill histograms for MC and Acc pairs.
TClonesArray * fStsTracks
virtual ~CbmAnaJpsiTask()
Standard destructor.
CbmAnaJpsiTask()
Standard constructor.
Bool_t IsMcTrackAccepted(Int_t mcTrackInd)
Return true if MC track is in detector acceptance.
void SingleParticleAcceptance()
TClonesArray * fTrdPoints
void PairSource(CbmAnaJpsiCandidate *candP, CbmAnaJpsiCandidate *candM, CbmAnaJpsiAnalysisSteps step, CbmAnaJpsiKinematicParams *parRec)
void DifferenceSignalAndBg()
Fill histograms for signal and BG electrons.
void CreateSourceTypesH1(const string &name, const string &axisX, const string &axisY, double nBins, double min, double max)
TClonesArray * fTofHitsMatches
TClonesArray * fJpsiCandidates
void IsRecoTrackAccepted(CbmAnaJpsiCandidate *cand)
void FillCandidates()
Fill fCandidates array with JPsiCandidates. Candidate should have STS, RICH, TRD, TOF local segments.
virtual InitStatus Init()
Inherited from FairTask.
CbmAnaJpsiCuts fCuts
std::map< Int_t, Int_t > fNofHitsInRingMap
void TrackSource(CbmAnaJpsiCandidate *cand, CbmAnaJpsiAnalysisSteps step, Int_t pdg)
void IsMismatch(CbmAnaJpsiCandidate *cand)
TClonesArray * fTrdHits
void IsElectron(Int_t globalTrackIndex, Double_t momentum, CbmAnaJpsiCandidate *cand)
Identifies particle as Electron (or not)
TClonesArray * fStsTrackMatches
TClonesArray * fTofPoints
TClonesArray * fRichRings
void CreateAnalysisStepsH2(const string &name, const string &axisX, const string &axisY, const string &axisZ, double nBinsX, double minX, double maxX, double nBinsY, double minY, double maxY)
static Bool_t IsMcSignalElectron(CbmMCTrack *mctrack)
static void CalculateAndSetTrackParamsToCandidate(CbmAnaJpsiCandidate *cand, CbmStsTrack *stsTrack, CbmKFVertex &kfVertex)
static Bool_t IsMcPi0Electron(CbmMCTrack *mctrack, TClonesArray *mcTracks)
static Bool_t IsMcGammaElectron(CbmMCTrack *mctrack, TClonesArray *mcTracks)
int32_t GetStsTrackIndex() const
int32_t GetRichRingIndex() const
int32_t GetTofHitIndex() const
int32_t GetTrdTrackIndex() const
Histogram manager.
TH2 * H2(const std::string &name) const
Return pointer to TH2 histogram.
void Create2(const std::string &name, const std::string &title, Int_t nofBinsX, Double_t minBinX, Double_t maxBinX, Int_t nofBinsY, Double_t minBinY, Double_t maxBinY)
Helper function for creation of 2-dimensional histograms and profiles. Template argument is a real ob...
void WriteToFile()
Write all objects to current opened file.
void Create1(const std::string &name, const std::string &title, Int_t nofBins, Double_t minBin, Double_t maxBin)
Helper function for creation of 1-dimensional histograms and profiles. Template argument is a real ob...
TH1 * H1(const std::string &name) const
Return pointer to TH1 histogram.
int32_t GetRefId() const
Definition CbmHit.h:73
Bool_t IsTrdElectron(Int_t globalTrackindex, Double_t momentum)
Identify electron in RICH detector.
Double_t GetTrdAnn(Int_t globalTrackindex, Double_t momentum)
Return ANN value for electron Identification in the TRD detector.
Double_t GetRichAnn(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
Bool_t IsTofElectron(Int_t globalTrackIndex, Double_t momentum, Double_t eventTime=1000.)
Identify electron in RICH detector.
Bool_t IsRichElectron(Int_t globalTrackIndex, Double_t momentum)
Identify electron in RICH detector.
static CbmLitGlobalElectronId & GetInstance()
double GetP() const
Definition CbmMCTrack.h:98
int32_t GetMotherId() const
Definition CbmMCTrack.h:69
int32_t GetPdgCode() const
Definition CbmMCTrack.h:68
void GetStartVertex(TVector3 &vertex) const
Definition CbmMCTrack.h:176
int32_t GetNPoints(ECbmModuleId detId) const
const CbmLink & GetMatchedLink() const
Definition CbmMatch.h:41
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
int32_t GetNofHits() const
Definition CbmRichRing.h:37
int32_t GetNofMvdHits() const
Definition CbmStsTrack.h:87
int32_t GetNofStsHits() const
Definition CbmStsTrack.h:93
virtual int32_t GetNofHits() const
Definition CbmTrack.h:58
Hash for CbmL1LinkKey.