80 fManager = FairRootManager::Instance();
85 LOG(error) <<
"Could not initialise MCDataManager" << std::endl;
89 LOG(warn) <<
"Could not initialise FairRootManager" << std::endl;
93 for (
unsigned int i = 0; i <
detectors.size(); i++) {
97 std::string px =
"Px_" + decName;
98 std::string py =
"Py_" + decName;
99 std::string pt =
"Pt_" + decName;
100 std::string rx =
"x_" + decName;
101 std::string ry =
"y_" + decName;
102 std::string rt =
"t_" + decName;
103 std::string pullx = decName +
" Pull x";
104 std::string pully = decName +
" Pull y";
105 std::string pullt = decName +
" Pull t";
106 std::string resx = decName +
" Residual x";
107 std::string resy = decName +
" Residual y";
108 std::string rest = decName +
" Residual t";
110 TH1F* pullxHist =
new TH1F(px.c_str(), pullx.c_str(), 100, -1 *
detectors[i].second[0],
detectors[i].second[0]);
111 TH1F* pullyHist =
new TH1F(py.c_str(), pully.c_str(), 100, -1 *
detectors[i].second[0],
detectors[i].second[0]);
112 TH1F* pulltHist =
new TH1F(pt.c_str(), pullt.c_str(), 100, -1 *
detectors[i].second[0],
detectors[i].second[0]);
114 TH1F* residualxHist =
new TH1F(rx.c_str(), resx.c_str(), 100, -1 *
detectors[i].second[1],
detectors[i].second[1]);
115 TH1F* residualyHist =
new TH1F(ry.c_str(), resy.c_str(), 100, -1 *
detectors[i].second[2],
detectors[i].second[2]);
116 TH1F* residualtHist =
new TH1F(rt.c_str(), rest.c_str(), 100, -1 *
detectors[i].second[3],
detectors[i].second[3]);
125 pullxHist->GetXaxis()->SetTitle(
"Pull x");
126 pullyHist->GetXaxis()->SetTitle(
"Pull y");
127 pulltHist->GetXaxis()->SetTitle(
"Pull t");
128 residualxHist->GetXaxis()->SetTitle(
"Residual x");
129 residualyHist->GetXaxis()->SetTitle(
"Residual y");
130 residualtHist->GetXaxis()->SetTitle(
"Residual t");
132 hists[i][0] = pullxHist;
133 hists[i][1] = pullyHist;
134 hists[i][2] = pulltHist;
135 hists[i][3] = residualxHist;
136 hists[i][4] = residualyHist;
137 hists[i][5] = residualtHist;
139 if (
verbosity > 1) LOG(info) <<
"CbmRecoQa Success Initiliasing Histograms for: " << decName;
190 if (
verbosity > 1) LOG(info) <<
"CbmRecoQa Record called for: " << decName;
194 TClonesArray* listHits =
nullptr;
195 TClonesArray* listHitMatches =
nullptr;
199 TClonesArray* listClusterMatches =
nullptr;
201 if (decName ==
"sts") {
202 listHits = (TClonesArray*) (
fManager->GetObject(
"StsHit"));
203 listHitMatches = (TClonesArray*) (
fManager->GetObject(
"StsHitMatch"));
205 listClusterMatches = (TClonesArray*) (
fManager->GetObject(
"StsClusterMatch"));
207 if (listPoints ==
nullptr) {
208 LOG(warn) <<
"No StsPoint data!";
212 if (listHits && listHitMatches) {
214 TVector3 hitPos(.0, .0, .0);
215 TVector3 mcPos(.0, .0, .0);
216 TVector3 hitErr(.0, .0, .0);
218 int nEnt = listHits->GetEntriesFast();
219 if (
verbosity > 2) LOG(info) <<
"CbmRecoQa for " << decName <<
" found " << nEnt <<
" Hit Entries";
220 for (
int j = 0; j < nEnt; j++) {
222 float bestWeight = 0.f;
229 if (listClusterMatches) {
237 LOG(info) <<
"Front Match: " << front_match->
ToString() <<
" Back Match: " << back_match->
ToString();
239 for (
int frontlink_c = 0; frontlink_c < front_match->
GetNofLinks(); frontlink_c++) {
243 for (
int backlink_c = 0; backlink_c < back_match->
GetNofLinks(); backlink_c++) {
247 LOG(info) <<
"FrontLink: " << frontLink.
ToString() <<
" BackLink: " << backLink.
ToString();
248 if (frontLink == backLink) {
257 for (
int iLink = 0; iLink < curr_match.
GetNofLinks(); iLink++) {
260 if (tmpweight > bestWeight) {
261 bestWeight = tmpweight;
263 link = curr_match.
GetLink(iLink);
264 if (
verbosity > 3) LOG(info) <<
"Found Link for current HIT";
270 if (curr_point == 0)
continue;
275 if (
verbosity > 3) LOG(info) <<
"Calculated Position Error";
277 mcPos.SetX(curr_point->
GetX(hitPos.Z()));
278 mcPos.SetY(curr_point->
GetY(hitPos.Z()));
279 mcPos.SetZ(hitPos.Z());
280 if (
verbosity > 3) LOG(info) <<
"Calculated MCPos";
283 if (hitErr.X() != 0)
hists[decNum][0]->Fill((hitPos.X() - mcPos.X()) / curr_hit->
GetDx());
284 if (hitErr.Y() != 0)
hists[decNum][1]->Fill((hitPos.Y() - mcPos.Y()) / curr_hit->
GetDy());
287 hists[decNum][3]->Fill((hitPos.X() - mcPos.X()) * 10 * 1000);
288 hists[decNum][4]->Fill((hitPos.Y() - mcPos.Y()) * 10 * 1000);
292 LOG(warn) <<
"CBMRECOQA WARNING :-- No Sts Cluster Matches found!" << std::endl;
297 LOG(warn) <<
"CBMRECOQA WARNING :-- NO Data for Reco QA found! "
298 <<
"Detector: " << decName << std::endl;
301 else if (decName ==
"mvd") {
302 listHits = (TClonesArray*) (
fManager->GetObject(
"MvdHit"));
303 listHitMatches = (TClonesArray*) (
fManager->GetObject(
"MvdHitMatch"));
306 TClonesArray* listMvdPoints = (TClonesArray*) (
fManager->GetObject(
"MvdPoint"));
308 if (listHits && listHitMatches) {
310 TVector3 hitPos(.0, .0, .0);
311 TVector3 mcPos(.0, .0, .0);
312 TVector3 hitErr(.0, .0, .0);
314 int nEnt = listHits->GetEntriesFast();
315 if (
verbosity > 2) LOG(info) <<
"CbmRecoQa for " << decName <<
" found " << nEnt <<
" Hit Entries";
316 for (
int j = 0; j < nEnt; j++) {
325 if (iMC < 0)
continue;
327 curr_point = (
CbmMvdPoint*) (listMvdPoints->At(iMC));
329 if (curr_point == 0)
continue;
333 if (
verbosity > 3) LOG(info) <<
"Calculated Position Error";
335 mcPos.SetX((curr_point->GetX() + curr_point->
GetXOut()) / 2.);
336 mcPos.SetY((curr_point->GetY() + curr_point->
GetYOut()) / 2.);
337 mcPos.SetZ(hitPos.Z());
338 if (
verbosity > 3) LOG(info) <<
"Calculated MCPos";
341 if (hitErr.X() != 0)
hists[decNum][0]->Fill((hitPos.X() - mcPos.X()) / curr_hit->
GetDx());
342 if (hitErr.Y() != 0)
hists[decNum][1]->Fill((hitPos.Y() - mcPos.Y()) / curr_hit->
GetDy());
344 hists[decNum][3]->Fill((hitPos.X() - mcPos.X()) * 10 * 1000);
345 hists[decNum][4]->Fill((hitPos.Y() - mcPos.Y()) * 10 * 1000);
349 LOG(warn) <<
"CBMRECOQA WARNING :-- NO Data for Reco QA found! "
350 <<
"Detector: " << decName << std::endl;
353 else if (decName ==
"much") {
355 listHits = (TClonesArray*) (
fManager->GetObject(
"MuchPixelHit"));
356 listHitMatches = (TClonesArray*) (
fManager->GetObject(
"MuchPixelHitMatch"));
358 if (listPoints ==
nullptr) {
359 LOG(warn) <<
"No MuchPoint data!";
362 if (listHits && listHitMatches) {
364 TVector3 hitPos(.0, .0, .0);
365 TVector3 mcPos(.0, .0, .0);
366 TVector3 hitErr(.0, .0, .0);
368 int nEnt = listHits->GetEntriesFast();
369 if (
verbosity > 2) LOG(info) <<
"CbmRecoQa for " << decName <<
" found " << nEnt <<
" Hit Entries";
370 for (
int j = 0; j < nEnt; j++) {
372 float bestWeight = 0.f;
379 for (
int iLink = 0; iLink < curr_match->
GetNofLinks(); iLink++) {
382 if (tmpweight > bestWeight) {
383 bestWeight = tmpweight;
385 link = curr_match->
GetLink(iLink);
386 if (
verbosity > 3) LOG(info) <<
"Found Link for current HIT";
390 if (iMC < 0)
continue;
396 if (curr_point == 0)
continue;
400 if (
verbosity > 3) LOG(info) <<
"Calculated Position Error";
402 mcPos.SetX((curr_point->
GetXIn() + curr_point->
GetXOut()) / 2.);
403 mcPos.SetY((curr_point->
GetYIn() + curr_point->
GetYOut()) / 2.);
404 mcPos.SetZ(hitPos.Z());
405 if (
verbosity > 3) LOG(info) <<
"Calculated MCPos";
409 if (hitErr.X() != 0)
hists[decNum][0]->Fill((hitPos.X() - mcPos.X()) / curr_hit->
GetDx());
410 if (hitErr.Y() != 0)
hists[decNum][1]->Fill((hitPos.Y() - mcPos.Y()) / curr_hit->
GetDy());
413 hists[decNum][3]->Fill((hitPos.X() - mcPos.X()));
414 hists[decNum][4]->Fill((hitPos.Y() - mcPos.Y()));
419 LOG(warn) <<
"CBMRECOQA WARNING :-- NO Data for Reco QA found! "
420 <<
"Detector: " << decName << std::endl;
424 LOG(warn) <<
"CBMRECOQA WARNING :-- NO matching Detector found ! " << std::endl;