23#include "FairTrackParam.h"
24#include "CbmKFTrack.h"
29#include "CbmMvdHitMatch.h"
30#include "CbmStsDigi.h"
31#include "CbmStsSensor.h"
32#include "CbmStsSector.h"
33#include "CbmStsStation.h"
34#include "CbmStsPoint.h"
36#include "CbmMvdPoint.h"
37#include "CbmMCTrack.h"
39#include "CbmL1Counters.h"
60void CbmL1::TrackMatch(){
61 map <int, CbmL1MCTrack*> pMCTrackMap; pMCTrackMap.clear();
64 for( vector<CbmL1MCTrack>::iterator
i = vMCTracks.begin();
i != vMCTracks.end(); ++
i){
67 if (pMCTrackMap.find(MC.
ID) == pMCTrackMap.end()){
68 pMCTrackMap.insert(pair<int, CbmL1MCTrack*>(MC.
ID, &MC));
71 cout <<
"*** L1: Track ID " << MC.
ID <<
" encountered twice! ***" << endl;
75 const int nRTracks =
vRTracks.size();
76 for (
int iR = 0; iR < nRTracks; iR++){
79 int hitsum = prtra->
StsHits.size();
82 map<int, int > &hitmap = prtra->
hitMap;
83 for (vector<int>::iterator ih = (prtra->
StsHits).begin(); ih != (prtra->
StsHits).end(); ++ih){
85 const int nMCPoints = vStsHits[*ih].mcPointIds.size();
86 for (
int iP = 0; iP < nMCPoints; iP++){
87 int iMC = vStsHits[*ih].mcPointIds[iP];
89 if (iMC >= 0) ID = vMCPoints[iMC].ID;
90 if(hitmap.find(ID) == hitmap.end())
99 double max_percent = 0.0;
100 for( map<int, int >::iterator posIt = hitmap.begin(); posIt != hitmap.end(); posIt++ ){
102 if (posIt->first < 0)
continue;
105 if (
double(posIt->second) > max_percent*double(hitsum))
106 max_percent =
double(posIt->second)/double(hitsum);
110 if (pMCTrackMap.find(posIt->first) == pMCTrackMap.end())
continue;
117 if (pMCTrackMap.find(posIt->first) == pMCTrackMap.end())
continue;
144 AddCounter(
"long_fast_prim" ,
"LongRPrim efficiency");
145 AddCounter(
"fast_prim" ,
"RefPrim efficiency");
149 AddCounter(
"slow_prim" ,
"ExtraPrim efficiency");
150 AddCounter(
"slow_sec" ,
"ExtraSec efficiency");
154 AddCounter(
"shortPion" ,
"Short123s pion eff");
155 AddCounter(
"shortProton" ,
"Short123s proton eff");
156 AddCounter(
"shortKaon" ,
"Short123s kaon eff");
158 AddCounter(
"shortRest" ,
"Short123s rest eff");
160 AddCounter(
"fast_sec_e" ,
"RefSec E efficiency");
163 AddCounter(
"slow_sec_e" ,
"ExtraSecE efficiency");
202 void Inc(
bool isReco,
bool isKilled,
double _ratio_length,
double _ratio_fakes,
int _nclones,
int _mc_length,
int _mc_length_hits, TString name){
205 const int index =
indices[name];
218 cout.setf(ios::fixed);
219 cout.setf(ios::showpoint);
221 cout.setf(ios::right);
222 cout <<
"Track category : " <<
" Eff " <<
" / "<<
"Killed" <<
" / "<<
"Length" <<
" / "<<
"Fakes " <<
" / "<<
"Clones" <<
" / "<<
"All Reco" <<
" | "<<
" All MC " <<
" / "<<
"MCl(hits)" <<
" / "<<
"MCl(MCps)" << endl;
225 for (
int iC = 0; iC < NCounters; iC++){
227 cout <<
names[iC] <<
" : "
256void CbmL1::EfficienciesPerformance()
260 static int L1_NEVENTS = 0;
261 static double L1_CATIME = 0.0;
265 for (vector<CbmL1Track>::iterator rtraIt =
vRTracks.begin(); rtraIt !=
vRTracks.end(); ++rtraIt){
266 ntra.
ghosts += rtraIt->IsGhost();
283 for ( vector<CbmL1MCTrack>::iterator mtraIt = vMCTracks.begin(); mtraIt != vMCTracks.end(); mtraIt++ ) {
296 double ratio_length = 0;
297 double ratio_fakes = 0;
298 double mc_length_hits = mtra.
NStations();
301 for (
unsigned int irt = 0; irt < rTracks.size(); irt++) {
302 ratio_length +=
static_cast<double>( rTracks[irt]->GetNOfHits() )*rTracks[irt]->GetMaxPurity() / mc_length_hits;
303 ratio_fakes += 1 - rTracks[irt]->GetMaxPurity();
318 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"short");
319 switch ( mtra.
pdg ) {
322 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"shortE");
326 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"shortPion");
330 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"shortKaon");
334 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"shortProton");
337 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"shortRest");
342 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"total");
345 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"d0");
349 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"fast");
353 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"long_fast_prim");
355 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"fast_prim");
358 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"fast_sec");
362 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"slow");
365 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"slow_prim");
368 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"slow_sec");
372 if ( mtra.
pdg == 11 || mtra.
pdg == -11 ) {
373 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"total_e");
376 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"fast_e");
381 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"fast_sec_e");
385 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"slow_e");
390 ntra.
Inc(reco, killed, ratio_length, ratio_fakes, nclones, mc_length, mc_length_hits,
"slow_sec_e");
410 cout <<
"Number of true and fake hits in stations: " << endl;
412 cout << sta_nhits[
i]-sta_nfakes[
i] <<
"+" << sta_nfakes[
i] <<
" ";
417 cout <<
"L1 ACCUMULATED STAT : " << L1_NEVENTS <<
" EVENTS " << endl << endl;
419 cout <<
"MC tracks/event found : " <<
int(
double(L1_NTRA.
reco.
counters[L1_NTRA.
indices[
"total"]])/
double(L1_NEVENTS)) << endl;
421 cout<<
"CA Track Finder: " << L1_CATIME/L1_NEVENTS <<
" s/ev" << endl << endl;
426void CbmL1::GetMCParticles()
428 vMCParticles.clear();
430 for(
int i=0;
i < listMCTracks->GetEntriesFast();
i++)
432 CbmMCTrack &mtra = *(L1_DYNAMIC_CAST<CbmMCTrack*>(listMCTracks->At(
i)));
437 vMCParticles.push_back( part );
441 const unsigned int nParticles = vMCParticles.size();
442 for (
unsigned int iP = 0; iP < nParticles; iP++ ) {
444 for(
unsigned int iP2 = 0; iP2 < nParticles; iP2++) {
465void CbmL1::FindReconstructableMCParticles()
467 const unsigned int nParticles = vMCParticles.size();
469 for (
unsigned int iP = 0; iP < nParticles; iP++ ) {
471 CheckMCParticleIsReconstructable(part);
475void CbmL1::CheckMCParticleIsReconstructable(
KFMCParticle &part)
480 const int nParticles = 5;
481 int partPDG[nParticles] = {310,3122,3312,-3312,3334};
482 vector<int> partDaughterPdg[nParticles];
484 partDaughterPdg[0].push_back( 211);
485 partDaughterPdg[0].push_back(-211);
487 partDaughterPdg[1].push_back(2212);
488 partDaughterPdg[1].push_back(-211);
490 partDaughterPdg[2].push_back(3122);
491 partDaughterPdg[2].push_back(-211);
493 partDaughterPdg[3].push_back(3122);
494 partDaughterPdg[3].push_back( 211);
496 partDaughterPdg[4].push_back(3122);
497 partDaughterPdg[4].push_back(-321);
500 if ( part.
GetPDG() == -211 ||
506 switch ( fFindParticlesMode ) {
512 for (
i = 0;
i < vMCTracks.size();
i++ )
514 if (
i != vMCTracks.size() )
515 if ( vMCTracks[
i].IsReconstructable() )
520 for (
i = 0;
i < vMCTracks.size();
i++ )
522 if (
i != vMCTracks.size() )
523 if ( vMCTracks[
i].IsReconstructed() )
534 for(
int iPart=0; iPart<nParticles; iPart++)
536 if(part.
GetPDG() == partPDG[iPart])
538 const unsigned int nDaughters = partDaughterPdg[iPart].size();
542 for(
unsigned int iD=0; iD<nDaughters; iD++)
545 bool isDaughterFound[nDaughters];
546 for(
unsigned int iDMC=0; iDMC<nDaughters; iDMC++)
547 isDaughterFound[iDMC] = 0;
550 for(
unsigned int iDMC=0; iDMC<nDaughters; iDMC++)
551 for(
unsigned int iD=0; iD<nDaughters; iD++)
552 if(pdg[iD] == partDaughterPdg[iPart][iDMC]) isDaughterFound[iDMC] = 1;
554 for(
unsigned int iDMC=0; iDMC<nDaughters; iDMC++)
555 isReco = isReco && isDaughterFound[iDMC];
562 const unsigned int nD = dIds.size();
564 for (
unsigned int iD = 0; iD < nD && reco; iD++ ) {
566 CheckMCParticleIsReconstructable(dp);
576void CbmL1::MatchParticles()
579 MCtoRParticleId.clear();
580 RtoMCParticleId.clear();
581 MCtoRParticleId.resize(vMCParticles.size());
582 RtoMCParticleId.resize(vRParticles.size() );
585 for(
unsigned int iRP = 0; iRP < vRParticles.size(); iRP++ ) {
588 L1_ASSERT(
static_cast<unsigned int>(rPart.
Id()) == iRP, rPart.
Id() <<
" != " << iRP );
593 if (
vRTracks[rTrackId].IsGhost() )
continue;
594 const int mcTrackId =
vRTracks[rTrackId].GetMCTrack()->ID;
596 for (
unsigned int iMP = 0; iMP < vMCParticles.size(); iMP++ ) {
600 MCtoRParticleId[iMP].ids.push_back(iRP);
601 RtoMCParticleId[iRP].ids.push_back(iMP);
604 MCtoRParticleId[iMP].idsMI.push_back(iRP);
605 RtoMCParticleId[iRP].idsMI.push_back(iMP);
612 for(
unsigned int iRP = 0; iRP < vRParticles.size(); iRP++ ) {
614 const unsigned int NRDaughters = rPart.
NDaughters();
615 if (NRDaughters < 2)
continue;
621 if ( !RtoMCParticleId[rdId].IsMatched() )
continue;
622 const int mdId = RtoMCParticleId[rdId].GetBestMatch();
623 mmId = vMCParticles[mdId].GetMotherId();
626 for ( ; iD < NRDaughters; iD++ ) {
628 if ( !RtoMCParticleId[rdId].IsMatched() )
break;
629 const int mdId = RtoMCParticleId[rdId].GetBestMatch();
630 if( vMCParticles[mdId].GetMotherId() != mmId )
break;
632 if ( iD == NRDaughters && mmId != -1 ) {
636 MCtoRParticleId[mmId].ids.push_back(iRP);
637 RtoMCParticleId[iRP].ids.push_back(mmId);
640 MCtoRParticleId[mmId].idsMI.push_back(iRP);
641 RtoMCParticleId[iRP].idsMI.push_back(mmId);
648void CbmL1::PartEffPerformance()
650 static int NEVENTS = 0;
656 const int NRP = vRParticles.size();
657 for (
int iP = 0; iP < NRP; ++iP ) {
659 const int pdg = part.
GetPDG();
661 const bool isBG = RtoMCParticleId[iP].idsMI.size() != 0;
662 const bool isGhost = !RtoMCParticleId[iP].IsMatched();
664 for(
int iPart=0; iPart<PARTEFF.
nParticles; iPart++)
665 if ( pdg == PARTEFF.
partPDG[iPart] )
670 const int NMP = vMCParticles.size();
671 for (
int iP = 0; iP < NMP; ++iP ) {
674 const int pdg = part.
GetPDG();
677 const bool isReco = MCtoRParticleId[iP].ids.size() != 0;
678 const int nClones = MCtoRParticleId[iP].ids.size() - 1;
680 for(
int iPart=0; iPart<PARTEFF.
nParticles; iPart++)
682 if ( pdg == PARTEFF.
partPDG[iPart] ) {
683 partEff.
Inc(isReco, nClones, PARTEFF.
partName[iPart].Data());
685 partEff.
Inc(isReco, nClones, (PARTEFF.
partName[iPart]+
"_prim").Data());
687 partEff.
Inc(isReco, nClones, (PARTEFF.
partName[iPart]+
"_sec").Data());
703 cout <<
" ---- KF Particle finder --- " << endl;
707 cout <<
"ACCUMULATED STAT : " << NEVENTS <<
" EVENTS " << endl << endl;
716void CbmL1::PartHistoPerformance()
718 static const int NParticles = 2;
720 static const int nFitQA = 16;
721 static TH1F *hFitDaughtersQA[NParticles][nFitQA];
722 static TH1F *hFitQA[NParticles][nFitQA];
724 static const int nHistoPartParam = 5;
725 static TH1F *hPartParam[NParticles][nHistoPartParam];
726 static TH1F *hPartParamBG[NParticles][nHistoPartParam];
727 static TH1F *hPartParamSignal[NParticles][nHistoPartParam];
728 static const int nHistoPartParamQA = 3;
731 static const int nHistosPV = 6;
732 static TH1F *hPVFitQa[nHistosPV];
734 TString patName[NParticles] = {
"K0s",
"Lambda"};
736 static bool first_call = 1;
742 TDirectory *currentDir = gDirectory;
743 gDirectory = histodir;
744 gDirectory->cd(
"L1");
745 gDirectory->mkdir(
"Particles");
746 gDirectory->cd(
"Particles");
748 for(
int iPart=0; iPart<NParticles; ++iPart)
750 gDirectory->mkdir(patName[iPart].Data());
751 gDirectory->cd(patName[iPart].Data());
754 TString pull =
"pull";
756 gDirectory->mkdir(
"DaughtersQA");
757 gDirectory->cd(
"DaughtersQA");
759 TString parName[nFitQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz",
"E",
"M"};
761 float xMax[nFitQA/2] = {0.15,0.15,0.03,0.01,0.01,0.06,0.06,0.01};
763 for(
int iH=0; iH<nFitQA/2; iH++ ){
764 hFitDaughtersQA[iPart][iH] =
new TH1F((res+parName[iH]).Data(),
765 (res+parName[iH]).Data(),
766 nBins, -xMax[iH],xMax[iH]);
767 hFitDaughtersQA[iPart][iH+8] =
new TH1F((pull+parName[iH]).Data(),
768 (pull+parName[iH]).Data(),
772 gDirectory->cd(
"..");
774 gDirectory->mkdir(
"FitQA");
775 gDirectory->cd(
"FitQA");
777 TString parName[nFitQA/2] = {
"X",
"Y",
"Z",
"Px",
"Py",
"Pz",
"E",
"M"};
779 float xMax[nFitQA/2] = {0.15,0.15,1.2,0.02,0.02,0.15,0.15,0.006};
781 for(
int iH=0; iH<nFitQA/2; iH++ ){
782 hFitQA[iPart][iH] =
new TH1F((res+parName[iH]).Data(),
783 (res+parName[iH]).Data(),
784 nBins, -xMax[iH],xMax[iH]);
785 hFitQA[iPart][iH+8] =
new TH1F((pull+parName[iH]).Data(),
786 (pull+parName[iH]).Data(),
790 gDirectory->cd(
"..");
792 gDirectory->mkdir(
"Parameters");
793 gDirectory->cd(
"Parameters");
795 TString parName[nHistoPartParam] = {
"M",
"DL",
"c#tau",
"chi2ndf",
"prob"};
796 int nBins[nHistoPartParam] = {1000,100,100,100,100};
797 float xMin[nHistoPartParam] = {0.3f,0. , 0., 0.,0.};
798 float xMax[nHistoPartParam] = {1.3f,30.,30.,20.,1.};
805 for(
int iH=0; iH<nHistoPartParam; iH++)
806 hPartParam[iPart][iH] =
new TH1F(parName[iH].Data(),parName[iH].Data(),
807 nBins[iH],xMin[iH],xMax[iH]);
809 gDirectory->mkdir(
"Signal");
810 gDirectory->cd(
"Signal");
812 for(
int iH=0; iH<nHistoPartParam; iH++)
813 hPartParamSignal[iPart][iH] =
new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
814 nBins[iH],xMin[iH],xMax[iH]);
816 gDirectory->mkdir(
"QA");
817 gDirectory->cd(
"QA");
821 for(
int iH=0; iH<nHistoPartParamQA; iH++ ){
828 gDirectory->cd(
"..");
831 gDirectory->cd(
"..");
832 gDirectory->mkdir(
"Background");
833 gDirectory->cd(
"Background");
835 for(
int iH=0; iH<nHistoPartParam; iH++)
836 hPartParamBG[iPart][iH] =
new TH1F((parName[iH]).Data(),(parName[iH]).Data(),
837 nBins[iH],xMin[iH],xMax[iH]);
839 gDirectory->cd(
"..");
841 gDirectory->cd(
"..");
843 gDirectory->cd(
"..");
846 gDirectory->cd(
"..");
847 gDirectory->mkdir(
"PrimaryVertexQA");
848 gDirectory->cd(
"PrimaryVertexQA");
857 {
"PVResX",
"x_{rec}-x_{mc}, cm", 100, -0.006f, 0.006f},
858 {
"PVResY",
"y_{rec}-y_{mc}, cm", 100, -0.006f, 0.006f},
859 {
"PVResZ",
"z_{rec}-z_{mc}, cm", 100, -0.06f, 0.06f},
860 {
"PVPullX",
"Pull X", 100, -6.f, 6.f},
861 {
"PVPullY",
"Pull Y", 100, -6.f, 6.f},
862 {
"PVPullZ",
"Pull Z", 100, -6.f, 6.f}
864 for(
int iHPV=0; iHPV<nHistosPV; ++iHPV){
865 hPVFitQa[iHPV] =
new TH1F(Table[iHPV].
name.data(),Table[iHPV].title.data(),
866 Table[iHPV].n, Table[iHPV].l, Table[iHPV].r);
869 gDirectory = currentDir;
872 for(
unsigned int iP=0; iP < vRParticles.size(); iP++)
875 switch( vRParticles[iP].GetPDG() ) {
886 if(iParticle < 0)
continue;
895 Double_t chi2 = TempPart.
GetChi2();
896 Int_t ndf = TempPart.
GetNDF();
897 Double_t prob = TMath::Prob(chi2,ndf);
899 hPartParam[iParticle][0]->Fill(M);
900 hPartParam[iParticle][1]->Fill(dL);
901 hPartParam[iParticle][2]->Fill(cT);
902 hPartParam[iParticle][3]->Fill(chi2/ndf);
903 hPartParam[iParticle][4]->Fill(prob);
905 if(!RtoMCParticleId[iP].IsMatchedWithPdg())
907 hPartParamBG[iParticle][0]->Fill(M);
908 hPartParamBG[iParticle][1]->Fill(dL);
909 hPartParamBG[iParticle][2]->Fill(cT);
910 hPartParamBG[iParticle][3]->Fill(chi2/ndf);
911 hPartParamBG[iParticle][4]->Fill(prob);
914 hPartParamSignal[iParticle][0]->Fill(M);
915 hPartParamSignal[iParticle][1]->Fill(dL);
916 hPartParamSignal[iParticle][2]->Fill(cT);
917 hPartParamSignal[iParticle][3]->Fill(chi2/ndf);
918 hPartParamSignal[iParticle][4]->Fill(prob);
920 int iMCPart = RtoMCParticleId[iP].GetBestMatchWithPdg();
925 CbmMCTrack &mcTrack = *(L1_DYNAMIC_CAST<CbmMCTrack*>(listMCTracks->At(iMCTrack)));
927 CbmMCTrack &mcDaughter = *(L1_DYNAMIC_CAST<CbmMCTrack*>(listMCTracks->At(mcDaughterId)));
930 Double_t recParam[8] = { 0 };
931 Double_t errParam[8] = { 0 };
933 for(
int iPar=0; iPar<3; iPar++)
937 if(error < 0.) {
error = 1.e20;}
938 errParam[iPar] = TMath::Sqrt(error);
941 for(
int iPar=3; iPar<7; iPar++)
945 if(error < 0.) {
error = 1.e20;}
946 errParam[iPar] = TMath::Sqrt(error);
950 Double_t res[8] = {0},
952 mcParam[8] = { decayVtx[0], decayVtx[1], decayVtx[2],
954 for(
int iPar=0; iPar < 7; iPar++ )
956 res[iPar] = recParam[iPar] - mcParam[iPar];
957 if(
fabs(errParam[iPar]) > 1.e-20) pull[iPar] = res[iPar]/errParam[iPar];
959 res[7] = M - mcParam[7];
960 if(
fabs(ErrM) > 1.e-20) pull[7] = res[7]/ErrM;
962 for(
int iPar=0; iPar < 8; iPar++ )
964 hFitQA[iParticle][iPar]->Fill(res[iPar]);
965 hFitQA[iParticle][iPar+8]->Fill(pull[iPar]);
975 if(!MCtoRParticleId[mcDaughterId].IsMatchedWithPdg())
continue;
976 CbmMCTrack &mcTrack = *(L1_DYNAMIC_CAST<CbmMCTrack*>(listMCTracks->At(mcDaughterId)));
977 int recDaughterId = MCtoRParticleId[mcDaughterId].GetBestMatchWithPdg();
985 Double_t res[8] = {0},
989 for(
int iPar=0; iPar < 7; iPar++ )
992 if(error < 0.) {
error = 1.e20;}
993 error = TMath::Sqrt(error);
994 res[iPar] = Daughter.
GetParameter(iPar) - mcParam[iPar];
995 if(
fabs(error) > 1.e-20) pull[iPar] = res[iPar]/
error;
997 res[7] = M - mcParam[7];
998 if(
fabs(ErrM) > 1.e-20) pull[7] = res[7]/ErrM;
1000 for(
int iPar=0; iPar < 8; iPar++ )
1002 hFitDaughtersQA[iParticle][iPar]->Fill(res[iPar]);
1003 hFitDaughtersQA[iParticle][iPar+8]->Fill(pull[iPar]);
1045 float mcPVx[3]={0.f};
1046 for(
unsigned iMC=0; iMC<vMCTracks.size(); ++iMC)
1048 if(vMCTracks[iMC].IsPrimary())
1050 mcPVx[0]=vMCTracks[iMC].x;
1051 mcPVx[1]=vMCTracks[iMC].y;
1052 mcPVx[2]=vMCTracks[iMC].z;
1062 for(
unsigned int iHPV=0; iHPV<3; ++iHPV)
1063 hPVFitQa[iHPV]->Fill(dRPVr[iHPV]);
1064 for(
unsigned int iHPV=3; iHPV<6; ++iHPV)
1065 hPVFitQa[iHPV]->Fill(dRPVp[iHPV-3]);
1069void CbmL1::HistoPerformance()
1074 static TProfile *p_eff_all_vs_mom, *p_eff_prim_vs_mom, *p_eff_sec_vs_mom, *p_eff_d0_vs_mom, *p_eff_prim_vs_theta, *p_eff_all_vs_pt, *p_eff_prim_vs_pt, *p_eff_all_vs_nhits, *p_eff_prim_vs_nhits, *p_eff_sec_vs_nhits;
1076 static TH1F *h_reg_MCmom, *h_acc_MCmom, *h_reco_MCmom, *h_ghost_Rmom;
1077 static TH1F *h_reg_prim_MCmom, *h_acc_prim_MCmom, *h_reco_prim_MCmom;
1078 static TH1F *h_reg_sec_MCmom, *h_acc_sec_MCmom, *h_reco_sec_MCmom;
1080 static TH1F *h_acc_mom_short123s;
1082 static TH1F *h_reg_mom_prim, *h_reg_mom_sec, *h_reg_nhits_prim, *h_reg_nhits_sec;
1083 static TH1F *h_acc_mom_prim, *h_acc_mom_sec, *h_acc_nhits_prim, *h_acc_nhits_sec;
1084 static TH1F *h_reco_mom_prim, *h_reco_mom_sec, *h_reco_nhits_prim, *h_reco_nhits_sec;
1085 static TH1F *h_rest_mom_prim, *h_rest_mom_sec, *h_rest_nhits_prim, *h_rest_nhits_sec;
1090 *h_ghost_mom, *h_ghost_nhits, *h_ghost_fstation,
1091 *h_ghost_chi2, *h_ghost_prob, *h_ghost_tx, *h_ghost_ty;
1092 static TH1F *h_reco_mom, *h_reco_d0_mom, *h_reco_nhits, *h_reco_station,
1093 *h_reco_chi2, *h_reco_prob, *h_rest_prob, *h_reco_clean, *h_reco_time;
1094 static TProfile *h_reco_timeNtr, *h_reco_timeNhit ;
1095 static TProfile *h_reco_fakeNtr, *h_reco_fakeNhit ;
1096 static TH1F *h_tx, *h_ty, *h_sec_r, *h_ghost_r;
1098 static TH1F *h_notfound_mom, *h_notfound_nhits, *h_notfound_station, *h_notfound_r, *h_notfound_tx, *h_notfound_ty;
1100 static TH1F *h_mcp, *h_nmchits;
1104 static TH2F *h2_vertex, *h2_prim_vertex, *h2_sec_vertex;
1107 static TH2F *h2_reg_nhits_vs_mom_prim, *h2_reg_nhits_vs_mom_sec,
1108 *h2_reg_fstation_vs_mom_prim, *h2_reg_fstation_vs_mom_sec, *h2_reg_lstation_vs_fstation_prim, *h2_reg_lstation_vs_fstation_sec;
1109 static TH2F *h2_acc_nhits_vs_mom_prim, *h2_acc_nhits_vs_mom_sec,
1110 *h2_acc_fstation_vs_mom_prim, *h2_acc_fstation_vs_mom_sec, *h2_acc_lstation_vs_fstation_prim, *h2_acc_lstation_vs_fstation_sec;
1111 static TH2F *h2_reco_nhits_vs_mom_prim, *h2_reco_nhits_vs_mom_sec,
1112 *h2_reco_fstation_vs_mom_prim, *h2_reco_fstation_vs_mom_sec, *h2_reco_lstation_vs_fstation_prim, *h2_reco_lstation_vs_fstation_sec;
1113 static TH2F *h2_ghost_nhits_vs_mom, *h2_ghost_fstation_vs_mom, *h2_ghost_lstation_vs_fstation;
1114 static TH2F *h2_rest_nhits_vs_mom_prim, *h2_rest_nhits_vs_mom_sec,
1115 *h2_rest_fstation_vs_mom_prim, *h2_rest_fstation_vs_mom_sec, *h2_rest_lstation_vs_fstation_prim, *h2_rest_lstation_vs_fstation_sec;
1117 static bool first_call = 1;
1123 TDirectory *curdir = gDirectory;
1124 gDirectory = histodir;
1125 gDirectory->cd(
"L1");
1127 p_eff_all_vs_mom =
new TProfile(
"p_eff_all_vs_mom",
"AllSet Efficiency vs Momentum",
1128 100, 0.0, 5.0, 0.0, 100.0);
1129 p_eff_prim_vs_mom =
new TProfile(
"p_eff_prim_vs_mom",
"Primary Set Efficiency vs Momentum",
1130 100, 0.0, 5.0, 0.0, 100.0);
1131 p_eff_sec_vs_mom =
new TProfile(
"p_eff_sec_vs_mom",
"Secondary Set Efficiency vs Momentum",
1132 100, 0.0, 5.0, 0.0, 100.0);
1133 p_eff_d0_vs_mom =
new TProfile(
"p_eff_d0_vs_mom",
"D0 Secondary Tracks Efficiency vs Momentum",
1134 150, 0.0, 15.0, 0.0, 100.0);
1135 p_eff_prim_vs_theta =
new TProfile(
"p_eff_prim_vs_theta",
"All Primary Set Efficiency vs Theta",
1136 100, 0.0, 30.0, 0.0, 100.0);
1137 p_eff_all_vs_pt =
new TProfile(
"p_eff_all_vs_pt",
"AllSet Efficiency vs Pt",
1138 100, 0.0, 5.0, 0.0, 100.0);
1139 p_eff_prim_vs_pt =
new TProfile(
"p_eff_prim_vs_pt",
"Primary Set Efficiency vs Pt",
1140 100, 0.0, 5.0, 0.0, 100.0);
1142 p_eff_all_vs_nhits =
new TProfile(
"p_eff_all_vs_nhits",
"AllSet Efficiency vs NMCHits",
1143 8, 3.0, 11.0, 0.0, 100.0);
1144 p_eff_prim_vs_nhits =
new TProfile(
"p_eff_prim_vs_nhits",
"PrimSet Efficiency vs NMCHits",
1145 8, 3.0, 11.0, 0.0, 100.0);
1146 p_eff_sec_vs_nhits =
new TProfile(
"p_eff_sec_vs_nhits",
"SecSet Efficiency vs NMCHits",
1147 8, 3.0, 11.0, 0.0, 100.0);
1149 h_reg_MCmom =
new TH1F(
"h_reg_MCmom",
"Momentum of registered tracks", 100, 0.0, 5.0);
1150 h_acc_MCmom =
new TH1F(
"h_acc_MCmom",
"Reconstructable tracks", 100, 0.0, 5.0);
1151 h_reco_MCmom =
new TH1F(
"h_reco_MCmom",
"Reconstructed tracks", 100, 0.0, 5.0);
1152 h_ghost_Rmom =
new TH1F(
"h_ghost_Rmom",
"Ghost tracks", 100, 0.0, 5.0);
1153 h_reg_prim_MCmom =
new TH1F(
"h_reg_prim_MCmom",
"Momentum of registered tracks", 100, 0.0, 5.0);
1154 h_acc_prim_MCmom =
new TH1F(
"h_acc_prim_MCmom",
"Reconstructable tracks", 100, 0.0, 5.0);
1155 h_reco_prim_MCmom =
new TH1F(
"h_reco_prim_MCmom",
"Reconstructed tracks", 100, 0.0, 5.0);
1156 h_reg_sec_MCmom =
new TH1F(
"h_reg_sec_MCmom",
"Momentum of registered tracks", 100, 0.0, 5.0);
1157 h_acc_sec_MCmom =
new TH1F(
"h_acc_sec_MCmom",
"Reconstructable tracks", 100, 0.0, 5.0);
1158 h_reco_sec_MCmom =
new TH1F(
"h_reco_sec_MCmom",
"Reconstructed tracks", 100, 0.0, 5.0);
1160 h_acc_mom_short123s =
new TH1F(
"h_acc_mom_short123s",
"Momentum of accepted tracks with 3 hits on first stations", 500, 0.0, 5.0);
1162 h_reg_mom_prim =
new TH1F(
"h_reg_mom_prim",
"Momentum of registered primary tracks", 500, 0.0, 5.0);
1163 h_reg_mom_sec =
new TH1F(
"h_reg_mom_sec",
"Momentum of registered secondary tracks", 500, 0.0, 5.0);
1164 h_acc_mom_prim =
new TH1F(
"h_acc_mom_prim",
"Momentum of accepted primary tracks", 500, 0.0, 5.0);
1165 h_acc_mom_sec =
new TH1F(
"h_acc_mom_sec",
"Momentum of accepted secondary tracks", 500, 0.0, 5.0);
1166 h_reco_mom_prim =
new TH1F(
"h_reco_mom_prim",
"Momentum of reconstructed primary tracks", 500, 0.0, 5.0);
1167 h_reco_mom_sec =
new TH1F(
"h_reco_mom_sec",
"Momentum of reconstructed secondary tracks", 500, 0.0, 5.0);
1168 h_rest_mom_prim =
new TH1F(
"h_rest_mom_prim",
"Momentum of not found primary tracks", 500, 0.0, 5.0);
1169 h_rest_mom_sec =
new TH1F(
"h_rest_mom_sec",
"Momentum of not found secondary tracks", 500, 0.0, 5.0);
1171 h_reg_nhits_prim =
new TH1F(
"h_reg_nhits_prim",
"Number of hits in registered primary track", 51, -0.1, 10.1);
1172 h_reg_nhits_sec =
new TH1F(
"h_reg_nhits_sec",
"Number of hits in registered secondary track", 51, -0.1, 10.1);
1173 h_acc_nhits_prim =
new TH1F(
"h_acc_nhits_prim",
"Number of hits in accepted primary track", 51, -0.1, 10.1);
1174 h_acc_nhits_sec =
new TH1F(
"h_acc_nhits_sec",
"Number of hits in accepted secondary track", 51, -0.1, 10.1);
1175 h_reco_nhits_prim =
new TH1F(
"h_reco_nhits_prim",
"Number of hits in reconstructed primary track", 51, -0.1, 10.1);
1176 h_reco_nhits_sec =
new TH1F(
"h_reco_nhits_sec",
"Number of hits in reconstructed secondary track", 51, -0.1, 10.1);
1177 h_rest_nhits_prim =
new TH1F(
"h_rest_nhits_prim",
"Number of hits in not found primary track", 51, -0.1, 10.1);
1178 h_rest_nhits_sec =
new TH1F(
"h_rest_nhits_sec",
"Number of hits in not found secondary track", 51, -0.1, 10.1);
1180 h_ghost_mom =
new TH1F(
"h_ghost_mom",
"Momentum of ghost tracks", 500, 0.0, 5.0);
1181 h_ghost_nhits =
new TH1F(
"h_ghost_nhits",
"Number of hits in ghost track", 51, -0.1, 10.1);
1182 h_ghost_fstation =
new TH1F(
"h_ghost_fstation",
"First station of ghost track", 50, -0.5, 10.0);
1183 h_ghost_chi2 =
new TH1F(
"h_ghost_chi2",
"Chi2/NDF of ghost track", 50, -0.5, 10.0);
1184 h_ghost_prob =
new TH1F(
"h_ghost_prob",
"Prob of ghost track", 505, 0., 1.01);
1185 h_ghost_r =
new TH1F(
"h_ghost_r",
"R of ghost track at the first hit", 50, 0.0, 15.0);
1186 h_ghost_tx =
new TH1F(
"h_ghost_tx",
"tx of ghost track at the first hit", 50, -5.0, 5.0);
1187 h_ghost_ty =
new TH1F(
"h_ghost_ty",
"ty of ghost track at the first hit", 50, -1.0, 1.0);
1189 h_reco_mom =
new TH1F(
"h_reco_mom",
"Momentum of reco track", 50, 0.0, 5.0);
1190 h_reco_nhits =
new TH1F(
"h_reco_nhits",
"Number of hits in reco track", 50, 0.0, 10.0);
1191 h_reco_station =
new TH1F(
"h_reco_station",
"First station of reco track", 50, -0.5, 10.0);
1192 h_reco_chi2 =
new TH1F(
"h_reco_chi2",
"Chi2/NDF of reco track", 50, -0.5, 10.0);
1193 h_reco_prob =
new TH1F(
"h_reco_prob",
"Prob of reco track", 505, 0., 1.01);
1194 h_rest_prob =
new TH1F(
"h_rest_prob",
"Prob of reco rest track", 505, 0., 1.01);
1195 h_reco_clean =
new TH1F(
"h_reco_clean",
"Percentage of correct hits", 100, -0.5, 100.5);
1196 h_reco_time =
new TH1F(
"h_reco_time",
"CA Track Finder Time (s/ev)", 20, 0.0, 20.0);
1197 h_reco_timeNtr =
new TProfile(
"h_reco_timeNtr",
1198 "CA Track Finder Time (s/ev) vs N Tracks",
1200 h_reco_timeNhit =
new TProfile(
"h_reco_timeNhit",
1201 "CA Track Finder Time (s/ev) vs N Hits",
1203 h_reco_fakeNtr =
new TProfile(
"h_reco_fakeNtr",
1204 "N Fake hits vs N Tracks",
1206 h_reco_fakeNhit =
new TProfile(
"h_reco_fakeNhit",
1207 "N Fake hits vs N Hits",
1210 h_reco_d0_mom =
new TH1F(
"h_reco_d0_mom",
"Momentum of reco D0 track", 150, 0.0, 15.0);
1224 h_tx =
new TH1F(
"h_tx",
"tx of MC track at the vertex", 50, -0.5, 0.5);
1225 h_ty =
new TH1F(
"h_ty",
"ty of MC track at the vertex", 50, -0.5, 0.5);
1227 h_sec_r =
new TH1F(
"h_sec_r",
"R of sec MC track at the first hit", 50, 0.0, 15.0);
1229 h_notfound_mom =
new TH1F(
"h_notfound_mom",
"Momentum of not found track", 50, 0.0, 5.0);
1230 h_notfound_nhits =
new TH1F(
"h_notfound_nhits",
"Num hits of not found track", 50, 0.0, 10.0);
1231 h_notfound_station =
new TH1F(
"h_notfound_station",
"First station of not found track", 50, 0.0, 10.0);
1232 h_notfound_r =
new TH1F(
"h_notfound_r",
"R at first hit of not found track", 50, 0.0, 15.0);
1233 h_notfound_tx =
new TH1F(
"h_notfound_tx",
"tx of not found track at the first hit", 50, -5.0, 5.0);
1234 h_notfound_ty =
new TH1F(
"h_notfound_ty",
"ty of not found track at the first hit", 50, -1.0, 1.0);
1240 h_mcp =
new TH1F(
"h_mcp",
"MC P ", 500, 0.0, 5.0);
1244 h_nmchits =
new TH1F(
"h_nmchits",
"N STS hits on MC track", 50, 0.0, 10.0);
1248 h2_vertex =
new TH2F(
"h2_vertex",
"2D vertex distribution", 105, -5., 100., 100, -50., 50.);
1249 h2_prim_vertex =
new TH2F(
"h2_primvertex",
"2D primary vertex distribution", 105, -5., 100., 100, -50., 50.);
1250 h2_sec_vertex =
new TH2F(
"h2_sec_vertex",
"2D secondary vertex distribution", 105, -5., 100., 100, -50., 50.);
1256 h2_reg_nhits_vs_mom_prim =
new TH2F(
"h2_reg_nhits_vs_mom_prim",
"NHits vs. Momentum (Reg. Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1257 h2_reg_nhits_vs_mom_sec =
new TH2F(
"h2_reg_nhits_vs_mom_sec",
"NHits vs. Momentum (Reg. Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1258 h2_acc_nhits_vs_mom_prim =
new TH2F(
"h2_acc_nhits_vs_mom_prim",
"NHits vs. Momentum (Acc. Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1259 h2_acc_nhits_vs_mom_sec =
new TH2F(
"h2_acc_nhits_vs_mom_sec",
"NHits vs. Momentum (Acc. Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1260 h2_reco_nhits_vs_mom_prim =
new TH2F(
"h2_reco_nhits_vs_mom_prim",
"NHits vs. Momentum (Reco Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1261 h2_reco_nhits_vs_mom_sec =
new TH2F(
"h2_reco_nhits_vs_mom_sec",
"NHits vs. Momentum (Reco Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1262 h2_ghost_nhits_vs_mom =
new TH2F(
"h2_ghost_nhits_vs_mom",
"NHits vs. Momentum (Ghost Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1263 h2_rest_nhits_vs_mom_prim =
new TH2F(
"h2_rest_nhits_vs_mom_prim",
"NHits vs. Momentum (!Found Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1264 h2_rest_nhits_vs_mom_sec =
new TH2F(
"h2_rest_nhits_vs_mom_sec",
"NHits vs. Momentum (!Found Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1266 h2_reg_fstation_vs_mom_prim =
new TH2F(
"h2_reg_fstation_vs_mom_prim",
"First Station vs. Momentum (Reg. Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1267 h2_reg_fstation_vs_mom_sec =
new TH2F(
"h2_reg_fstation_vs_mom_sec",
"First Station vs. Momentum (Reg. Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1268 h2_acc_fstation_vs_mom_prim =
new TH2F(
"h2_acc_fstation_vs_mom_prim",
"First Station vs. Momentum (Acc. Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1269 h2_acc_fstation_vs_mom_sec =
new TH2F(
"h2_acc_fstation_vs_mom_sec",
"First Station vs. Momentum (Acc. Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1270 h2_reco_fstation_vs_mom_prim =
new TH2F(
"h2_reco_fstation_vs_mom_prim",
"First Station vs. Momentum (Reco Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1271 h2_reco_fstation_vs_mom_sec =
new TH2F(
"h2_reco_fstation_vs_mom_sec",
"First Station vs. Momentum (Reco Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1272 h2_ghost_fstation_vs_mom =
new TH2F(
"h2_ghost_fstation_vs_mom",
"First Station vs. Momentum (Ghost Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1273 h2_rest_fstation_vs_mom_prim =
new TH2F(
"h2_rest_fstation_vs_mom_prim",
"First Station vs. Momentum (!Found Primary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1274 h2_rest_fstation_vs_mom_sec =
new TH2F(
"h2_rest_fstation_vs_mom_sec",
"First Station vs. Momentum (!Found Secondary Tracks)", 51, -0.05, 5.05, 11, -0.5, 10.5);
1276 h2_reg_lstation_vs_fstation_prim =
new TH2F(
"h2_reg_lstation_vs_fstation_prim",
"Last vs. First Station (Reg. Primary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1277 h2_reg_lstation_vs_fstation_sec =
new TH2F(
"h2_reg_lstation_vs_fstation_sec",
"Last vs. First Station (Reg. Secondary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1278 h2_acc_lstation_vs_fstation_prim =
new TH2F(
"h2_acc_lstation_vs_fstation_prim",
"Last vs. First Station (Acc. Primary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1279 h2_acc_lstation_vs_fstation_sec =
new TH2F(
"h2_acc_lstation_vs_fstation_sec",
"Last vs. First Station (Acc. Secondary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1280 h2_reco_lstation_vs_fstation_prim =
new TH2F(
"h2_reco_lstation_vs_fstation_prim",
"Last vs. First Station (Reco Primary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1281 h2_reco_lstation_vs_fstation_sec =
new TH2F(
"h2_reco_lstation_vs_fstation_sec",
"Last vs. First Station (Reco Secondary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1282 h2_ghost_lstation_vs_fstation =
new TH2F(
"h2_ghost_lstation_vs_fstation",
"Last vs. First Station (Ghost Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1283 h2_rest_lstation_vs_fstation_prim =
new TH2F(
"h2_rest_lstation_vs_fstation_prim",
"Last vs. First Station (!Found Primary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1284 h2_rest_lstation_vs_fstation_sec =
new TH2F(
"h2_rest_lstation_vs_fstation_sec",
"Last vs. First Station (!Found Secondary Tracks)", 11, -0.5, 10.5, 11, -0.5, 10.5);
1290 gDirectory = curdir;
1295 static int NEvents = 0;
1296 if ( NEvents > 0 ) {
1297 h_reg_MCmom->Scale(NEvents);
1298 h_acc_MCmom->Scale(NEvents);
1299 h_reco_MCmom->Scale(NEvents);
1300 h_ghost_Rmom->Scale(NEvents);
1301 h_reg_prim_MCmom->Scale(NEvents);
1302 h_acc_prim_MCmom->Scale(NEvents);
1303 h_reco_prim_MCmom->Scale(NEvents);
1304 h_reg_sec_MCmom->Scale(NEvents);
1305 h_acc_sec_MCmom->Scale(NEvents);
1306 h_reco_sec_MCmom->Scale(NEvents);
1321 for (vector<CbmL1Track>::iterator rtraIt =
vRTracks.begin(); rtraIt !=
vRTracks.end(); ++rtraIt){
1323 if((prtra->
StsHits).size() < 1)
continue;
1325 if(
fabs(prtra->
T[4])>1.e-10 ) h_reco_mom->Fill(
fabs(1.0/prtra->
T[4]));
1326 h_reco_nhits->Fill((prtra->
StsHits).size());
1334 if (prtra->
NDF > 0) {
1336 h_ghost_chi2->Fill(prtra->
chi2/prtra->
NDF);
1337 h_ghost_prob->Fill(TMath::Prob(prtra->
chi2,prtra->
NDF));
1341 h_reco_chi2->Fill(prtra->
chi2/prtra->
NDF);
1342 h_reco_prob->Fill(TMath::Prob(prtra->
chi2,prtra->
NDF));
1345 h_rest_prob->Fill(TMath::Prob(prtra->
chi2,prtra->
NDF));
1353 if(
fabs(prtra->
T[4])>1.e-10) {
1354 h_ghost_mom->Fill(
fabs(1.0/prtra->
T[4]));
1355 h_ghost_Rmom->Fill(
fabs(1.0/prtra->
T[4]));
1357 h_ghost_nhits->Fill((prtra->
StsHits).size());
1360 h_ghost_fstation->Fill(h1.
iStation);
1364 if(
fabs(z2-z1)>1.e-4 ){
1365 h_ghost_tx->Fill((h2.
x-h1.
x)/(z2-z1));
1366 h_ghost_ty->Fill((h2.
y-h1.
y)/(z2-z1));
1369 if(
fabs(prtra->
T[4])>1.e-10)
1370 h2_ghost_nhits_vs_mom->Fill(
fabs(1.0/prtra->
T[4]), (prtra->
StsHits).size());
1373 if(
fabs(prtra->
T[4])>1.e-10)
1374 h2_ghost_fstation_vs_mom->Fill(
fabs(1.0/prtra->
T[4]), hf.
iStation+1);
1382 for ( vector<CbmL1MCTrack>::iterator mtraIt = vMCTracks.begin(); mtraIt != vMCTracks.end(); mtraIt++ ) {
1387 int nmchits = mtra.
StsHits.size();
1388 if (nmchits == 0)
continue;
1390 double momentum = mtra.
p;
1392 double theta =
acos(mtra.
pz/mtra.
p)*180/3.1415;
1394 h_mcp->Fill(momentum);
1395 h_nmchits->Fill(nmchits);
1402 h_reg_MCmom->Fill(momentum);
1404 h_reg_mom_prim->Fill(momentum);
1405 h_reg_prim_MCmom->Fill(momentum);
1406 h_reg_nhits_prim->Fill(nSta);
1407 h2_reg_nhits_vs_mom_prim->Fill(momentum, nSta);
1408 h2_reg_fstation_vs_mom_prim->Fill(momentum, fh.
iStation+1);
1410 h2_reg_lstation_vs_fstation_prim->Fill(fh.
iStation+1, lh.iStation+1);
1412 h_reg_mom_sec->Fill(momentum);
1413 h_reg_sec_MCmom->Fill(momentum);
1414 h_reg_nhits_sec->Fill(nSta);
1415 if (momentum > 0.01){
1416 h2_reg_nhits_vs_mom_sec->Fill(momentum, nSta);
1417 h2_reg_fstation_vs_mom_sec->Fill(momentum, fh.
iStation+1);
1419 h2_reg_lstation_vs_fstation_sec->Fill(fh.
iStation+1, lh.iStation+1);
1424 h_acc_mom_short123s->Fill(momentum);
1430 h_acc_MCmom->Fill(momentum);
1432 h_acc_mom_prim->Fill(momentum);
1433 h_acc_prim_MCmom->Fill(momentum);
1434 h_acc_nhits_prim->Fill(nSta);
1435 h2_acc_nhits_vs_mom_prim->Fill(momentum, nSta);
1436 h2_acc_fstation_vs_mom_prim->Fill(momentum, fh.
iStation+1);
1438 h2_acc_lstation_vs_fstation_prim->Fill(fh.
iStation+1, lh.iStation+1);
1440 h_acc_mom_sec->Fill(momentum);
1441 h_acc_sec_MCmom->Fill(momentum);
1442 h_acc_nhits_sec->Fill(nSta);
1443 if (momentum > 0.01){
1444 h2_acc_nhits_vs_mom_sec->Fill(momentum, nSta);
1445 h2_acc_fstation_vs_mom_sec->Fill(momentum, fh.
iStation+1);
1447 h2_acc_lstation_vs_fstation_sec->Fill(fh.
iStation+1, lh.iStation+1);
1453 h2_vertex->Fill(mtra.
z, mtra.
y);
1456 h2_prim_vertex->Fill(mtra.
z, mtra.
y);
1459 h2_sec_vertex->Fill(mtra.
z, mtra.
y);
1468 if(
fabs( mtra.
pz )>1.e-8 ){
1469 h_tx->Fill(mtra.
px/mtra.
pz);
1470 h_ty->Fill(mtra.
py/mtra.
pz);
1478 p_eff_all_vs_mom->Fill(momentum, 100.0);
1479 p_eff_all_vs_nhits->Fill(nMCHits, 100.0);
1480 p_eff_all_vs_pt->Fill(pt, 100.0);
1481 h_reco_MCmom->Fill(momentum);
1483 p_eff_prim_vs_mom->Fill(momentum, 100.0);
1484 p_eff_prim_vs_nhits->Fill(nMCHits, 100.0);
1485 p_eff_prim_vs_pt->Fill(pt, 100.0);
1486 p_eff_prim_vs_theta->Fill(theta, 100.0);
1488 p_eff_sec_vs_mom->Fill(momentum, 100.0);
1489 p_eff_sec_vs_nhits->Fill(nMCHits, 100.0);
1492 h_reco_mom_prim->Fill(momentum);
1493 h_reco_prim_MCmom->Fill(momentum);
1494 h_reco_nhits_prim->Fill(nSta);
1495 h2_reco_nhits_vs_mom_prim->Fill(momentum, nSta);
1496 h2_reco_fstation_vs_mom_prim->Fill(momentum, fh.
iStation+1);
1498 h2_reco_lstation_vs_fstation_prim->Fill(fh.
iStation+1, lh.iStation+1);
1500 h_reco_mom_sec->Fill(momentum);
1501 h_reco_sec_MCmom->Fill(momentum);
1502 h_reco_nhits_sec->Fill(nSta);
1503 if (momentum > 0.01){
1504 h2_reco_nhits_vs_mom_sec->Fill(momentum, nSta);
1505 h2_reco_fstation_vs_mom_sec->Fill(momentum, fh.
iStation+1);
1507 h2_reco_lstation_vs_fstation_sec->Fill(fh.
iStation+1, lh.iStation+1);
1511 h_notfound_mom->Fill(momentum);
1512 p_eff_all_vs_mom->Fill(momentum, 0.0);
1513 p_eff_all_vs_nhits->Fill(nMCHits, 0.0);
1514 p_eff_all_vs_pt->Fill(pt, 0.0);
1516 p_eff_prim_vs_mom->Fill(momentum, 0.0);
1517 p_eff_prim_vs_nhits->Fill(nMCHits, 0.0);
1518 p_eff_prim_vs_pt->Fill(pt, 0.0);
1519 p_eff_prim_vs_theta->Fill(theta, 0.0);
1521 p_eff_sec_vs_mom->Fill(momentum, 0.0);
1522 p_eff_sec_vs_nhits->Fill(nMCHits, 0.0);
1525 h_rest_mom_prim->Fill(momentum);
1526 h_rest_nhits_prim->Fill(nSta);
1527 h2_rest_nhits_vs_mom_prim->Fill(momentum, nSta);
1528 h2_rest_fstation_vs_mom_prim->Fill(momentum, fh.
iStation+1);
1530 h2_rest_lstation_vs_fstation_prim->Fill(fh.
iStation+1, lh.iStation+1);
1532 h_rest_mom_sec->Fill(momentum);
1533 h_rest_nhits_sec->Fill(nSta);
1534 if (momentum > 0.01){
1535 h2_rest_nhits_vs_mom_sec->Fill(momentum, nSta);
1536 h2_rest_fstation_vs_mom_sec->Fill(momentum, fh.
iStation+1);
1538 h2_rest_lstation_vs_fstation_sec->Fill(fh.
iStation+1, lh.iStation+1);
1546 h_notfound_nhits->Fill(nmchits);
1547 h_notfound_station->Fill(ph.
iStation);
1550 if(mtra.
Points.size() > 0){
1552 h_notfound_tx->Fill(pMC.
px/pMC.
pz);
1553 h_notfound_ty->Fill(pMC.
py/pMC.
pz);
1573 h_reco_d0_mom->Fill(momentum);
1574 if (reco) p_eff_d0_vs_mom->Fill(momentum, 100.0);
1575 else p_eff_d0_vs_mom->Fill(momentum, 0.0);
1581 for(
unsigned int ih=0; ih<
algo->
vStsHits.size(); ih++){
1582 int iMC = vHitMCRef[ih];
1583 if (iMC < 0) NFakes++;
1590 h_reco_fakeNtr->Fill(mc_total,NFakes);
1591 h_reco_fakeNhit->Fill(
algo->
vStsHits.size()-NFakes,NFakes);
1594 h_reg_MCmom->Scale(1.f/NEvents);
1595 h_acc_MCmom->Scale(1.f/NEvents);
1596 h_reco_MCmom->Scale(1.f/NEvents);
1597 h_ghost_Rmom->Scale(1.f/NEvents);
1598 h_reg_prim_MCmom->Scale(1.f/NEvents);
1599 h_acc_prim_MCmom->Scale(1.f/NEvents);
1600 h_reco_prim_MCmom->Scale(1.f/NEvents);
1601 h_reg_sec_MCmom->Scale(1.f/NEvents);
1602 h_acc_sec_MCmom->Scale(1.f/NEvents);
1603 h_reco_sec_MCmom->Scale(1.f/NEvents);
1608void CbmL1::TrackFitPerformance()
1610 const int Nh_fit = 12;
1611 static TH1F *h_fit[Nh_fit], *h_fitL[Nh_fit], *h_fitSV[Nh_fit], *h_fitPV[Nh_fit], *h_fit_chi2;
1613 static TH2F *PRes2D, *PRes2DPrim, *PRes2DSec;
1615 static bool first_call = 1;
1621 TDirectory *currentDir = gDirectory;
1622 gDirectory = histodir;
1623 gDirectory->cd(
"L1");
1624 gDirectory->mkdir(
"Fit");
1625 gDirectory->cd(
"Fit");
1627 PRes2D =
new TH2F(
"PRes2D",
"Resolution P vs P", 100, 0., 20.,100, -15., 15.);
1628 PRes2DPrim =
new TH2F(
"PRes2DPrim",
"Resolution P vs P", 100, 0., 20.,100, -15., 15.);
1629 PRes2DSec =
new TH2F(
"PRes2DSec",
"Resolution P vs P", 100, 0., 20.,100, -15., 15.);
1638 {
"x",
"Residual X [#mum]", 100, -45., 45.},
1639 {
"y",
"Residual Y [#mum]", 100, -450., 450.},
1640 {
"tx",
"Residual Tx [mrad]", 100, -2., 2.},
1641 {
"ty",
"Residual Ty [mrad]", 100, -3.5, 3.5},
1642 {
"P",
"Resolution P/Q [100%]", 100, -0.1, 0.1 },
1643 {
"px",
"Pull X [residual/estimated_error]", 100, -6., 6.},
1644 {
"py",
"Pull Y [residual/estimated_error]", 100, -6., 6.},
1645 {
"ptx",
"Pull Tx [residual/estimated_error]", 100, -6., 6.},
1646 {
"pty",
"Pull Ty [residual/estimated_error]", 100, -6., 6.},
1647 {
"pQP",
"Pull Q/P [residual/estimated_error]", 100, -6., 6.},
1648 {
"QPreco",
"Reco Q/P ", 100, -10., 10.},
1649 {
"QPmc",
"MC Q/P ", 100, -10., 10.}
1658 Tab TableVertex[Nh_fit]=
1660 {
"x",
"Residual X [cm]", 2000, -1., 1.},
1661 {
"y",
"Residual Y [cm]", 2000, -1., 1.},
1662 {
"tx",
"Residual Tx [mrad]", 100, -2., 2.},
1663 {
"ty",
"Residual Ty [mrad]", 100, -2., 2.},
1664 {
"P",
"Resolution P/Q [100%]", 100, -0.1, 0.1 },
1665 {
"px",
"Pull X [residual/estimated_error]", 100, -6., 6.},
1666 {
"py",
"Pull Y [residual/estimated_error]", 100, -6., 6.},
1667 {
"ptx",
"Pull Tx [residual/estimated_error]", 100, -6., 6.},
1668 {
"pty",
"Pull Ty [residual/estimated_error]", 100, -6., 6.},
1669 {
"pQP",
"Pull Q/P [residual/estimated_error]", 100, -6., 6.},
1670 {
"QPreco",
"Reco Q/P ", 100, -10., 10.},
1671 {
"QPmc",
"MC Q/P ", 100, -10., 10.}
1674 for(
int i=0;
i<Nh_fit;
i++ ){
1675 char n[225], t[255];
1676 sprintf(n,
"fst_%s",Table[
i].name);
1677 sprintf(t,
"First point %s",Table[
i].title);
1678 h_fit[
i] =
new TH1F(n,t, Table[
i].n, Table[
i].l, Table[
i].r);
1679 sprintf(n,
"lst_%s",Table[
i].name);
1680 sprintf(t,
"Last point %s",Table[
i].title);
1681 h_fitL[
i] =
new TH1F(n,t, Table[
i].n, Table[
i].l, Table[
i].r);
1682 sprintf(n,
"svrt_%s",TableVertex[
i].name);
1683 sprintf(t,
"Secondary vertex point %s",TableVertex[
i].title);
1684 h_fitSV[
i] =
new TH1F(n,t, TableVertex[
i].n, TableVertex[
i].l, TableVertex[
i].r);
1685 sprintf(n,
"pvrt_%s",TableVertex[
i].name);
1686 sprintf(t,
"Primary vertex point %s",TableVertex[
i].title);
1687 h_fitPV[
i] =
new TH1F(n,t, TableVertex[
i].n, TableVertex[
i].l, TableVertex[
i].r);
1689 h_fit_chi2 =
new TH1F(
"h_fit_chi2",
"Chi2/NDF", 50, -0.5, 10.0);
1691 gDirectory = currentDir;
1694 for (vector<CbmL1Track>::iterator it =
vRTracks.begin(); it !=
vRTracks.end(); ++it){
1696 if ( it->IsGhost() )
continue;
1698 int iMC = vHitMCRef[it->StsHits.front()];
1699 if (iMC < 0)
continue;
1702 h_fit[0]->Fill( (mc.
x-it->T[0]) *1.e4);
1703 h_fit[1]->Fill( (mc.
y-it->T[1]) *1.e4);
1704 h_fit[2]->Fill((mc.
px/mc.
pz-it->T[2])*1.e3);
1705 h_fit[3]->Fill((mc.
py/mc.
pz-it->T[3])*1.e3);
1706 h_fit[4]->Fill(it->T[4]/mc.
q*mc.
p-1);
1708 PRes2D->Fill( mc.
p, (1./
fabs(it->T[4]) - mc.
p)/mc.
p*100. );
1712 PRes2DPrim->Fill( mc.
p, (1./
fabs(it->T[4]) - mc.
p)/mc.
p*100. );
1714 PRes2DSec->Fill( mc.
p, (1./
fabs(it->T[4]) - mc.
p)/mc.
p*100. );
1716 if( finite(it->C[0]) && it->C[0]>0 )h_fit[5]->Fill( (mc.
x-it->T[0])/
sqrt(it->C[0]));
1717 if( finite(it->C[2]) && it->C[2]>0 )h_fit[6]->Fill( (mc.
y-it->T[1])/
sqrt(it->C[2]));
1718 if( finite(it->C[5]) && it->C[5]>0 )h_fit[7]->Fill( (mc.
px/mc.
pz-it->T[2])/
sqrt(it->C[5]));
1719 if( finite(it->C[9]) && it->C[9]>0 )h_fit[8]->Fill( (mc.
py/mc.
pz-it->T[3])/
sqrt(it->C[9]));
1720 if( finite(it->C[14]) && it->C[14]>0 )h_fit[9]->Fill( (mc.
q/mc.
p-it->T[4])/
sqrt(it->C[14]));
1721 h_fit[10]->Fill(it->T[4]);
1722 h_fit[11]->Fill(mc.
q/mc.
p);
1726 int iMC = vHitMCRef[it->StsHits.back()];
1727 if (iMC < 0)
continue;
1729 h_fitL[0]->Fill( (mc.
x-it->TLast[0]) *1.e4);
1730 h_fitL[1]->Fill( (mc.
y-it->TLast[1]) *1.e4);
1731 h_fitL[2]->Fill((mc.
px/mc.
pz-it->TLast[2])*1.e3);
1732 h_fitL[3]->Fill((mc.
py/mc.
pz-it->TLast[3])*1.e3);
1733 h_fitL[4]->Fill(it->T[4]/mc.
q*mc.
p-1);
1734 if( finite(it->CLast[0]) && it->CLast[0]>0 ) h_fitL[5]->Fill( (mc.
x-it->TLast[0])/
sqrt(it->CLast[0]));
1735 if( finite(it->CLast[2]) && it->CLast[2]>0 ) h_fitL[6]->Fill( (mc.
y-it->TLast[1])/
sqrt(it->CLast[2]));
1736 if( finite(it->CLast[5]) && it->CLast[5]>0 ) h_fitL[7]->Fill( (mc.
px/mc.
pz-it->TLast[2])/
sqrt(it->CLast[5]));
1737 if( finite(it->CLast[9]) && it->CLast[9]>0 ) h_fitL[8]->Fill( (mc.
py/mc.
pz-it->TLast[3])/
sqrt(it->CLast[9]));
1738 if( finite(it->CLast[14]) && it->CLast[14]>0 ) h_fitL[9]->Fill( (mc.
q/mc.
p-it->TLast[4])/
sqrt(it->CLast[14]));
1739 h_fitL[10]->Fill(it->TLast[4]);
1740 h_fitL[11]->Fill(mc.
q/mc.
p);
1753 for (
int ih = 0; ih < 3; ih++){
1754 const int iMCP = mc.
Points[ih];
1760 fld.Set( B[0], z[0], B[1], z[1], B[2], z[2] );
1764 const int fSta =
vHitStore[it->StsHits[0]].iStation;
1765 const int dir =
int((mc.
z -
algo->vStations[fSta].z[0])/
fabs(mc.
z -
algo->vStations[fSta].z[0]));
1767 for (
int iSta = fSta; (iSta >= 0) && (iSta < NStation) && (dir*(mc.
z -
algo->vStations[iSta].z[0]) > 0); iSta += dir){
1773 if (mc.
z != trPar.z[0])
continue;
1786 h_fitSV[0]->Fill( (mc.
x-trPar.x[0]) );
1787 h_fitSV[1]->Fill( (mc.
y-trPar.y[0]) );
1788 h_fitSV[2]->Fill((mc.
px/mc.
pz-trPar.tx[0])*1.e3);
1789 h_fitSV[3]->Fill((mc.
py/mc.
pz-trPar.ty[0])*1.e3);
1790 h_fitSV[4]->Fill(trPar.qp[0]/mc.
q*mc.
p-1);
1791 if( finite(trPar.C00[0]) && trPar.C00[0]>0 ) h_fitSV[5]->Fill( (mc.
x-trPar.x[0])/
sqrt(trPar.C00[0]));
1792 if( finite(trPar.C11[0]) && trPar.C11[0]>0 ) h_fitSV[6]->Fill( (mc.
y-trPar.y[0])/
sqrt(trPar.C11[0]));
1793 if( finite(trPar.C22[0]) && trPar.C22[0]>0 ) h_fitSV[7]->Fill( (mc.
px/mc.
pz-trPar.tx[0])/
sqrt(trPar.C22[0]));
1794 if( finite(trPar.C33[0]) && trPar.C33[0]>0 ) h_fitSV[8]->Fill( (mc.
py/mc.
pz-trPar.ty[0])/
sqrt(trPar.C33[0]));
1795 if( finite(trPar.C44[0]) && trPar.C44[0]>0 ) h_fitSV[9]->Fill( (mc.
q/mc.
p-trPar.qp[0])/
sqrt(trPar.C44[0]));
1796 h_fitSV[10]->Fill(trPar.qp[0]);
1797 h_fitSV[11]->Fill(mc.
q/mc.
p);
1800 if (
vHitStore[it->StsHits[0]].iStation != 0)
continue;
1808 for (
int ih = 0; ih < 3; ih++){
1809 const int iMCP = mc.
Points[ih];
1819 targB =
algo->vtxFieldValue;
1820 fld.Set( targB, 0., B[0], z[0], B[1], z[1] );
1825 const int fSta =
vHitStore[it->StsHits[0]].iStation;
1827 const int dir = (mc.
z -
algo->vStations[fSta].z[0])/abs(mc.
z -
algo->vStations[fSta].z[0]);
1829 for (
int iSta = fSta; (iSta >= 0) && (iSta < NStation) && (dir*(mc.
z -
algo->vStations[iSta].z[0]) > 0); iSta += dir){
1835 if (mc.
z != trPar.z[0])
continue;
1848 h_fitPV[0]->Fill( (mc.
x-trPar.x[0]) );
1849 h_fitPV[1]->Fill( (mc.
y-trPar.y[0]) );
1850 h_fitPV[2]->Fill((mc.
px/mc.
pz-trPar.tx[0])*1.e3);
1851 h_fitPV[3]->Fill((mc.
py/mc.
pz-trPar.ty[0])*1.e3);
1852 h_fitPV[4]->Fill(trPar.qp[0]/mc.
q*mc.
p-1);
1853 if( finite(trPar.C00[0]) && trPar.C00[0]>0 ) h_fitPV[5]->Fill( (mc.
x-trPar.x[0])/
sqrt(trPar.C00[0]));
1854 if( finite(trPar.C11[0]) && trPar.C11[0]>0 ) h_fitPV[6]->Fill( (mc.
y-trPar.y[0])/
sqrt(trPar.C11[0]));
1855 if( finite(trPar.C22[0]) && trPar.C22[0]>0 ) h_fitPV[7]->Fill( (mc.
px/mc.
pz-trPar.tx[0])/
sqrt(trPar.C22[0]));
1856 if( finite(trPar.C33[0]) && trPar.C33[0]>0 ) h_fitPV[8]->Fill( (mc.
py/mc.
pz-trPar.ty[0])/
sqrt(trPar.C33[0]));
1857 if( finite(trPar.C44[0]) && trPar.C44[0]>0 ) h_fitPV[9]->Fill( (mc.
q/mc.
p-trPar.qp[0])/
sqrt(trPar.C44[0]));
1858 h_fitPV[10]->Fill(trPar.qp[0]);
1859 h_fitPV[11]->Fill(mc.
q/mc.
p);
1870 for (
int ipar = 0; ipar < 6; ipar++) it2.
T[ipar] = kfTr.
GetTrack()[ipar];
1871 for (
int ipar = 0; ipar < 15; ipar++) it2.
C[ipar] = kfTr.
GetCovMatrix()[ipar];
1877 h_fitPV[0]->Fill( (mc.
x-it2.
T[0]) );
1878 h_fitPV[1]->Fill( (mc.
y-it2.
T[1]) );
1879 h_fitPV[2]->Fill((mc.
px/mc.
pz-it2.
T[2])*1.e3);
1880 h_fitPV[3]->Fill((mc.
py/mc.
pz-it2.
T[3])*1.e3);
1881 h_fitPV[4]->Fill(it2.
T[4]/mc.
q*mc.
p-1);
1882 if( finite(it2.
C[0]) && it2.
C[0]>0 )h_fitPV[5]->Fill( (mc.
x-it2.
T[0])/
sqrt(it2.
C[0]));
1883 if( finite(it2.
C[2]) && it2.
C[2]>0 )h_fitPV[6]->Fill( (mc.
y-it2.
T[1])/
sqrt(it2.
C[2]));
1884 if( finite(it2.
C[5]) && it2.
C[5]>0 )h_fitPV[7]->Fill( (mc.
px/mc.
pz-it2.
T[2])/
sqrt(it2.
C[5]));
1885 if( finite(it2.
C[9]) && it2.
C[9]>0 )h_fitPV[8]->Fill( (mc.
py/mc.
pz-it2.
T[3])/
sqrt(it2.
C[9]));
1886 if( finite(it2.
C[14]) && it2.
C[14]>0 )h_fitPV[9]->Fill( (mc.
q/mc.
p-it2.
T[4])/
sqrt(it2.
C[14]));
1887 h_fitPV[10]->Fill(it2.
T[4]);
1888 h_fitPV[11]->Fill(mc.
q/mc.
p);
1893 h_fit_chi2->Fill(it->chi2/it->NDF);
1900void CbmL1::FieldApproxCheck()
1902 TDirectory *curr = gDirectory;
1903 TFile *currentFile = gFile;
1904 TFile* fout =
new TFile(
"FieldApprox.root",
"RECREATE");
1908 for (
int ist = 0; ist<NStation; ist++ )
1911 double Xmax=-100, Ymax=-100;
1912 if( ist<NMvdStations ){
1922 for(
int isec = 0; isec < st->
GetNSectors(); isec++)
1925 for(
int isen = 0; isen < sect->
GetNSensors(); isen++)
1929 if(x>Xmax) Xmax = x;
1930 if(y>Ymax) Ymax = y;
1933 cout <<
"Station "<< ist <<
", Xmax " << Xmax<<
", Ymax" << Ymax<<endl;
1942 float ddx = 2*Xmax/NbinsX;
1943 float ddy = 2*Ymax/NbinsY;
1945 TH2F *stB =
new TH2F(Form(
"station %i, dB", ist+1) ,Form(
"station %i, dB, z = %0.f cm", ist+1,z) ,
static_cast<int>(NbinsX+1),-(Xmax+ddx/2.),(Xmax+ddx/2.),
static_cast<int>(NbinsY+1),-(Ymax+ddy/2.),(Ymax+ddy/2.));
1946 TH2F *stBx =
new TH2F(Form(
"station %i, dBx", ist+1),Form(
"station %i, dBx, z = %0.f cm", ist+1,z),
static_cast<int>(NbinsX+1),-(Xmax+ddx/2.),(Xmax+ddx/2.),
static_cast<int>(NbinsY+1),-(Ymax+ddy/2.),(Ymax+ddy/2.));
1947 TH2F *stBy =
new TH2F(Form(
"station %i, dBy", ist+1),Form(
"station %i, dBy, z = %0.f cm", ist+1,z),
static_cast<int>(NbinsX+1),-(Xmax+ddx/2.),(Xmax+ddx/2.),
static_cast<int>(NbinsY+1),-(Ymax+ddy/2.),(Ymax+ddy/2.));
1948 TH2F *stBz =
new TH2F(Form(
"station %i, dBz", ist+1),Form(
"station %i, dBz, z = %0.f cm", ist+1,z),
static_cast<int>(NbinsX+1),-(Xmax+ddx/2.),(Xmax+ddx/2.),
static_cast<int>(NbinsY+1),-(Ymax+ddy/2.),(Ymax+ddy/2.));
1953 Double_t bbb, bbb_L1;
1956 const int N=(M+1)*(M+2)/2;
1958 for(
int i=0;
i<N;
i++)
1968 for(
int ii = 1; ii <=NbinsX+1; ii++)
1971 x = -Xmax+(ii-1)*ddx;
1972 for(
int jj = 1; jj <=NbinsY+1; jj++)
1974 y = -Ymax+(jj-1)*ddy;
1975 double rrr =
sqrt(
fabs(x*x/Xmax/Xmax+y/Ymax*y/Ymax));
1981 r[2] = z; r[0] = x; r[1] = y;
1982 MF->GetFieldValue( r, B );
1983 bbb =
sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]);
1986 bbb_L1 =
sqrt(B_L1.
x[0]*B_L1.
x[0] + B_L1.
y[0]*B_L1.
y[0] + B_L1.
z[0]*B_L1.
z[0]);
1988 stB -> SetBinContent(ii,jj,(bbb - bbb_L1));
1989 stBx -> SetBinContent(ii,jj,(B[0] - B_L1.
x[0]));
1990 stBy -> SetBinContent(ii,jj,(B[1] - B_L1.
y[0]));
1991 stBz -> SetBinContent(ii,jj,(B[2] - B_L1.
z[0]));
1997 stB ->GetXaxis()->SetTitle(
"X, cm");
1998 stB ->GetYaxis()->SetTitle(
"Y, cm");
1999 stB ->GetXaxis()->SetTitleOffset(1);
2000 stB ->GetYaxis()->SetTitleOffset(1);
2001 stB ->GetZaxis()->SetTitle(
"B_map - B_L1, kGauss");
2002 stB ->GetZaxis()->SetTitleOffset(1.3);
2004 stBx ->GetXaxis()->SetTitle(
"X, cm");
2005 stBx ->GetYaxis()->SetTitle(
"Y, cm");
2006 stBx ->GetXaxis()->SetTitleOffset(1);
2007 stBx ->GetYaxis()->SetTitleOffset(1);
2008 stBx ->GetZaxis()->SetTitle(
"Bx_map - Bx_L1, kGauss");
2009 stBx ->GetZaxis()->SetTitleOffset(1.3);
2011 stBy ->GetXaxis()->SetTitle(
"X, cm");
2012 stBy ->GetYaxis()->SetTitle(
"Y, cm");
2013 stBy ->GetXaxis()->SetTitleOffset(1);
2014 stBy ->GetYaxis()->SetTitleOffset(1);
2015 stBy ->GetZaxis()->SetTitle(
"By_map - By_L1, kGauss");
2016 stBy ->GetZaxis()->SetTitleOffset(1.3);
2018 stBz ->GetXaxis()->SetTitle(
"X, cm");
2019 stBz ->GetYaxis()->SetTitle(
"Y, cm");
2020 stBz ->GetXaxis()->SetTitleOffset(1);
2021 stBz ->GetYaxis()->SetTitleOffset(1);
2022 stBz ->GetZaxis()->SetTitle(
"Bz_map - Bz_L1, kGauss");
2023 stBz ->GetZaxis()->SetTitleOffset(1.3);
2034 gFile = currentFile;
2039void CbmL1::FieldIntegralCheck()
2041 TDirectory *curr = gDirectory;
2042 TFile *currentFile = gFile;
2043 TFile* fout =
new TFile(
"FieldApprox.root",
"RECREATE");
2048 int nPointsZ = 1000;
2049 int nPointsPhi = 100;
2050 int nPointsTheta = 100;
2051 double startZ=0, endZ=100.;
2052 double startPhi=0, endPhi=2*TMath::Pi();
2053 double startTheta=-30./180.*TMath::Pi(), endTheta=30./180.*TMath::Pi();
2055 double DZ=endZ-startZ;
2056 double DP=endPhi-startPhi;
2057 double DT=endTheta-startTheta;
2059 float ddp = endPhi/nPointsPhi;
2060 float ddt = 2*endTheta/nPointsTheta;
2062 TH2F *hSb =
new TH2F(
"Field Integral",
"Field Integral" ,
static_cast<int>(nPointsPhi),-(startPhi+ddp/2.),(endPhi+ddp/2.),
static_cast<int>(nPointsTheta),(startTheta-ddt/2.),(endTheta+ddt/2.));
2064 for(
int iP=0; iP<nPointsPhi; iP++)
2066 double phi=startPhi+iP*DP/nPointsPhi;
2067 for(
int iT=0; iT<nPointsTheta; iT++)
2069 double theta=startTheta+iT*DT/nPointsTheta;
2072 for(
int iZ=1;
iZ<nPointsZ;
iZ++)
2074 double z = startZ+ DZ*
iZ/nPointsZ;
2075 double x = z*TMath::Tan(theta)*TMath::Cos(phi);
2076 double y = z*TMath::Tan(theta)*TMath::Sin(phi);
2077 double r[3] = {x,y,z};
2079 MF->GetFieldValue( r, b );
2080 double B=
sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]);
2081 Sb += B*DZ/nPointsZ/100./10.;
2083 hSb->SetBinContent(iP+1,iT+1,Sb);
2087 hSb ->GetXaxis()->SetTitle(
"#phi [rad]");
2088 hSb ->GetYaxis()->SetTitle(
"#theta [rad]");
2089 hSb ->GetXaxis()->SetTitleOffset(1);
2090 hSb ->GetYaxis()->SetTitleOffset(1);
2091 hSb ->GetZaxis()->SetTitle(
"Field Integral [T#dotm]");
2092 hSb ->GetZaxis()->SetTitleOffset(1.3);
2099 gFile = currentFile;
2103void CbmL1::InputPerformance()
2105 static TH1I *nStripFHits, *nStripBHits, *nStripFMC, *nStripBMC;
2107 static TH1F *resX, *resY;
2108 static TH1F *pullX, *pullY;
2110 static bool first_call = 1;
2114 TDirectory *currentDir = gDirectory;
2115 gDirectory = histodir;
2116 gDirectory->cd(
"L1");
2117 gDirectory->mkdir(
"Input");
2118 gDirectory->cd(
"Input");
2120 nStripFHits =
new TH1I(
"nHits_f",
"NHits On Front Strip", 10, 0, 10);
2121 nStripBHits =
new TH1I(
"nHits_b",
"NHits On Back Strip", 10, 0, 10);
2122 nStripFMC =
new TH1I(
"nMC_f",
"N MC Points On Front Strip", 10, 0, 10);
2123 nStripBMC =
new TH1I(
"nMC_b",
"N MC Points On Back Strip", 10, 0, 10);
2125 pullX =
new TH1F(
"Px",
"Pull x", 50, -5, 5);
2126 pullY =
new TH1F(
"Py",
"Pull y", 50, -5, 5);
2128 resX =
new TH1F(
"x",
"Residual x", 50, -50, 50);
2129 resY =
new TH1F(
"y",
"Residual y", 50, -500, 500);
2132 histo->GetXaxis()->SetTitle(
"Residual x, um");
2134 histo->GetXaxis()->SetTitle(
"Residual y, um");
2136 gDirectory = currentDir;
2139 std::map<unsigned int, unsigned int> stripFToNHitMap,stripBToNHitMap;
2140 std::map<unsigned int, unsigned int> stripFToNMCMap,stripBToNMCMap;
2142 map<unsigned int, unsigned int>::iterator it;
2145 nMC = listStsPts->GetEntries();
2148 for (
unsigned int iH=0; iH < vStsHits.size(); iH++ ){
2152 const CbmStsHit *sh = L1_DYNAMIC_CAST<CbmStsHit*>( listStsHits->At(h.
extIndex) );
2156 if ( iStripF >= 0 ) stripFToNHitMap[iStripF]++;
2157 if ( iStripB >= 0 ) stripBToNHitMap[iStripB]++;
2160 int iMC = vMCPoints[h.
mcPointIds[0]].pointId;
2161 if( !( iMC>=0 && iMC < nMC) )
2164 if ( iStripF >= 0 ) stripFToNMCMap[iStripF]++;
2165 if ( iStripB >= 0 ) stripBToNMCMap[iStripB]++;
2169 TVector3 hitPos, mcPos, hitErr;
2170 sh->Position(hitPos);
2171 sh->PositionError(hitErr);
2173 pt = L1_DYNAMIC_CAST<CbmStsPoint*>( listStsPts->At(iMC) );
2179 mcPos.SetX( pt->
GetX( hitPos.Z() ) );
2180 mcPos.SetY( pt->
GetY( hitPos.Z() ) );
2181 mcPos.SetZ( hitPos.Z() );
2184 if (hitErr.X() != 0) pullX->Fill( (hitPos.X() - mcPos.X()) / hitErr.X() );
2185 if (hitErr.Y() != 0) pullY->Fill( (hitPos.Y() - mcPos.Y()) / hitErr.Y() );
2187 if (hitErr.X() != 0) pullX->Fill( (hitPos.X() - mcPos.X()) / sh->GetDx() );
2188 if (hitErr.Y() != 0) pullY->Fill( (hitPos.Y() - mcPos.Y()) / sh->GetDy() );
2190 if (hitErr.X() != 0) pullX->Fill( (hitPos.X() - mcPos.X()) /
sqrt(
algo->vStations[NMvdStations].XYInfo.C00[0]) );
2191 if (hitErr.Y() != 0) pullY->Fill( (hitPos.Y() - mcPos.Y()) /
sqrt(
algo->vStations[NMvdStations].XYInfo.C11[0]) );
2194 resX->Fill((hitPos.X() - mcPos.X())*10*1000);
2195 resY->Fill((hitPos.Y() - mcPos.Y())*10*1000);
2200 Int_t nEnt = listMvdHits->GetEntries();
2202 for (
int j=0; j < nEnt; j++ ){
2203 CbmMvdHit *sh = L1_DYNAMIC_CAST<CbmMvdHit*>( listMvdHits->At(j) );
2204 CbmMvdHitMatch *hm = L1_DYNAMIC_CAST<CbmMvdHitMatch*>( listMvdHitMatches->At(j) );
2211 TVector3 hitPos, mcPos, hitErr;
2212 sh->Position(hitPos);
2213 sh->PositionError(hitErr);
2215 if( iMC>=0 && iMC<nMC) pt = L1_DYNAMIC_CAST<CbmMvdPoint*>( listMvdPts->At(iMC) );
2221 mcPos.SetX( ( pt->GetX() + pt->
GetXOut() )/2. );
2222 mcPos.SetY( ( pt->GetY() + pt->
GetYOut() )/2 );
2223 mcPos.SetZ( hitPos.Z() );
2229 if (hitErr.X() != 0) pullX->Fill( (hitPos.X() - mcPos.X()) /
sqrt(
algo->vStations[0].XYInfo.C00[0]) );
2230 if (hitErr.Y() != 0) pullY->Fill( (hitPos.Y() - mcPos.Y()) /
sqrt(
algo->vStations[0].XYInfo.C11[0]) );
2232 resX->Fill((hitPos.X() - mcPos.X())*10*1000);
2233 resY->Fill((hitPos.Y() - mcPos.Y())*10*1000);
2240 for (it = stripFToNHitMap.begin(); it != stripFToNHitMap.end(); it++){
2241 nStripFHits->Fill(it->second);
2243 for (it = stripBToNHitMap.begin(); it != stripBToNHitMap.end(); it++){
2244 nStripBHits->Fill(it->second);
2246 for (it = stripFToNMCMap.begin(); it != stripFToNMCMap.end(); it++){
2247 nStripFMC->Fill(it->second);
2249 for (it = stripBToNMCMap.begin(); it != stripBToNMCMap.end(); it++){
2250 nStripBMC->Fill(it->second);
#define L1_ASSERT(v, msg)
void L1AddPipeMaterial(L1TrackPar &T, fvec qp0, fvec w=1, fvec mass2=0.1395679f *0.1395679f)
void L1AddMaterial(L1TrackPar &T, fvec radThick, fvec qp0, fvec w=1, fvec mass2=0.1395679f *0.1395679f)
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 fabs(const F32vec4 &a)
friend F32vec4 acos(const F32vec4 &a)
static void CopyTC2TrackParam(FairTrackParam *par, Double_t T[], Double_t C[])
void Inc(bool isReco, int nClones, TString name)
static const int nParticles
void IncReco(bool isGhost, bool isBg, TString name)
TString partName[nParticles]
void Extrapolate(Double_t r0[], double T)
void GetMass(Double_t &M, Double_t &Error)
void GetLifeTime(Double_t &T, Double_t &Error)
void GetDecayLength(Double_t &L, Double_t &Error)
Double_t GetParameter(Int_t i) const
Double_t GetCovariance(Int_t i) const
const vector< int > & DaughterIds() const
Double_t GetDStoPoint(const Double_t xyz[]) const
Int_t Extrapolate(Double_t z, Double_t *QP0=0, Bool_t line=false)
Access to i-th hit.
void SetTrackParam(FairTrackParam &track)
Double_t * GetTrack()
Is it electron.
Double_t * GetCovMatrix()
array[6] of track parameters(x,y,tx,ty,qp,z)
Double_t * GetCovMatrix()
static CbmKF * Instance()
BmnNewFieldMap * GetMagneticField()
std::vector< CbmKFTube > vMvdMaterial
void AddRecoTrack(CbmL1Track *rTr)
bool IsReconstructed() const
bool IsReconstructable() const
void AddTouchTrack(CbmL1Track *tTr)
vector< CbmL1Track * > & GetRecoTracks()
bool IsAdditional() const
CbmL1MCTrack * GetMCTrack()
void AddMCTrack(CbmL1MCTrack *mcTr)
void SetMaxPurity(double maxPurity_)
vector< CbmL1HitStore > vHitStore
vector< CbmL1Track > vRTracks
CbmL1ParticlesFinder * PF
for access to L1 Algorithm from L1::Instance
Double_t GetStartZ() const
Double_t GetStartY() const
Int_t GetMotherId() const
Double_t GetStartX() const
CbmStsStation * GetStation(Int_t iStation)
Int_t GetDigi(Int_t iSide) const
Double_t GetY(Double_t z) const
Double_t GetX(Double_t z) const
CbmStsSensor * GetSensor(Int_t iSensor)
Int_t GetNSensors() const
Int_t GetNSectors() const
Double_t GetZ(Int_t it=0)
CbmStsSector * GetSector(Int_t iSector)
bool IsReconstructable() const
void SetMCTrackID(int id)
const std::vector< int > & GetDaughterIds() const
void SetAsReconstructable()
vector< L1StsHit > vStsHits
void GetFieldValue(const fvec &x, const fvec &y, L1FieldValue &B) const
@ error
throw a parse_error exception in case of a tag
TL1TracksCatCounters< int > reco
TL1TracksCatCounters< int > mc
map< TString, int > indices
TL1Efficiencies & operator+=(TL1Efficiencies &a)
TL1TracksCatCounters< double > ratio_reco
void Inc(bool isReco, TString name)
virtual void AddCounter(TString shortname, TString name)
TL1TracksCatCounters< double > ratio_clone
TL1TracksCatCounters< int > mc_length_hits
TL1TracksCatCounters< double > ratio_length
TL1TracksCatCounters< double > ratio_fakes
virtual void AddCounter(TString shortname, TString name)
TL1TracksCatCounters< double > reco_length
TL1TracksCatCounters< int > mc_length
TL1TracksCatCounters< double > reco_fakes
void Inc(bool isReco, bool isKilled, double _ratio_length, double _ratio_fakes, int _nclones, int _mc_length, int _mc_length_hits, TString name)
virtual ~TL1PerfEfficiencies()
TL1TracksCatCounters< int > killed
TL1TracksCatCounters< double > ratio_killed
TL1TracksCatCounters< int > clone
TL1PerfEfficiencies & operator+=(TL1PerfEfficiencies &a)
counters used for efficiency calculation