1 #include "ERmuSiMatcher.h" 7 #include "FairRootManager.h" 8 #include "FairRunAna.h" 9 #include "FairRuntimeDb.h" 12 #include "ERDetectorList.h" 14 #include "ERMCTrack.h" 15 #include "ERmuSiPoint.h" 16 #include "ERmuSiHit.h" 17 #include "ERmuSiTrack.h" 18 #include "ERmuSiVertex.h" 21 : FairTask(
"ER muSi matching scheme"),
26 fNotFoundedVerteciesNb(0)
33 : FairTask(
"ER muSi matching scheme ", verbose),
38 fNotFoundedVerteciesNb(0)
50 void ERmuSiMatcher::SetParContainers()
53 FairRunAna* run = FairRunAna::Instance();
54 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
56 FairRuntimeDb* rtdb = run->GetRuntimeDb();
57 if ( ! rtdb ) Fatal(
"SetParContainers",
"No runtime database");
65 FairRootManager* ioman = FairRootManager::Instance();
66 if ( ! ioman ) Fatal(
"Init",
"No FairRootManager");
68 fMCTracks = (TClonesArray*) ioman->GetObject(
"MCTrack");
69 fmuSiPoints = (TClonesArray*) ioman->GetObject(
"muSiPoint");
70 fmuSiHits = (TClonesArray*) ioman->GetObject(
"muSiHit");
71 fmuSiTracks = (TClonesArray*) ioman->GetObject(
"muSiTrack");
72 fmuSiVertecies = (TClonesArray*) ioman->GetObject(
"muSiVertex");
74 fHVertexDz =
new TH1F(
"Vertex z quality",
"Vertex z quality", 5000, 0., .5);
75 fHVertexDxy =
new TH1F(
"Vertex xy quality",
"Vertex xy quality", 5000, 0., .5);
83 std::cout << std::endl;
84 std::cout <<
"ERmuSiMatcher:" << std::endl;
86 Int_t wrongTracks = 0;
87 for(Int_t iTrack = 0; iTrack < fmuSiTracks->GetEntriesFast(); iTrack++){
93 if (hit0->GetRefIndex() == -1 || hit1->GetRefIndex() == -1 || hit2->GetRefIndex() == -1){
100 if ((point0->GetTrackID() == point1->GetTrackID()) && (point1->GetTrackID() == point2->GetTrackID()))
106 map<Int_t,Int_t> pointsOnTracks;
107 for (Int_t iPoint = 0; iPoint <
fmuSiPoints->GetEntriesFast(); iPoint++){
109 pointsOnTracks[point->GetTrackID()]++;
111 Int_t shortMCTracks = 0;
112 for (map<Int_t,Int_t>::iterator it = pointsOnTracks.begin(); it != pointsOnTracks.end(); ++it){
117 std::cout <<
"True tracks:" << trueTracks << std::endl;
118 std::cout <<
"Wrong tracks:" << wrongTracks << std::endl;
119 fTrueTracksNb += trueTracks;
120 fWrongTracksNb += wrongTracks;
121 fMCTracksNb += pointsOnTracks.size();
122 fShortMCTracksNb+= shortMCTracks;
124 Int_t notFoundedVerteciesNb = 0;
126 vector<MCVertex> MCVertecies;
127 for (Int_t iTrack = 0; iTrack < fMCTracks->GetEntriesFast(); iTrack++){
129 Bool_t addedToMC = kFALSE;
130 if (mcTrack->GetMotherId() == -1){
131 for(vector<MCVertex>::iterator it = MCVertecies.begin(); it!=MCVertecies.end(); it++){
132 if ( ((*it).x - mcTrack->GetStartX() < 0.01) &&
133 ((*it).y - mcTrack->GetStartY() < 0.01) &&
134 ((*it).y - mcTrack->GetStartY() < 0.01))
138 MCVertecies.push_back(
MCVertex(mcTrack->GetStartX(), mcTrack->GetStartY(), mcTrack->GetStartZ()));
142 for(vector<MCVertex>::iterator it = MCVertecies.begin(); it!=MCVertecies.end(); it++){
144 Bool_t founded = kFALSE;
145 Float_t distFounded = 99999999.;
147 for(Int_t iVert =0; iVert < fmuSiVertecies->GetEntriesFast(); iVert++ ){
149 Float_t dist = TMath::Sqrt((vert->X()-mcVertex.x)*(vert->X()-mcVertex.x) +
150 (vert->Y()-mcVertex.y)*(vert->Y()-mcVertex.y) +
151 (vert->Z()-mcVertex.z)*(vert->Z()-mcVertex.z));
154 if (dist < distFounded){
161 notFoundedVerteciesNb++;
163 fHVertexDz->Fill(TMath::Abs(vertFounded->Z() - mcVertex.z));
164 fHVertexDxy->Fill(TMath::Sqrt((vertFounded->Y() - mcVertex.y)*(vertFounded->Y() - mcVertex.y)
165 +(vertFounded->X() - mcVertex.x)*(vertFounded->Z() - mcVertex.z)));
169 std::cout <<
"Not founded primary vertecies:" << notFoundedVerteciesNb << std::endl;
170 fNotFoundedVerteciesNb += notFoundedVerteciesNb;
183 std::cout << std::endl;
184 std::cout <<
"========= ERmuSiMatcher : ================" << std::endl;
186 std::cout <<
"MC tracks: " << fMCTracksNb << std::endl;
187 std::cout <<
"Short MC tracks: " << fShortMCTracksNb << std::endl;
188 std::cout <<
"True tracks: " << fTrueTracksNb << std::endl;
189 std::cout <<
"Wrong tracks: " << fWrongTracksNb << std::endl;
190 std::cout <<
"Eff. all: " << (Float_t)fTrueTracksNb/(Float_t)fMCTracksNb << std::endl;
191 std::cout <<
"Eff. long: " << (Float_t)fTrueTracksNb/(Float_t)(fMCTracksNb-fShortMCTracksNb)<< std::endl;
192 std::cout <<
"Not founded primary vertecies: " << fNotFoundedVerteciesNb << std::endl;
195 fHVertexDxy->Write();
TClonesArray * fmuSiPoints
virtual void Exec(Option_t *opt)
virtual InitStatus Init()