178 if (!str.Contains(
"lambda"))
202 const Int_t nCutBins = 4;
203 Double_t cutsNHitsFrac[nCutBins] = {0., 0.2, 0.4, 0.5};
204 Int_t nRecProtons[nCutBins];
205 Int_t nRecPions[nCutBins];
207 for (
Int_t iBin = 0; iBin < nCutBins; iBin++) {
208 nRecProtons[iBin] = 0;
212 Int_t nEmbeddedProtons = 0;
213 Int_t nEmbeddedPions = 0;
220 if (iEmb % 1000 == 0)
221 cout <<
"Event# " << iEmb << endl;
223 if (!
fMon->IsEmbedded())
229 UInt_t idEmb =
fMon->GetEventId();
231 for (UInt_t iDst = idEmb - 1; iDst < idEmb + 1; iDst++) {
235 if (
hDst->GetEventId() != idEmb)
241 Int_t store =
fMon->GetStoreVertexEvent()[0];
242 Int_t vertex =
fMon->GetStoreVertexEvent()[1];
243 Int_t event =
fMon->GetStoreVertexEvent()[2];
247 lambda->
Add(
Form(
"%s/lambda%d_vertex%d.root",
fPath[iInput].Data(), store, vertex));
254 map<Int_t, vector<CbmStsPoint>> gemsMc;
255 for (
Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
256 vector<CbmStsPoint> tmp;
260 map<Int_t, vector<BmnSiliconPoint>> siliconsMc;
261 for (
Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
262 vector<BmnSiliconPoint> tmp;
263 siliconsMc[iStat] = tmp;
267 for (
Int_t iPoint = 0; iPoint <
fGemPoints->GetEntriesFast(); iPoint++) {
270 gemsMc.find(point->
GetStation())->second.push_back(*point);
277 siliconsMc.find(point->
GetStation())->second.push_back(*point);
280 map<Int_t, vector<BmnHit>> gemsReco;
281 map<Int_t, vector<BmnHit>> siliconsReco;
283 for (
Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
285 gemsReco[iStat] = tmp;
288 for (
Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
290 siliconsReco[iStat] = tmp;
295 for (
Int_t iHit = 0; iHit <
fGemHits->GetEntriesFast(); iHit++) {
298 gemsReco.find(hit->
GetStation())->second.push_back(*hit);
306 siliconsReco.find(hit->
GetStation())->second.push_back(*hit);
311 for (
auto mc : siliconsMc)
312 for (
auto reco : siliconsReco) {
315 if (mc.first != reco.first)
318 vector<BmnSiliconPoint> points = mc.second;
319 vector<BmnHit> hits = reco.second;
321 for (
auto mcPoint : points) {
324 vector<Double_t> distances;
326 if (hits.size() != 0)
327 for (
auto recoHit : hits) {
332 distances.push_back(Abs(xMC - xReco));
335 if (distances.size() != 0) {
336 Double_t min = *min_element(distances.begin(), distances.end());
341 pEmbSilHitEff->
Fill(mcPoint.GetStation(), mcPoint.GetModule(), isEmbedded ? 1. : 0.);
342 pEffSilStatXY[mcPoint.GetStation()]->
Fill(mcPoint.GetX(), mcPoint.GetY(),
343 isEmbedded ? 1. : 0.);
348 for (
auto mc : gemsMc)
349 for (
auto reco : gemsReco) {
352 if (mc.first != reco.first)
355 vector<CbmStsPoint> points = mc.second;
356 vector<BmnHit> hits = reco.second;
358 if (hits.size() == 0)
361 for (
auto mcPoint : points) {
366 GEM->GetStation(mcPoint.GetStation())->GetModule(mcPoint.GetModule());
369 driftCenterShift = 0.15;
371 driftCenterShift = 0.75;
373 vector<Double_t> distances;
375 if (hits.size() != 0)
376 for (
auto recoHit : hits) {
377 Double_t xMC = mcPoint.GetX(mcPoint.GetZ() + driftCenterShift);
381 distances.push_back(Abs(xMC - xReco));
384 if (distances.size() != 0) {
385 Double_t min = *min_element(distances.begin(), distances.end());
391 const Int_t nLayers = 4;
397 for (
Int_t iLayer = 0; iLayer <
GEM->GetStation(mcPoint.GetStation())
398 ->GetModule(mcPoint.GetModule())
403 ->GetModule(mcPoint.GetModule())
404 ->GetStripLayer(iLayer);
406 (-1.) * mcPoint.GetX(mcPoint.GetZ() + driftCenterShift),
407 mcPoint.GetY(mcPoint.GetZ() + driftCenterShift));
410 if (isLayerActive[0] && isLayerActive[1])
412 else if (isLayerActive[2] && isLayerActive[3])
415 pEffGemStatXY[mcPoint.GetStation()]->
Fill(
416 mcPoint.GetX(mcPoint.GetZ() + driftCenterShift),
417 mcPoint.GetY(mcPoint.GetZ() + driftCenterShift), isEmbedded ? 1. : 0.);
419 Int_t idx = isBigZone ? 1 : isHotZone ? 0 : -1;
422 pEmbGemHitEff[idx]->
Fill(mcPoint.GetStation(), mcPoint.GetModule(),
423 isEmbedded ? 1. : 0.);
429 vector<BmnGlobalTrack*> protonCands;
430 vector<BmnGlobalTrack*> pionCands;
432 for (
Int_t iGlobTrack = 0; iGlobTrack <
fGlobTracks->GetEntriesFast(); iGlobTrack++) {
436 protonCands.push_back(glTrack);
438 pionCands.push_back(glTrack);
446 hNhitsEmbReco[proton]->
Fill(cand->GetNHits(),
fMon->GetNHitsProton());
456 hNhitsEmbReco[pion]->
Fill(cand->GetNHits(),
fMon->GetNHitsPion());
462 for (
Int_t iCut = 0; iCut < nCutBins; iCut++) {
488 for (
Int_t iCut = 0; iCut < nCutBins; iCut++) {
489 hEtaLambda[proton][iCut]->
SetBinContent(hEtaLambda[proton][iCut]->FindBin(.5 * (etaMax + etaMin)),
490 1. * nRecProtons[iCut] / nEmbeddedProtons);
491 hEtaLambda[pion][iCut]->
SetBinContent(hEtaLambda[pion][iCut]->FindBin(.5 * (etaMax + etaMin)),
492 1. * nRecPions[iCut] / nEmbeddedPions);
495 cout <<
"Events with embedded particles# " << counter << endl;
668 const Int_t nHitsCut = 4;
672 Form(
"effProton vs. p, nHits > %d, Delta p / p < %G", nHitsCut, deltaPtoP), 100, 1., 7.);
673 pEffPion =
new TProfile(
"effPion vs. p",
Form(
"effPion vs. p, nHits > %d, Delta p / p < %G", nHitsCut, deltaPtoP),
693 if (iEmb % 1000 == 0)
694 cout <<
"Event# " << iEmb << endl;
696 if (!
fMon->IsEmbedded())
699 UInt_t idEmb =
fMon->GetEventId();
701 for (UInt_t iDst = idEmb - 1; iDst < idEmb + 1; iDst++) {
705 if (
hDst->GetEventId() != idEmb)
709 Int_t store =
fMon->GetStoreVertexEvent()[0];
710 Int_t vertex =
fMon->GetStoreVertexEvent()[1];
711 Int_t event =
fMon->GetStoreVertexEvent()[2];
715 lambda->
Add(
Form(
"%s/lambda%d_vertex%d.root",
fPath[iInput].Data(), store, vertex));
724 Int_t nRecoHitsProton[2] = {0, 0};
725 Int_t nRecoHitsPion[2] = {0, 0};
728 for (
Int_t iPoint = 0; iPoint <
fGemPoints->GetEntriesFast(); iPoint++) {
734 for (
Int_t iHit = 0; iHit <
fGemHits->GetEntriesFast(); iHit++) {
756 nRecoHitsProton[0]++;
790 nRecoHitsProton[1]++;
805 for (
Int_t iGlobTrack = 0; iGlobTrack <
fGlobTracks->GetEntriesFast(); iGlobTrack++) {
821 if (p > 0. && Abs((p -
fMon->GetProtonP()) / p) < deltaPtoP && nHits > nHitsCut)
824 if (p < 0. && Abs((-p -
fMon->GetPionP()) / -p) < deltaPtoP && nHits > nHitsCut)
825 pEffPion->Fill(-p, (1. * nHits) /
fMon->GetNHitsPion());
841 cout <<
"*****************************************************" << endl;
842 cout <<
"*.list file contains more than one line! Exiting ...." << endl;
843 cout <<
"*****************************************************" << endl;
850 TBox*** gemModBoxes =
nullptr;
851 TBox**** gemLayBoxes =
nullptr;
853 geoms->GetGemBorders(gemModBoxes, gemLayBoxes, gemDeadZones);
855 TBox*** siliconModBoxes =
nullptr;
856 TBox**** siliconLayBoxes =
nullptr;
857 TPolyLine**** siliconDeadZones =
nullptr;
858 geoms->GetSiliconBorders(siliconModBoxes, siliconLayBoxes, siliconDeadZones);
873 hXzMC =
new TH2F(
"",
"", 500, 0., 200., 500, -80., 20.);
874 hXzReco =
new TH2F(
"",
"", 500, 0., 200., 500, -80., 20.);
875 hYzMC =
new TH2F(
"",
"", 500, 0., 0., 500, 0., 0.);
876 hYzReco =
new TH2F(
"",
"", 500, 0., 0., 500, 0., 0.);
879 for (
Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
881 500, -90., +90., 500, -10., +40.);
888 for (
Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
889 Double_t xLow = (iStat == 0) ? -8. : (iStat == 1) ? -8. : -13.;
892 Double_t yLow = (iStat == 0) ? -12. : (iStat == 1) ? -13. : -20.;
893 Double_t yUp = (iStat == 0) ? +3. : (iStat == 1) ? +4. : +10.;
896 Form(
"SILICON: X vs. Y, stat# %d", iStat), 500, xLow, xUp, 500, yLow, yUp);
911 cout <<
"Geometry '" << setupTag <<
"' can't be loaded from the Geometry Database" << endl;
926 for (
Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++)
929 for (
Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++)
930 fSilGemZ[3 + iStat] =
GEM->GetStation(iStat)->GetZPosition();
945 UInt_t idDst =
hDst->GetEventId();
950 UInt_t idEmb =
fMon->GetEventId();
957 if (!
fMon->IsEmbedded())
960 hXzMC->SetTitle(
Form(
" XZ SI-GEM profile, id = %d",
id));
961 hXzReco->SetTitle(
Form(
"XZ SI-GEM profile, id = %d",
id));
962 hYzMC->SetTitle(
Form(
" YZ SI-GEM profile, id = %d",
id));
963 hYzReco->SetTitle(
Form(
"YZ SI-GEM profile, id = %d",
id));
969 Int_t store =
fMon->GetStoreVertexEvent()[0];
970 Int_t vertex =
fMon->GetStoreVertexEvent()[1];
971 Int_t event =
fMon->GetStoreVertexEvent()[2];
974 lambda->
Add(
Form(
"%s/lambda%d_vertex%d.root",
fPath[0].Data(), store, vertex));
981 for (
Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
982 vector<pair<Double_t, Double_t>> tmp;
983 gems[0][iStat] = tmp;
986 for (
Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
987 vector<pair<Double_t, Double_t>> tmp;
992 for (
Int_t iPoint = 0; iPoint <
fGemPoints->GetEntriesFast(); iPoint++) {
1000 gems[0].find(point->
GetStation())->second.push_back(make_pair(x, y));
1015 for (
Int_t iStat = 0; iStat <
GEM->GetNStations(); iStat++) {
1016 vector<pair<Double_t, Double_t>> tmp;
1017 gems[1][iStat] = tmp;
1020 for (
Int_t iStat = 0; iStat <
SILICON->GetNStations(); iStat++) {
1021 vector<pair<Double_t, Double_t>> tmp;
1027 for (
Int_t iHit = 0; iHit <
fGemHits->GetEntriesFast(); iHit++) {
1036 gems[1].find(hit->
GetStation())->second.push_back(make_pair(x, y));
1113 for (
Int_t iGlobTrack = 0; iGlobTrack <
fGlobTracks->GetEntriesFast(); iGlobTrack++) {
1124 map<Int_t, Int_t> statMod0;
1125 if (zStart < geoms->GetGemGeometry()->GetStation(0)->GetZPosition()) {
1134 Double_t zFinish = last_par->GetZ();
1136 Int_t pdg = (first->GetQp() > 0.) ? 2212 : -211;
1141 if (statMod0.size() == 0)
1149 for (
auto it : statMod0) {
1155 for (
Int_t iStep = idx + 1; iStep < 9; iStep++) {
1158 for (
auto it : statMod0) {
1159 if (it.first != iStep)
1162 zStat =
geoms->GetSiliconGeometry()
1163 ->GetStation(it.first)
1164 ->GetModule(it.second)
1165 ->GetZPositionRegistered();
1168 zStat =
fSilGemZ.find(iStep)->second;
1170 if (zStat > zFinish)
1184 TBox*** gemModBoxes =
nullptr;
1185 TBox**** gemLayBoxes =
nullptr;
1187 geoms->GetGemBorders(gemModBoxes, gemLayBoxes, gemDeadZones);
1189 TBox*** siliconModBoxes =
nullptr;
1190 TBox**** siliconLayBoxes =
nullptr;
1191 TPolyLine**** siliconDeadZones =
nullptr;
1192 geoms->GetSiliconBorders(siliconModBoxes, siliconLayBoxes, siliconDeadZones);
1195 gStyle->SetTitleFontSize(0.1);
1196 gStyle->SetTitleY(1.015);
1203 hXzMC->SetMarkerSize(1.5);
1204 hXzMC->SetMarkerStyle(20);
1205 if (
hXzReco->GetEntries() > 0.) {
1222 hYzMC->SetMarkerSize(1.5);
1223 hYzMC->SetMarkerStyle(20);
1224 if (
hYzReco->GetEntries() > 0.) {
1234 for (
Int_t iStat = 0; iStat <
geoms->GetGemGeometry()->GetNStations(); iStat++) {
1239 Int_t nHitsPerStat =
gems[0].find(iStat)->second.size();
1240 for (
Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1242 new TMarker(
gems[0].find(iStat)->second[iHit].first,
gems[0].find(iStat)->second[iHit].second, 19);
1248 nHitsPerStat =
gems[1].find(iStat)->second.size();
1249 for (
Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1251 new TMarker(
gems[1].find(iStat)->second[iHit].first,
gems[1].find(iStat)->second[iHit].second, 19);
1257 for (
Int_t iMod = 0; iMod <
geoms->GetGemGeometry()->GetStation(iStat)->GetNModules(); iMod++) {
1258 gemModBoxes[iStat][iMod]->
Draw(
"l");
1260 for (
Int_t iLayer = 0;
1261 iLayer <
geoms->GetGemGeometry()->GetStation(iStat)->GetModule(iMod)->GetNStripLayers(); iLayer++)
1263 gemLayBoxes[iStat][iMod][iLayer]->
Draw(
"l");
1264 gemDeadZones[iStat][iMod][iLayer]->
Draw(
"l");
1269 for (
Int_t iStat = 0; iStat <
geoms->GetSiliconGeometry()->GetNStations(); iStat++) {
1270 pad->
cd(iStat +
geoms->GetGemGeometry()->GetNStations() + 1);
1274 Int_t nHitsPerStat =
silicons[0].find(iStat)->second.size();
1275 for (
Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1277 silicons[0].find(iStat)->second[iHit].second, 19);
1283 nHitsPerStat =
silicons[1].find(iStat)->second.size();
1284 for (
Int_t iHit = 0; iHit < nHitsPerStat; iHit++) {
1286 silicons[1].find(iStat)->second[iHit].second, 19);
1292 for (
Int_t iMod = 0; iMod <
geoms->GetSiliconGeometry()->GetStation(iStat)->GetNModules(); iMod++) {
1293 siliconModBoxes[iStat][iMod]->
Draw(
"l");
1295 for (
Int_t iLayer = 0;
1296 iLayer <
geoms->GetSiliconGeometry()->GetStation(iStat)->GetModule(iMod)->GetNStripLayers(); iLayer++)
1298 siliconLayBoxes[iStat][iMod][iLayer]->
Draw(
"l");
1300 if (iStat == 2 && iMod == 7 && (iLayer == 0 || iLayer == 2))
1301 siliconDeadZones[iStat][iMod][iLayer]->
Draw(
"l");
1317 const Int_t nZones = 2;
1320 TBox**** boundBoxesStrips =
new TBox***[nZones];
1321 TBox**** boundBoxesChannels =
new TBox***[nZones];
1324 vector<Int_t> naturalGemOrder{11, 10, 5, 6, 8, 9};
1326 for (
Int_t iZone = 0; iZone < nZones; iZone++) {
1327 const Int_t nStats =
geoms->GetGemGeometry()->GetNStations();
1328 boundBoxesStrips[iZone] =
new TBox**[nStats];
1329 boundBoxesChannels[iZone] =
new TBox**[nStats];
1332 for (
Int_t iStat = 0; iStat < nStats; iStat++) {
1334 const Int_t nMaps = 2;
1336 boundBoxesStrips[iZone][iStat] =
new TBox*[nMaps];
1337 boundBoxesChannels[iZone][iStat] =
new TBox*[nMaps];
1339 for (
Int_t iMap = 0; iMap < nMaps; iMap++) {
1341 TString mapping = (iMap == 0) ?
"Left Part" :
"Right Part";
1344 new TH2F(
Form(
"Zone# %d Stat# %d Map# %d", iZone, iStat, iMap),
1345 Form(
"Stat# %d (GEM %d), %s", iStat, naturalGemOrder[iStat], mapping.
Data()), 2060, 0.,
1346 2060., 1200, 0., 1200.);
1347 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetLabelSize(0.1);
1348 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetLabelSize(0.1);
1349 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetTitle(
"Channel#");
1350 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetTitleOffset(-.28);
1351 hStripChannel[iZone][iStat][iMap]->GetXaxis()->SetTitleSize(0.15);
1352 hStripChannel[iZone][iStat][iMap]->GetXaxis()->CenterTitle();
1354 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetTitle(
"Strip#");
1355 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetTitleOffset(-.15);
1356 hStripChannel[iZone][iStat][iMap]->GetYaxis()->SetTitleSize(0.15);
1357 hStripChannel[iZone][iStat][iMap]->GetYaxis()->CenterTitle();
1359 Int_t low = (iMap == 0) ? 985 : 1024;
1360 Int_t up = (iMap == 0) ? 1080 : 1129;
1362 boundBoxesStrips[iZone][iStat][iMap] =
new TBox(0., low, 2048., up);
1364 boundBoxesStrips[iZone][iStat][iMap]->
SetFillStyle(3001);
1366 boundBoxesChannels[iZone][iStat][iMap] =
new TBox(0., 0., 0., 1200.);
1368 boundBoxesChannels[iZone][iStat][iMap]->
SetFillStyle(3001);
1399 map<Int_t, Int_t> stripGlobChan = info->
stripChan;
1401 if ((stat == 0 || stat == 1) && mapIdx == 1)
1404 for (
auto it : stripGlobChan)
1407 boundBoxesChannels[1][stat][mapIdx]->
SetX1(info->
channels.first);
1408 boundBoxesChannels[1][stat][mapIdx]->
SetX2(info->
channels.second);
1415 gStyle->SetTitleFontSize(0.1);
1418 const Int_t nPads = 6;
1419 Int_t statsC[nPads] = {0, 0, 3, 3, 5, 5};
1420 Int_t statsD[nPads] = {1, 1, 2, 2, 4, 4};
1422 for (
Int_t iPad = 1; iPad < nPads + 1; iPad++) {
1424 vPadC->
Divide(1, 2, 0.01, 0.01);
1429 Int_t stat = (iPad % 2 == 1) ? statsC[iPad - 1] : statsD[iPad - 1];
1433 boundBoxesStrips[1][stat][mapping]->
Draw(
"l");
1434 boundBoxesChannels[1][stat][mapping]->
Draw(
"l");
1441 boundBoxesStrips[1][stat][mapping]->
Draw(
"l");
1442 boundBoxesChannels[1][stat][mapping]->
Draw(
"l");
1445 c->
SaveAs(
"strChan.pdf");