15 #include "FairLogger.h"
17 #include "TClonesArray.h"
18 #include "TDatabasePDG.h"
20 #include "TGeoBoolNode.h"
21 #include "TGeoCompositeShape.h"
23 #include "TParticlePDG.h"
52 {
"jpsi", 443, 3.0,
true},
53 {
"omega", 223, 1.5,
true},
58 , fMuchMCPoints(nullptr)
59 , fMuchPixelHits(nullptr)
60 , fMuchClusters(nullptr)
61 , fMuchPixelDigiMatches(nullptr)
63 , fTrdMCPoints(nullptr)
65 , fTrdClusters(nullptr)
66 , fTrdDigiMatches(nullptr)
82 , fSignalParticle(
"jpsi")
88 nof_timebins(isEvByEv ? 5 : 1000)
91 last_timebin(nof_timebins - 1)
98 , fStsClusters(nullptr)
99 , fStsDigiMatches(nullptr)
107 gGeoManager->cd(
"/cave_1");
108 TObjArray* children = gGeoManager->GetCurrentNode()->GetNodes();
111 TObject* child = children->First();
114 TString name(
static_cast<TGeoNode*
>(child)->GetName());
116 if (name.Contains(
"trd", TString::kIgnoreCase))
return true;
118 child = children->After(child);
126 FindGeoChild(TGeoNode* node,
const char* name, list<TGeoNode*>& results) {
127 Int_t nofChildren = node->GetNdaughters();
129 for (Int_t
i = 0;
i < nofChildren; ++
i) {
130 TGeoNode* child = node->GetDaughter(
i);
131 TString childName(child->GetName());
133 if (childName.Contains(name, TString::kIgnoreCase))
134 results.push_back(child);
139 Double_t localCoords[3] = {0., 0., 0.};
140 Double_t globalCoords[3];
141 TGeoNavigator* pNavigator = gGeoManager->GetCurrentNavigator();
142 gGeoManager->cd(
"/cave_1");
143 list<TGeoNode*> detectors;
144 FindGeoChild(gGeoManager->GetCurrentNode(),
"much", detectors);
146 for (list<TGeoNode*>::iterator
i = detectors.begin();
i != detectors.end();
148 TGeoNode* detector = *
i;
149 pNavigator->CdDown(detector);
150 list<TGeoNode*> stations;
152 int stationNumber = 0;
154 for (list<TGeoNode*>::iterator j = stations.begin(); j != stations.end();
156 TGeoNode* station = *j;
157 pNavigator->CdDown(station);
158 list<TGeoNode*> layers;
162 for (list<TGeoNode*>::iterator k = layers.begin(); k != layers.end();
164 TGeoNode* layer = *k;
165 pNavigator->CdDown(layer);
166 gGeoManager->LocalToMaster(localCoords, globalCoords);
168 if (1 == layerNumber) {
180 fDetector->fLayers[stationNumber * 3 + layerNumber].z = globalCoords[2];
181 fDetector->fLayers[stationNumber * 3 + layerNumber].minX = 0;
182 fDetector->fLayers[stationNumber * 3 + layerNumber].maxX = 0;
183 fDetector->fLayers[stationNumber * 3 + layerNumber].binSizeX = 0;
184 fDetector->fLayers[stationNumber * 3 + layerNumber].minY = 0;
185 fDetector->fLayers[stationNumber * 3 + layerNumber].maxY = 0;
186 fDetector->fLayers[stationNumber * 3 + layerNumber].binSizeY = 0;
189 list<TGeoNode*> actives;
192 for (list<TGeoNode*>::iterator l = actives.begin(); l != actives.end();
194 TGeoNode* active = *l;
195 pNavigator->CdDown(active);
196 TGeoCompositeShape* cs =
197 dynamic_cast<TGeoCompositeShape*
>(active->GetVolume()->GetShape());
198 TGeoBoolNode* bn = cs->GetBoolNode();
199 TGeoTrap* trap =
dynamic_cast<TGeoTrap*
>(bn->GetLeftShape());
202 Double_t* xy = trap->GetVertices();
204 for (
int m = 0;
m < 4; ++
m) {
205 Double_t localActiveCoords[3] = {xy[2 *
m], xy[2 *
m + 1], 0.};
206 Double_t globalActiveCoords[3];
207 gGeoManager->LocalToMaster(localActiveCoords, globalActiveCoords);
210 if (fDetector->fLayers[stationNumber * 3 + layerNumber].minY
211 > globalActiveCoords[1])
212 fDetector->fLayers[stationNumber * 3 + layerNumber].minY =
213 globalActiveCoords[1];
215 if (fDetector->fLayers[stationNumber * 3 + layerNumber].maxY
216 < globalActiveCoords[1])
217 fDetector->fLayers[stationNumber * 3 + layerNumber].maxY =
218 globalActiveCoords[1];
220 if (fDetector->fLayers[stationNumber * 3 + layerNumber].minX
221 > globalActiveCoords[0])
222 fDetector->fLayers[stationNumber * 3 + layerNumber].minX =
223 globalActiveCoords[0];
225 if (fDetector->fLayers[stationNumber * 3 + layerNumber].maxX
226 < globalActiveCoords[0])
227 fDetector->fLayers[stationNumber * 3 + layerNumber].maxX =
228 globalActiveCoords[0];
231 if (1 == layerNumber) {
233 > globalActiveCoords[1])
237 < globalActiveCoords[1])
241 > globalActiveCoords[0])
245 < globalActiveCoords[0])
262 int nofStations = stationNumber;
264 list<TGeoNode*> absorbers;
266 int absorberNumber = 0;
268 for (list<TGeoNode*>::iterator j = absorbers.begin(); j != absorbers.end();
270 TGeoNode* absorber = *j;
271 pNavigator->CdDown(absorber);
272 TGeoVolume* absVol = gGeoManager->GetCurrentVolume();
273 const TGeoBBox* absShape =
274 static_cast<const TGeoBBox*
>(absVol->GetShape());
276 if (absorberNumber < nofStations) {
277 gGeoManager->LocalToMaster(localCoords, globalCoords);
279 globalCoords[2] - absShape->GetDZ();
281 2 * absShape->GetDZ();
283 absVol->GetMaterial()->GetRadLen();
285 absVol->GetMaterial()->GetDensity();
287 absVol->GetMaterial()->GetZ();
289 absVol->GetMaterial()->GetA();
293 absVol->GetMaterial()->GetRadLen();
313 FindGeoChild(gGeoManager->GetCurrentNode(),
"trd", detectors);
315 for (list<TGeoNode*>::iterator
i = detectors.begin();
i != detectors.end();
317 TGeoNode* detector = *
i;
318 pNavigator->CdDown(detector);
319 list<TGeoNode*> layers;
323 for (list<TGeoNode*>::iterator j = layers.begin(); j != layers.end(); ++j) {
324 TGeoNode* layer = *j;
325 pNavigator->CdDown(layer);
326 list<TGeoNode*> modules;
329 for (list<TGeoNode*>::iterator k = modules.begin(); k != modules.end();
331 TGeoNode* module = *k;
332 pNavigator->CdDown(module);
333 list<TGeoNode*> padCoppers;
336 for (list<TGeoNode*>::iterator l = padCoppers.begin();
337 l != padCoppers.end();
339 TGeoNode* padCopper = *l;
340 pNavigator->CdDown(padCopper);
342 static_cast<TGeoBBox*
>(padCopper->GetVolume()->GetShape());
344 gGeoManager->LocalToMaster(localCoords, globalCoords);
412 FairRootManager* ioman = FairRootManager::Instance();
414 if (0 == ioman) LOG(fatal) <<
"No FairRootManager";
416 Int_t nofEventsInFile = ioman->CheckMaxEventNo();
422 gMuonMass = TDatabasePDG::Instance()->GetParticle(13)->Mass();
423 gElectronMass = TDatabasePDG::Instance()->GetParticle(11)->Mass();
426 gRandom->SetSeed(time(&initTime));
431 pair<int, int> stSpatLimits[] = {
432 {20, 20}, {20, 20}, {20, 20}, {20, 20}, {20, 20}, {20, 20}};
451 fStsHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsHit"));
452 fStsTracks =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsTrack"));
453 fStsClusters =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsCluster"));
455 static_cast<TClonesArray*
>(ioman->GetObject(
"StsDigiMatch"));
457 fDetector->fMuchTracks =
new TClonesArray(
"CbmMuchTrack", 100);
458 ioman->Register(
"MuchTrack",
460 fDetector->fMuchTracks,
461 IsOutputBranchPersistent(
"MuchTrack"));
462 fDetector->fGlobalTracks =
new TClonesArray(
"CbmGlobalTrack", 100);
463 ioman->Register(
"GlobalTrack",
465 fDetector->fGlobalTracks,
466 IsOutputBranchPersistent(
"GlobalTrack"));
476 fMuchPixelHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"MuchPixelHit"));
477 fTrdHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"TrdHit"));
483 fMuchClusters =
static_cast<TClonesArray*
>(ioman->GetObject(
"MuchCluster"));
485 static_cast<TClonesArray*
>(ioman->GetObject(
"MuchDigiMatch"));
487 fTrdClusters =
static_cast<TClonesArray*
>(ioman->GetObject(
"TrdCluster"));
489 static_cast<TClonesArray*
>(ioman->GetObject(
"TrdDigiMatch"));
490 fMvdDigis =
static_cast<TClonesArray*
>(ioman->GetObject(
"MvdDigi"));
491 fStsDigis =
static_cast<TClonesArray*
>(ioman->GetObject(
"StsDigi"));
492 fTofDigis =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofDigi"));
495 TH1F* jpsiPHisto =
new TH1F(
"jpsiPHisto",
"jpsiPHisto", 90, 0., 30.);
496 TH1F* jpsiMHisto =
new TH1F(
"jpsiMHisto",
"jpsiMHisto", 200, 3., 3.2);
497 TH1F* jpsiEHisto =
new TH1F(
"jpsiEHisto",
"jpsiEHisto", 90, 0., 30.);
498 TH1F* signalMHisto =
new TH1F(
"signalMHisto",
"signalMHisto", 600, 0., 6.0);
502 fMCTracks.push_back(vector<TrackDataHolder>());
504 if (0 >= evSize)
continue;
506 vector<TrackDataHolder>& evTracks =
fMCTracks.back();
510 for (
int j = 0; j < evSize; ++j) {
516 Double_t p = mcTrack->
GetP();
537 evTracks.back().isSignalShort =
true;
538 evTracks.back().isSignalLong =
true;
539 evTracks.back().isPos = mcTrack->
GetPdgCode() == -13;
550 if (0 != posTrack && 0 != negTrack) {
552 Double_t E12Sq = E12 * E12;
553 Double_t P12Sq = (posTrack->
GetPx() + negTrack->
GetPx())
559 Double_t
m =
sqrt(E12Sq - P12Sq);
560 signalMHisto->Fill(
m);
565 TFile* curFile = TFile::CurrentFile();
566 TString histoName =
"jpsiMHisto.root";
568 TFile fh(histoName.Data(),
"RECREATE");
573 TFile::CurrentFile() = curFile;
577 TFile* curFile = TFile::CurrentFile();
578 TString histoName =
"jpsiPHisto.root";
580 TFile fh(histoName.Data(),
"RECREATE");
585 TFile::CurrentFile() = curFile;
589 TFile* curFile = TFile::CurrentFile();
590 TString histoName =
"jpsiEHisto.root";
592 TFile fh(histoName.Data(),
"RECREATE");
597 TFile::CurrentFile() = curFile;
601 TFile* curFile = TFile::CurrentFile();
602 TString histoName =
"signalMHisto.root";
604 TFile fh(histoName.Data(),
"RECREATE");
605 signalMHisto->Write();
609 TFile::CurrentFile() = curFile;
612 TH2F* trdHisto =
new TH2F(
"TRD",
"TRD", 500, -50., 1000., 500, 0., 600.);
614 new TH2F(
"TRD_XY",
"TRD_XY", 400, -400., 400., 300, -300., 300.);
636 if (0 >= evSize)
continue;
639 vector<PointDataHolder>& evPoints =
fMuchPoints.back();
641 for (
int j = 0; j < evSize; ++j) {
655 muchPt.
trackId = pMuchPt->GetTrackID();
660 evPoints.push_back(muchPt);
668 fTrdPoints.push_back(vector<PointDataHolder>());
670 if (0 >= evSize)
continue;
672 set<Int_t> trdTracks;
673 vector<PointDataHolder>& evPoints =
fTrdPoints.back();
675 for (
int j = 0; j < evSize; ++j) {
678 Int_t trackId = pTrdPt->GetTrackID();
679 trdTracks.insert(trackId);
693 trdPt.
trackId = pTrdPt->GetTrackID();
696 evPoints.push_back(trdPt);
698 trdHistoXY->Fill(trdPt.
x, trdPt.
y);
701 for (set<Int_t>::const_iterator j = trdTracks.begin();
702 j != trdTracks.end();
710 trdHisto->Fill(startZ, startR);
715 for (vector<vector<PointDataHolder>>::iterator
i =
fMuchPoints.begin();
718 vector<PointDataHolder>& evPoints = *
i;
720 for (vector<PointDataHolder>::iterator j = evPoints.begin();
732 for (vector<vector<PointDataHolder>>::iterator
i =
fTrdPoints.begin();
735 vector<PointDataHolder>& evPoints = *
i;
737 for (vector<PointDataHolder>::iterator j = evPoints.begin();
747 TH1F* trd2XHisto =
new TH1F(
"trd2XHisto",
"trd2XHisto", 100, -2.5, 2.5);
748 TH1F* trd2YHisto =
new TH1F(
"trd2YHisto",
"trd2YHisto", 100, -2.5, 2.5);
749 TH1F* trd3XHisto =
new TH1F(
"trd3XHisto",
"trd3XHisto", 100, -2.5, 2.5);
750 TH1F* trd3YHisto =
new TH1F(
"trd3YHisto",
"trd3YHisto", 100, -2.5, 2.5);
753 for (vector<vector<TrackDataHolder>>::iterator
i =
fMCTracks.begin();
756 vector<TrackDataHolder>& evTracks = *
i;
758 for (vector<TrackDataHolder>::iterator j = evTracks.begin();
788 Double_t tx = (trdPt1.
x - trdPt0.
x) / (trdPt1.
z - trdPt0.
z);
789 Double_t ty = (trdPt1.
y - trdPt0.
y) / (trdPt1.
z - trdPt0.
z);
790 Double_t p2X = trdPt1.
x + tx * (trdPt2.
z - trdPt1.
z);
791 trd2XHisto->Fill(p2X - trdPt2.
x);
792 Double_t p2Y = trdPt1.
y + ty * (trdPt2.
z - trdPt1.
z);
793 trd2YHisto->Fill(p2Y - trdPt2.
y);
794 Double_t p3X = trdPt1.
x + tx * (trdPt3.
z - trdPt1.
z);
795 trd3XHisto->Fill(p3X - trdPt3.
x);
796 Double_t p3Y = trdPt1.
y + ty * (trdPt3.
z - trdPt1.
z);
797 trd3YHisto->Fill(p3Y - trdPt3.
y);
806 TFile* curFile = TFile::CurrentFile();
807 TString histoName =
"trd2XHisto.root";
809 TFile fh(histoName.Data(),
"RECREATE");
814 TFile::CurrentFile() = curFile;
818 TFile* curFile = TFile::CurrentFile();
819 TString histoName =
"trd2YHisto.root";
821 TFile fh(histoName.Data(),
"RECREATE");
826 TFile::CurrentFile() = curFile;
830 TFile* curFile = TFile::CurrentFile();
831 TString histoName =
"trd3XHisto.root";
833 TFile fh(histoName.Data(),
"RECREATE");
838 TFile::CurrentFile() = curFile;
842 TFile* curFile = TFile::CurrentFile();
843 TString histoName =
"trd3YHisto.root";
845 TFile fh(histoName.Data(),
"RECREATE");
850 TFile::CurrentFile() = curFile;
855 TH1F* signalDistHisto =
856 new TH1F(
"signalDistHisto",
"signalDistHisto", 200, 0., 200.);
858 for (vector<vector<TrackDataHolder>>::iterator
i =
fMCTracks.begin();
861 vector<TrackDataHolder>& evTracks = *
i;
862 bool hasShortPos =
false;
863 bool hasShortNeg =
false;
864 bool hasLongPos =
false;
865 bool hasLongNeg =
false;
873 for (vector<TrackDataHolder>::iterator j = evTracks.begin();
897 if (hasShortPos && hasShortNeg) {
900 if (hasLongPos && hasLongNeg) {
902 signalDistHisto->Fill(
903 sqrt((posX - negX) * (posX - negX) + (posY - negY) * (posY - negY)));
906 if (hasLongPos || hasLongNeg)
914 TFile* curFile = TFile::CurrentFile();
915 TString histoName =
"signalDistHisto.root";
917 TFile fh(histoName.Data(),
"RECREATE");
918 signalDistHisto->Write();
920 delete signalDistHisto;
922 TFile::CurrentFile() = curFile;
927 TFile* curFile = TFile::CurrentFile();
928 TString histoName =
"trdMctByZR_All.root";
930 TFile fh(histoName.Data(),
"RECREATE");
935 TFile::CurrentFile() = curFile;
939 TFile* curFile = TFile::CurrentFile();
940 TString histoName =
"trdMctByXY_All.root";
942 TFile fh(histoName.Data(),
"RECREATE");
947 TFile::CurrentFile() = curFile;
1000 const FairMCPoint* pMCPt =
static_cast<const FairMCPoint*
>(
1003 Int_t trackId = pMCPt->GetTrackID();
1008 t += gRandom->Gaus(0, 4);
1009 #endif //LXTB_EMU_TS
1010 point.
mcRefs.push_back(ptDesc);
1013 isTrd ? fTrdClusters->At(clusterId) : fMuchClusters->At(clusterId));
1018 #endif //LXTB_EMU_TS
1021 for (Int_t
i = 0;
i < nDigis; ++
i) {
1023 isTrd ? fTrdDigiMatches->At(cluster->
GetDigi(
i))
1024 : fMuchPixelDigiMatches->At(cluster->
GetDigi(
i)));
1027 for (Int_t j = 0; j < nMCs; ++j) {
1033 (isTrd && fTrdPoints[eventId].size() <=
static_cast<size_t>(pointId))
1035 && fMuchPoints[eventId].size() <=
static_cast<size_t>(
1039 const FairMCPoint* pMCPt =
static_cast<const FairMCPoint*
>(
1040 isTrd ? fTrdMCPoints->Get(0, eventId, pointId)
1041 : fMuchMCPoints->Get(0, eventId, pointId));
1042 Int_t trackId = pMCPt->GetTrackID();
1044 point.
mcRefs.push_back(ptDesc);
1045 Double_t deltaT = isTrd ? fTrdPoints[eventId][pointId].t
1046 : fMuchPoints[eventId][pointId].t;
1048 deltaT += gRandom->Gaus(0, 4);
1050 #endif //LXTB_EMU_TS
1059 avTErr = TMath::Sqrt(avTErr);
1062 #endif //LXTB_EMU_TS
1078 (isTrd ? fFinder->trdStation.minY : fFinder->stations[stationNumber].minY);
1079 scaltype binSizeY = (isTrd ? fFinder->trdStation.binSizeY
1080 : fFinder->stations[stationNumber].binSizeY);
1081 int lastYBin = (isTrd ? fFinder->trdStation.lastYBin
1082 : fFinder->stations[stationNumber].lastYBin);
1084 (isTrd ? fFinder->trdStation.minX : fFinder->stations[stationNumber].minX);
1085 scaltype binSizeX = (isTrd ? fFinder->trdStation.binSizeX
1086 : fFinder->stations[stationNumber].binSizeX);
1087 int lastXBin = (isTrd ? fFinder->trdStation.lastXBin
1088 : fFinder->stations[stationNumber].lastXBin);
1094 else if (tInd > last_timebin)
1095 tInd = last_timebin;
1098 (isTrd ? fFinder->trdStation.tyxBinsArr[stationNumber][tInd]
1099 : fFinder->stations[stationNumber].tyxBins[tInd]);
1100 int yInd = (
y - minY) / binSizeY;
1104 else if (yInd > lastYBin)
1108 int xInd = (
x - minX) / binSizeX;
1112 else if (xInd > lastXBin)
1116 xBin.
points.push_back(point);
1123 #endif //LXTB_EMU_TS
1127 void LxTBFinder::AddLayerHit(
const CbmPixelHit* hit,
1148 point.isTrd = isTrd;
1149 point.stationNumber =
1172 #endif //LXTB_EMU_TS
1175 for (Int_t
i = 0;
i < nDigis; ++
i) {
1181 for (Int_t j = 0; j < nMCs; ++j) {
1187 (isTrd &&
fTrdPoints[eventId].size() <= pointId)
1193 const FairMCPoint* pMCPt =
static_cast<const FairMCPoint*
>(
1196 Int_t trackId = pMCPt->GetTrackID();
1198 point.mcRefs.push_back(ptDesc);
1199 Double_t deltaT = isTrd ?
fTrdPoints[eventId][pointId].t
1202 deltaT += gRandom->Gaus(0, 4);
1204 #endif //LXTB_EMU_TS
1213 avTErr = TMath::Sqrt(avTErr);
1216 #endif //LXTB_EMU_TS
1233 scaltype minY = fDetector->fLayers[layerNumber].minY;
1234 scaltype binSizeY = fDetector->fLayers[layerNumber].binSizeY;
1235 int lastYBin = fDetector->fLayers[layerNumber].lastYBin;
1236 scaltype minX = fDetector->fLayers[layerNumber].minX;
1237 scaltype binSizeX = fDetector->fLayers[layerNumber].binSizeX;
1238 int lastXBin = fDetector->fLayers[layerNumber].lastXBin;
1239 timetype minT = fDetector->fLayers[layerNumber].minT;
1240 int binSizeT = fDetector->fLayers[layerNumber].binSizeT;
1241 int lastTBin = fDetector->fLayers[layerNumber].lastTBin;
1243 int tInd = (t - minT) / binSizeT;
1247 else if (tInd > lastTBin)
1250 LxTbTYXBin& tyxBin = fDetector->fLayers[layerNumber].tyxBins[tInd];
1251 int yInd = (
y - minY) / binSizeY;
1255 else if (yInd > lastYBin)
1259 int xInd = (
x - minX) / binSizeX;
1263 else if (xInd > lastXBin)
1267 xBin.
points.push_back(point);
1271 void LxTBFinder::AddStsTrack(
const CbmStsTrack& stsTrack, Int_t selfId) {
1274 if (0 == par.GetQp())
return;
1278 if (nofHits < 1)
return;
1280 Int_t lastHitNr = nofHits - 1;
1284 Int_t lastHitIndex = stsTrack.
GetHitIndex(lastHitNr);
1286 *
static_cast<const CbmStsHit*
>(fStsHits->At(lastHitIndex));
1289 fDetector->AddStsTrack(par, stsTrack.
GetChiSq(), lastHitTime, selfId);
1305 FairRootManager* ioman = FairRootManager::Instance();
1307 if (0 == ioman) LOG(fatal) <<
"No FairRootManager";
1309 Int_t evNumb = ioman->GetEntryNr();
1310 cout <<
"evNumb = " << evNumb << endl;
1317 fDetector->fMuchTracks->Delete();
1318 fDetector->fGlobalTracks->Clear();
1328 if (1 != hitLrN)
continue;
1339 for (
int i = 0;
i <
fTrdHits->GetEntriesFast(); ++
i) {
1362 for (list<LxTbBinnedFinder::Chain*>::const_iterator j =
1363 recoTracksBin.begin();
1364 j != recoTracksBin.end();
1384 int prevTrigTimeSize =
1396 Int_t nofStsTracks = fStsTracks->GetEntriesFast();
1398 for (
int i = 0;
i < nofStsTracks; ++
i) {
1401 AddStsTrack(*stsTrack,
i);
1409 AddLayerHit(mh, hitStN * 3 + hitLrN,
i,
false);
1412 for (
int i = 0;
i <
fTrdHits->GetEntriesFast(); ++
i) {
1418 fDetector->TieTracks(*
fFinder);
1429 #endif //LXTB_EMU_TS
1465 if (
x.eventId <
y.eventId)
return true;
1467 return x.trackId <
y.trackId;
1472 list<timetype>& signalMCTimes,
1474 bool write_eff_for_inv_m =
false) {
1475 int nofRecoSignals = 0;
1477 for (list<timetype>::const_iterator
i = signalMCTimes.begin();
1478 i != signalMCTimes.end();
1481 bool matched =
false;
1483 for (list<pair<timetype, timetype>>::const_iterator j =
1484 signalRecoTimes.begin();
1485 j != signalRecoTimes.end();
1493 if (matched) ++nofRecoSignals;
1496 cout <<
"Have: " << signalRecoTimes.size() <<
" signaled " << name
1497 <<
" events" << endl;
1498 double eff = 0 == signalMCTimes.size()
1500 : 100.0 * nofRecoSignals / signalMCTimes.size();
1501 cout <<
"Triggered signals(" << name <<
"): " << eff <<
"% [ "
1502 << nofRecoSignals <<
" / " << signalMCTimes.size() <<
" ]" << endl;
1505 sprintf(buf,
"triggerings_%s.txt", name);
1506 ofstream triggeringsFile(buf, ios_base::out | ios_base::trunc);
1507 triggeringsFile << signalRecoTimes.size();
1509 sprintf(buf,
"signal_triggerings_%s.txt", name);
1510 ofstream signalTriggeringsFile(buf, ios_base::out | ios_base::trunc);
1511 signalTriggeringsFile << nofRecoSignals;
1513 if (write_eff_for_inv_m) {
1514 ifstream invMFile(
"inv_m.txt");
1516 if (invMFile.is_open()) {
1519 ofstream invMEffFile(
"inv_m_eff.txt", ios_base::out | ios_base::trunc);
1520 invMEffFile << invM <<
" " << eff << endl;
1530 for (list<LxTbBinnedPoint>::iterator
i =
ts_points.begin();
1537 bool isTrd = point.
isTrd;
1562 int yInd = (point.
y - minY) / binSizeY;
1566 else if (yInd > lastYBin)
1570 int xInd = (point.
x - minX) / binSizeX;
1574 else if (xInd > lastXBin)
1578 xBin.
points.push_back(point);
1588 fDetector->SetTSBegin(0);
1617 for (list<LxTbBinnedFinder::Chain*>::const_iterator j =
1618 recoTracksBin.begin();
1619 j != recoTracksBin.end();
1648 #endif //LXTB_EMU_TS
1649 cout <<
"LxTbBinnedFinder::Reconstruct() full duration was: " <<
fullDuration
1652 int nofRecoTracks = 0;
1654 for (list<LxTbBinnedFinder::Chain*>::const_iterator
i =
recoTracks.begin();
1662 cout <<
"LxTbBinnedFinder::Reconstruct() the number of found tracks: "
1663 << nofRecoTracks << endl;
1666 static int nofSignalTracks = 0;
1667 static int nofRecoSignalTracks = 0;
1670 for (vector<vector<TrackDataHolder>>::iterator
i =
fMCTracks.begin();
1673 vector<TrackDataHolder>& evTracks = *
i;
1675 for (vector<TrackDataHolder>::iterator j = evTracks.begin();
1676 j != evTracks.end();
1684 int nofMatchPoints = 0;
1686 for (list<LxTbBinnedFinder::Chain*>::const_iterator k =
1695 bool pointsMatched =
false;
1697 for (list<LxTbBinnedPoint::PointDesc>::const_iterator
m =
1701 if (
m->eventId == eventN &&
m->pointId == track.
pointInds[l]) {
1702 pointsMatched =
true;
1707 if (pointsMatched) ++nofMatchPoints;
1711 if (nofMatchPoints >= 2) {
1712 ++nofRecoSignalTracks;
1721 0 == nofSignalTracks ? 100 : 100.0 * nofRecoSignalTracks / nofSignalTracks;
1722 cout <<
"Reconstruction efficiency is: " << eff <<
"% [ "
1723 << nofRecoSignalTracks <<
" / " << nofSignalTracks <<
" ]" << endl;
1725 int nofRightRecoTracks = 0;
1727 for (list<LxTbBinnedFinder::Chain*>::const_iterator
i =
recoTracks.begin();
1734 map<RecoTrackData, int, RTDLess> nofTracks;
1737 int stMask = 1 << j;
1739 for (list<LxTbBinnedPoint::PointDesc>::const_iterator k =
1744 map<RecoTrackData, int, RTDLess>::iterator nofTIter =
1747 if (nofTIter != nofTracks.end())
1748 nofTIter->second |= stMask;
1750 nofTracks[st] = stMask;
1756 for (map<RecoTrackData, int, RTDLess>::const_iterator j = nofTracks.begin();
1757 j != nofTracks.end();
1762 if (j->second & (1 << k)) ++nofp;
1765 if (nofp > nofPoints) nofPoints = nofp;
1768 if (nofPoints >= 2) ++nofRightRecoTracks;
1772 0 ==
recoTracks.size() ? 100 : 100.0 * nofRightRecoTracks / nofRecoTracks;
1773 cout <<
"Non ghosts are: " << eff <<
"% [ " << nofRightRecoTracks <<
" / "
1774 << nofRecoTracks <<
" ]" << endl;
1784 ofstream nofEventsFile(
"nof_events.txt", ios_base::out | ios_base::trunc);
1787 ofstream nofShortSignalsFile(
"nof_short_signals.txt",
1788 ios_base::out | ios_base::trunc);
1791 ofstream nofLongSignalsFile(
"nof_long_signals.txt",
1792 ios_base::out | ios_base::trunc);
1795 ofstream nofMiddleSignalsFile(
"nof_middle_signals.txt",
1796 ios_base::out | ios_base::trunc);
1801 "triggerTimes_trd0_sign0_dist0");
1804 "triggerTimes_trd0_sign0_dist1");
1807 "triggerTimes_trd0_sign1_dist0");
1810 "triggerTimes_trd0_sign1_dist1");
1813 "triggerTimes_trd1_sign0_dist0");
1816 "triggerTimes_trd1_sign0_dist1");
1819 "triggerTimes_trd1_sign1_dist0");
1822 "triggerTimes_trd1_sign1_dist1",
1826 "triggerTimes_trd05_sign0_dist0");
1829 "triggerTimes_trd05_sign0_dist1");
1832 "triggerTimes_trd05_sign1_dist0");
1835 "triggerTimes_trd05_sign1_dist1");
1837 Int_t nofTriggerDigis = 0;
1844 ofstream nofTriggerDigisFile(
"nof_trigger_digis.txt",
1845 ios_base::out | ios_base::trunc);
1846 nofTriggerDigisFile << nofTriggerDigis;
1847 ofstream nofDigisFile(
"nof_digis.txt", ios_base::out | ios_base::trunc);
1851 for (list<LxTbBinnedFinder::Chain*>::iterator
i =
recoTracks.begin();