2#include "BmnSiliconPoint.h"
18 fSiliconDigits(nullptr),
20 fSiliconHits(nullptr),
21 fSiliconTracks(nullptr),
24 fSiliconPoints(nullptr),
30 hGemXYProfiles(nullptr),
31 hSiliconXYProfiles(nullptr),
32 hXzRecoFromTracks(nullptr),
33 hProtonMomentaEmb(nullptr),
34 hPionMomentaEmb(nullptr),
35 hProtonMomentaReco(nullptr),
36 hPionMomentaReco(nullptr),
37 hProtonNhitsEmb(nullptr),
38 hPionNhitsEmb(nullptr),
39 hProtonNhitsReco(nullptr),
40 hPionNhitsReco(nullptr),
41 hProtonNhitsRecoAll(nullptr),
42 hPionNhitsRecoAll(nullptr),
45 hStripChannel(nullptr),
65 fSiliconDigits(nullptr),
67 fSiliconHits(nullptr),
68 fSiliconTracks(nullptr),
71 fSiliconPoints(nullptr),
77 hGemXYProfiles(nullptr),
78 hSiliconXYProfiles(nullptr),
79 hXzRecoFromTracks(nullptr),
80 hProtonMomentaEmb(nullptr),
81 hPionMomentaEmb(nullptr),
82 hProtonMomentaReco(nullptr),
83 hPionMomentaReco(nullptr),
84 hProtonNhitsEmb(nullptr),
85 hPionNhitsEmb(nullptr),
86 hProtonNhitsReco(nullptr),
87 hPionNhitsReco(nullptr),
88 hProtonNhitsRecoAll(nullptr),
89 hPionNhitsRecoAll(nullptr),
92 hStripChannel(nullptr),
103 drawFoundTracks = kFALSE;
110 fSignalWindow[
GEM][0] = 0;
111 fSignalWindow[
GEM][1] = LDBL_MAX;
113 fSignalWindow[
SILICON][1] = LDBL_MAX;
116 ifstream
f(list.Data());
118 for (
string line; getline(
f, line);)
122 cout <<
"List file contains " << nLines <<
" inputs" << endl;
125 fDigi =
new TString[nLines];
126 fDst =
new TString[nLines];
127 fEmb =
new TString[nLines];
128 fPath =
new TString[nLines];
132 ifstream g(list.Data());
134 g >> fDigi[nLines] >> fDst[nLines] >> fEmb[nLines] >> fPath[nLines];
141 for (Int_t iLine = 0; iLine < nLines; iLine++)
142 cout << fDigi[iLine] <<
" " << fDst[iLine] <<
" " << fEmb[iLine] <<
" " << fPath[iLine] << endl;
165 for (Int_t iInput = 0; iInput < nInputs; iInput++) {
166 Double_t etaMin = 0.;
167 Double_t etaMax = 0.;
170 TObjArray* tx = fPath[iInput].Tokenize(
"/");
171 for (Int_t
i = 0;
i < tx->GetEntries();
i++) {
172 TString str = ((TObjString*) (tx->At(
i)))->String();
174 if (!str.Contains(
"lambda"))
177 TObjArray* ty = str.Tokenize(
"_");
179 etaMin = ((TObjString*) (ty->At(2)))->String().Atof();
180 etaMax = ((TObjString*) (ty->At(3)))->String().Atof();
185 TChain* emb =
new TChain(
"bmndata");
186 emb->Add(fEmb[iInput].Data());
188 emb->SetBranchAddress(
"EmbeddingMonitor.", &fMon);
190 TChain* dst =
new TChain(
"bmndata");
191 dst->Add(fDst[iInput].Data());
193 dst->SetBranchAddress(
"DstEventHeader.", &hDst);
194 dst->SetBranchAddress(
"BmnGemStripHit", &fGemHits);
195 dst->SetBranchAddress(
"BmnSiliconHit", &fSiliconHits);
196 dst->SetBranchAddress(
"BmnGlobalTrack", &fGlobTracks);
198 const Int_t nCutBins = 4;
199 Double_t cutsNHitsFrac[nCutBins] = {0., 0.2, 0.4, 0.5};
200 Int_t nRecProtons[nCutBins];
201 Int_t nRecPions[nCutBins];
203 for (Int_t iBin = 0; iBin < nCutBins; iBin++) {
204 nRecProtons[iBin] = 0;
208 Int_t nEmbeddedProtons = 0;
209 Int_t nEmbeddedPions = 0;
213 for (Int_t iEmb = 0; iEmb < emb->GetEntries(); iEmb++) {
216 if (iEmb % 1000 == 0)
217 cout <<
"Event# " << iEmb << endl;
227 for (UInt_t iDst = idEmb - 1; iDst < idEmb + 1; iDst++) {
242 TChain* lambda =
new TChain(
"bmndata");
243 lambda->Add(Form(
"%s/lambda%d_vertex%d.root", fPath[iInput].Data(), store, vertex));
245 lambda->SetBranchAddress(
"StsPoint", &fGemPoints);
246 lambda->SetBranchAddress(
"SiliconPoint", &fSiliconPoints);
248 lambda->GetEntry(event);
250 map <Int_t, vector < CbmStsPoint>> gemsMc;
251 for (Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
252 vector <CbmStsPoint> tmp;
256 map <Int_t, vector < BmnSiliconPoint>> siliconsMc;
257 for (Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
258 vector <BmnSiliconPoint> tmp;
259 siliconsMc[iStat] = tmp;
263 for (Int_t iPoint = 0; iPoint < fGemPoints->GetEntriesFast(); iPoint++) {
266 gemsMc.find(point->
GetStation())->second.push_back(*point);
270 for (Int_t iPoint = 0; iPoint < fSiliconPoints->GetEntriesFast(); iPoint++) {
273 siliconsMc.find(point->
GetStation())->second.push_back(*point);
276 map <Int_t, vector < BmnHit>> gemsReco;
277 map <Int_t, vector < BmnHit>> siliconsReco;
279 for (Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
281 gemsReco[iStat] = tmp;
284 for (Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
286 siliconsReco[iStat] = tmp;
291 for (Int_t iHit = 0; iHit < fGemHits->GetEntriesFast(); iHit++) {
294 gemsReco.find(hit->
GetStation())->second.push_back(*hit);
299 for (Int_t iHit = 0; iHit < fSiliconHits->GetEntriesFast(); iHit++) {
300 BmnHit* hit = (
BmnHit*) fSiliconHits->UncheckedAt(iHit);
302 siliconsReco.find(hit->
GetStation())->second.push_back(*hit);
306 for (
auto mc : siliconsMc)
307 for (
auto reco : siliconsReco) {
310 if (mc.first != reco.first)
313 vector <BmnSiliconPoint> points = mc.second;
314 vector <BmnHit> hits = reco.second;
316 for (
auto mcPoint : points) {
317 Bool_t isEmbedded = kFALSE;
319 vector <Double_t> distances;
321 if (hits.size() != 0)
322 for (
auto recoHit : hits) {
323 Double_t xMC = mcPoint.GetX();
324 Double_t xReco = recoHit.GetX();
327 distances.push_back(Abs(xMC - xReco));
330 if (distances.size() != 0) {
331 Double_t
min = *min_element(distances.begin(), distances.end());
336 pEmbSilHitEff->Fill(mcPoint.GetStation(), mcPoint.GetModule(), isEmbedded ? 1. : 0.);
337 pEffSilStatXY[mcPoint.GetStation()]->Fill(mcPoint.GetX(), mcPoint.GetY(), isEmbedded ? 1. : 0.);
342 for (
auto mc : gemsMc)
343 for (
auto reco : gemsReco) {
346 if (mc.first != reco.first)
349 vector <CbmStsPoint> points = mc.second;
350 vector <BmnHit> hits = reco.second;
352 if (hits.size() == 0)
355 for (
auto mcPoint : points) {
356 Bool_t isEmbedded = kFALSE;
360 Double_t driftCenterShift = 0.;
362 driftCenterShift = 0.15;
364 driftCenterShift = 0.75;
366 vector <Double_t> distances;
368 if (hits.size() != 0)
369 for (
auto recoHit : hits) {
370 Double_t xMC = mcPoint.GetX(mcPoint.GetZ() + driftCenterShift);
371 Double_t xReco = recoHit.GetX();
374 distances.push_back(Abs(xMC - xReco));
377 if (distances.size() != 0) {
378 Double_t
min = *min_element(distances.begin(), distances.end());
384 const Int_t nLayers = 4;
385 Bool_t isLayerActive[nLayers] = {kFALSE, kFALSE, kFALSE, kFALSE};
387 Bool_t isHotZone = kFALSE;
388 Bool_t isBigZone = kFALSE;
390 for (Int_t iLayer = 0; iLayer <
GEM->GetStation(mcPoint.GetStation())->GetModule(mcPoint.GetModule())->GetNStripLayers(); iLayer++) {
391 BmnGemStripLayer layer =
GEM->GetStation(mcPoint.GetStation())->GetModule(mcPoint.GetModule())->GetStripLayer(iLayer);
392 isLayerActive[iLayer] = layer.
IsPointInsideStripLayer((-1.) * mcPoint.GetX(mcPoint.GetZ() + driftCenterShift), mcPoint.GetY(mcPoint.GetZ() + driftCenterShift));
395 if (isLayerActive[0] && isLayerActive[1])
397 else if (isLayerActive[2] && isLayerActive[3])
400 pEffGemStatXY[mcPoint.GetStation()]->Fill(mcPoint.GetX(mcPoint.GetZ() + driftCenterShift), mcPoint.GetY(mcPoint.GetZ() + driftCenterShift), isEmbedded ? 1. : 0.);
402 Int_t idx = isBigZone ? 1 : isHotZone ? 0 : -1;
405 pEmbGemHitEff[idx]->Fill(mcPoint.GetStation(), mcPoint.GetModule(), isEmbedded ? 1. : 0.);
411 vector <BmnGlobalTrack*> protonCands;
412 vector <BmnGlobalTrack*> pionCands;
415 for (Int_t iGlobTrack = 0; iGlobTrack < fGlobTracks->GetEntriesFast(); iGlobTrack++) {
419 protonCands.push_back(glTrack);
422 pionCands.push_back(glTrack);
427 if (!wasReconstructed(cand, 0.05))
430 hNhitsEmbReco[proton]->Fill(cand->GetNHits(), fMon->
GetNHitsProton());
437 if (!wasReconstructed(cand, 0.05))
440 hNhitsEmbReco[pion]->Fill(cand->GetNHits(), fMon->
GetNHitsPion());
446 for (Int_t iCut = 0; iCut < nCutBins; iCut++) {
450 if (!wasReconstructed(cand, cutsNHitsFrac[iCut], 0.05))
460 if (!wasReconstructed(cand, cutsNHitsFrac[iCut], 0.05))
472 for (Int_t iCut = 0; iCut < nCutBins; iCut++) {
473 hEtaLambda[proton][iCut]->SetBinContent(hEtaLambda[proton][iCut]->FindBin(.5 * (etaMax + etaMin)), 1. * nRecProtons[iCut] / nEmbeddedProtons);
474 hEtaLambda[pion][iCut]->SetBinContent(hEtaLambda[pion][iCut]->FindBin(.5 * (etaMax + etaMin)), 1. * nRecPions[iCut] / nEmbeddedPions);
477 cout <<
"Events with embedded particles# " << counter << endl;
483Bool_t BmnLambdaEmbeddingQa::wasReconstructed(
BmnGlobalTrack* glTrack, Double_t lostOrWrongConnectedHitsCut, Double_t momResCut) {
485 Int_t nHitsReco = glTrack->
GetNHits();
487 Int_t sign = (pReco > 0.) ? +1. : -1.;
492 Double_t momRes = TMath::Abs(pReco * sign - pMc) / pMc;
494 Double_t lostOrWrongConnectedHits = 1. * TMath::Abs(nHitsReco - nHitsMc) / nHitsMc;
496 if (momRes < momResCut && lostOrWrongConnectedHits <= lostOrWrongConnectedHitsCut)
502Bool_t BmnLambdaEmbeddingQa::wasReconstructed(
BmnGlobalTrack* glTrack, Double_t momResCut) {
505 Int_t sign = (pReco > 0.) ? +1. : -1.;
509 Double_t momRes = TMath::Abs(pReco * sign - pMc) / pMc;
511 if (momRes < momResCut)
524 for (Int_t iInput = 0; iInput < nInputs; iInput++) {
526 TChain* emb =
new TChain(
"bmndata");
527 emb->Add(fEmb[iInput].Data());
528 emb->SetBranchAddress(
"EmbeddingMonitor.", &fMon);
530 TChain* digi =
new TChain(
"bmndata");
531 digi->Add(fDigi[iInput].Data());
532 digi->SetBranchAddress(
"BmnEventHeader.", &hDigi);
533 digi->SetBranchAddress(
"GEM", &fGemDigits);
534 digi->SetBranchAddress(
"SILICON", &fSiliconDigits);
536 for (Int_t iEmb = 0; iEmb < emb->GetEntries(); iEmb++) {
539 if (iEmb % 1000 == 0)
540 cout <<
"Event# " << iEmb << endl;
549 TChain* lambda =
new TChain(
"bmndata");
550 lambda->Add(Form(
"%s/lambda%d_vertex%d.root", fPath[iInput].Data(), store, vertex));
552 lambda->SetBranchAddress(
"BmnGemStripDigit", &fGemDigits);
553 lambda->SetBranchAddress(
"BmnSiliconDigit", &fSiliconDigits);
555 lambda->GetEntry(event);
558 for (Int_t iDig = 0; iDig < fGemDigits->GetEntriesFast(); iDig++) {
566 hGemStripInfo[0][stat][mod][lay]->Fill(strip);
570 for (Int_t iDig = 0; iDig < fSiliconDigits->GetEntriesFast(); iDig++) {
578 hSiliconStripInfo[0][stat][mod][lay]->Fill(strip);
586 for (UInt_t iEvent = idEmb - 1; iEvent < idEmb + 1; iEvent++) {
587 digi->GetEntry(iEvent);
589 for (Int_t iDigi = 0; iDigi < fGemDigits->GetEntriesFast(); iDigi++) {
599 if (signal < fSignalWindow[
GEM][0] || signal > fSignalWindow[
GEM][1])
602 hGemStripInfo[1][stat][mod][lay]->Fill(strip);
605 for (Int_t iDigi = 0; iDigi < fSiliconDigits->GetEntriesFast(); iDigi++) {
615 if (signal < fSignalWindow[
SILICON][0] || signal > fSignalWindow[
SILICON][1])
618 hSiliconStripInfo[1][stat][mod][lay]->Fill(strip);
629 hProtonMomentaEmb =
new TH1F(
"pMomentaEmb",
"pMomentaEmb", 100, 1., 7.);
630 hPionMomentaEmb =
new TH1F(
"pionMomentaEmb",
"pionMomentaEmb", 100, 0., 2.);
632 hProtonMomentaReco =
new TH1F(
"pMomentaReco",
"pMomentaReco", 100, 1., 7.);
633 hPionMomentaReco =
new TH1F(
"pionMomentaReco",
"pionMomentaReco", 100, 0., 2.);
635 hProtonNhitsEmb =
new TH1F(
"pNhitsEmb",
"pNhitsEmb", 10, 0., 10.);
636 hPionNhitsEmb =
new TH1F(
"pionNhitsEmb",
"pionNhitsEmb", 10, 0., 10.);
638 hProtonNhitsReco =
new TH1F(
"pNhitsReco",
"pNhitsReco", 10, 0., 10.);
639 hPionNhitsReco =
new TH1F(
"pionNhitsReco",
"pionNhitsReco", 10, 0., 10.);
641 hProtonNhitsRecoAll =
new TH1F(
"pNhitsRecoAll",
"pNhitsRecoAll", 10, 0., 10.);
642 hPionNhitsRecoAll =
new TH1F(
"pionNhitsRecoAll",
"pionNhitsRecoAll", 10, 0., 10.);
644 const Int_t nHitsCut = 4;
645 const Double_t deltaPtoP = 0.05;
647 pEffProton =
new TProfile(
"effProton vs. p", Form(
"effProton vs. p, nHits > %d, Delta p / p < %G", nHitsCut, deltaPtoP), 100, 1., 7.);
648 pEffPion =
new TProfile(
"effPion vs. p", Form(
"effPion vs. p, nHits > %d, Delta p / p < %G", nHitsCut, deltaPtoP), 100, 0., 2.);
651 for (Int_t iInput = 0; iInput < nInputs; iInput++) {
652 TChain* emb =
new TChain(
"bmndata");
653 emb->Add(fEmb[iInput].Data());
655 TChain* dst =
new TChain(
"bmndata");
656 dst->Add(fDst[iInput].Data());
658 emb->SetBranchAddress(
"EmbeddingMonitor.", &fMon);
659 dst->SetBranchAddress(
"DstEventHeader.", &hDst);
660 dst->SetBranchAddress(
"BmnGlobalTrack", &fGlobTracks);
661 dst->SetBranchAddress(
"BmnGemStripHit", &fGemHits);
662 dst->SetBranchAddress(
"BmnSiliconHit", &fSiliconHits);
664 for (Int_t iEmb = 0; iEmb < emb->GetEntries(); iEmb++) {
667 if (iEmb % 1000 == 0)
668 cout <<
"Event# " << iEmb << endl;
675 for (UInt_t iDst = idEmb - 1; iDst < idEmb + 1; iDst++) {
688 TChain* lambda =
new TChain(
"bmndata");
689 lambda->Add(Form(
"%s/lambda%d_vertex%d.root", fPath[iInput].Data(), store, vertex));
691 lambda->SetBranchAddress(
"StsPoint", &fGemPoints);
692 lambda->SetBranchAddress(
"SiliconPoint", &fSiliconPoints);
693 lambda->SetBranchAddress(
"MCTrack", &fMcTracks);
695 lambda->GetEntry(event);
698 Int_t nRecoHitsProton[2] = {0, 0};
699 Int_t nRecoHitsPion[2] = {0, 0};
702 for (Int_t iPoint = 0; iPoint < fGemPoints->GetEntriesFast(); iPoint++) {
705 Bool_t isProton = kFALSE;
706 Bool_t isPion = kFALSE;
708 for (Int_t iHit = 0; iHit < fGemHits->GetEntriesFast(); iHit++) {
714 Double_t
dist = Abs(hit->GetX() - point->
GetXIn());
730 nRecoHitsProton[0]++;
736 for (Int_t iPoint = 0; iPoint < fSiliconPoints->GetEntriesFast(); iPoint++) {
739 Bool_t isProton = kFALSE;
740 Bool_t isPion = kFALSE;
742 for (Int_t iHit = 0; iHit < fSiliconHits->GetEntriesFast(); iHit++) {
743 BmnHit* hit = (
BmnHit*) fSiliconHits->UncheckedAt(iHit);
748 Double_t
dist = Abs(hit->GetX() - point->GetX());
764 nRecoHitsProton[1]++;
770 hPionMomentaEmb->Fill(fMon->
GetPionP());
775 hProtonNhitsRecoAll->Fill(nRecoHitsProton[0] + nRecoHitsProton[1]);
776 hPionNhitsRecoAll->Fill(nRecoHitsPion[0] + nRecoHitsPion[1]);
779 for (Int_t iGlobTrack = 0; iGlobTrack < fGlobTracks->GetEntriesFast(); iGlobTrack++) {
782 Double_t p = glTrack->
GetP();
786 hProtonMomentaReco->Fill(p);
787 hProtonNhitsReco->Fill(nHits);
789 hPionMomentaReco->Fill(-p);
790 hPionNhitsReco->Fill(nHits);
795 if (p > 0. && Abs((p - fMon->
GetProtonP()) / p) < deltaPtoP && nHits > nHitsCut)
798 if (p < 0. && Abs((-p - fMon->
GetPionP()) / -p) < deltaPtoP && nHits > nHitsCut)
799 pEffPion->Fill(-p, (1. * nHits) / fMon->
GetNHitsPion());
814 cout <<
"*****************************************************" << endl;
815 cout <<
"*.list file contains more than one line! Exiting ...." << endl;
816 cout <<
"*****************************************************" << endl;
823 TBox*** gemModBoxes =
nullptr;
824 TBox**** gemLayBoxes =
nullptr;
825 TPolyLine**** gemDeadZones =
nullptr;
826 geoms->
GetGemBorders(gemModBoxes, gemLayBoxes, gemDeadZones);
828 TBox*** siliconModBoxes =
nullptr;
829 TBox**** siliconLayBoxes =
nullptr;
830 TPolyLine**** siliconDeadZones =
nullptr;
833 TChain* emb =
new TChain(
"bmndata");
834 emb->Add(fEmb[0].Data());
836 TChain* dst =
new TChain(
"bmndata");
837 dst->Add(fDst[0].Data());
839 emb->SetBranchAddress(
"EmbeddingMonitor.", &fMon);
840 dst->SetBranchAddress(
"DstEventHeader.", &hDst);
841 dst->SetBranchAddress(
"BmnGemStripHit", &fGemHits);
842 dst->SetBranchAddress(
"BmnSiliconHit", &fSiliconHits);
843 dst->SetBranchAddress(
"BmnSiliconTrack", &fSiliconTracks);
844 dst->SetBranchAddress(
"BmnGlobalTrack", &fGlobTracks);
846 hXzMC =
new TH2F(
"",
"", 500, 0., 200., 500, -80., 20.);
847 hXzReco =
new TH2F(
"",
"", 500, 0., 200., 500, -80., 20.);
848 hYzMC =
new TH2F(
"",
"", 500, 0., 0., 500, 0., 0.);
849 hYzReco =
new TH2F(
"",
"", 500, 0., 0., 500, 0., 0.);
851 hGemXYProfiles =
new TH2F*[
GEM->GetNStations()];
852 for (Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
853 hGemXYProfiles[iStat] =
new TH2F(Form(
"GEM: X vs. Y, stat# %d", iStat), Form(
"GEM: X vs. Y, stat# %d", iStat), 500, -90., +90., 500, -10., +40.);
854 hGemXYProfiles[iStat]->GetXaxis()->SetLabelSize(0.1);
855 hGemXYProfiles[iStat]->GetXaxis()->SetLabelSize(0.1);
856 hGemXYProfiles[iStat]->GetYaxis()->SetLabelSize(0.1);
859 hSiliconXYProfiles =
new TH2F*[
SILICON->GetNStations()];
860 for (Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
861 Double_t xLow = (iStat == 0) ? -8. : (iStat == 1) ? -8. : -13.;
862 Double_t xUp = -xLow;
864 Double_t yLow = (iStat == 0) ? -12. : (iStat == 1) ? -13. : -20.;
865 Double_t yUp = (iStat == 0) ? +3. : (iStat == 1) ? +4. : +10.;
867 hSiliconXYProfiles[iStat] =
new TH2F(Form(
"SILICON: X vs. Y, stat# %d", iStat), Form(
"SILICON: X vs. Y, stat# %d", iStat), 500, xLow, xUp, 500, yLow, yUp);
868 hSiliconXYProfiles[iStat]->GetXaxis()->SetLabelSize(0.1);
869 hSiliconXYProfiles[iStat]->GetXaxis()->SetLabelSize(0.1);
870 hSiliconXYProfiles[iStat]->GetYaxis()->SetLabelSize(0.1);
873 if (drawFoundTracks) {
874 fRunAna =
new FairRunAna();
878 Char_t* geoFileName = (Char_t*)
"current_geo_file.root";
881 cout <<
"Geometry file can't be read from the database" << endl;
885 TGeoManager::Import(geoFileName);
891 fRunAna->SetField(fMagField);
894 hXzRecoFromTracks =
new TH2F(
"",
"", 500, 0., 200., 500, 0., 0.);
897 if (drawFoundTracks) {
898 for (Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++)
899 fSilGemZ[iStat] =
SILICON->GetStation(iStat)->GetZPosition();
901 for (Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++)
902 fSilGemZ[3 + iStat] =
GEM->GetStation(iStat)->GetZPosition();
906 for (Int_t iDst = 0; iDst < dst->GetEntries(); iDst++) {
915 hXzRecoFromTracks->Reset();
919 for (Int_t iEmb = 0; iEmb < emb->GetEntries(); iEmb++) {
932 hXzMC->SetTitle(Form(
" XZ SI-GEM profile, id = %d",
id));
933 hXzReco->SetTitle(Form(
"XZ SI-GEM profile, id = %d",
id));
934 hYzMC->SetTitle(Form(
" YZ SI-GEM profile, id = %d",
id));
935 hYzReco->SetTitle(Form(
"YZ SI-GEM profile, id = %d",
id));
945 TChain* lambda =
new TChain(
"bmndata");
946 lambda->Add(Form(
"%s/lambda%d_vertex%d.root", fPath[0].Data(), store, vertex));
948 lambda->SetBranchAddress(
"StsPoint", &fGemPoints);
949 lambda->SetBranchAddress(
"SiliconPoint", &fSiliconPoints);
951 lambda->GetEntry(event);
953 for (Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
954 vector <pair <Double_t, Double_t>> tmp;
955 gems[0][iStat] = tmp;
958 for (Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
959 vector <pair <Double_t, Double_t>> tmp;
960 silicons[0][iStat] = tmp;
964 for (Int_t iPoint = 0; iPoint < fGemPoints->GetEntriesFast(); iPoint++) {
966 Double_t x = point->
GetXIn();
967 Double_t y = point->
GetYIn();
968 Double_t z = point->
GetZIn();
972 gems[0].find(point->
GetStation())->second.push_back(make_pair(x, y));
976 for (Int_t iPoint = 0; iPoint < fSiliconPoints->GetEntriesFast(); iPoint++) {
978 Double_t x = point->GetX();
979 Double_t y = point->GetY();
980 Double_t z = point->GetZ();
984 silicons[0].find(point->
GetStation())->second.push_back(make_pair(x, y));
987 for (Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
988 vector <pair <Double_t, Double_t>> tmp;
989 gems[1][iStat] = tmp;
992 for (Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
993 vector <pair <Double_t, Double_t>> tmp;
994 silicons[1][iStat] = tmp;
999 for (Int_t iHit = 0; iHit < fGemHits->GetEntriesFast(); iHit++) {
1002 Double_t x = hit->GetX();
1003 Double_t y = hit->GetY();
1004 Double_t z = hit->GetZ();
1005 hXzReco->Fill(z, x);
1006 hYzReco->Fill(z, y);
1008 gems[1].find(hit->
GetStation())->second.push_back(make_pair(x, y));
1013 for (Int_t iHit = 0; iHit < fSiliconHits->GetEntriesFast(); iHit++) {
1014 BmnHit* hit = (
BmnHit*) fSiliconHits->UncheckedAt(iHit);
1015 Double_t x = hit->GetX();
1016 Double_t y = hit->GetY();
1017 Double_t z = hit->GetZ();
1018 hXzReco->Fill(z, x);
1019 hYzReco->Fill(z, y);
1021 silicons[1].find(hit->
GetStation())->second.push_back(make_pair(x, y));
1050 delete hGemXYProfiles;
1051 if (hSiliconXYProfiles)
1052 delete hSiliconXYProfiles;
1054 if (hProtonMomentaEmb)
1055 delete hProtonMomentaEmb;
1056 if (hPionMomentaEmb)
1057 delete hPionMomentaEmb;
1058 if (hProtonMomentaReco)
1059 delete hProtonMomentaReco;
1060 if (hPionMomentaReco)
1061 delete hPionMomentaReco;
1062 if (hProtonNhitsEmb)
1063 delete hProtonNhitsEmb;
1065 delete hPionNhitsEmb;
1066 if (hProtonNhitsReco)
1067 delete hProtonNhitsReco;
1069 delete hPionNhitsReco;
1082void BmnLambdaEmbeddingQa::DrawFoundTracks() {
1083 for (Int_t iGlobTrack = 0; iGlobTrack < fGlobTracks->GetEntriesFast(); iGlobTrack++) {
1091 Double_t zStart = first->GetZ();
1092 hXzRecoFromTracks->Fill(first->GetZ(), first->GetX());
1094 map <Int_t, Int_t> statMod0;
1095 if (zStart < geoms->GetGemGeometry()->GetStation(0)->GetZPosition()) {
1098 for (Int_t iHit = 0; iHit < silTrack->
GetNHits(); iHit++) {
1104 Double_t zFinish = last_par->GetZ();
1106 Int_t pdg = (first->GetQp() > 0.) ? 2212 : -211;
1111 if (statMod0.size() == 0)
1112 for (
auto it : fSilGemZ) {
1113 if (TMath::Abs(it.second - zStart) < 1.) {
1118 for (
auto it : statMod0) {
1124 for (Int_t iStep = idx + 1; iStep < 9; iStep++) {
1125 Double_t zStat = -1000.;
1127 for (
auto it : statMod0) {
1128 if (it.first != iStep)
1134 zStat = fSilGemZ.find(iStep)->second;
1136 if (zStat > zFinish)
1140 hXzRecoFromTracks->Fill(first->GetZ(), first->GetX());
1147void BmnLambdaEmbeddingQa::DrawHistos1() {
1148 gStyle->SetOptStat(0);
1149 TBox*** gemModBoxes =
nullptr;
1150 TBox**** gemLayBoxes =
nullptr;
1151 TPolyLine**** gemDeadZones =
nullptr;
1152 geoms->
GetGemBorders(gemModBoxes, gemLayBoxes, gemDeadZones);
1154 TBox*** siliconModBoxes =
nullptr;
1155 TBox**** siliconLayBoxes =
nullptr;
1156 TPolyLine**** siliconDeadZones =
nullptr;
1159 TCanvas* c =
new TCanvas(
"c1",
"c1", 1200, 1200);
1160 gStyle->SetTitleFontSize(0.1);
1161 gStyle->SetTitleY(1.015);
1163 TVirtualPad* pad = c->cd(1);
1167 hXzMC->SetMarkerColor(kRed);
1168 hXzMC->SetMarkerSize(1.5);
1169 hXzMC->SetMarkerStyle(20);
1170 if (hXzReco->GetEntries() > 0.) {
1171 hXzReco->Draw(
"sameP*");
1172 hXzReco->SetMarkerColor(kBlue);
1173 hXzReco->SetMarkerSize(1.);
1174 hXzReco->SetMarkerStyle(19);
1177 if (hXzRecoFromTracks && hXzRecoFromTracks->GetEntries() > 0.) {
1178 hXzRecoFromTracks->Draw(
"sameP*");
1179 hXzRecoFromTracks->SetMarkerColor(kBlack);
1180 hXzRecoFromTracks->SetMarkerSize(2.5);
1181 hXzRecoFromTracks->SetMarkerStyle(kOpenStar);
1186 hYzMC->SetMarkerColor(kRed);
1187 hYzMC->SetMarkerSize(1.5);
1188 hYzMC->SetMarkerStyle(20);
1189 if (hYzReco->GetEntries() > 0.) {
1190 hYzReco->Draw(
"sameP*");
1191 hYzReco->SetMarkerColor(kBlue);
1192 hYzReco->SetMarkerSize(1.);
1193 hYzReco->SetMarkerStyle(19);
1199 for (Int_t iStat = 0; iStat < geoms->
GetGemGeometry()->GetNStations(); iStat++) {
1202 hGemXYProfiles[iStat]->Draw();
1204 Int_t nHitsPerStat = gems[0].find(iStat)->second.size();
1205 for (Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1206 TMarker* marker =
new TMarker(gems[0].find(iStat)->second[iHit].first, gems[0].find(iStat)->second[iHit].second, 19);
1207 marker->SetMarkerColor(kRed);
1208 marker->SetMarkerSize(1.5);
1212 nHitsPerStat = gems[1].find(iStat)->second.size();
1213 for (Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1214 TMarker* marker =
new TMarker(gems[1].find(iStat)->second[iHit].first, gems[1].find(iStat)->second[iHit].second, 19);
1215 marker->SetMarkerColor(kBlue);
1216 marker->SetMarkerSize(.8);
1220 for (Int_t iMod = 0; iMod < geoms->
GetGemGeometry()->GetStation(iStat)->GetNModules(); iMod++) {
1221 gemModBoxes[iStat][iMod]->Draw(
"l");
1223 for (Int_t iLayer = 0; iLayer < geoms->
GetGemGeometry()->GetStation(iStat)->GetModule(iMod)->GetNStripLayers(); iLayer++) {
1224 gemLayBoxes[iStat][iMod][iLayer]->Draw(
"l");
1225 gemDeadZones[iStat][iMod][iLayer]->Draw(
"l");
1230 for (Int_t iStat = 0; iStat < geoms->
GetSiliconGeometry()->GetNStations(); iStat++) {
1233 hSiliconXYProfiles[iStat]->Draw();
1235 Int_t nHitsPerStat = silicons[0].find(iStat)->second.size();
1236 for (Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1237 TMarker* marker =
new TMarker(silicons[0].find(iStat)->second[iHit].first, silicons[0].find(iStat)->second[iHit].second, 19);
1238 marker->SetMarkerColor(kRed);
1239 marker->SetMarkerSize(1.5);
1243 nHitsPerStat = silicons[1].find(iStat)->second.size();
1244 for (Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1245 TMarker* marker =
new TMarker(silicons[1].find(iStat)->second[iHit].first, silicons[1].find(iStat)->second[iHit].second, 19);
1246 marker->SetMarkerColor(kBlue);
1247 marker->SetMarkerSize(.8);
1251 for (Int_t iMod = 0; iMod < geoms->
GetSiliconGeometry()->GetStation(iStat)->GetNModules(); iMod++) {
1252 siliconModBoxes[iStat][iMod]->Draw(
"l");
1254 for (Int_t iLayer = 0; iLayer < geoms->
GetSiliconGeometry()->GetStation(iStat)->GetModule(iMod)->GetNStripLayers(); iLayer++) {
1255 siliconLayBoxes[iStat][iMod][iLayer]->Draw(
"l");
1257 if (iStat == 2 && iMod == 7 && (iLayer == 0 || iLayer == 2))
1258 siliconDeadZones[iStat][iMod][iLayer]->Draw(
"l");
1262 c->SaveAs(
"tmp.pdf");
1273 const Int_t nZones = 2;
1275 hStripChannel =
new TH2F***[nZones];
1276 TBox**** boundBoxesStrips =
new TBox***[nZones];
1277 TBox**** boundBoxesChannels =
new TBox***[nZones];
1280 vector <Int_t> naturalGemOrder{11, 10, 5, 6, 8, 9};
1282 for (Int_t iZone = 0; iZone < nZones; iZone++) {
1284 boundBoxesStrips[iZone] =
new TBox**[nStats];
1285 boundBoxesChannels[iZone] =
new TBox**[nStats];
1286 hStripChannel[iZone] =
new TH2F**[nStats];
1288 for (Int_t iStat = 0; iStat < nStats; iStat++) {
1290 const Int_t nMaps = 2;
1291 hStripChannel[iZone][iStat] =
new TH2F*[nMaps];
1292 boundBoxesStrips[iZone][iStat] =
new TBox*[nMaps];
1293 boundBoxesChannels[iZone][iStat] =
new TBox*[nMaps];
1295 for (Int_t iMap = 0; iMap < nMaps; iMap++) {
1297 TString mapping = (iMap == 0) ?
"Left Part" :
"Right Part";
1299 hStripChannel[iZone][iStat][iMap] =
new TH2F(Form(
"Zone# %d Stat# %d Map# %d", iZone, iStat, iMap),
1300 Form(
"Stat# %d (GEM %d), %s", iStat, naturalGemOrder[iStat], mapping.Data()), 2060, 0., 2060., 1200, 0., 1200.);
1301 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetLabelSize(0.1);
1302 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetLabelSize(0.1);
1303 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetTitle(
"Channel#");
1304 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetTitleOffset(-.28);
1305 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetTitleSize(0.15);
1306 hStripChannel[iZone][iStat][iMap]->GetXaxis()->CenterTitle();
1308 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetTitle(
"Strip#");
1309 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetTitleOffset(-.15);
1310 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetTitleSize(0.15);
1311 hStripChannel[iZone][iStat][iMap]->GetYaxis()->CenterTitle();
1313 Int_t low = (iMap == 0) ? 985 : 1024;
1314 Int_t up = (iMap == 0) ? 1080 : 1129;
1316 boundBoxesStrips[iZone][iStat][iMap] =
new TBox(0., low, 2048., up);
1317 boundBoxesStrips[iZone][iStat][iMap]->SetFillColorAlpha(TColor::GetColor(
"#cccccc"), 0.3);
1318 boundBoxesStrips[iZone][iStat][iMap]->SetFillStyle(3001);
1320 boundBoxesChannels[iZone][iStat][iMap] =
new TBox(0., 0., 0., 1200.);
1321 boundBoxesChannels[iZone][iStat][iMap]->SetFillColorAlpha(TColor::GetColor(
"#cccccc"), 0.3);
1322 boundBoxesChannels[iZone][iStat][iMap]->SetFillStyle(3001);
1330 for (Int_t iInfo = 0; iInfo < map1->GetEntriesFast(); iInfo++) {
1334 TString mapping = info->
mapFile;
1337 Int_t str = info->
strip;
1339 Int_t mapIdx = (mapping.Contains(
"Left")) ? 0 : 1;
1341 hStripChannel[0][stat][mapIdx]->Fill(ch, str);
1345 for (Int_t iInfo = 0; iInfo < map2->GetEntriesFast(); iInfo++) {
1349 TString mapping = info->
mapFile;
1351 Int_t mapIdx = (mapping.Contains(
"Left")) ? 0 : 1;
1353 map <Int_t, Int_t> stripGlobChan = info->
stripChan;
1355 if ((stat == 0 || stat == 1) && mapIdx == 1)
1358 for (
auto it : stripGlobChan)
1359 hStripChannel[1][stat][mapIdx]->Fill(it.second, it.first);
1361 boundBoxesChannels[1][stat][mapIdx]->SetX1(info->
channels.first);
1362 boundBoxesChannels[1][stat][mapIdx]->SetX2(info->
channels.second);
1365 TCanvas* c =
new TCanvas(
"c1",
"c1", 1200, 800);
1368 gStyle->SetOptStat(0);
1369 gStyle->SetTitleFontSize(0.1);
1370 gStyle->SetTitleY(1.0);
1372 const Int_t nPads = 6;
1373 Int_t statsC[nPads] = {0, 0, 3, 3, 5, 5};
1374 Int_t statsD[nPads] = {1, 1, 2, 2, 4, 4};
1376 for (Int_t iPad = 1; iPad < nPads + 1; iPad++) {
1377 TVirtualPad* vPadC = c->cd(iPad);
1378 vPadC->Divide(1, 2, 0.01, 0.01);
1383 Int_t stat = (iPad % 2 == 1) ? statsC[iPad - 1] : statsD[iPad - 1];
1385 hStripChannel[0][stat][mapping]->Draw(
"");
1386 hStripChannel[1][stat][mapping]->Draw(
"same");
1387 boundBoxesStrips[1][stat][mapping]->Draw(
"l");
1388 boundBoxesChannels[1][stat][mapping]->Draw(
"l");
1393 hStripChannel[0][stat][mapping]->Draw(
"");
1394 hStripChannel[1][stat][mapping]->Draw(
"same");
1395 boundBoxesStrips[1][stat][mapping]->Draw(
"l");
1396 boundBoxesChannels[1][stat][mapping]->Draw(
"l");
1399 c->SaveAs(
"strChan.pdf");
vector< Double_t > dist(vector< Double_t > qp, Double_t mu)
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
void SetScale(Double_t factor)
Bool_t IsPointInsideStripLayer(Double_t x, Double_t y)
ElectronDriftDirectionInModule GetElectronDriftDirection()
Int_t GetSilTrackIndex() const
Short_t GetStation() const
BmnGemStripStationSet * GetGemGeometry()
void GetGemBorders(TBox ***&mods, TBox ****&layers, TPolyLine ****&deadZones)
BmnSiliconStationSet * GetSiliconGeometry()
void GetSiliconBorders(TBox ***&mods, TBox ****&layers, TPolyLine ****&deadZones)
BmnStatus TGeoTrackPropagate(FairTrackParam *par, Double_t zOut, Int_t pdg, vector< Double_t > *F, Double_t *length, Bool_t isField)
void SetActive(Int_t currentAnal)
TH2F ** GetNHitsEmbReco()
TProfile2D ** GetSilHitEff2D()
TH1F ***** GetSiliconStripInfo()
TProfile2D ** GetGemHitEff2D()
TProfile2D * GetSilHitEff()
TH1F ***** GetGemStripInfo()
TProfile2D ** GetGemHitEff()
void IsEmbedded(Bool_t flag)
TVector3 GetStoreVertexEvent()
virtual ~BmnLambdaEmbeddingQa()
void DoInnerTrackerRecoEfficiency()
void DrawHistos6(TClonesArray *, TClonesArray *)
void DoDrawEventsWithEmbeddedSignals()
Double_t GetZPositionRegistered()
BmnSiliconStation * GetStation(Int_t station_num)
BmnSiliconModule * GetModule(Int_t module_num)
Double_t GetStripSignal()
FairTrackParam * GetParamFirst()
Int_t GetHitIndex(Int_t iHit) const
FairTrackParam * GetParamLast()
pair< Int_t, Int_t > channels
map< Int_t, Int_t > stripChan
static UniRun * GetRun(int period_number, int run_number)
get run from the database
static int ReadGeometryFile(int period_number, int run_number, char *geo_file_path, bool usePrevGeometryIfMissing=false)
double * GetFieldVoltage()
get field voltage of the current run