24 #include "FairMCPoint.h"
25 #include "TDatabasePDG.h"
30 #include "TDirectory.h"
45 , listStsTracksMatch(0)
49 , listMvdHitMatches(0)
57 outfileName(
"outCbmTrackError.root")
112 TDirectory* currentDir = gDirectory;
113 gDirectory->cd(outfileName.Data());
115 ggg =
new TH1F(
"ggg",
"ggg", 6, -0.5, 5.5);
116 q_QA =
new TProfile(
"q_QA",
"q quality", 100, 0.0, 1.0, 0.0, 100.0);
117 q_QA->GetXaxis()->SetTitle(
"p, GeV/c");
118 q_QA->GetYaxis()->SetTitle(
"Q determenition efficiency, %");
120 dp_p =
new TProfile(
"dp_p",
"dp_p", 100, 0.0, 1.0, 0.0, 5.0);
121 dp_p->GetXaxis()->SetTitle(
"p, GeV/c");
122 dp_p->GetYaxis()->SetTitle(
"#Deltap/p, %");
125 new TH1F(
"residual_STShit_x",
"residual_STShit_x", 200, -10., 10.);
126 res_STShit_x->GetXaxis()->SetTitle(
"dX, um");
128 new TH1F(
"residual_STShit_y",
"residual_STShit_y", 200, -10., 10.);
129 res_STShit_y->GetXaxis()->SetTitle(
"dY, um");
130 pull_STShit_x =
new TH1F(
"pull_STShit_x",
"pull_STShit_x", 100, -15., 15.);
131 pull_STShit_y =
new TH1F(
"pull_STShit_y",
"pull_STShit_y", 100, -15., 15.);
134 new TH1F(
"residual_MVDhit_x",
"residual_MVDhit_x", 200, -30., 30.);
135 res_MVDhit_x->GetXaxis()->SetTitle(
"dX, um");
137 new TH1F(
"residual_MVDhit_y",
"residual_MVDhit_y", 200, -30., 30.);
138 res_MVDhit_y->GetXaxis()->SetTitle(
"dY, um");
139 pull_MVDhit_x =
new TH1F(
"pull_MVDhit_x",
"pull_MVDhit_x", 100, -5., 5.);
140 pull_MVDhit_y =
new TH1F(
"pull_MVDhit_y",
"pull_MVDhit_y", 100, -5., 5.);
143 res_AtPV_x =
new TH1F(
"residual_AtPV_x",
"residual_AtPV_x", 2000, -1., 1.);
144 res_AtPV_x->GetXaxis()->SetTitle(
"dX, cm");
145 res_AtPV_y =
new TH1F(
"residual_AtPV_y",
"residual_AtPV_y", 2000, -1., 1.);
146 res_AtPV_y->GetXaxis()->SetTitle(
"dY, cm");
148 new TH1F(
"residual_AtPV_tx",
"residual_AtPV_tx", 200, -0.004, 0.004);
149 res_AtPV_tx->GetXaxis()->SetTitle(
"dtx");
151 new TH1F(
"residual_AtPV_ty",
"residual_AtPV_ty", 200, -0.004, 0.004);
152 res_AtPV_ty->GetXaxis()->SetTitle(
"dty");
154 new TH1F(
"residual_AtPV_qp",
"residual_AtPV_qp", 200, -0.05, 0.05);
155 res_AtPV_qp->GetXaxis()->SetTitle(
"d(Q/P), c/GeV");
157 pull_AtPV_x =
new TH1F(
"pull_AtPV_x",
"pull_AtPV_x", 100, -5., 5.);
158 pull_AtPV_y =
new TH1F(
"pull_AtPV_y",
"pull_AtPV_y", 100, -5., 5.);
159 pull_AtPV_tx =
new TH1F(
"pull_AtPV_tx",
"pull_AtPV_tx", 100, -5., 5.);
160 pull_AtPV_ty =
new TH1F(
"pull_AtPV_ty",
"pull_AtPV_ty", 100, -5., 5.);
161 pull_AtPV_qp =
new TH1F(
"pull_AtPV_qp",
"pull_AtPV_qp", 100, -5., 5.);
163 res_AtFP_x =
new TH1F(
"residual_AtFP_x",
"residual_AtFP_x", 200, -50., 50.);
164 res_AtFP_x->GetXaxis()->SetTitle(
"dX, cm");
165 res_AtFP_y =
new TH1F(
"residual_AtFP_y",
"residual_AtFP_y", 200, -400., 400.);
166 res_AtFP_y->GetXaxis()->SetTitle(
"dY, cm");
168 new TH1F(
"residual_AtFP_tx",
"residual_AtFP_tx", 200, -0.004, 0.004);
169 res_AtFP_tx->GetXaxis()->SetTitle(
"dtx, GeV/c");
171 new TH1F(
"residual_AtFP_ty",
"residual_AtFP_ty", 200, -0.004, 0.004);
172 res_AtFP_ty->GetXaxis()->SetTitle(
"dty, GeV/c");
174 new TH1F(
"residual_AtFP_qp",
"residual_AtFP_qp", 200, -0.05, 0.05);
175 res_AtFP_qp->GetXaxis()->SetTitle(
"d(Q/P), c/GeV");
177 pull_AtFP_x =
new TH1F(
"pull_AtFP_x",
"pull_AtFP_x", 100, -5., 5.);
178 pull_AtFP_y =
new TH1F(
"pull_AtFP_y",
"pull_AtFP_y", 100, -5., 5.);
179 pull_AtFP_tx =
new TH1F(
"pull_AtFP_tx",
"pull_AtFP_tx", 100, -5., 5.);
180 pull_AtFP_ty =
new TH1F(
"pull_AtFP_ty",
"pull_AtFP_ty", 100, -5., 5.);
181 pull_AtFP_qp =
new TH1F(
"pull_AtFP_qp",
"pull_AtFP_qp", 100, -5., 5.);
183 gDirectory = currentDir;
225 FairRootManager* fManger = FairRootManager::Instance();
227 listMCTracks =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"MCTrack"));
228 listStsPts =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsPoint"));
229 listStsTracks =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsTrack"));
231 dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsTrackMatch"));
232 listStsHits =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsHit"));
234 dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsCluster"));
235 listStsDigi =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsDigi"));
237 dynamic_cast<TClonesArray*
>(fManger->GetObject(
"StsDigiMatch"));
244 listMvdPts =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"MvdPoint"));
245 listMvdHits =
dynamic_cast<TClonesArray*
>(fManger->GetObject(
"MvdHit"));
247 dynamic_cast<TClonesArray*
>(fManger->GetObject(
"MvdHitMatch"));
259 for (Int_t iMvd = 0; iMvd <
listMvdPts->GetEntriesFast(); iMvd++) {
262 MCTrackSortedArray[MvdPoint->GetTrackID()].
MvdArray.push_back(MvdPoint);
264 for (Int_t iSts = 0; iSts <
listStsPts->GetEntriesFast(); iSts++) {
267 MCTrackSortedArray[StsPoint->GetTrackID()].
StsArray.push_back(StsPoint);
269 for (Int_t itrack = 0; itrack <
listStsTracks->GetEntriesFast(); itrack++) {
278 &MCTrackSortedArray[StsTrackMatch->
GetMCTrackId()], MCTrack, &KFTrack);
284 delete[] MCTrackSortedArray;
306 TDatabasePDG::Instance()->GetParticle(track_mc->
GetPdgCode())->Charge()
311 Double_t PointPx = track_mc->
GetPx();
312 Double_t PointPy = track_mc->
GetPy();
313 Double_t PointPz = track_mc->
GetPz();
315 sqrt(PointPx * PointPx + PointPy * PointPy + PointPz * PointPz);
334 Double_t ddqp = (
fabs(1. / fT[4]) - P_mc) / P_mc;
335 Double_t ddqp_p = fT[4]
337 /
sqrt(PointPx * PointPx + PointPy * PointPy
338 + PointPz * PointPz));
353 if (
finite(fT[4]) && (
fabs(fT[4]) > 1.e-20)) {
354 if (qtrack == (
fabs(fT[4]) / fT[4]))
355 q_QA->Fill(P_mc, 100.0);
357 q_QA->Fill(P_mc, 0.0);
359 if (
finite(fC[14]) && fC[14] > 0)
360 dp_p->Fill(P_mc,
fabs(1. / fT[4]) *
sqrt(fC[14]) * 100, 1);
367 Double_t* fT = track_kf->
GetTrack();
371 Bool_t nomvdpoint = 1;
373 FairMCPoint* MCFirstPoint;
379 if (!mc_points)
return;
384 MCFirstPoint = *mc_points->
MvdArray.begin();
386 MCFirstPoint = *mc_points->
StsArray.begin();
388 for (vector<CbmMvdPoint*>::iterator imvd = mc_points->
MvdArray.begin();
391 MCFirstPoint = *imvd;
394 if (
fabs(MCFirstPoint->GetZ() - fT[5]) < 1.) {
400 for (vector<CbmStsPoint*>::iterator ists = mc_points->
StsArray.begin();
403 MCFirstPoint = *ists;
406 if (
fabs(MCFirstPoint->GetZ() - fT[5]) < 1.) {
break; }
417 TDatabasePDG::Instance()->GetParticle(track_mc->
GetPdgCode())->Charge()
422 Double_t PointPx = MCFirstPoint->GetPx();
423 Double_t PointPy = MCFirstPoint->GetPy();
424 Double_t PointPz = MCFirstPoint->GetPz();
426 sqrt(PointPx * PointPx + PointPy * PointPy + PointPz * PointPz);
445 Double_t ddqp = (
fabs(1. / fT[4]) - P_mc) / P_mc;
446 Double_t ddqp_p = fT[4]
448 /
sqrt(PointPx * PointPx + PointPy * PointPy
449 + PointPz * PointPz));
464 if (
finite(fT[4]) && (
fabs(fT[4]) > 1.e-20)) {
465 if (qtrack == (
fabs(fT[4]) / fT[4]))
466 q_QA->Fill(P_mc, 100.0);
468 q_QA->Fill(P_mc, 0.0);
470 if (
finite(fC[14]) && fC[14] > 0)
471 dp_p->Fill(P_mc,
fabs(1. / fT[4]) *
sqrt(fC[14]) * 100, 1);
479 TDirectory* curr = gDirectory;
480 TFile* currentFile = gFile;
481 TFile* fout =
new TFile(
outfileName.Data(),
"Recreate");
541 res_AtPV_qp->GetXaxis()->SetTitle(
"d(Q/P), c/GeV");
560 res_AtFP_qp->GetXaxis()->SetTitle(
"d(Q/P), c/GeV");
574 for (Int_t iSts = 0; iSts <
listStsHits->GetEntriesFast(); iSts++) {
610 const bool useLinks =
614 for (
int iH = 0; iH <
listStsHits->GetEntriesFast(); iH++) {
624 vector<int> stsPointIds_hit;
630 for (
int iL2 = 0; iL2 < NLinks2; iL2++) {
637 for (
int iL3 = 0; iL3 < NLinks3; iL3++) {
641 stsPointIds.push_back(stsPointId);
650 for (
int iL2 = 0; iL2 < NLinks2; iL2++) {
657 for (
int iL3 = 0; iL3 < NLinks3; iL3++) {
662 if (!find(&(stsPointIds[0]),
663 &(stsPointIds[stsPointIds.size()]),
672 stsPointIds_hit.push_back(stsPointId);