Skip to content

Commit 3e5abd9

Browse files
committed
Group tracks per vertex in the TrackingStudy output, extra info
1 parent b193088 commit 3e5abd9

File tree

6 files changed

+118
-130
lines changed

6 files changed

+118
-130
lines changed

DataFormats/Reconstruction/include/ReconstructionDataFormats/PrimaryVertexExt.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,11 @@ struct PrimaryVertexExt : public PrimaryVertex {
2727
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrc{}; // N contributors for each source type
2828
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrcA{}; // N associated and passing cuts for each source type
2929
std::array<uint16_t, o2::dataformats::GlobalTrackID::Source::NSources> nSrcAU{}; // N ambgous associated and passing cuts for each source type
30-
int VtxID = -1; // original vtx ID
30+
double FT0Time = -1.; // time of closest FT0 trigger
3131
float FT0A = -1; // amplitude of closest FT0 A side
3232
float FT0C = -1; // amplitude of closest FT0 C side
33-
float FT0Time = -1.; // time of closest FT0 trigger
34-
float rmsT = 0;
35-
float rmsZ = 0;
36-
float rmsTW = 0;
37-
float rmsZW = 0;
38-
float rmsT0 = 0; // w/o ITS
39-
float rmsTW0 = 0; // w/o ITS
40-
float tMAD = 0;
41-
float zMAD = 0;
33+
int VtxID = -1; // original vtx ID
34+
4235
int getNSrc(int i) const { return nSrc[i]; }
4336
int getNSrcA(int i) const { return nSrcA[i]; }
4437
int getNSrcAU(int i) const { return nSrcAU[i]; }
@@ -48,7 +41,7 @@ struct PrimaryVertexExt : public PrimaryVertex {
4841
std::string asString() const;
4942
#endif
5043

51-
ClassDefNV(PrimaryVertexExt, 5);
44+
ClassDefNV(PrimaryVertexExt, 6);
5245
};
5346

5447
#ifndef GPUCA_ALIGPUCODE

Detectors/GlobalTrackingWorkflow/study/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ o2_add_library(GlobalTrackingStudy
2020
src/ITSOffsStudy.cxx
2121
src/DumpTracks.cxx
2222
src/V0Ext.cxx
23+
src/TrackInfoExt.cxx
2324
PUBLIC_LINK_LIBRARIES O2::GlobalTracking
2425
O2::GlobalTrackingWorkflowReaders
2526
O2::GlobalTrackingWorkflowHelpers
@@ -31,6 +32,7 @@ o2_add_library(GlobalTrackingStudy
3132
o2_target_root_dictionary(
3233
GlobalTrackingStudy
3334
HEADERS include/GlobalTrackingStudy/V0Ext.h
35+
include/GlobalTrackingStudy/TrackInfoExt.h
3436
)
3537

3638
o2_add_executable(study-workflow
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
// class for extended Track info (for debugging)
13+
14+
#ifndef ALICEO2_TRINFOEXT_H
15+
#define ALICEO2_TRINFOEXT_H
16+
17+
#include "ReconstructionDataFormats/MatchInfoTOF.h"
18+
#include "ReconstructionDataFormats/DCA.h"
19+
#include "ReconstructionDataFormats/VtxTrackIndex.h"
20+
#include "ReconstructionDataFormats/Track.h"
21+
22+
namespace o2
23+
{
24+
namespace dataformats
25+
{
26+
27+
struct TrackInfoExt {
28+
o2::track::TrackParCov track;
29+
DCA dca{};
30+
VtxTrackIndex gid;
31+
MatchInfoTOF infoTOF;
32+
float ttime = 0;
33+
float ttimeE = 0;
34+
float xmin = 0;
35+
float chi2ITSTPC = 0.f;
36+
float q2ptITS = 0.f;
37+
float q2ptTPC = 0.f;
38+
float q2ptITSTPC = 0.f;
39+
float q2ptITSTPCTRD = 0.f;
40+
int nClTPC = 0;
41+
int nClITS = 0;
42+
int pattITS = 0;
43+
ClassDefNV(TrackInfoExt, 1);
44+
};
45+
46+
} // namespace dataformats
47+
} // namespace o2
48+
49+
#endif

Detectors/GlobalTrackingWorkflow/study/src/GlobalTrackingStudyLinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#pragma link C++ class o2::dataformats::ProngInfoExt + ;
1919
#pragma link C++ class o2::dataformats::V0Ext + ;
20+
#pragma link C++ class o2::dataformats::TrackInfoExt + ;
21+
#pragma link C++ class std::vector < o2::dataformats::TrackInfoExt> + ;
2022
#pragma link C++ class std::vector < o2::dataformats::ProngInfoExt> + ;
2123
#pragma link C++ class std::vector < o2::dataformats::V0Ext> + ;
2224

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
// class for extended track info (for debugging)
13+
14+
#include "GlobalTrackingStudy/TrackInfoExt.h"

Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx

Lines changed: 47 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <vector>
1313
#include <TStopwatch.h>
1414
#include "DataFormatsGlobalTracking/RecoContainer.h"
15+
#include "DataFormatsITSMFT/TrkClusRef.h"
1516
#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h"
1617
#include "ReconstructionDataFormats/TrackTPCITS.h"
1718
#include "ReconstructionDataFormats/GlobalTrackID.h"
@@ -30,6 +31,7 @@
3031
#include "DetectorsCommonDataFormats/DetID.h"
3132
#include "DetectorsBase/GRPGeomHelper.h"
3233
#include "GlobalTrackingStudy/TrackingStudy.h"
34+
#include "GlobalTrackingStudy/TrackInfoExt.h"
3335
#include "TPCBase/ParameterElectronics.h"
3436
#include "ReconstructionDataFormats/PrimaryVertex.h"
3537
#include "ReconstructionDataFormats/PrimaryVertexExt.h"
@@ -80,7 +82,7 @@ class TrackingStudySpec : public Task
8082
float mMaxVTTimeDiff = 80.; // \mus
8183
float mTPCDCAYCut = 2.;
8284
float mTPCDCAZCut = 2.;
83-
float mMinX = 6.;
85+
float mMinX = 46.;
8486
float mMaxEta = 0.8;
8587
float mMinPt = 0.1;
8688
int mMinTPCClusters = 60;
@@ -144,23 +146,19 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
144146
static int TFCount = 0;
145147
int nv = vtxRefs.size();
146148
o2::dataformats::PrimaryVertexExt pveDummy;
147-
o2::dataformats::PrimaryVertex vtxDummy(mMeanVtx.getPos(), {}, {}, 0);
148-
std::vector<o2::dataformats::PrimaryVertexExt> pveVec(nv - 1);
149+
o2::dataformats::PrimaryVertexExt vtxDummy(mMeanVtx.getPos(), {}, {}, 0);
150+
std::vector<o2::dataformats::PrimaryVertexExt> pveVec(nv);
151+
pveVec.back() = vtxDummy;
149152
const auto& alpParams = o2::itsmft::DPLAlpideParam<o2::detectors::DetID::ITS>::Instance();
150153
float tBiasITS = alpParams.roFrameBiasInBC * o2::constants::lhc::LHCBunchSpacingMUS;
151-
std::vector<float> dtvec, dzvec;
152154
const o2::ft0::InteractionTag& ft0Params = o2::ft0::InteractionTag::Instance();
153-
155+
std::vector<o2::dataformats::TrackInfoExt> trcExtVec;
154156
for (int iv = 0; iv < nv; iv++) {
155157
LOGP(debug, "processing PV {} of {}", iv, nv);
156158
const auto& vtref = vtxRefs[iv];
157159
if (iv != nv - 1) {
158160
auto& pve = pveVec[iv];
159161
static_cast<o2::dataformats::PrimaryVertex&>(pve) = pvvec[iv];
160-
dtvec.clear();
161-
dzvec.clear();
162-
dtvec.reserve(pve.getNContributors());
163-
dzvec.reserve(pve.getNContributors());
164162
float bestTimeDiff = 1000, bestTime = -999;
165163
int bestFTID = -1;
166164
if (mTracksSrc[GTrackID::FT0]) {
@@ -180,16 +178,11 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
180178
if (bestFTID >= 0) {
181179
pve.FT0A = FITInfo[bestFTID].getTrigger().getAmplA();
182180
pve.FT0C = FITInfo[bestFTID].getTrigger().getAmplC();
183-
pve.FT0Time = FITInfo[bestFTID].getInteractionRecord().differenceInBCMUS(recoData.startIR);
181+
pve.FT0Time = double(FITInfo[bestFTID].getInteractionRecord().differenceInBCMUS(recoData.startIR)) + FITInfo[bestFTID].getCollisionTimeMean() * 1e-6; // time in \mus
184182
}
185183
pve.VtxID = iv;
186184
}
187-
float meanT = 0, meanZ = 0, rmsT = 0, rmsZ = 0;
188-
float meanTW = 0, meanZW = 0, rmsTW = 0, rmsZW = 0, WT = 0, WZ = 0;
189-
float meanT0 = 0, rmsT0 = 0;
190-
float meanTW0 = 0, rmsTW0 = 0, WT0 = 0;
191-
int nContAdd = 0, nContAdd0 = 0, ntITS = 0;
192-
int nAdjusted = 0;
185+
trcExtVec.clear();
193186
float q2ptITS, q2ptTPC, q2ptITSTPC, q2ptITSTPCTRD;
194187
for (int is = 0; is < GTrackID::NSources; is++) {
195188
DetID::mask_t dm = GTrackID::getSourceDetectorsMask(is);
@@ -213,6 +206,7 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
213206
}
214207
bool hasITS = GTrackID::getSourceDetectorsMask(is)[GTrackID::ITS];
215208
bool acceptGlo = true;
209+
int nclTPC = 0, nclITS = 0, pattITS = 0;
216210
while (1) {
217211
// do we cound this track for global multiplicity?
218212
if (!(acceptGlo = abs(trc.getEta()) < mMaxEta && trc.getPt() > mMinPt)) {
@@ -224,7 +218,7 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
224218
GTrackID tpcTrID;
225219
if (GTrackID::getSourceDetectorsMask(is)[GTrackID::TPC] && recoData.isTrackSourceLoaded(GTrackID::TPC) && (tpcTrID = recoData.getTPCContributorGID(vid))) {
226220
auto& tpcTr = recoData.getTPCTrack(tpcTrID);
227-
if (!(acceptGlo = tpcTr.getNClusters() >= mMinTPCClusters)) {
221+
if (!(acceptGlo = (nclTPC = tpcTr.getNClusters()) >= mMinTPCClusters)) {
228222
break;
229223
}
230224
}
@@ -236,124 +230,58 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData)
236230
}
237231
break;
238232
}
239-
240233
if (!hasITS) {
241234
continue;
242235
}
243-
float ttime = 0, ttimeE = 0;
244-
recoData.getTrackTime(vid, ttime, ttimeE);
245-
bool acceptForPV0 = pvCont;
246-
if (vid.getSource() == GTrackID::ITS) {
247-
ttimeE *= mITSROFrameLengthMUS;
248-
ttime += ttimeE + tBiasITS;
249-
ttimeE *= 1. / sqrt(3);
250-
if (++ntITS > 0) { // do not allow ITS in the MAD
251-
acceptForPV0 = false;
252-
}
253-
} else if (vid.getSource() == GTrackID::ITSTPC) {
254-
float bcf = ttime / o2::constants::lhc::LHCBunchSpacingMUS + o2::constants::lhc::LHCMaxBunches;
255-
int bcWrtROF = int(bcf - alpParams.roFrameBiasInBC) % alpParams.roFrameLengthInBC;
256-
if (bcWrtROF == 0) {
257-
float dbc = bcf - (int(bcf / alpParams.roFrameBiasInBC)) * alpParams.roFrameBiasInBC;
258-
if (std::abs(dbc) < 1e-6 && (++nAdjusted) > 1) {
259-
acceptForPV0 = false; // do not allow more than 1 adjusted track MAD
260-
}
261-
}
262-
} else if (vid.getSource() == GTrackID::TPC) {
263-
ttimeE *= o2::constants::lhc::LHCBunchSpacingMUS * 8;
264-
}
265-
if (pvCont) {
266-
float dt = ttime - pveVec[iv].getTimeStamp().getTimeStamp();
267-
float tW = 1. / (ttimeE * ttimeE), zW = 1. / trc.getSigmaZ2();
268-
dzvec.push_back(dca.getZ());
269-
WT += tW;
270-
WZ += zW;
271-
meanT += dt;
272-
meanTW += dt * tW;
273-
meanZ += dca.getZ();
274-
meanZW += dca.getZ() * zW;
275-
276-
rmsT += dt * dt;
277-
rmsTW += dt * dt * tW;
278-
rmsZ += dca.getZ() * dca.getZ();
279-
rmsZW += dca.getZ() * dca.getZ() * zW;
280-
nContAdd++;
281-
if (acceptForPV0) {
282-
dtvec.push_back(dt);
283-
WT0 += tW;
284-
meanT0 += dt;
285-
meanTW0 += dt * tW;
286-
rmsT0 += dt * dt;
287-
rmsTW0 += dt * dt * tW;
288-
nContAdd0++;
289-
}
290-
LOGP(debug, "dt={} dz={}, tW={}, zW={} t={} tE={} {}", dt, dca.getZ(), tW, zW, ttime, ttimeE, vid.asString());
291-
}
292236
if (acceptGlo) {
293-
q2ptITS = q2ptTPC = q2ptITSTPC = q2ptITSTPCTRD = 0.;
237+
auto& trcExt = trcExtVec.emplace_back();
238+
recoData.getTrackTime(vid, trcExt.ttime, trcExt.ttimeE);
239+
trcExt.track = trc;
240+
trcExt.dca = dca;
241+
trcExt.gid = vid;
242+
trcExt.xmin = xmin;
294243
auto gidRefs = recoData.getSingleDetectorRefs(vid);
295244
if (gidRefs[GTrackID::ITS].isIndexSet()) {
296-
q2ptITS = recoData.getTrackParam(gidRefs[GTrackID::ITS]).getQ2Pt();
245+
const auto& itsTr = recoData.getITSTrack(gidRefs[GTrackID::ITS]);
246+
trcExt.q2ptITS = itsTr.getQ2Pt();
247+
trcExt.nClITS = itsTr.getNClusters();
248+
for (int il = 0; il < 7; il++) {
249+
if (itsTr.hasHitOnLayer(il)) {
250+
trcExt.pattITS |= 0x1 << il;
251+
}
252+
}
253+
} else if (gidRefs[GTrackID::ITSAB].isIndexSet()) {
254+
const auto& itsTrf = recoData.getITSABRefs()[gidRefs[GTrackID::ITSAB]];
255+
trcExt.nClITS = itsTrf.getNClusters();
256+
for (int il = 0; il < 7; il++) {
257+
if (itsTrf.hasHitOnLayer(il)) {
258+
trcExt.pattITS |= 0x1 << il;
259+
}
260+
}
297261
}
298262
if (gidRefs[GTrackID::TPC].isIndexSet()) {
299-
q2ptTPC = recoData.getTrackParam(gidRefs[GTrackID::TPC]).getQ2Pt();
263+
trcExt.q2ptTPC = recoData.getTrackParam(gidRefs[GTrackID::TPC]).getQ2Pt();
264+
trcExt.nClTPC = nclTPC;
300265
}
301266
if (gidRefs[GTrackID::ITSTPC].isIndexSet()) {
302-
q2ptITSTPC = recoData.getTrackParam(gidRefs[GTrackID::ITSTPC]).getQ2Pt();
267+
const auto& trTPCITS = recoData.getTPCITSTrack(gidRefs[GTrackID::ITSTPC]);
268+
trcExt.q2ptITSTPC = trTPCITS.getQ2Pt();
269+
trcExt.chi2ITSTPC = trTPCITS.getChi2Match();
303270
}
304271
if (gidRefs[GTrackID::TRD].isIndexSet()) {
305-
q2ptITSTPCTRD = recoData.getTrackParam(gidRefs[GTrackID::TRD]).getQ2Pt();
272+
trcExt.q2ptITSTPCTRD = recoData.getTrackParam(gidRefs[GTrackID::TRD]).getQ2Pt();
273+
}
274+
if (gidRefs[GTrackID::TOF].isIndexSet()) {
275+
trcExt.infoTOF = recoData.getTOFMatch(vid);
306276
}
307-
308-
(*mDBGOut) << "dca"
309-
<< "tfID=" << TFCount << "ttime=" << ttime << "ttimeE=" << ttimeE
310-
<< "gid=" << vid << "pvid=" << (iv == nv - 1 ? -1 : iv) << "pv=" << (iv == nv - 1 ? vtxDummy : pvvec[iv])
311-
<< "trc=" << trc << "pvCont=" << pvCont << "ambig=" << ambig << "dca=" << dca << "xmin=" << xmin
312-
<< "q2ptITS=" << q2ptITS << "q2ptTPC=" << q2ptTPC << "q2ptITSTPC=" << q2ptITSTPC << "q2ptITSTPCTRD=" << q2ptITSTPCTRD
313-
<< "\n";
314277
}
315278
}
316279
}
317-
318-
if (iv != nv - 1) {
319-
auto& pve = pveVec[iv];
320-
if (nContAdd) {
321-
rmsT /= nContAdd;
322-
rmsZ /= nContAdd;
323-
meanT /= nContAdd;
324-
meanZ /= nContAdd;
325-
pve.rmsT = (rmsT - meanT * meanT);
326-
pve.rmsT = pve.rmsT > 0 ? std::sqrt(pve.rmsT) : 0;
327-
pve.rmsZ = rmsZ - meanZ * meanZ;
328-
pve.rmsZ = pve.rmsZ > 0 ? std::sqrt(pve.rmsZ) : 0;
329-
}
330-
if (nContAdd0) {
331-
rmsT0 /= nContAdd0;
332-
meanT0 /= nContAdd0;
333-
pve.rmsT0 = (rmsT0 - meanT0 * meanT0);
334-
pve.rmsT0 = pve.rmsT0 > 0 ? std::sqrt(pve.rmsT0) : 0;
335-
}
336-
if (WT0 > 0) {
337-
rmsTW0 /= WT0;
338-
meanTW0 /= WT0;
339-
pve.rmsTW0 = (rmsTW0 - meanTW0 * meanTW0);
340-
pve.rmsTW0 = pve.rmsTW0 > 0 ? std::sqrt(pve.rmsTW0) : 0;
341-
}
342-
//
343-
if (WT > 0 && WZ > 0) {
344-
rmsTW /= WT;
345-
meanTW /= WT;
346-
pve.rmsTW = (rmsTW - meanTW * meanTW);
347-
pve.rmsTW = pve.rmsTW > 0 ? std::sqrt(pve.rmsTW) : 0;
348-
rmsZW /= WZ;
349-
meanZW /= WZ;
350-
pve.rmsZW = rmsZW - meanZW * meanZW;
351-
pve.rmsZW = pve.rmsZ > 0 ? std::sqrt(pve.rmsZ) : 0;
352-
}
353-
pve.tMAD = o2::math_utils::MAD2Sigma(dtvec.size(), dtvec.data());
354-
pve.zMAD = o2::math_utils::MAD2Sigma(dzvec.size(), dzvec.data());
355-
}
280+
(*mDBGOut) << "trpv"
281+
<< "orbit=" << recoData.startIR.orbit << "tfID=" << TFCount
282+
<< "pve=" << pveVec[iv] << "trc=" << trcExtVec << "\n";
356283
}
284+
357285
int nvtot = mMaxNeighbours < 0 ? -1 : (int)pveVec.size();
358286

359287
auto insSlot = [maxSlots = mMaxNeighbours](std::vector<float>& vc, float v, int slot, std::vector<int>& vid, int id) {
@@ -499,7 +427,7 @@ DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mas
499427
{"max-tpc-dcaz", VariantType::Float, 2.f, {"Cut on TPC dcaZ"}},
500428
{"max-eta", VariantType::Float, 0.8f, {"Cut on track eta"}},
501429
{"min-pt", VariantType::Float, 0.1f, {"Cut on track pT"}},
502-
{"min-x-prop", VariantType::Float, 6.f, {"track should be propagated to this X at least"}},
430+
{"min-x-prop", VariantType::Float, 46.f, {"track should be propagated to this X at least"}},
503431
}};
504432
}
505433

0 commit comments

Comments
 (0)