|
33 | 33 | #include "DetectorsBase/GRPGeomHelper.h" |
34 | 34 | #include "GlobalTrackingStudy/TrackingStudy.h" |
35 | 35 | #include "GlobalTrackingStudy/TrackInfoExt.h" |
| 36 | +#include "GlobalTrackingStudy/TrackMCStudyTypes.h" |
36 | 37 | #include "TPCBase/ParameterElectronics.h" |
37 | 38 | #include "ReconstructionDataFormats/PrimaryVertex.h" |
38 | 39 | #include "ReconstructionDataFormats/PrimaryVertexExt.h" |
@@ -108,6 +109,7 @@ class TrackingStudySpec : public Task |
108 | 109 | int mNHBPerTF = 0; |
109 | 110 | float mNTPCOccBinLengthInv; |
110 | 111 | bool mStoreWithITSOnly = false; |
| 112 | + bool mDoPairsCorr = false; |
111 | 113 | std::string mDCAYFormula = "0.0105 + 0.0350 / pow(x, 1.1)"; |
112 | 114 | std::string mDCAZFormula = "0.0105 + 0.0350 / pow(x, 1.1)"; |
113 | 115 | GTrackID::mask_t mTracksSrc{}; |
@@ -136,6 +138,7 @@ void TrackingStudySpec::init(InitContext& ic) |
136 | 138 | mMinTPCClusters = ic.options().get<int>("min-tpc-clusters"); |
137 | 139 | mDCAYFormula = ic.options().get<std::string>("dcay-vs-pt"); |
138 | 140 | mDCAZFormula = ic.options().get<std::string>("dcaz-vs-pt"); |
| 141 | + mDoPairsCorr = ic.options().get<bool>("pair-correlations"); |
139 | 142 | } |
140 | 143 |
|
141 | 144 | void TrackingStudySpec::run(ProcessingContext& pc) |
@@ -245,6 +248,7 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) |
245 | 248 | float tBiasITS = alpParams.roFrameBiasInBC * o2::constants::lhc::LHCBunchSpacingMUS; |
246 | 249 | const o2::ft0::InteractionTag& ft0Params = o2::ft0::InteractionTag::Instance(); |
247 | 250 | std::vector<o2::dataformats::TrackInfoExt> trcExtVec; |
| 251 | + std::vector<o2::trackstudy::TrackPairInfo> trcPairsVec; |
248 | 252 | auto vdrit = mTPCVDriftHelper.getVDriftObject().getVDrift(); |
249 | 253 | bool tpcTrackOK = recoData.isTrackSourceLoaded(GTrackID::TPC); |
250 | 254 |
|
@@ -278,6 +282,82 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) |
278 | 282 | } |
279 | 283 | }; |
280 | 284 |
|
| 285 | + auto getTPCPairSharing = [&recoData, this](const o2::tpc::TrackTPC& trc0, const o2::tpc::TrackTPC& trc1) { |
| 286 | + const auto clRefs = recoData.getTPCTracksClusterRefs(); |
| 287 | + const auto shMap = recoData.clusterShMapTPC.data(); |
| 288 | + uint8_t nsh = 0, nshRows = 0, lastSharedRow = -1; |
| 289 | + if (recoData.inputsTPCclusters) { |
| 290 | + uint8_t clSect0 = 0, clRow0 = 0, clSect1 = 0, clRow1 = 0; |
| 291 | + uint32_t clIdx0 = 0, clIdx1 = 0; |
| 292 | + int ic1Start = 0; |
| 293 | + for (int ic0 = 0; ic0 < trc0.getNClusterReferences(); ic0++) { // outside -> inside |
| 294 | + trc0.getClusterReference(clRefs, ic0, clSect0, clRow0, clIdx0); |
| 295 | + for (int ic1 = ic1Start; ic1 < trc1.getNClusterReferences(); ic1++) { // outside -> inside |
| 296 | + trc1.getClusterReference(clRefs, ic1, clSect1, clRow1, clIdx1); |
| 297 | + if (clRow1 > clRow0) { |
| 298 | + ic1Start = ic1 + 1; |
| 299 | + continue; // catch up ic0 |
| 300 | + } |
| 301 | + if (clRow1 == clRow0) { |
| 302 | + if (clSect0 == clSect1 && clIdx0 == clIdx1) { |
| 303 | + nsh++; |
| 304 | + if (lastSharedRow != clRow0) { |
| 305 | + lastSharedRow = clRow0; |
| 306 | + nshRows++; |
| 307 | + } |
| 308 | + ic1Start = ic1 + 1; |
| 309 | + break; // check next ic0 |
| 310 | + } |
| 311 | + } |
| 312 | + } |
| 313 | + } |
| 314 | + } |
| 315 | + return std::make_pair(nsh, nshRows); |
| 316 | + }; |
| 317 | + |
| 318 | + auto assignRecTrack = [&recoData, this](const o2::dataformats::TrackInfoExt& src, o2::trackstudy::RecTrack& dst) { |
| 319 | + dst.track = src.track; |
| 320 | + dst.gid = src.gid; |
| 321 | + dst.ts.setTimeStamp(src.ttime); |
| 322 | + dst.ts.setTimeStampError(src.ttimeE); |
| 323 | + dst.nClITS = src.nClITS; |
| 324 | + dst.nClTPC = src.nClTPC; |
| 325 | + dst.pattITS = src.pattITS; |
| 326 | + if (src.q2ptITS == 0. && dst.nClITS > 0) { |
| 327 | + dst.pattITS |= 0x1 << 7; |
| 328 | + } |
| 329 | + dst.lowestPadRow = src.rowMinTPC; |
| 330 | + if (this->mUseMC) { |
| 331 | + auto gidSet = recoData.getSingleDetectorRefs(src.gid); |
| 332 | + if (recoData.getTrackMCLabel(src.gid).isFake()) { |
| 333 | + dst.flags |= RecTrack::FakeGLO; |
| 334 | + } |
| 335 | + auto msk = src.gid.getSourceDetectorsMask(); |
| 336 | + if (msk[DetID::ITS]) { |
| 337 | + if (gidSet[GTrackID::ITS].isSourceSet()) { // has ITS track rather than AB tracklet |
| 338 | + auto lblITS = recoData.getTrackMCLabel(gidSet[GTrackID::ITS]); |
| 339 | + if (lblITS.isFake()) { |
| 340 | + dst.flags |= RecTrack::FakeITS; |
| 341 | + } |
| 342 | + } else { // AB ITS tracklet |
| 343 | + if (recoData.getTrackMCLabel(gidSet[GTrackID::ITSAB]).isFake()) { |
| 344 | + dst.flags |= RecTrack::FakeITS; |
| 345 | + } |
| 346 | + } |
| 347 | + if (msk[DetID::TPC]) { // has both ITS and TPC contribution |
| 348 | + if (recoData.getTrackMCLabel(gidSet[GTrackID::ITSTPC]).isFake()) { |
| 349 | + dst.flags |= RecTrack::FakeITSTPC; |
| 350 | + } |
| 351 | + } |
| 352 | + } |
| 353 | + if (msk[DetID::TPC]) { |
| 354 | + if (recoData.getTrackMCLabel(gidSet[GTrackID::TPC]).isFake()) { |
| 355 | + dst.flags |= RecTrack::FakeTPC; |
| 356 | + } |
| 357 | + } |
| 358 | + } |
| 359 | + }; |
| 360 | + |
281 | 361 | for (int iv = 0; iv < nv; iv++) { |
282 | 362 | LOGP(debug, "processing PV {} of {}", iv, nv); |
283 | 363 | const auto& vtref = vtxRefs[iv]; |
@@ -309,6 +389,7 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) |
309 | 389 | pve.VtxID = iv; |
310 | 390 | } |
311 | 391 | trcExtVec.clear(); |
| 392 | + trcPairsVec.clear(); |
312 | 393 | float q2ptITS, q2ptTPC, q2ptITSTPC, q2ptITSTPCTRD; |
313 | 394 | for (int is = 0; is < GTrackID::NSources; is++) { |
314 | 395 | DetID::mask_t dm = GTrackID::getSourceDetectorsMask(is); |
@@ -444,6 +525,42 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) |
444 | 525 | << "orbit=" << recoData.startIR.orbit << "tfID=" << TFCount |
445 | 526 | << "tpcOccBef=" << tpcOccBef << "tpcOccAft=" << tpcOccAft |
446 | 527 | << "pve=" << pveVec[iv] << "trc=" << trcExtVec << "\n"; |
| 528 | + |
| 529 | + if (mDoPairsCorr) { |
| 530 | + for (int it0 = 0; it0 < (int)trcExtVec.size(); it0++) { |
| 531 | + const auto& tr0 = trcExtVec[it0]; |
| 532 | + if (tr0.nClTPC < 1) { |
| 533 | + continue; |
| 534 | + } |
| 535 | + for (int it1 = it0 + 1; it1 < (int)trcExtVec.size(); it1++) { |
| 536 | + const auto& tr1 = trcExtVec[it1]; |
| 537 | + if (tr1.nClTPC < 1) { |
| 538 | + continue; |
| 539 | + } |
| 540 | + |
| 541 | + if (std::abs(tr0.track.getTgl() - tr1.track.getTgl()) > 0.25) { |
| 542 | + continue; |
| 543 | + } |
| 544 | + auto dphi = tr0.track.getPhi() - tr1.track.getPhi(); |
| 545 | + if (dphi < -o2::constants::math::PI) { |
| 546 | + dphi += o2::constants::math::TwoPI; |
| 547 | + } else if (dphi > o2::constants::math::PI) { |
| 548 | + dphi -= o2::constants::math::TwoPI; |
| 549 | + } |
| 550 | + if (std::abs(dphi) > 0.25) { |
| 551 | + continue; |
| 552 | + } |
| 553 | + auto& pr = trcPairsVec.emplace_back(); |
| 554 | + assignRecTrack(tr0, pr.tr0); |
| 555 | + assignRecTrack(tr1, pr.tr1); |
| 556 | + auto shinfo = getTPCPairSharing(recoData.getTPCTrack(recoData.getTPCContributorGID(tr0.gid)), recoData.getTPCTrack(recoData.getTPCContributorGID(tr1.gid))); |
| 557 | + pr.nshTPC = shinfo.first; |
| 558 | + pr.nshTPCRow = shinfo.second; |
| 559 | + } |
| 560 | + } |
| 561 | + } |
| 562 | + (*mDBGOut) << "pairs" |
| 563 | + << "pr=" << trcPairsVec << "\n"; |
447 | 564 | } |
448 | 565 |
|
449 | 566 | int nvtot = mMaxNeighbours < 0 ? -1 : (int)pveVec.size(); |
@@ -600,6 +717,7 @@ DataProcessorSpec getTrackingStudySpec(GTrackID::mask_t srcTracks, GTrackID::mas |
600 | 717 | {"max-eta", VariantType::Float, 1.0f, {"Cut on track eta"}}, |
601 | 718 | {"min-pt", VariantType::Float, 0.1f, {"Cut on track pT"}}, |
602 | 719 | {"with-its-only", VariantType::Bool, false, {"Store tracks with ITS only"}}, |
| 720 | + {"pair-correlations", VariantType::Bool, false, {"Do pairs correlation"}}, |
603 | 721 | {"min-x-prop", VariantType::Float, 100.f, {"track should be propagated to this X at least"}}, |
604 | 722 | }; |
605 | 723 | o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs); |
|
0 commit comments