Skip to content

Commit 11a227f

Browse files
committed
aslkdjalks
Signed-off-by: Felix Schlepper <[email protected]>
1 parent 7679426 commit 11a227f

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

Detectors/Upgrades/ITS3/study/src/TrackingStudy.cxx

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,46 @@ class TrackingStudySpec : public Task
7272

7373
void operator+=(int src)
7474
{
75-
if (src >= 0 && src < static_cast<int>(mC.size())) {
76-
++mC[src];
77-
} else {
78-
LOGP(warning, "Invalid src index: {}", src);
75+
if (src >= 0 && src < static_cast<int>(mSuccess.size())) {
76+
++mSuccess[src];
77+
}
78+
}
79+
80+
void operator-=(int src)
81+
{
82+
if (src >= 0 && src < static_cast<int>(mErrors.size())) {
83+
++mErrors[src];
84+
}
85+
}
86+
87+
void operator&=(int src)
88+
{
89+
if (src >= 0 && src < static_cast<int>(mRejected.size())) {
90+
++mRejected[src];
7991
}
8092
}
8193

8294
void print() const
8395
{
96+
LOGP(info, "\t\t\tSuccess / Error / Rejected");
8497
for (int cis = 0; cis < GTrackID::NSources; ++cis) {
8598
const auto cdm = GTrackID::getSourceDetectorsMask(cis);
8699
if (cdm[DetID::ITS]) {
87-
LOGP(info, "\t{:{}}\t{}", GTrackID::getSourceName(cis), 15, mC[cis]);
100+
LOGP(info, "\t{:{}}\t{} / {} / {}", GTrackID::getSourceName(cis), 15, mSuccess[cis], mErrors[cis], mRejected[cis]);
88101
}
89102
}
90103
}
91104

92105
void reset()
93106
{
94-
mC.fill(0);
107+
mSuccess.fill(0);
108+
mErrors.fill(0);
109+
mRejected.fill(0);
95110
}
96111

97-
std::array<size_t, GTrackID::NSources> mC{};
112+
std::array<size_t, GTrackID::NSources> mSuccess{};
113+
std::array<size_t, GTrackID::NSources> mErrors{};
114+
std::array<size_t, GTrackID::NSources> mRejected{};
98115
};
99116
TrackCounter mTrackCounter;
100117

@@ -308,7 +325,6 @@ void TrackingStudySpec::doDCAStudy(o2::globaltracking::RecoContainer& recoData)
308325
auto prop = o2::base::Propagator::Instance();
309326
TStopwatch sw;
310327
sw.Start();
311-
312328
int nDCAFits{0}, nDCAFitsFail{0};
313329
auto pvvec = recoData.getPrimaryVertices();
314330
auto trackIndex = recoData.getPrimaryVertexMatchedTracks(); // Global ID's for associated tracks
@@ -321,15 +337,18 @@ void TrackingStudySpec::doDCAStudy(o2::globaltracking::RecoContainer& recoData)
321337
for (int is = 0; is < GTrackID::NSources; is++) {
322338
const auto dm = GTrackID::getSourceDetectorsMask(is);
323339
if (!recoData.isTrackSourceLoaded(is) || !dm[DetID::ITS]) {
340+
mTrackCounter &= is;
324341
continue;
325342
}
326343
int idMin = vtref.getFirstEntryOfSource(is), idMax = idMin + vtref.getEntriesOfSource(is);
327344
for (int i = idMin; i < idMax; i++) {
328345
const auto vid = trackIndex[i];
329346
if (!vid.isPVContributor()) {
347+
mTrackCounter &= vid.getSource();
330348
continue;
331349
}
332350
if (!selectITSTrack(vid, recoData)) {
351+
mTrackCounter &= vid.getSource();
333352
continue;
334353
}
335354

@@ -339,13 +358,15 @@ void TrackingStudySpec::doDCAStudy(o2::globaltracking::RecoContainer& recoData)
339358
for (int cis = 0; cis < GTrackID::NSources && cis <= is; cis++) {
340359
const auto cdm = GTrackID::getSourceDetectorsMask(cis);
341360
if (!recoData.isTrackSourceLoaded(cis) || !cdm[DetID::ITS] || !contributorsGID[cis].isIndexSet()) {
361+
mTrackCounter &= cis;
342362
continue;
343363
}
344364

345365
o2::dataformats::DCA dcaInfo;
346366
const auto& trk = recoData.getTrackParam(contributorsGID[cis]);
347367
auto trkC = trk;
348368
if (!prop->propagateToDCABxByBz(pv, trkC, 2.f, matCorr, &dcaInfo)) {
369+
mTrackCounter -= cis;
349370
++nDCAFitsFail;
350371
continue;
351372
}
@@ -364,6 +385,7 @@ void TrackingStudySpec::doDCAStudy(o2::globaltracking::RecoContainer& recoData)
364385
mcEve.setPos({(float)eve.GetX(), (float)eve.GetY(), (float)eve.GetZ()});
365386
auto trkC = trk;
366387
if (!prop->propagateToDCABxByBz(mcEve, trkC, 2.f, matCorr, &dcaInfoMC)) {
388+
mTrackCounter -= cis;
367389
++nDCAFitsFail;
368390
continue;
369391
}
@@ -417,53 +439,64 @@ void TrackingStudySpec::doDCARefitStudy(o2::globaltracking::RecoContainer& recoD
417439
v2t.resize(nv);
418440
auto creator = [&](const auto& trk, GTrackID trkID, float _t0, float terr) -> bool {
419441
if constexpr (!isBarrelTrack<decltype(trk)>()) {
442+
mTrackCounter &= trkID.getSource();
420443
return false;
421444
}
422445
if (!trkID.includesDet(GTrackID::ITS)) {
446+
mTrackCounter &= trkID.getSource();
423447
return false;
424448
}
425449
// general
426450
if constexpr (isBarrelTrack<decltype(trk)>()) {
427451
if (trk.getPt() < conf.minPt || trk.getPt() > conf.maxPt) {
452+
mTrackCounter &= trkID.getSource();
428453
return false;
429454
}
430455
if (std::abs(trk.getEta()) > conf.maxEta) {
456+
mTrackCounter &= trkID.getSource();
431457
return false;
432458
}
433459
if (!t2v.contains(trkID)) {
460+
mTrackCounter &= trkID.getSource();
434461
return false;
435462
}
436463
}
437464
auto contributorsGID = recoData.getSingleDetectorRefs(trkID);
438465
if (!contributorsGID[GTrackID::ITS].isIndexSet()) { // we need of course ITS
466+
mTrackCounter &= trkID.getSource();
439467
return false;
440468
}
441469
// ITS specific
442470
const auto& itsTrk = recoData.getITSTrack(contributorsGID[GTrackID::ITS]);
443471
if (itsTrk.getChi2() > conf.maxChi2 || itsTrk.getNClusters() < conf.minITSCls) {
472+
mTrackCounter &= trkID.getSource();
444473
return false;
445474
}
446475
if (mUseMC) { // for dca studies only account for correct tracks
447476
const auto& gLbl = recoData.getTrackMCLabel(trkID);
448477
if (!gLbl.isValid() || !gLbl.isCorrect()) {
478+
mTrackCounter &= trkID.getSource();
449479
return false;
450480
}
451481
const auto& itsLbl = recoData.getTrackMCLabel(contributorsGID[GTrackID::ITS]);
452482
if (contributorsGID[GTrackID::TPC].isIndexSet()) {
453483
const auto& tpcLbl = recoData.getTrackMCLabel(contributorsGID[GTrackID::TPC]);
454484
if (itsLbl != tpcLbl) {
485+
mTrackCounter &= trkID.getSource();
455486
return false;
456487
}
457488
}
458489
if (contributorsGID[GTrackID::TRD].isIndexSet()) {
459490
const auto& trdLbl = recoData.getTrackMCLabel(contributorsGID[GTrackID::TRD]);
460491
if (itsLbl != trdLbl) {
492+
mTrackCounter &= trkID.getSource();
461493
return false;
462494
}
463495
}
464496
if (contributorsGID[GTrackID::TOF].isIndexSet()) {
465497
const auto& tofLbl = recoData.getTrackMCLabel(contributorsGID[GTrackID::TOF]);
466498
if (itsLbl != tofLbl) {
499+
mTrackCounter &= trkID.getSource();
467500
return false;
468501
}
469502
}
@@ -506,12 +539,14 @@ void TrackingStudySpec::doDCARefitStudy(o2::globaltracking::RecoContainer& recoD
506539
o2::dataformats::DCA dcaInfo;
507540
auto trkC = trks[it];
508541
if (!prop->propagateToDCABxByBz(pv, trkC, 2.f, matCorr, &dcaInfo)) {
542+
mTrackCounter -= trkIDs[it].getSource();
509543
++nDCAFitsFail;
510544
continue;
511545
}
512546
o2::dataformats::DCA dcaInfoRefit;
513547
auto trkCRefit = trks[it];
514548
if (!prop->propagateToDCABxByBz(pv, trkCRefit, 2.f, matCorr, &dcaInfoRefit)) {
549+
mTrackCounter -= trkIDs[it].getSource();
515550
++nDCAFitsFail;
516551
continue;
517552
}
@@ -578,6 +613,7 @@ void TrackingStudySpec::doPullStudy(o2::globaltracking::RecoContainer& recoData)
578613
const auto& pv = pvvec[t2v[gidx]];
579614
auto trkPV = trkIn;
580615
if (!prop->propagateToDCA(pv, trkPV, prop->getNominalBz(), 2.0, matCorr)) {
616+
mTrackCounter -= gidx.getSource();
581617
return false;
582618
}
583619
// create base cluster from the PV, with the alpha corresponding to the track at DCA
@@ -598,10 +634,12 @@ void TrackingStudySpec::doPullStudy(o2::globaltracking::RecoContainer& recoData)
598634
float chi2{0};
599635
for (int icl = ncl; icl >= 0; --icl) { // go backwards
600636
if (!trFit.rotate(clAlpha[icl]) || !prop->propagateToX(trFit, clArr[icl].getX(), prop->getNominalBz(), 0.85, 2.0, matCorr)) {
637+
mTrackCounter -= gidx.getSource();
601638
return false;
602639
}
603640
chi2 += trFit.getPredictedChi2(clArr[icl]);
604641
if (!trFit.update(clArr[icl])) {
642+
mTrackCounter -= gidx.getSource();
605643
return false;
606644
}
607645
}
@@ -610,6 +648,7 @@ void TrackingStudySpec::doPullStudy(o2::globaltracking::RecoContainer& recoData)
610648

611649
auto checkInTrack = [&](GTrackID trkID) {
612650
if (!selectITSTrack(trkID, recoData)) {
651+
mTrackCounter &= trkID.getSource();
613652
return;
614653
}
615654
const auto mcTrk = mcReader.getTrack(recoData.getTrackMCLabel(trkID));
@@ -620,6 +659,7 @@ void TrackingStudySpec::doPullStudy(o2::globaltracking::RecoContainer& recoData)
620659

621660
// for ITS standalone tracks we add the PV as an additional measurement point
622661
if (trkID.getSource() == GTrackID::ITS && !refitITSPVTrack(trk, trkID)) {
662+
mTrackCounter -= trkID.getSource();
623663
++nPullsFail;
624664
return;
625665
}
@@ -628,19 +668,22 @@ void TrackingStudySpec::doPullStudy(o2::globaltracking::RecoContainer& recoData)
628668
pxyz{(float)mcTrk->GetStartVertexMomentumX(), (float)mcTrk->GetStartVertexMomentumY(), (float)mcTrk->GetStartVertexMomentumZ()};
629669
TParticlePDG* pPDG = TDatabasePDG::Instance()->GetParticle(mcTrk->GetPdgCode());
630670
if (!pPDG) {
671+
mTrackCounter -= trkID.getSource();
631672
++nPullsFail;
632673
return;
633674
}
634675
o2::track::TrackPar mcTrkO2(xyz, pxyz, TMath::Nint(pPDG->Charge() / 3), false);
635676
// propagate it to the alpha/X of the reconstructed track
636677
if (!mcTrkO2.rotate(trk.getAlpha()) || !prop->PropagateToXBxByBz(mcTrkO2, trk.getX())) {
678+
mTrackCounter -= trkID.getSource();
637679
++nPullsFail;
638680
return;
639681
}
640682

641683
(*mDBGOut) << "pull"
642684
<< "src=" << trkID.getSource()
643685
<< "mcTrk=" << mcTrkO2
686+
<< "mcPart=" << mcTrk
644687
<< "trk=" << trk
645688
<< "\n";
646689
++nPulls;

0 commit comments

Comments
 (0)