Skip to content

Commit 3640ecb

Browse files
committed
Misc fixes for TrackMCStudy workflow
1 parent ad782f9 commit 3640ecb

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct TrackMCStudyConfig : o2::conf::ConfigurableParamHelper<TrackMCStudyConfig
2828
bool requireITSorTPCTrackRefs = true;
2929
bool requireTopBottomRefs = false;
3030
int minTPCRefsToExtractClRes = 2;
31-
float rejectClustersResStat = 0.;
31+
float rejectClustersResStat = 0.1;
3232
float maxTPCRefExtrap = 2; // max dX to extrapolate the track ref when extrapolating track true posions
3333
int decayPDG[5] = {310, 3122, 411, 421, -1}; // decays to study, must end by -1
3434
O2ParamDef(TrackMCStudyConfig, "trmcconf");

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ struct MCTrackInfo {
5252
uint8_t maxTPCRowSect = -1;
5353
int8_t nITSCl = 0;
5454
int8_t pattITSCl = 0;
55-
ClassDefNV(MCTrackInfo, 4);
55+
bool addedAtRecStage = false;
56+
ClassDefNV(MCTrackInfo, 5);
5657
};
5758

5859
struct RecTrack {
@@ -75,6 +76,7 @@ struct RecTrack {
7576
uint8_t nClTPC = 0;
7677
uint8_t pattITS = 0;
7778
int8_t lowestPadRow = -1;
79+
int8_t padFromEdge = -1;
7880

7981
bool isFakeGLO() const { return flags & FakeGLO; }
8082
bool isFakeITS() const { return flags & FakeITS; }
@@ -83,7 +85,7 @@ struct RecTrack {
8385
bool isFakeTOF() const { return flags & FakeTOF; }
8486
bool isFakeITSTPC() const { return flags & FakeITSTPC; }
8587

86-
ClassDefNV(RecTrack, 1);
88+
ClassDefNV(RecTrack, 2);
8789
};
8890

8991
struct TrackPairInfo {

Detectors/GlobalTrackingWorkflow/study/src/TrackMCStudy.cxx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class TrackMCStudy : public Task
122122
std::vector<float> mTPCOcc; ///< TPC occupancy for this interaction time
123123
std::vector<int> mITSOcc; //< N ITS clusters in the ROF containing collision
124124
bool mCheckSV = false; //< check SV binding (apart from prongs availability)
125+
bool mRecProcStage = false; //< flag that the MC particle was added only at the stage of reco tracks processing
125126
int mNTPCOccBinLength = 0; ///< TPC occ. histo bin length in TBs
126127
float mNTPCOccBinLengthInv;
127128
int mVerbose = 0;
@@ -185,6 +186,7 @@ void TrackMCStudy::run(ProcessingContext& pc)
185186

186187
recoData.collectData(pc, *mDataRequest.get()); // select tracks of needed type, with minimal cuts, the real selected will be done in the vertexer
187188
updateTimeDependentParams(pc); // Make sure this is called after recoData.collectData, which may load some conditions
189+
mRecProcStage = false;
188190
process(recoData);
189191
}
190192

@@ -278,15 +280,21 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
278280
return patt;
279281
};
280282

281-
auto getLowestPadrow = [&recoData](const o2::tpc::TrackTPC& trc) {
283+
auto getLowestPadrow = [&recoData](const o2::tpc::TrackTPC& trc, RecTrack& tref) {
282284
if (recoData.inputsTPCclusters) {
283285
uint8_t clSect = 0, clRow = 0;
284286
uint32_t clIdx = 0;
285287
const auto clRefs = recoData.getTPCTracksClusterRefs();
288+
const auto tpcClusAcc = recoData.getTPCClusters();
286289
trc.getClusterReference(clRefs, trc.getNClusterReferences() - 1, clSect, clRow, clIdx);
287-
return int(clRow);
290+
const auto& clus = tpcClusAcc.clusters[clSect][clRow][clIdx];
291+
int padFromEdge = int(clus.getPad()), npads = o2::gpu::GPUTPCGeometry::NPads(clRow);
292+
if (padFromEdge > npads / 2) {
293+
padFromEdge = npads - 1 - padFromEdge;
294+
}
295+
tref.padFromEdge = uint8_t(padFromEdge);
296+
tref.lowestPadRow = clRow;
288297
}
289-
return -1;
290298
};
291299

292300
auto flagTPCClusters = [&recoData](const o2::tpc::TrackTPC& trc, o2::MCCompLabel lbTrc) {
@@ -352,7 +360,7 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
352360
int nev = mcReader.getNEvents(curSrcMC);
353361
bool okAccVtx = true;
354362
if (nev != (int)mMCVtVec.size()) {
355-
LOGP(error, "source {} has {} events while {} MC vertices were booked", curSrcMC, nev, mMCVtVec.size());
363+
LOGP(debug, "source {} has {} events while {} MC vertices were booked", curSrcMC, nev, mMCVtVec.size());
356364
okAccVtx = false;
357365
}
358366
for (curEvMC = 0; curEvMC < nev; curEvMC++) {
@@ -382,6 +390,7 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
382390
}
383391

384392
// add reconstruction info to MC particles. If MC particle was not selected before but was reconstrected, account MC info
393+
mRecProcStage = true; // MC particles accepted only at this stage will be flagged
385394
for (int iv = 0; iv < nv; iv++) {
386395
if (mVerbose > 1) {
387396
LOGP(info, "processing PV {} of {}", iv, nv);
@@ -532,7 +541,7 @@ void TrackMCStudy::process(const o2::globaltracking::RecoContainer& recoData)
532541
if (msk[DetID::TPC]) {
533542
const auto& trtpc = recoData.getTPCTrack(gidSet[GTrackID::TPC]);
534543
tref.nClTPC = trtpc.getNClusters();
535-
tref.lowestPadRow = getLowestPadrow(trtpc);
544+
getLowestPadrow(trtpc, tref);
536545
flagTPCClusters(trtpc, entry.first);
537546
if (trackFam.entTPC < 0) {
538547
trackFam.entTPC = tcnt;
@@ -1088,6 +1097,7 @@ bool TrackMCStudy::addMCParticle(const MCTrack& mcPart, const o2::MCCompLabel& l
10881097
mcEntry.mcTrackInfo.bcInTF = mIntBC[lb.getEventID()];
10891098
mcEntry.mcTrackInfo.occTPC = mTPCOcc[lb.getEventID()];
10901099
mcEntry.mcTrackInfo.occITS = mITSOcc[lb.getEventID()];
1100+
mcEntry.mcTrackInfo.addedAtRecStage = mRecProcStage;
10911101
int moth = -1;
10921102
o2::MCCompLabel mclbPar;
10931103
if ((moth = mcPart.getMotherTrackId()) >= 0) {

0 commit comments

Comments
 (0)