21#include "CbmKFVertex.h"
29#include "CbmStsTrack.h"
30#include "CbmTrackMatch.h"
31#include "CbmStsCluster.h"
32#include "CbmStsDigi.h"
35#include "CbmMCTrack.h"
36#include "CbmMvdPoint.h"
37#include "CbmMvdHitMatch.h"
38#include "CbmStsPoint.h"
40#include "TClonesArray.h"
42#include "TDirectory.h"
50#include "FairRunAna.h"
61 FairTask(name,iVerbose),
62 fFindParticlesMode(findParticlesMode),
75 flistStsTracksMatch(0),
79 flistMvdHitMatches(0),
88 outfileName(
"CbmParticlesFinderQA.root"),
89 fEfffileName(
"Efficiency.txt"),
108 hPartParam2DSignal(),
114 TString partNames[nHistoMotherPdg] = {
"e+",
"e-",
120 "#Lambda",
"#Lambda_bar",
122 "#Omega+",
"#Omega-" };
123 int partPdg[nHistoMotherPdg] = { -11, 11,
132 for(
int iMP=0; iMP<nHistoMotherPdg; iMP++)
133 fMotherPdgToIndex[partPdg[iMP]] = iMP;
135 TDirectory *currentDir = gDirectory;
136 gDirectory->mkdir(
"KFParticlesFinder");
137 gDirectory->cd(
"KFParticlesFinder");
138 histodir = gDirectory;
139 gDirectory->mkdir(
"Particles");
140 gDirectory->cd(
"Particles");
142 for(
int iPart=0; iPart<fParteff.
nParticles; ++iPart)
144 gDirectory->mkdir(fParteff.
partName[iPart].Data());
145 gDirectory->cd(fParteff.
partName[iPart].Data());
148 TString pull =
"pull";
150 gDirectory->mkdir(
"DaughtersQA");
151 gDirectory->cd(
"DaughtersQA");
153 TString parName[nFitQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz",
"E",
"M"};
155 float xMax[nFitQA/2] = {0.15,0.15,0.03,0.01,0.01,0.06,0.06,0.01};
157 for(
int iH=0; iH<nFitQA/2; iH++ ){
158 hFitDaughtersQA[iPart][iH] =
new TH1F((res+parName[iH]).Data(),
159 (res+parName[iH]).Data(),
160 nBins, -xMax[iH],xMax[iH]);
161 hFitDaughtersQA[iPart][iH+8] =
new TH1F((pull+parName[iH]).Data(),
162 (pull+parName[iH]).Data(),
166 gDirectory->cd(
"..");
168 gDirectory->mkdir(
"FitQA");
169 gDirectory->cd(
"FitQA");
171 TString parName[nFitQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz",
"E",
"M"};
173 float xMax[nFitQA/2] = {0.15,0.15,1.2,0.02,0.02,0.15,0.15,0.006};
175 for(
int iH=0; iH<nFitQA/2; iH++ ){
176 hFitQA[iPart][iH] =
new TH1F((res+parName[iH]).Data(),
177 (res+parName[iH]).Data(),
178 nBins, -xMax[iH],xMax[iH]);
179 hFitQA[iPart][iH+8] =
new TH1F((pull+parName[iH]).Data(),
180 (pull+parName[iH]).Data(),
184 gDirectory->cd(
"..");
186 gDirectory->mkdir(
"Parameters");
187 gDirectory->cd(
"Parameters");
189 TString parName[nHistoPartParam] = {
"M",
"p",
"p_{t}",
"y",
"DL",
"c#tau",
"chi2ndf",
"chi2ndfTopo",
"prob",
"#theta",
"phi",
"z",
"l/dl"};
190 TString parAxisName[nHistoPartParam] = {
"m [GeV/c^{2}]",
"p [GeV/c]",
"p_{t} [GeV/c]",
191 "y",
"Decay length [cm]",
"Life time c#tau [cm]",
192 "chi2/ndf",
"chi2/ndf topo",
"prob",
"#theta [rad]",
193 "phi [rad]",
"z [cm]",
"l/dl"};
194 int nBins[nHistoPartParam] = {1000,100,100,100,100,100,100,100,100,100,100,100,100};
195 float xMin[nHistoPartParam] = {fParteff.
partMHistoMin[iPart], 0., 0., 0., -5., 0., 0., 0., 0., -2., -2., -5., -1.};
196 float xMax[nHistoPartParam] = {fParteff.
partMHistoMax[iPart], 10., 3., 6., 55., 30., 20., 20., 1., 2., 2., 55., 35.};
198 for(
int iH=0; iH<nHistoPartParam; iH++)
200 hPartParam[iPart][iH] =
new TH1F(parName[iH].Data(),parName[iH].Data(),
201 nBins[iH],xMin[iH],xMax[iH]);
202 hPartParam[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
205 hPartParam2D[iPart][0] =
new TH2F(
"y-p_{t}",
"y-p_{t}",
206 nBins[3],xMin[3],xMax[3],
207 nBins[2],xMin[2],xMax[2]);
208 hPartParam2D[iPart][0]->GetXaxis()->SetTitle(
"y");
209 hPartParam2D[iPart][0]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
211 gDirectory->mkdir(
"Signal");
212 gDirectory->cd(
"Signal");
214 for(
int iH=0; iH<nHistoPartParam; iH++)
216 hPartParamSignal[iPart][iH] =
new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
217 nBins[iH],xMin[iH],xMax[iH]);
218 hPartParamSignal[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
221 hPartParam2DSignal[iPart][0] =
new TH2F(
"y-p_{t}",
"y-p_{t}",
222 nBins[3],xMin[3],xMax[3],
223 nBins[2],xMin[2],xMax[2]);
224 hPartParam2DSignal[iPart][0]->GetXaxis()->SetTitle(
"y");
225 hPartParam2DSignal[iPart][0]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
227 gDirectory->mkdir(
"QA");
228 gDirectory->cd(
"QA");
231 float xMaxQA[nHistoPartParamQA] = {0.01,0.001,0.001};
232 for(
int iH=0; iH<nHistoPartParamQA; iH++ ){
233 hPartParamQA[iPart][iH] =
234 new TH1F((res+parName[iH]).Data(), (res+parName[iH]).Data(), nBinsQA, -xMaxQA[iH],xMaxQA[iH]);
235 hPartParamQA[iPart][iH+nHistoPartParamQA] =
236 new TH1F((pull+parName[iH]).Data(), (pull+parName[iH]).Data(), nBinsQA, -6,6);
239 gDirectory->cd(
"..");
241 gDirectory->cd(
"..");
242 gDirectory->mkdir(
"Background");
243 gDirectory->cd(
"Background");
245 for(
int iH=0; iH<nHistoPartParam; iH++)
247 hPartParamBG[iPart][iH] =
new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
248 nBins[iH],xMin[iH],xMax[iH]);
249 hPartParamBG[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
252 hPartParam2DBG[iPart][0] =
new TH2F(
"y-p_{t}",
"y-p_{t}",
253 nBins[3],xMin[3],xMax[3],
254 nBins[2],xMin[2],xMax[2]);
255 hPartParam2DBG[iPart][0]->GetXaxis()->SetTitle(
"y");
256 hPartParam2DBG[iPart][0]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
275 gDirectory->cd(
"..");
276 gDirectory->mkdir(
"Ghost");
277 gDirectory->cd(
"Ghost");
279 for(
int iH=0; iH<nHistoPartParam; iH++)
281 hPartParamGhost[iPart][iH] =
new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
282 nBins[iH],xMin[iH],xMax[iH]);
283 hPartParamGhost[iPart][iH]->GetXaxis()->SetTitle(parAxisName[iH].Data());
286 hPartParam2DGhost[iPart][0] =
new TH2F(
"y-p_{t}",
"y-p_{t}",
287 nBins[3],xMin[3],xMax[3],
288 nBins[2],xMin[2],xMax[2]);
289 hPartParam2DGhost[iPart][0]->GetXaxis()->SetTitle(
"y");
290 hPartParam2DGhost[iPart][0]->GetYaxis()->SetTitle(
"p_{t} [GeV/c]");
292 gDirectory->cd(
"..");
294 gDirectory->cd(
"..");
296 gDirectory->cd(
"..");
299 gDirectory->cd(
"..");
300 gDirectory->mkdir(
"PrimaryVertexQA");
301 gDirectory->cd(
"PrimaryVertexQA");
310 {
"PVResX",
"x_{rec}-x_{mc}, cm", 100, -0.006f, 0.006f},
311 {
"PVResY",
"y_{rec}-y_{mc}, cm", 100, -0.006f, 0.006f},
312 {
"PVResZ",
"z_{rec}-z_{mc}, cm", 100, -0.06f, 0.06f},
313 {
"PVPullX",
"Pull X", 100, -6.f, 6.f},
314 {
"PVPullY",
"Pull Y", 100, -6.f, 6.f},
315 {
"PVPullZ",
"Pull Z", 100, -6.f, 6.f}
317 for(
int iHPV=0; iHPV<nHistosPV; ++iHPV){
318 hPVFitQa[iHPV] =
new TH1F(Table[iHPV].name.data(),Table[iHPV].title.data(),
319 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
322 gDirectory->cd(
"..");
323 gDirectory->mkdir(
"MotherPDG");
324 gDirectory->cd(
"MotherPDG");
326 for(
int iMP=0; iMP<nHistoMotherPdg; iMP++)
327 hMotherPdg[iMP] =
new TH1F(partNames[iMP].Data(), partNames[iMP].Data(), 10000, -5000, 5000);
329 gDirectory->cd(
"..");
331 gDirectory->mkdir(
"TrackParameters");
332 gDirectory->cd(
"TrackParameters");
334 TString chi2Name =
"Chi2Prim";
337 TString chi2NamePart =
"Chi2Prim";
339 chi2NamePart += fParteff.
partName[iPart].Data();
340 hTrackParameters[iPart] =
new TH1F(chi2NamePart.Data(), chi2NamePart.Data(), 1000, 0, 100);
345 gDirectory->cd(
"..");
347 gDirectory = currentDir;
353 fRecParticles->Delete();
356 fMCParticles->Delete();
357 fMatchParticles->Delete();
368 FairRootManager *fManger = FairRootManager::Instance();
370 flistMCTracks =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"MCTrack") );
371 flistStsPts =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"StsPoint") );
372 flistStsTracks =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"StsTrack") );
373 flistStsTracksMatch =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"StsTrackMatch") );
374 flistStsHits =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"StsHit") );
375 flistStsClusters =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"StsCluster") );
376 flistStsDigi =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"StsDigi") );
377 fPrimVtx = (
CbmVertex*) fManger->GetObject(
"PrimaryVertex");
383 flistMvdHitMatches = 0;
387 flistMvdPts =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"MvdPoint") );
388 flistMvdHits =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"MvdHit") );
389 flistMvdHitMatches =
dynamic_cast<TClonesArray*
>( fManger->GetObject(
"MvdHitMatch") );
395 fRecParticles =
new TClonesArray(
"KFParticle",100);
396 fManger->Register(
"RecoParticles",
"KFParticle", fRecParticles, kTRUE);
402 fMCParticles =
new TClonesArray(
"KFMCParticle",100);
403 fManger->Register(
"KFMCParticles",
"KFParticle", fMCParticles, kTRUE);
406 fMatchParticles =
new TClonesArray(
"KFParticleMatch",100);
407 fManger->Register(
"KFParticleMatch",
"KFParticle", fMatchParticles, kTRUE);
416 fRecParticles->Delete();
419 fMCParticles->Delete();
420 fMatchParticles->Delete();
423 vStsHitMatch.clear();
424 vStsPointMatch.clear();
425 vMvdPointMatch.clear();
426 vMCTrackMatch.clear();
427 vStsHitMatch.resize(flistStsHits->GetEntriesFast());
428 vStsPointMatch.resize(flistStsPts->GetEntriesFast());
430 vMvdPointMatch.resize(flistMvdPts->GetEntriesFast());
431 vMCTrackMatch.resize(flistMCTracks->GetEntriesFast());
432 for(
unsigned int iP=0; iP<vStsPointMatch.size(); iP++)
433 vStsPointMatch[iP] = -1;
434 for(
unsigned int iP=0; iP<vMvdPointMatch.size(); iP++)
435 vMvdPointMatch[iP] = -1;
436 for(
unsigned int iTr=0; iTr<vMCTrackMatch.size(); iTr++)
437 vMCTrackMatch[iTr] = -1;
441 for(
int iH=0; iH<flistMvdHits->GetEntriesFast(); iH++)
445 int iMC =
match->GetPointId();
446 if(iMC < 0)
continue;
447 vMvdPointMatch[iMC] = iH;
454 for(
int iTr=0; iTr<flistStsTracksMatch->GetEntriesFast(); iTr++)
457 if(StsTrackMatch -> GetNofMCTracks() == 0)
continue;
459 vMCTrackMatch[mcTrackId] = iTr;
462 fMCTrackPoints.clear();
463 fMCTrackPoints.resize(flistMCTracks->GetEntriesFast());
465 for (Int_t iMvd=0; iMvd<flistMvdPts->GetEntriesFast(); iMvd++)
468 if(!MvdPoint)
continue;
469 fMCTrackPoints[MvdPoint->GetTrackID()].MvdArray.push_back(MvdPoint);
470 int iHit = vMvdPointMatch[iMvd];
473 if(!MvdHit)
continue;
474 fMCTrackPoints[MvdPoint->GetTrackID()].MvdHitsArray.push_back(MvdHit);
476 for (Int_t iSts=0; iSts<flistStsPts->GetEntriesFast(); iSts++)
479 fMCTrackPoints[StsPoint->GetTrackID()].StsArray.push_back(StsPoint);
480 int iHit = vStsPointMatch[iSts];
483 fMCTrackPoints[StsPoint->GetTrackID()].StsHitsArray.push_back(StsHit);
487 FindReconstructableMCParticles();
489 PartEffPerformance();
490 PartHistoPerformance();
495 for(
unsigned int iP=0; iP < fPF->
GetParticles().size(); iP++)
503 for(
unsigned int iP=0; iP < fPF->
GetParticles().size(); iP++)
508 Short_t matchType = 0;
510 if(!RtoMCParticleId[iP].IsMatchedWithPdg())
512 if(RtoMCParticleId[iP].IsMatched())
514 iMCPart = RtoMCParticleId[iP].GetBestMatchWithPdg();
520 iMCPart = RtoMCParticleId[iP].GetBestMatchWithPdg();
528 for(
unsigned int iP=0; iP < vMCParticles.size(); iP++)
530 new((*fMCParticles)[iP])
KFMCParticle(vMCParticles[iP]);
539 if(!(outfileName ==
""))
541 TDirectory *curr = gDirectory;
542 TFile *currentFile = gFile;
546 outfile =
new TFile(outfileName.Data(),
"RECREATE");
548 WriteHistos(histodir);
556 WriteHistosCurFile(histodir);
558 std::fstream eff(fEfffileName.Data(),fstream::out);
563void CbmKFParticlesFinderQA::WriteHistos( TObject *obj ){
564 if( !obj->IsFolder() ) obj->Write();
566 TDirectory *cur = gDirectory;
567 TDirectory *sub = cur->mkdir(obj->GetName());
569 TList *listSub = (
static_cast<TDirectory*
>(obj))->GetList();
571 while( TObject *obj1=it() ) WriteHistos(obj1);
576void CbmKFParticlesFinderQA::WriteHistosCurFile( TObject *obj ){
577 if( !obj->IsFolder() ) obj->Write();
579 TDirectory *cur = gDirectory;
580 TDirectory *sub = cur->GetDirectory(obj->GetName());
582 TList *listSub = (
static_cast<TDirectory*
>(obj))->GetList();
584 while( TObject *obj1=it() ) WriteHistosCurFile(obj1);
589void CbmKFParticlesFinderQA::StsHitMatch()
591 const bool useLinks = 1;
594 for (
int iH = 0; iH < flistStsHits->GetEntriesFast(); iH++){
596 vStsHitMatch[iH] = -1;
598 if (flistStsClusters){
601 vector<int> stsPointIds;
602 vector<int> stsPointIds_hit;
604 FairLink link = stsHit->GetLink(iL);
606 int NLinks2 = stsCluster->GetNLinks();
607 for (
int iL2 = 0; iL2 < NLinks2; iL2++){
608 FairLink link2 = stsCluster->GetLink(iL2);
610 const int NLinks3 = stsDigi->GetNLinks();
611 for (
int iL3 = 0; iL3 < NLinks3; iL3++){
612 FairLink link3 = stsDigi->GetLink(iL3);
613 int stsPointId = link3.GetIndex();
614 stsPointIds.push_back( stsPointId );
619 link = stsHit->GetLink(iL);
620 stsCluster =
dynamic_cast<CbmStsCluster*
>( flistStsClusters->At( link.GetIndex() ) );
621 NLinks2 = stsCluster->GetNLinks();
622 for (
int iL2 = 0; iL2 < NLinks2; iL2++){
623 FairLink link2 = stsCluster->GetLink(iL2);
625 const int NLinks3 = stsDigi->GetNLinks();
626 for (
int iL3 = 0; iL3 < NLinks3; iL3++){
627 FairLink link3 = stsDigi->GetLink(iL3);
628 int stsPointId = link3.GetIndex();
630 if ( !find(&(stsPointIds[0]), &(stsPointIds[stsPointIds.size()]), stsPointId) )
continue;
637 for(
unsigned int iP=0; iP < stsPointIds_hit.size(); iP ++)
if(vStsHitMatch[iH] == stsPointIds_hit[iP]) save=0;
638 stsPointIds_hit.push_back(stsPointId);
639 vStsHitMatch[iH] = stsPointId;
640 vStsPointMatch[stsPointId] = iH;
648void CbmKFParticlesFinderQA::GetMCParticles()
650 vMCParticles.clear();
652 for(
int i=0;
i < flistMCTracks->GetEntriesFast();
i++)
659 vMCParticles.push_back( part );
662 const unsigned int nMCParticles = vMCParticles.size();
663 for (
unsigned int iP = 0; iP < nMCParticles; iP++ ) {
665 for(
unsigned int iP2 = 0; iP2 < nMCParticles; iP2++) {
675void CbmKFParticlesFinderQA::FindReconstructableMCParticles()
677 const unsigned int nMCParticles = vMCParticles.size();
679 for (
unsigned int iP = 0; iP < nMCParticles; iP++ ) {
681 CheckMCParticleIsReconstructable(part);
685void CbmKFParticlesFinderQA::CheckMCParticleIsReconstructable(
KFMCParticle &part)
690 if ( part.
GetPDG() == -211 ||
701 switch ( fFindParticlesMode ) {
709 if(fMCTrackPoints[iMCPart].IsReconstructable(mcTr, fMinNStations, fPerformance, fMinRecoMom))
716 if ( vMCTrackMatch[iMCPart]>=0 )
727 for(
int iPart=0; iPart<fParteff.
nParticles; iPart++)
731 const unsigned int nDaughters = fParteff.
partDaughterPdg[iPart].size();
735 for(
unsigned int iD=0; iD<nDaughters; iD++)
738 bool isDaughterFound[nDaughters];
739 for(
unsigned int iDMC=0; iDMC<nDaughters; iDMC++)
740 isDaughterFound[iDMC] = 0;
743 for(
unsigned int iDMC=0; iDMC<nDaughters; iDMC++)
744 for(
unsigned int iD=0; iD<nDaughters; iD++)
745 if(pdg[iD] == fParteff.
partDaughterPdg[iPart][iDMC]) isDaughterFound[iDMC] = 1;
747 for(
unsigned int iDMC=0; iDMC<nDaughters; iDMC++)
748 isReco = isReco && isDaughterFound[iDMC];
756 const unsigned int nD = dIds.size();
758 for (
unsigned int iD = 0; iD < nD && reco; iD++ ) {
760 CheckMCParticleIsReconstructable(dp);
768void CbmKFParticlesFinderQA::MatchParticles()
771 MCtoRParticleId.clear();
772 RtoMCParticleId.clear();
773 MCtoRParticleId.resize(vMCParticles.size());
775 vIsBkgWithSamePDG.clear();
779 for(
unsigned int iRP = 0; iRP < fPF->
GetParticles().size(); iRP++ ) {
787 if(StsTrackMatch -> GetNofMCTracks() == 0)
continue;
790 for (
unsigned int iMP = 0; iMP < vMCParticles.size(); iMP++ ) {
794 MCtoRParticleId[iMP].ids.push_back(iRP);
795 RtoMCParticleId[iRP].ids.push_back(iMP);
798 MCtoRParticleId[iMP].idsMI.push_back(iRP);
799 RtoMCParticleId[iRP].idsMI.push_back(iMP);
806 for(
unsigned int iRP = 0; iRP < fPF->
GetParticles().size(); iRP++ ) {
809 const unsigned int NRDaughters = rPart.
NDaughters();
810 if (NRDaughters < 2)
continue;
816 if ( !RtoMCParticleId[rdId].IsMatched() )
continue;
817 const int mdId = RtoMCParticleId[rdId].GetBestMatch();
818 mmId = vMCParticles[mdId].GetMotherId();
821 for ( ; iD < NRDaughters; iD++ ) {
823 if ( !RtoMCParticleId[rdId].IsMatched() )
break;
824 const int mdId = RtoMCParticleId[rdId].GetBestMatch();
825 if( vMCParticles[mdId].GetMotherId() != mmId )
break;
827 if ( iD == NRDaughters && mmId != -1 ) {
831 MCtoRParticleId[mmId].ids.push_back(iRP);
832 RtoMCParticleId[iRP].ids.push_back(mmId);
835 MCtoRParticleId[mmId].idsMI.push_back(iRP);
836 RtoMCParticleId[iRP].idsMI.push_back(mmId);
843void CbmKFParticlesFinderQA::PartEffPerformance()
848 for (
int iP = 0; iP < NRP; ++iP ) {
851 const int pdg = part.
GetPDG();
853 const bool isBG = RtoMCParticleId[iP].idsMI.size() != 0;
854 const bool isGhost = !RtoMCParticleId[iP].IsMatched();
856 for(
int iPart=0; iPart<fParteff.
nParticles; iPart++)
857 if ( pdg == fParteff.
partPDG[iPart] )
862 const int NMP = vMCParticles.size();
863 for (
int iP = 0; iP < NMP; ++iP ) {
866 const int pdg = part.
GetPDG();
869 const bool isReco = MCtoRParticleId[iP].ids.size() != 0;
870 const int nClones = MCtoRParticleId[iP].ids.size() - 1;
872 for(
int iPart=0; iPart<fParteff.
nParticles; iPart++)
874 if ( pdg == fParteff.
partPDG[iPart] ) {
875 partEff.
Inc(isReco, nClones, fParteff.
partName[iPart].Data());
877 partEff.
Inc(isReco, nClones, (fParteff.
partName[iPart]+
"_prim").Data());
879 partEff.
Inc(isReco, nClones, (fParteff.
partName[iPart]+
"_sec").Data());
893 if(fNEvents%100 == 0)
895 cout <<
" ---- KF Particle finder --- " << endl;
899 cout <<
"ACCUMULATED STAT : " << fNEvents <<
" EVENTS " << endl << endl;
908void CbmKFParticlesFinderQA::PartHistoPerformance()
914 for(
unsigned int iP=0; iP < fPF->
GetParticles().size(); iP++)
917 if(iParticle < 0)
continue;
933 Pt = TempPart.
GetPt();
937 Double_t chi2 = TempPart.
GetChi2();
938 Int_t ndf = TempPart.
GetNDF();
939 Double_t prob = TMath::Prob(chi2,ndf);
947 tempSIMDPart.GetDistanceToVertexLine(pv, l, dl);
948 dL =
sqrt(TempPart.
X()*TempPart.
X() + TempPart.
Y()*TempPart.
Y() + TempPart.
Z()*TempPart.
Z() );
951 tempSIMDPart.SetProductionVertex(pv);
952 fvec chi2topo = tempSIMDPart.Chi2()/tempSIMDPart.GetNDF();
954 hPartParam[iParticle][ 0]->Fill(M);
955 hPartParam[iParticle][ 1]->Fill(P);
956 hPartParam[iParticle][ 2]->Fill(Pt);
957 hPartParam[iParticle][ 3]->Fill(Rapidity);
958 hPartParam[iParticle][ 4]->Fill(dL);
959 hPartParam[iParticle][ 5]->Fill(cT);
960 hPartParam[iParticle][ 6]->Fill(chi2/ndf);
961 hPartParam[iParticle][ 7]->Fill(chi2topo[0]);
962 hPartParam[iParticle][ 8]->Fill(prob);
963 hPartParam[iParticle][ 9]->Fill(Theta);
964 hPartParam[iParticle][10]->Fill(Phi);
965 hPartParam[iParticle][11]->Fill(Z);
966 hPartParam[iParticle][12]->Fill(l[0]/dl[0]);
969 hPartParam2D[iParticle][0]->Fill(Rapidity,Pt,1);
971 if(!RtoMCParticleId[iP].IsMatchedWithPdg())
973 if(!RtoMCParticleId[iP].IsMatched())
975 hPartParamGhost[iParticle][ 0]->Fill(M);
976 hPartParamGhost[iParticle][ 1]->Fill(P);
977 hPartParamGhost[iParticle][ 2]->Fill(Pt);
978 hPartParamGhost[iParticle][ 3]->Fill(Rapidity);
979 hPartParamGhost[iParticle][ 4]->Fill(dL);
980 hPartParamGhost[iParticle][ 5]->Fill(cT);
981 hPartParamGhost[iParticle][ 6]->Fill(chi2/ndf);
982 hPartParamGhost[iParticle][ 7]->Fill(chi2topo[0]);
983 hPartParamGhost[iParticle][ 8]->Fill(prob);
984 hPartParamGhost[iParticle][ 9]->Fill(Theta);
985 hPartParamGhost[iParticle][10]->Fill(Phi);
986 hPartParamGhost[iParticle][11]->Fill(Z);
987 hPartParamGhost[iParticle][12]->Fill(l[0]/dl[0]);
989 hPartParam2DGhost[iParticle][0]->Fill(Rapidity,Pt,1);
1010 hPartParamBG[iParticle][ 0]->Fill(M);
1011 hPartParamBG[iParticle][ 1]->Fill(P);
1012 hPartParamBG[iParticle][ 2]->Fill(Pt);
1013 hPartParamBG[iParticle][ 3]->Fill(Rapidity);
1014 hPartParamBG[iParticle][ 4]->Fill(dL);
1015 hPartParamBG[iParticle][ 5]->Fill(cT);
1016 hPartParamBG[iParticle][ 6]->Fill(chi2/ndf);
1017 hPartParamBG[iParticle][ 7]->Fill(chi2topo[0]);
1018 hPartParamBG[iParticle][ 8]->Fill(prob);
1019 hPartParamBG[iParticle][ 9]->Fill(Theta);
1020 hPartParamBG[iParticle][10]->Fill(Phi);
1021 hPartParamBG[iParticle][11]->Fill(Z);
1022 hPartParamBG[iParticle][12]->Fill(l[0]/dl[0]);
1024 hPartParam2DBG[iParticle][0]->Fill(Rapidity,Pt,1);
1028 hPartParamSignal[iParticle][ 0]->Fill(M);
1029 hPartParamSignal[iParticle][ 1]->Fill(P);
1030 hPartParamSignal[iParticle][ 2]->Fill(Pt);
1031 hPartParamSignal[iParticle][ 3]->Fill(Rapidity);
1032 hPartParamSignal[iParticle][ 4]->Fill(dL);
1033 hPartParamSignal[iParticle][ 5]->Fill(cT);
1034 hPartParamSignal[iParticle][ 6]->Fill(chi2/ndf);
1035 hPartParamSignal[iParticle][ 7]->Fill(chi2topo[0]);
1036 hPartParamSignal[iParticle][ 8]->Fill(prob);
1037 hPartParamSignal[iParticle][ 9]->Fill(Theta);
1038 hPartParamSignal[iParticle][10]->Fill(Phi);
1039 hPartParamSignal[iParticle][11]->Fill(Z);
1040 hPartParamSignal[iParticle][12]->Fill(l[0]/dl[0]);
1042 hPartParam2DSignal[iParticle][0]->Fill(Rapidity,Pt,1);
1044 int iMCPart = RtoMCParticleId[iP].GetBestMatchWithPdg();
1054 Double_t recParam[8] = { 0 };
1055 Double_t errParam[8] = { 0 };
1057 for(
int iPar=0; iPar<3; iPar++)
1061 if(error < 0.) {
error = 1.e20;}
1062 errParam[iPar] = TMath::Sqrt(error);
1065 for(
int iPar=3; iPar<7; iPar++)
1069 if(error < 0.) {
error = 1.e20;}
1070 errParam[iPar] = TMath::Sqrt(error);
1074 Double_t res[8] = {0},
1076 mcParam[8] = { decayVtx[0], decayVtx[1], decayVtx[2],
1078 for(
int iPar=0; iPar < 7; iPar++ )
1080 res[iPar] = recParam[iPar] - mcParam[iPar];
1081 if(
fabs(errParam[iPar]) > 1.e-20) pull[iPar] = res[iPar]/errParam[iPar];
1083 res[7] = M - mcParam[7];
1084 if(
fabs(ErrM) > 1.e-20) pull[7] = res[7]/ErrM;
1086 for(
int iPar=0; iPar < 8; iPar++ )
1088 hFitQA[iParticle][iPar]->Fill(res[iPar]);
1089 hFitQA[iParticle][iPar+8]->Fill(pull[iPar]);
1100 if(!MCtoRParticleId[mcDaughterId].IsMatched())
continue;
1103 int recDaughterId = MCtoRParticleId[mcDaughterId].GetBestMatch();
1112 Double_t res[8] = {0},
1116 for(
int iPar=0; iPar < 7; iPar++ )
1119 if(error < 0.) {
error = 1.e20;}
1120 error = TMath::Sqrt(error);
1121 res[iPar] = Daughter.
GetParameter(iPar) - mcParam[iPar];
1122 if(
fabs(error) > 1.e-20) pull[iPar] = res[iPar]/
error;
1124 res[7] = M - mcParam[7];
1125 if(
fabs(ErrM) > 1.e-20) pull[7] = res[7]/ErrM;
1127 for(
int iPar=0; iPar < 8; iPar++ )
1129 hFitDaughtersQA[iParticle][iPar]->Fill(res[iPar]);
1130 hFitDaughtersQA[iParticle][iPar+8]->Fill(pull[iPar]);
1135 float mcPVx[3]={0.f};
1136 for(
int iMC=0; iMC<flistMCTracks->GetEntriesFast(); ++iMC)
1148 float dRPVr[3] = {vtx.
GetRefX()-mcPVx[0],
1154 for(
unsigned int iHPV=0; iHPV<3; ++iHPV)
1155 hPVFitQa[iHPV]->Fill(dRPVr[iHPV]);
1156 for(
unsigned int iHPV=3; iHPV<6; ++iHPV)
1157 hPVFitQa[iHPV]->Fill(dRPVp[iHPV-3]);
1160 for(
int i=0;
i < flistMCTracks->GetEntriesFast();
i++)
1165 int histoIndex = GetMotherPdgIndex(pdg);
1166 if(histoIndex != -1)
1172 hMotherPdg[histoIndex]->Fill(motherPdg);
1175 hMotherPdg[histoIndex]->Fill(-1);
1180 for(
unsigned int iP=0; iP<fPF->
GetParticles().size(); iP++)
1183 const unsigned int NRDaughters = rPart.
NDaughters();
1184 if (NRDaughters > 1)
break;
1185 if( RtoMCParticleId[iP].GetBestMatch()<0 )
continue;
1186 KFMCParticle &mPart = vMCParticles[ RtoMCParticleId[iP].GetBestMatch() ];
1199 hTrackParameters[iParticle]->Fill(chiPrim );
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 fabs(const F32vec4 &a)
float partMHistoMin[nParticles]
vector< vector< int > > partDaughterPdg
void Inc(bool isReco, int nClones, TString name)
int GetParticleIndex(int pdg)
float partMHistoMax[nParticles]
static const int nParticles
void IncReco(bool isGhost, bool isBg, TString name)
TString partName[nParticles]
virtual InitStatus ReInit()
~CbmKFParticlesFinderQA()
virtual InitStatus Init()
CbmKFParticlesFinderQA(CbmKFParticlesFinder *pf=0, Int_t iVerbose=1, int findParticlesMode=1, int perf=3, const char *name="CbmKFParticlesFinderQA", const char *title="Cbm KF Particles Finder QA")
void Exec(Option_t *option)
std::vector< float > & GetChiPrim()
std::vector< KFParticle > & GetParticles()
Double_t * GetCovMatrix()
static CbmKF * Instance()
int GetNMvdStations() const
Double_t GetStartZ() const
Double_t GetStartY() const
Int_t GetMotherId() const
Double_t GetStartX() const
Int_t GetMCTrackId() const
bool IsReconstructable() const
void SetMCTrackID(int id)
const std::vector< int > & GetDaughterIds() const
void SetAsReconstructable()
const std::vector< int > & DaughterIds() const
void SetMatchType(Short_t i)
Double_t GetTheta() const
const Double_t & Y() const
Double_t GetMomentum() const
const Double_t & X() const
const Double_t & Z() const
Double_t GetCovariance(int i) const
Double_t GetParameter(int i) const
Double_t GetDecayLength() const
void TransportToPoint(const Double_t xyz[])
Double_t GetLifeTime() const
Double_t GetRapidity() const
@ error
throw a parse_error exception in case of a tag