11 #include "CbmTofHit.h"
13 #include "FairLogger.h"
92 set<const QAMCPoint*> _points,
93 set<const QAMCTrack*> _tracks,
114 static vector<vector<QAHit>>
hits;
130 , fTofDigiPointMatchs(0)
137 FairRootManager* ioman = FairRootManager::Instance();
139 if (0 == ioman) LOG(fatal) <<
"No FairRootManager";
141 fTofHits =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofHit"));
142 fTofDigiMatchs =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofDigiMatch"));
143 fTofDigis =
static_cast<TClonesArray*
>(ioman->GetObject(
"TofDigiExp"));
145 static_cast<TClonesArray*
>(ioman->GetObject(
"TofDigiMatchPoints"));
178 if (0 ==
fTimeSlice) LOG(fatal) <<
"No time slice";
182 if (0 ==
fEventList) LOG(fatal) <<
"No event list";
184 for (
int i = 0;
i < 1000; ++
i) {
185 vector<QAMCTrack>& evMcTracks =
mcTracks[
i];
186 vector<QAMCPoint>& evMcPoints =
mcPoints[
i];
190 if (nofmct > 0) evMcTracks.resize(nofmct);
194 if (nofmcp > 0) evMcPoints.resize(nofmcp);
196 for (
int j = 0; j < nofmcp; ++j) {
199 int trackId = tp->GetTrackID();
200 evMcPoints[j] = {tp->GetX(),
204 &evMcTracks[trackId],
206 const QAMCPoint* lastPoint = &evMcPoints[j];
207 evMcTracks[trackId].points.push_back(lastPoint);
211 deltaTHisto =
new TH1F(
"deltaTHisto",
"deltaTHisto", 100, -1., 1.);
212 deltaXHisto =
new TH1F(
"deltaXHisto",
"deltaXHisto", 100, -5., 5.);
213 deltaYHisto =
new TH1F(
"deltaYHisto",
"deltaYHisto", 100, -5., 5.);
214 pullTHisto =
new TH1F(
"pullTHisto",
"pullTHisto", 100, -5., 5.);
215 pullXHisto =
new TH1F(
"pullXHisto",
"pullXHisto", 100, -5., 5.);
216 pullYHisto =
new TH1F(
"pullYHisto",
"pullYHisto", 100, -5., 5.);
217 nofHitsHisto =
new TH1F(
"nofHitsHisto",
"nofHitsHisto", 5, 0., 5.);
219 new TH1F(
"nofTracksDepositedHisto",
"nofTracksDepositedHisto", 8, 0., 8.);
320 Int_t nofHits =
fTofHits->GetEntriesFast();
321 evHits.resize(nofHits);
323 Int_t nofDigis =
fTofDigis->GetEntriesFast();
326 for (
int i = 0;
i < nofHits; ++
i) {
337 set<const QAMCPoint*> {},
338 set<const QAMCTrack*> {},
340 QAHit& lastHit = evHits[
i];
344 for (
int j = 0; j < nofDigis; ++j) {
353 for (Int_t k = 0; k < nofPoints; ++k) {
355 Int_t evN = pointLnk.
GetEntry() - 1;
356 Int_t pointInd = pointLnk.
GetIndex();
360 if (!
mcPoints[evN][pointInd].isInit) {
362 mcPoints[evN][pointInd].t += eventTime;
363 mcPoints[evN][pointInd].isInit =
true;
370 for (set<const QAMCPoint*>::const_iterator j = lastHit.
points.begin();
371 j != lastHit.
points.end();
377 for (set<QAMCTrack*>::iterator j =
tracks.begin(); j !=
tracks.end(); ++j) {
379 track->
hits.push_back(&lastHit);
387 TFile* curFile = TFile::CurrentFile();
388 TString histoName = histo->GetName();
389 histoName +=
".root";
390 TFile fh(histoName.Data(),
"RECREATE");
394 TFile::CurrentFile() = curFile;
492 int nofTracksTof = 0;
493 int nofTracksHit = 0;
496 for (vector<vector<QAMCTrack>>::const_iterator
i =
mcTracks.begin();
499 const vector<QAMCTrack>& evTracks = *
i;
501 if (!evTracks.empty()) ++nofMCEvents;
503 for (vector<QAMCTrack>::const_iterator j = evTracks.begin();
508 if (!track.
points.empty()) {
511 if (!track.
hits.empty()) ++nofTracksHit;
514 for (list<const QAHit*>::const_iterator k = track.
hits.begin();
515 k != track.
hits.end();
517 const QAHit* hit = *k;
519 set<const QAMCPoint*> hitPoints;
537 for (list<const QAMCPoint*>::const_iterator l = track.
points.begin();
544 hitPoints.insert(point);
547 if (hitPoints.empty())
continue;
549 for (set<const QAMCPoint*>::const_iterator l = hitPoints.begin();
550 l != hitPoints.end();
560 double deltaX = hit->
x -
x / nofPoints;
561 double deltaY = hit->
y -
y / nofPoints;
562 double deltaT = hit->
t - t / nofPoints;
573 int nofHitEvents = 0;
575 int nofSingleHits = 0;
577 for (vector<vector<QAHit>>::const_iterator
i =
hits.begin();
i !=
hits.end();
579 const vector<QAHit>& evHits = *
i;
581 if (!evHits.empty()) ++nofHitEvents;
583 nofHits += evHits.size();
585 for (vector<QAHit>::const_iterator j = evHits.begin(); j != evHits.end();
587 const QAHit& hit = *j;
590 if (hit.
tracks.size() == 1) ++nofSingleHits;
603 double eff = 100 * nofTracksHit;
605 cout <<
"Clustering efficiency: " << eff <<
" % [ " << nofTracksHit <<
" / "
606 << nofTracksTof <<
" ]" << endl;
607 cout <<
"NOF hit events: " << nofHitEvents << endl;
608 cout <<
"NOF hits: " << nofHits << endl;
611 cout <<
"NOF MC Events: " << nofMCEvents << endl;
612 eff = 100 * nofSingleHits;
614 cout <<
"Pure hits: " << eff <<
" % [ " << nofSingleHits <<
" / " << nofHits