Skip to content

Commit b257056

Browse files
committed
AOD-like global track selection for the TrackStudy
1 parent 8f7c2d6 commit b257056

2 files changed

Lines changed: 71 additions & 6 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/PrimaryVertexExt.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ namespace dataformats
2424

2525
struct PrimaryVertexExt : public PrimaryVertex {
2626
using PrimaryVertex::PrimaryVertex;
27-
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrc{}; // N contributors for each source type
27+
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrc{}; // N contributors for each source type
28+
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrcA{}; // N associated and passing cuts for each source type
29+
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrcAU{}; // N ambgous associated and passing cuts for each source type
2830
int VtxID = -1; // original vtx ID
2931
float FT0A = -1; // amplitude of closest FT0 A side
3032
float FT0C = -1; // amplitude of closest FT0 C side
@@ -38,13 +40,15 @@ struct PrimaryVertexExt : public PrimaryVertex {
3840
float tMAD = 0;
3941
float zMAD = 0;
4042
int getNSrc(int i) const { return nSrc[i]; }
43+
int getNSrcA(int i) const { return nSrcA[i]; }
44+
int getNSrcAU(int i) const { return nSrcAU[i]; }
4145

4246
#ifndef GPUCA_ALIGPUCODE
4347
void print() const;
4448
std::string asString() const;
4549
#endif
4650

47-
ClassDefNV(PrimaryVertexExt, 4);
51+
ClassDefNV(PrimaryVertexExt, 5);
4852
};
4953

5054
#ifndef GPUCA_ALIGPUCODE

Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class TrackingStudySpec : public Task
6969

7070
private:
7171
void updateTimeDependentParams(ProcessingContext& pc);
72+
float getDCAYCut(float pt) const;
7273
std::shared_ptr<DataRequest> mDataRequest;
7374
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
7475
bool mUseMC{false}; ///< MC flag
@@ -77,6 +78,14 @@ class TrackingStudySpec : public Task
7778
float mITSROFrameLengthMUS = 0.;
7879
int mMaxNeighbours = 3;
7980
float mMaxVTTimeDiff = 80.; // \mus
81+
float mTPCDCAYCut = 2.;
82+
float mTPCDCAZCut = 2.;
83+
float mMinX = 6.;
84+
float mMaxEta = 0.8;
85+
float mMinPt = 0.1;
86+
int mMinTPCClusters = 60;
87+
std::string mDCAYFormula = "0.0105 + 0.0350 / pow(x, 1.1)";
88+
8089
GTrackID::mask_t mTracksSrc{};
8190
o2::dataformats::MeanVertexObject mMeanVtx{};
8291
o2::steer::MCKinematicsReader mcReader; // reader of MC information
@@ -90,6 +99,13 @@ void TrackingStudySpec::init(InitContext& ic)
9099

91100
mMaxVTTimeDiff = ic.options().get<float>("max-vtx-timediff");
92101
mMaxNeighbours = ic.options().get<int>("max-vtx-neighbours");
102+
mTPCDCAYCut = ic.options().get<float>("max-tpc-dcay");
103+
mTPCDCAZCut = ic.options().get<float>("max-tpc-dcaz");
104+
mMinX = ic.options().get<float>("min-x-prop");
105+
mMaxEta = ic.options().get<float>("max-eta");
106+
mMinPt = ic.options().get<float>("min-pt");
107+
mMinTPCClusters = ic.options().get<int>("min-tpc-clusters");
108+
mDCAYFormula = ic.options().get<std::string>("dcay-vs-pt");
93109
}
94110

95111
void TrackingStudySpec::run(ProcessingContext& pc)
@@ -175,7 +191,8 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
175191
int nContAdd = 0, nContAdd0 = 0, ntITS = 0;
176192
int nAdjusted = 0;
177193
for (int is = 0; is < GTrackID::NSources; is++) {
178-
bool skipTracks = (!GTrackID::getSourceDetectorsMask(is)[GTrackID::ITS] || !mTracksSrc[is] || !recoData.isTrackSourceLoaded(is));
194+
DetID::mask_t dm = GTrackID::getSourceDetectorsMask(is);
195+
bool skipTracks = !mTracksSrc[is] || !recoData.isTrackSourceLoaded(is) || !(dm[DetID::ITS] || dm[DetID::TPC]);
179196
int idMin = vtref.getFirstEntryOfSource(is), idMax = idMin + vtref.getEntriesOfSource(is);
180197
for (int i = idMin; i < idMax; i++) {
181198
auto vid = trackIndex[i];
@@ -193,6 +210,35 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
193210
if (!prop->propagateToDCA(iv == nv - 1 ? vtxDummy : pvvec[iv], trc, prop->getNominalBz(), 2., o2::base::PropagatorF::MatCorrType::USEMatCorrLUT, &dca)) {
194211
continue;
195212
}
213+
bool hasITS = GTrackID::getSourceDetectorsMask(is)[GTrackID::ITS];
214+
bool acceptGlo = true;
215+
while (1) {
216+
// do we cound this track for global multiplicity?
217+
if (!(acceptGlo = abs(trc.getEta()) < mMaxEta && trc.getPt() > mMinPt)) {
218+
break;
219+
}
220+
if (!(acceptGlo = std::abs(dca.getY()) < (hasITS ? getDCAYCut(trc.getPt()) : mTPCDCAYCut) && std::abs(dca.getZ()) < mTPCDCAYCut && xmin < mMinX)) {
221+
break;
222+
}
223+
GTrackID tpcTrID;
224+
if (GTrackID::getSourceDetectorsMask(is)[GTrackID::TPC] && recoData.isTrackSourceLoaded(GTrackID::TPC) && (tpcTrID = recoData.getTPCContributorGID(vid))) {
225+
auto& tpcTr = recoData.getTPCTrack(tpcTrID);
226+
if (!(acceptGlo = tpcTr.getNClusters() >= mMinTPCClusters)) {
227+
break;
228+
}
229+
}
230+
if (iv != nv - 1) {
231+
pveVec[iv].nSrcA[is]++;
232+
if (ambig) {
233+
pveVec[iv].nSrcAU[is]++;
234+
}
235+
}
236+
break;
237+
}
238+
239+
if (!hasITS) {
240+
continue;
241+
}
196242
float ttime = 0, ttimeE = 0;
197243
recoData.getTrackTime(vid, ttime, ttimeE);
198244
bool acceptForPV0 = pvCont;
@@ -242,9 +288,11 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
242288
}
243289
LOGP(debug, "dt={} dz={}, tW={}, zW={} t={} tE={} {}", dt, dca.getZ(), tW, zW, ttime, ttimeE, vid.asString());
244290
}
245-
(*mDBGOut) << "dca"
246-
<< "tfID=" << TFCount << "ttime=" << ttime << "ttimeE=" << ttimeE
247-
<< "gid=" << vid << "pv=" << (iv == nv - 1 ? vtxDummy : pvvec[iv]) << "trc=" << trc << "pvCont=" << pvCont << "ambig=" << ambig << "dca=" << dca << "xmin=" << xmin << "\n";
291+
if (acceptGlo) {
292+
(*mDBGOut) << "dca"
293+
<< "tfID=" << TFCount << "ttime=" << ttime << "ttimeE=" << ttimeE
294+
<< "gid=" << vid << "pv=" << (iv == nv - 1 ? vtxDummy : pvvec[iv]) << "trc=" << trc << "pvCont=" << pvCont << "ambig=" << ambig << "dca=" << dca << "xmin=" << xmin << "\n";
295+
}
248296
}
249297
}
250298

@@ -394,6 +442,12 @@ void TrackingStudySpec::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
394442
}
395443
}
396444

445+
float TrackingStudySpec::getDCAYCut(float pt) const
446+
{
447+
static TF1 fun("dcayvspt", mDCAYFormula.c_str(), 0, 20);
448+
return fun.Eval(pt);
449+
}
450+
397451
DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mask_t srcClusters, bool useMC)
398452
{
399453
std::vector<OutputSpec> outputs;
@@ -420,6 +474,13 @@ DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mas
420474
Options{
421475
{"max-vtx-neighbours", VariantType::Int, 3, {"Max PV neighbours fill, no PV study if < 0"}},
422476
{"max-vtx-timediff", VariantType::Float, 90.f, {"Max PV time difference to consider"}},
477+
{"dcay-vs-pt", VariantType::String, "0.0105 + 0.0350 / pow(x, 1.1)", {"Formula for global tracks DCAy vs pT cut"}},
478+
{"min-tpc-clusters", VariantType::Int, 60, {"Cut on TPC clusters"}},
479+
{"max-tpc-dcay", VariantType::Float, 2.f, {"Cut on TPC dcaY"}},
480+
{"max-tpc-dcaz", VariantType::Float, 2.f, {"Cut on TPC dcaZ"}},
481+
{"max-eta", VariantType::Float, 0.8f, {"Cut on track eta"}},
482+
{"min-pt", VariantType::Float, 0.1f, {"Cut on track pT"}},
483+
{"min-x-prop", VariantType::Float, 6.f, {"track should be propagated to this X at least"}},
423484
}};
424485
}
425486

0 commit comments

Comments
 (0)