|
23 | 23 | #include "PWGDQ/Core/MixingLibrary.h" |
24 | 24 | #include "PWGDQ/Core/VarManager.h" |
25 | 25 | #include "PWGDQ/DataModel/ReducedInfoTables.h" |
26 | | -#include <DetectorsVertexing/PVertexer.h> |
27 | | -#include <ReconstructionDataFormats/Track.h> |
28 | | -#include <Common/Core/trackUtilities.h> |
29 | 26 |
|
30 | 27 | #include "Common/Core/PID/PIDTOFParamService.h" |
31 | 28 | #include "Common/Core/TableHelper.h" |
|
34 | 31 | #include "Common/DataModel/McCollisionExtra.h" |
35 | 32 | #include "Common/DataModel/Multiplicity.h" |
36 | 33 | #include "Common/DataModel/TrackSelectionTables.h" |
| 34 | +#include <Common/Core/trackUtilities.h> |
37 | 35 |
|
38 | 36 | #include "CCDB/BasicCCDBManager.h" |
39 | 37 | #include "DataFormatsParameters/GRPMagField.h" |
|
46 | 44 | #include "Framework/AnalysisHelpers.h" |
47 | 45 | #include "Framework/AnalysisTask.h" |
48 | 46 | #include "Framework/runDataProcessing.h" |
| 47 | +#include <DetectorsVertexing/PVertexer.h> |
| 48 | +#include <ReconstructionDataFormats/Track.h> |
49 | 49 |
|
50 | 50 | #include "TGeoGlobalMagField.h" |
51 | 51 | #include <TH1F.h> |
@@ -1163,7 +1163,6 @@ struct AnalysisSameEventPairing { |
1163 | 1163 | std::vector<o2::track::TrackParCov> pvContribTrackPars; |
1164 | 1164 | std::vector<bool> vec_useTrk_PVrefit; |
1165 | 1165 |
|
1166 | | - |
1167 | 1166 | // keep histogram class names in maps, so we don't have to buld their names in the pair loops |
1168 | 1167 | std::map<int, std::vector<TString>> fTrackHistNames; |
1169 | 1168 | std::map<int, std::vector<TString>> fBarrelHistNamesMCmatched; |
@@ -1509,17 +1508,16 @@ struct AnalysisSameEventPairing { |
1509 | 1508 | cout << "AnalysisSameEventPairing::init() completed" << endl; |
1510 | 1509 | } |
1511 | 1510 |
|
1512 | | - |
1513 | 1511 | void initParamsFromCCDB(uint64_t timestamp, bool withTwoProngFitter = true) |
1514 | 1512 | { |
1515 | 1513 | cout << "AnalysisSameEventPairing::initParamsFromCCDB() called for timestamp " << timestamp << endl; |
1516 | 1514 | if (fConfigOptions.useRemoteField.value) { |
1517 | 1515 | o2::parameters::GRPMagField* grpmag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(fConfigCCDB.grpMagPath, timestamp); |
1518 | | - o2::base::MatLayerCylSet* lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(fCCDB->get<o2::base::MatLayerCylSet>(fConfigCCDB.lutPath)); |
| 1516 | + o2::base::MatLayerCylSet* lut = o2::base::MatLayerCylSet::rectifyPtrFromFile(fCCDB->get<o2::base::MatLayerCylSet>(fConfigCCDB.lutPath)); |
1519 | 1517 | float magField = 0.0; |
1520 | 1518 | if (grpmag != nullptr) { |
1521 | 1519 | magField = grpmag->getNominalL3Field(); |
1522 | | - o2::base::Propagator::initFieldFromGRP(grpmag); |
| 1520 | + o2::base::Propagator::initFieldFromGRP(grpmag); |
1523 | 1521 | o2::base::Propagator::Instance()->setMatLUT(lut); |
1524 | 1522 | } else { |
1525 | 1523 | LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", timestamp); |
@@ -1549,53 +1547,56 @@ struct AnalysisSameEventPairing { |
1549 | 1547 | cout << "AnalysisSameEventPairing::initParamsFromCCDB() completed" << endl; |
1550 | 1548 | } |
1551 | 1549 |
|
1552 | | -template <typename Events, typename TTracks, typename Tracks> |
1553 | | -bool refitPVWithPVertexer(Events const& collision, TTracks const& tracks, Tracks const& t1, Tracks const& t2, o2::dataformats::VertexBase& pvRefitted) |
1554 | | -{ |
1555 | | - // --- build PV contributor list --- |
1556 | | - pvContribGlobIDs.clear(); |
1557 | | - pvContribTrackPars.clear(); |
1558 | | - // int nMyPVContrib = 0; int nMyPVContribOrig = 0; |
1559 | | - for (auto const& trk : tracks) { |
1560 | | - // check if it is PV contributor |
1561 | | - if (!trk.isPVContributor()) continue; |
1562 | | - // check if it contributes to the vtx of this collision |
1563 | | - if (trk.collisionId() != collision.globalIndex()) continue; |
1564 | | - // nMyPVContribOrig++; |
1565 | | - // --- remove t1 and t2 if they are PV contributors --- |
1566 | | - if (trk.globalIndex() == t1.globalIndex() || trk.globalIndex() == t2.globalIndex()) continue; |
1567 | | - // add tracks and parameters to the list |
1568 | | - pvContribGlobIDs.push_back(trk.globalIndex()); |
1569 | | - pvContribTrackPars.push_back(getTrackParCov(trk)); |
1570 | | - // nMyPVContrib++; |
1571 | | - } |
| 1550 | + template <typename Events, typename TTracks, typename Tracks> |
| 1551 | + bool refitPVWithPVertexer(Events const& collision, TTracks const& tracks, Tracks const& t1, Tracks const& t2, o2::dataformats::VertexBase& pvRefitted) |
| 1552 | + { |
| 1553 | + // --- build PV contributor list --- |
| 1554 | + pvContribGlobIDs.clear(); |
| 1555 | + pvContribTrackPars.clear(); |
| 1556 | + // int nMyPVContrib = 0; int nMyPVContribOrig = 0; |
| 1557 | + for (auto const& trk : tracks) { |
| 1558 | + // check if it is PV contributor |
| 1559 | + if (!trk.isPVContributor()) |
| 1560 | + continue; |
| 1561 | + // check if it contributes to the vtx of this collision |
| 1562 | + if (trk.collisionId() != collision.globalIndex()) |
| 1563 | + continue; |
| 1564 | + // nMyPVContribOrig++; |
| 1565 | + // --- remove t1 and t2 if they are PV contributors --- |
| 1566 | + if (trk.globalIndex() == t1.globalIndex() || trk.globalIndex() == t2.globalIndex()) |
| 1567 | + continue; |
| 1568 | + // add tracks and parameters to the list |
| 1569 | + pvContribGlobIDs.push_back(trk.globalIndex()); |
| 1570 | + pvContribTrackPars.push_back(getTrackParCov(trk)); |
| 1571 | + // nMyPVContrib++; |
| 1572 | + } |
1572 | 1573 |
|
1573 | | - // cout << "contributors from collision: " << collision.numContrib() << " - from refitting: before -> " << nMyPVContribOrig << " after -> " << nMyPVContrib << endl; |
1574 | | - vec_useTrk_PVrefit.assign(pvContribGlobIDs.size(), true); |
1575 | | - // --- build VertexBase from event collision --- |
1576 | | - o2::dataformats::VertexBase Pvtx; |
1577 | | - Pvtx.setX(collision.posX()); |
1578 | | - Pvtx.setY(collision.posY()); |
1579 | | - Pvtx.setZ(collision.posZ()); |
1580 | | - Pvtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), |
1581 | | - collision.covXZ(), collision.covYZ(), collision.covZZ()); |
1582 | | - |
1583 | | - // --- configure vertexer --- |
1584 | | - o2::vertexing::PVertexer vertexer; |
1585 | | - if (fConfigOptions.removeDiamondConstrPV) { |
1586 | | - o2::conf::ConfigurableParam::updateFromString("pvertexer.useMeanVertexConstraint=false"); |
1587 | | - } |
1588 | | - vertexer.init(); |
| 1574 | + // cout << "contributors from collision: " << collision.numContrib() << " - from refitting: before -> " << nMyPVContribOrig << " after -> " << nMyPVContrib << endl; |
| 1575 | + vec_useTrk_PVrefit.assign(pvContribGlobIDs.size(), true); |
| 1576 | + // --- build VertexBase from event collision --- |
| 1577 | + o2::dataformats::VertexBase Pvtx; |
| 1578 | + Pvtx.setX(collision.posX()); |
| 1579 | + Pvtx.setY(collision.posY()); |
| 1580 | + Pvtx.setZ(collision.posZ()); |
| 1581 | + Pvtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), |
| 1582 | + collision.covXZ(), collision.covYZ(), collision.covZZ()); |
1589 | 1583 |
|
1590 | | - bool PVrefit_doable = vertexer.prepareVertexRefit(pvContribTrackPars, Pvtx); |
1591 | | - if (!PVrefit_doable) return false; |
| 1584 | + // --- configure vertexer --- |
| 1585 | + o2::vertexing::PVertexer vertexer; |
| 1586 | + if (fConfigOptions.removeDiamondConstrPV) { |
| 1587 | + o2::conf::ConfigurableParam::updateFromString("pvertexer.useMeanVertexConstraint=false"); |
| 1588 | + } |
| 1589 | + vertexer.init(); |
1592 | 1590 |
|
1593 | | - // --- do the refit --- |
1594 | | - pvRefitted = vertexer.refitVertex(vec_useTrk_PVrefit, Pvtx); |
| 1591 | + bool PVrefit_doable = vertexer.prepareVertexRefit(pvContribTrackPars, Pvtx); |
| 1592 | + if (!PVrefit_doable) |
| 1593 | + return false; |
1595 | 1594 |
|
1596 | | - return true; |
1597 | | -} |
| 1595 | + // --- do the refit --- |
| 1596 | + pvRefitted = vertexer.refitVertex(vec_useTrk_PVrefit, Pvtx); |
1598 | 1597 |
|
| 1598 | + return true; |
| 1599 | + } |
1599 | 1600 |
|
1600 | 1601 | // Template function to run same event pairing (barrel-barrel, muon-muon, barrel-muon) |
1601 | 1602 | template <bool TTwoProngFitter, int TPairType, uint32_t TEventFillMap, uint32_t TTrackFillMap, typename TEvents, typename TTracks> |
@@ -1710,17 +1711,18 @@ bool refitPVWithPVertexer(Events const& collision, TTracks const& tracks, Track |
1710 | 1711 | } |
1711 | 1712 | if constexpr (TTwoProngFitter) { |
1712 | 1713 | VarManager::FillPairVertexing<TPairType, TEventFillMap, TTrackFillMap>(event, t1, t2, fConfigOptions.propToPCA); |
1713 | | - if(fConfigOptions.recomputePV){ |
1714 | | - VarManager::SetPVrecalculationKF(false); |
1715 | | - VarManager::ResetValues(VarManager::kVertexingLxyProjectedRecalculatePV, VarManager::kVertexingLxyProjectedRecalculatePV+1); |
1716 | | - VarManager::ResetValues(VarManager::kVertexingTauxyProjectedPoleJPsiMassRecalculatePV, VarManager::kVertexingTauxyProjectedPoleJPsiMassRecalculatePV+1); |
1717 | | - // cout << "primary vertex (before): x -> " << event.posX() << " y -> " << event.posY() << " z -> " << event.posZ() << endl; |
1718 | | - o2::dataformats::VertexBase pvRefit; |
1719 | | - bool ok = refitPVWithPVertexer(event, tracks, t1, t2, pvRefit); |
1720 | | - if(ok) VarManager::FillPairVertexingRecomputePV<TPairType, TEventFillMap, TTrackFillMap>(event, t1, t2, pvRefit); |
1721 | | - // cout << "primary vertex (after): ok -> " << ok << " x -> " << pvRefit.getX() << " y -> " << pvRefit.getY() << " z -> " << pvRefit.getZ() << endl; |
| 1714 | + if (fConfigOptions.recomputePV) { |
| 1715 | + VarManager::SetPVrecalculationKF(false); |
| 1716 | + VarManager::ResetValues(VarManager::kVertexingLxyProjectedRecalculatePV, VarManager::kVertexingLxyProjectedRecalculatePV + 1); |
| 1717 | + VarManager::ResetValues(VarManager::kVertexingTauxyProjectedPoleJPsiMassRecalculatePV, VarManager::kVertexingTauxyProjectedPoleJPsiMassRecalculatePV + 1); |
| 1718 | + // cout << "primary vertex (before): x -> " << event.posX() << " y -> " << event.posY() << " z -> " << event.posZ() << endl; |
| 1719 | + o2::dataformats::VertexBase pvRefit; |
| 1720 | + bool ok = refitPVWithPVertexer(event, tracks, t1, t2, pvRefit); |
| 1721 | + if (ok) |
| 1722 | + VarManager::FillPairVertexingRecomputePV<TPairType, TEventFillMap, TTrackFillMap>(event, t1, t2, pvRefit); |
| 1723 | + // cout << "primary vertex (after): ok -> " << ok << " x -> " << pvRefit.getX() << " y -> " << pvRefit.getY() << " z -> " << pvRefit.getZ() << endl; |
1722 | 1724 | } |
1723 | | - } |
| 1725 | + } |
1724 | 1726 | if constexpr (eventHasQvector) { |
1725 | 1727 | VarManager::FillPairVn<TPairType>(t1, t2); |
1726 | 1728 | } |
@@ -1858,7 +1860,7 @@ bool refitPVWithPVertexer(Events const& collision, TTracks const& tracks, Track |
1858 | 1860 | fHistMan->FillHistClass(histNames[icut][0].Data(), VarManager::fgValues); // reconstructed, unmatched |
1859 | 1861 | for (unsigned int isig = 0; isig < fRecMCSignals.size(); isig++) { // loop over MC signals |
1860 | 1862 | if (mcDecision & (static_cast<uint32_t>(1) << isig)) { |
1861 | | - PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kRap], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMassRecalculatePV], isAmbiInBunch, isAmbiOutOfBunch, isCorrect_pair, VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kVtxNcontribReal]); |
| 1863 | + PromptNonPromptSepTable(VarManager::fgValues[VarManager::kMass], VarManager::fgValues[VarManager::kPt], VarManager::fgValues[VarManager::kEta], VarManager::fgValues[VarManager::kRap], VarManager::fgValues[VarManager::kPhi], VarManager::fgValues[VarManager::kVertexingTauxyProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMass], VarManager::fgValues[VarManager::kVertexingTauzProjected], VarManager::fgValues[VarManager::kVertexingTauxyProjectedPoleJPsiMassRecalculatePV], isAmbiInBunch, isAmbiOutOfBunch, isCorrect_pair, VarManager::fgValues[VarManager::kMultFT0A], VarManager::fgValues[VarManager::kMultFT0C], VarManager::fgValues[VarManager::kCentFT0M], VarManager::fgValues[VarManager::kVtxNcontribReal]); |
1862 | 1864 | fHistMan->FillHistClass(histNamesMC[icut * fRecMCSignals.size() + isig][0].Data(), VarManager::fgValues); // matched signal |
1863 | 1865 | /*if (fConfigOptions.fConfigMiniTree) { |
1864 | 1866 | if constexpr (TPairType == VarManager::kDecayToMuMu) { |
|
0 commit comments