Skip to content

Commit 7c0b93e

Browse files
authored
Fix in the cluster stat. extraction + clusters sigmas (#13648)
* Fix in the cluster stat. extraction * Add clusters sigmas to the output
1 parent b0e6623 commit 7c0b93e

File tree

5 files changed

+69
-13
lines changed

5 files changed

+69
-13
lines changed

Detectors/GlobalTrackingWorkflow/study/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
# add_compile_options(-O0 -g -fPIC)
12+
#add_compile_options(-O0 -g -fPIC)
1313

1414
o2_add_library(GlobalTrackingStudy
1515
SOURCES src/TPCTrackStudy.cxx

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackInfoExt.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ struct TrackInfoExt {
3737
float q2ptTPC = 0.f;
3838
float q2ptITSTPC = 0.f;
3939
float q2ptITSTPCTRD = 0.f;
40-
int nClTPC = 0;
41-
int nClITS = 0;
42-
int pattITS = 0;
43-
ClassDefNV(TrackInfoExt, 1);
40+
uint16_t nClTPC = 0;
41+
uint8_t pattITS = 0;
42+
uint8_t nClITS = 0;
43+
uint8_t rowMinTPC = 0;
44+
uint8_t rowMaxTPC = 0;
45+
uint8_t rowCountTPC = 0;
46+
ClassDefNV(TrackInfoExt, 2);
4447
};
4548

4649
} // namespace dataformats

Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ struct MCTrackInfo {
4646
int8_t parentDecID = -1;
4747
uint8_t minTPCRow = -1;
4848
uint8_t maxTPCRow = 0;
49+
uint8_t nUsedPadRows = 0;
4950
uint8_t maxTPCRowInner = 0; // highest row in the sector containing the lowest one
5051
uint8_t minTPCRowSect = -1;
5152
uint8_t maxTPCRowSect = -1;
5253
int8_t nITSCl = 0;
5354
int8_t pattITSCl = 0;
54-
ClassDefNV(MCTrackInfo, 3);
55+
ClassDefNV(MCTrackInfo, 4);
5556
};
5657

5758
struct RecTrack {
@@ -127,6 +128,10 @@ struct ClResTPCCont {
127128

128129
int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
129130

131+
float getClX() const { return xyz[0]; }
132+
float getClY() const { return xyz[1]; }
133+
float getClZ() const { return xyz[2]; }
134+
130135
float getDY() const { return xyz[1] - getYRef(); }
131136
float getDZ() const { return xyz[2] - getZRef(); }
132137

@@ -195,9 +200,14 @@ struct ClResTPC {
195200
uint8_t row = 0;
196201
uint8_t ncont = 0;
197202
uint8_t flags = 0;
203+
uint8_t sigmaTimePacked;
204+
uint8_t sigmaPadPacked;
198205
float qmax = 0;
199206
float qtot = 0;
200207
float occ = 0;
208+
float occBin = 0;
209+
float getSigmaPad() const { return float(sigmaPadPacked) * (1.f / 32); }
210+
float getSigmaTime() const { return float(sigmaTimePacked) * (1.f / 32); }
201211

202212
std::vector<ClResTPCCont> contTracks;
203213
int getNCont() const { return contTracks.size(); }

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudy.cxx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class TrackMCStudy : public Task
117117
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
118118
std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut;
119119
std::vector<float> mTBinClOcc; ///< TPC occupancy histo: i-th entry is the integrated occupancy for ~1 orbit starting from the TB = i*mNTPCOccBinLength
120+
std::vector<float> mTBinClOccHist; //< original occupancy
120121
std::vector<long> mIntBC; ///< interaction global BC wrt TF start
121122
std::vector<float> mTPCOcc; ///< TPC occupancy for this interaction time
122123
std::vector<int> mITSOcc; //< N ITS clusters in the ROF containing collision
@@ -620,15 +621,15 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
620621
}
621622
}
622623

624+
// collect ITS/TPC cluster info for selected MC particles
625+
fillMCClusterInfo(recoData);
626+
623627
// single tracks
624628
for (auto& entry : mSelMCTracks) {
625629
auto& trackFam = entry.second;
626630
(*mDBGOut) << "tracks" << "tr=" << trackFam << "\n";
627631
}
628632

629-
// collect ITS/TPC cluster info for selected MC particles
630-
fillMCClusterInfo(recoData);
631-
632633
// decays
633634
std::vector<TrackFamily> decFam;
634635
for (int id = 0; id < mNCheckDecays; id++) {
@@ -735,6 +736,7 @@ void TrackMCStudy::fillMCClusterInfo(const o2::globaltracking::RecoContainer& re
735736
ncontLb++;
736737
}
737738
const auto& clus = TPCClusterIdxStruct.clusters[sector][row][icl0];
739+
int tbinH = int(clus.getTime() * mNTPCOccBinLengthInv); // time bin converted to slot of the occ. histo
738740
clRes.contTracks.clear();
739741
bool doClusRes = (params.minTPCRefsToExtractClRes > 0) && (params.rejectClustersResStat <= 0. || gRandom->Rndm() < params.rejectClustersResStat);
740742
for (auto lbl : labels) {
@@ -749,6 +751,9 @@ void TrackMCStudy::fillMCClusterInfo(const o2::globaltracking::RecoContainer& re
749751
if (row > mctr.maxTPCRow) {
750752
mctr.maxTPCRow = row;
751753
mctr.maxTPCRowSect = sector;
754+
mctr.nUsedPadRows++;
755+
} else if (row == 0 && mctr.nUsedPadRows == 0) {
756+
mctr.nUsedPadRows++;
752757
}
753758
if (row < mctr.minTPCRow) {
754759
mctr.minTPCRow = row;
@@ -838,8 +843,18 @@ void TrackMCStudy::fillMCClusterInfo(const o2::globaltracking::RecoContainer& re
838843
clRes.qtot = clus.getQtot();
839844
clRes.qmax = clus.getQmax();
840845
clRes.flags = clus.getFlags();
846+
clRes.sigmaTimePacked = clus.sigmaTimePacked;
847+
clRes.sigmaPadPacked = clus.sigmaPadPacked;
841848
clRes.ncont = ncontLb;
842849
clRes.sortCont();
850+
851+
if (tbinH < 0) {
852+
tbinH = 0;
853+
} else if (tbinH >= int(mTBinClOccHist.size())) {
854+
tbinH = (int)mTBinClOccHist.size() - 1;
855+
}
856+
clRes.occBin = mTBinClOccHist[tbinH];
857+
843858
(*mDBGOut) << "clres" << "clr=" << clRes << "\n";
844859
}
845860
}
@@ -1147,21 +1162,22 @@ void TrackMCStudy::loadTPCOccMap(const o2::globaltracking::RecoContainer& recoDa
11471162
int nTPCBins = NHBPerTF * o2::constants::lhc::LHCMaxBunches / 8, ninteg = 0;
11481163
int nTPCOccBins = nTPCBins * mNTPCOccBinLengthInv, sumBins = std::max(1, int(o2::constants::lhc::LHCMaxBunches / 8 * mNTPCOccBinLengthInv));
11491164
mTBinClOcc.resize(nTPCOccBins);
1150-
std::vector<float> mltHistTB(nTPCOccBins);
1165+
mTBinClOccHist.resize(nTPCOccBins);
11511166
float sm = 0., tb = 0.5 * mNTPCOccBinLength;
11521167
for (int i = 0; i < nTPCOccBins; i++) {
1153-
mltHistTB[i] = TPCRefitter->getParam()->GetUnscaledMult(tb);
1168+
mTBinClOccHist[i] = TPCRefitter->getParam()->GetUnscaledMult(tb);
11541169
tb += mNTPCOccBinLength;
11551170
}
11561171
for (int i = nTPCOccBins; i--;) {
1157-
sm += mltHistTB[i];
1172+
sm += mTBinClOccHist[i];
11581173
if (i + sumBins < nTPCOccBins) {
1159-
sm -= mltHistTB[i + sumBins];
1174+
sm -= mTBinClOccHist[i + sumBins];
11601175
}
11611176
mTBinClOcc[i] = sm;
11621177
}
11631178
} else {
11641179
mTBinClOcc.resize(1);
1180+
mTBinClOccHist.resize(1);
11651181
}
11661182
}
11671183

Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,28 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
248248
auto vdrit = mTPCVDriftHelper.getVDriftObject().getVDrift();
249249
bool tpcTrackOK = recoData.isTrackSourceLoaded(GTrackID::TPC);
250250

251+
auto getTPCClInfo = [&recoData](const o2::tpc::TrackTPC& trc) {
252+
const auto clRefs = recoData.getTPCTracksClusterRefs();
253+
std::array<int, 3> clinfo = {};
254+
if (recoData.inputsTPCclusters) {
255+
uint8_t clSect = 0, clRow = 0, clRowP = -1;
256+
uint32_t clIdx = 0;
257+
for (int ic = 0; ic < trc.getNClusterReferences(); ic++) {
258+
trc.getClusterReference(clRefs, ic, clSect, clRow, clIdx);
259+
if (clRow != clRowP) {
260+
clinfo[2]++;
261+
clRowP = clRow;
262+
}
263+
}
264+
const auto clRefs = recoData.getTPCTracksClusterRefs();
265+
trc.getClusterReference(clRefs, trc.getNClusterReferences() - 1, clSect, clRow, clIdx);
266+
clinfo[0] = clRow;
267+
trc.getClusterReference(clRefs, 0, clSect, clRow, clIdx);
268+
clinfo[1] = clRow;
269+
}
270+
return clinfo;
271+
};
272+
251273
for (int iv = 0; iv < nv; iv++) {
252274
LOGP(debug, "processing PV {} of {}", iv, nv);
253275
const auto& vtref = vtxRefs[iv];
@@ -297,13 +319,15 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
297319
GTrackID tpcTrID;
298320
const o2::tpc::TrackTPC* tpcTr = nullptr;
299321
int nclTPC = 0;
322+
std::array<int, 3> tpcClInfo{};
300323
if (dm[DetID::TPC] && tpcTrackOK) {
301324
tpcTrID = recoData.getTPCContributorGID(vid);
302325
tpcTr = &recoData.getTPCTrack(tpcTrID);
303326
nclTPC = tpcTr->getNClusters();
304327
if (nclTPC < mMinTPCClusters) {
305328
continue;
306329
}
330+
tpcClInfo = getTPCClInfo(*tpcTr);
307331
}
308332
bool ambig = vid.isAmbiguous();
309333
auto trc = recoData.getTrackParam(vid);
@@ -368,6 +392,9 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
368392
if (gidRefs[GTrackID::TPC].isIndexSet()) {
369393
trcExt.q2ptTPC = recoData.getTrackParam(gidRefs[GTrackID::TPC]).getQ2Pt();
370394
trcExt.nClTPC = nclTPC;
395+
trcExt.rowMinTPC = tpcClInfo[0];
396+
trcExt.rowMaxTPC = tpcClInfo[1];
397+
trcExt.rowCountTPC = tpcClInfo[2];
371398
}
372399
if (gidRefs[GTrackID::ITSTPC].isIndexSet()) {
373400
const auto& trTPCITS = recoData.getTPCITSTrack(gidRefs[GTrackID::ITSTPC]);

0 commit comments

Comments
 (0)