Skip to content

Commit

Permalink
corrected the MCP outlier rejection for every event + identification …
Browse files Browse the repository at this point in the history
…of fake matches based on EMCAL fiducial cuts
  • Loading branch information
Archita-Dash committed Sep 8, 2024
2 parents ef5a291 + f00ccdd commit c692941
Show file tree
Hide file tree
Showing 73 changed files with 2,723 additions and 1,394 deletions.
135 changes: 96 additions & 39 deletions ALICE3/TableProducer/alice3-multicharm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "ALICE3/DataModel/tracksAlice3.h"
#include "DetectorsVertexing/PVertexer.h"
#include "DetectorsVertexing/PVertexerHelpers.h"
#include "CommonConstants/PhysicsConstants.h"

using namespace o2;
using namespace o2::framework;
Expand All @@ -77,19 +78,27 @@ struct alice3multicharm {
Produces<aod::MCharmCores> multiCharmCore;

// Operation and minimisation criteria
Configurable<bool> fillDerivedTable{"fillDerivedTable", false, "fill MCharm[] tables (careful: memory)"};
Configurable<float> magneticField{"magneticField", 20.0f, "Magnetic field (in kilogauss)"};
Configurable<bool> doDCAplots{"doDCAplots", true, "do daughter prong DCA plots for D mesons"};
Configurable<bool> mcSameMotherCheck{"mcSameMotherCheck", true, "check if tracks come from the same MC mother"};
Configurable<float> dcaXiCDaughtersSelection{"dcaXiCDaughtersSelection", 1000.0f, "DCA between XiC daughters (cm)"};
Configurable<float> dcaXiCCDaughtersSelection{"dcaXiCCDaughtersSelection", 1000.0f, "DCA between XiCC daughters (cm)"};
Configurable<float> dcaXiCDaughtersSelection{"dcaXiCDaughtersSelection", 200.0f, "DCA between XiC daughters (cm)"};
Configurable<float> dcaXiCCDaughtersSelection{"dcaXiCCDaughtersSelection", 200.0f, "DCA between XiCC daughters (cm)"};

Configurable<float> piFromXiC_dcaXYconstant{"piFromXiC_dcaXYconstant", -1.0f, "[0] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> piFromXiC_dcaXYconstant{"piFromXiC_dcaXYconstant", 0.001f, "[0] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> piFromXiC_dcaXYpTdep{"piFromXiC_dcaXYpTdep", 0.0, "[1] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> piFromXiCC_dcaXYconstant{"piFromXiCC_dcaXYconstant", -1.0f, "[0] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> piFromXiCC_dcaXYconstant{"piFromXiCC_dcaXYconstant", 0.001f, "[0] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> piFromXiCC_dcaXYpTdep{"piFromXiCC_dcaXYpTdep", 0.0, "[1] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> xiFromXiC_dcaXYconstant{"xiFromXiC_dcaXYconstant", -1.0f, "[0] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> xiFromXiC_dcaXYconstant{"xiFromXiC_dcaXYconstant", 0.001f, "[0] in |DCAxy| > [0]+[1]/pT"};
Configurable<float> xiFromXiC_dcaXYpTdep{"xiFromXiC_dcaXYpTdep", 0.0, "[1] in |DCAxy| > [0]+[1]/pT"};

Configurable<float> minPiCPt{"minPiCPt", 0.15, "Minimum pT for XiC pions"};
Configurable<float> minPiCCPt{"minPiCCPt", 0.3, "Minimum pT for XiCC pions"};

Configurable<float> minXiCRadius{"minXiCRadius", 0.001, "Minimum R2D for XiC decay (cm)"};
Configurable<float> massWindowXi{"massWindowXi", 0.015, "Mass window around Xi peak"};
Configurable<float> massWindowXiC{"massWindowXiC", 0.015, "Mass window around XiC peak"};

ConfigurableAxis axisEta{"axisEta", {80, -4.0f, +4.0f}, "#eta"};
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 17.0f, 19.0f, 21.0f, 23.0f, 25.0f, 30.0f, 35.0f, 40.0f, 50.0f}, "pt axis for QA histograms"};
ConfigurableAxis axisDCA{"axisDCA", {200, -100, 100}, "DCA (#mum)"};
Expand Down Expand Up @@ -118,9 +127,9 @@ struct alice3multicharm {

// partitions for Xi daughters
Partition<alice3tracks> tracksPiFromXiC =
((aod::a3DecayMap::decayMap & trackSelectionPiFromXiC) == trackSelectionPiFromXiC) && aod::track::signed1Pt > 0.0f && nabs(aod::track::dcaXY) > piFromXiC_dcaXYconstant + piFromXiC_dcaXYpTdep* nabs(aod::track::signed1Pt);
((aod::a3DecayMap::decayMap & trackSelectionPiFromXiC) == trackSelectionPiFromXiC) && aod::track::signed1Pt > 0.0f && 1.0f / nabs(aod::track::signed1Pt) > minPiCPt&& nabs(aod::track::dcaXY) > piFromXiC_dcaXYconstant + piFromXiC_dcaXYpTdep* nabs(aod::track::signed1Pt);
Partition<alice3tracks> tracksPiFromXiCC =
((aod::a3DecayMap::decayMap & trackSelectionPiFromXiCC) == trackSelectionPiFromXiCC) && aod::track::signed1Pt > 0.0f && nabs(aod::track::dcaXY) > piFromXiCC_dcaXYconstant + piFromXiCC_dcaXYpTdep* nabs(aod::track::signed1Pt);
((aod::a3DecayMap::decayMap & trackSelectionPiFromXiCC) == trackSelectionPiFromXiCC) && aod::track::signed1Pt > 0.0f && 1.0f / nabs(aod::track::signed1Pt) > minPiCCPt&& nabs(aod::track::dcaXY) > piFromXiCC_dcaXYconstant + piFromXiCC_dcaXYpTdep* nabs(aod::track::signed1Pt);

// Helper struct to pass candidate information
struct {
Expand Down Expand Up @@ -307,6 +316,33 @@ struct alice3multicharm {
return returnValue;
}

// Association check for the XiCC pion
template <typename TTrackType1, typename TTrackType2>
bool checkSameMotherExtra(TTrackType1 const& track1, TTrackType2 const& track2)
{
bool returnValue = false;
// This might perhaps be a bit excessive
// Could be joined with `checkSameMother` but leaving as is for now
if (track1.has_mcParticle() && track2.has_mcParticle()) {
auto mcParticle1 = track1.template mcParticle_as<aod::McParticles>();
auto mcParticle2 = track2.template mcParticle_as<aod::McParticles>();
if (mcParticle1.has_mothers() && mcParticle2.has_mothers()) {
for (auto& mcParticleMother1 : mcParticle1.template mothers_as<aod::McParticles>()) {
if (mcParticleMother1.has_mothers()) {
for (auto& mcParticleGrandMother1 : mcParticleMother1.template mothers_as<aod::McParticles>()) {
for (auto& mcParticleMother2 : mcParticle2.template mothers_as<aod::McParticles>()) {
if (mcParticleGrandMother1.globalIndex() == mcParticleMother2.globalIndex()) {
returnValue = true;
}
}
}
}
}
}
} // end association check
return returnValue;
}

void init(InitContext&)
{
// initialize O2 2-prong fitter (only once)
Expand Down Expand Up @@ -336,33 +372,34 @@ struct alice3multicharm {
// failure rates.
// --- 0: attempt XiC, 1: success XiC
// --- 2: attempt XiCC, 3: success XiCC
histos.add("hCharmBuilding", "hCharmBuilding", kTH1F, {{10, -0.5, 9.5f}});
histos.add("hCharmBuilding", "hCharmBuilding", kTH1D, {{10, -0.5, 9.5f}});

histos.add("h2dGenXi", "h2dGenXi", kTH2F, {axisPt, axisEta});
histos.add("h2dGenXiC", "h2dGenXiC", kTH2F, {axisPt, axisEta});
histos.add("h2dGenXiCC", "h2dGenXiCC", kTH2F, {axisPt, axisEta});
histos.add("h2dGenXi", "h2dGenXi", kTH2D, {axisPt, axisEta});
histos.add("h2dGenXiC", "h2dGenXiC", kTH2D, {axisPt, axisEta});
histos.add("h2dGenXiCC", "h2dGenXiCC", kTH2D, {axisPt, axisEta});

histos.add("hMassXi", "hMassXi", kTH1F, {axisXiMass});
histos.add("hMassXiC", "hMassXiC", kTH1F, {axisXiCMass});
histos.add("hMassXiCC", "hMassXiCC", kTH1F, {axisXiCCMass});
histos.add("hMassXi", "hMassXi", kTH1D, {axisXiMass});
histos.add("hMassXiC", "hMassXiC", kTH1D, {axisXiCMass});
histos.add("hMassXiCC", "hMassXiCC", kTH1D, {axisXiCCMass});

histos.add("hEtaXiCC", "hEtaXiCC", kTH1F, {axisEta});
histos.add("hPtXiCC", "hPtXiCC", kTH1F, {axisPt});
histos.add("h3dMassXiCC", "h3dMassXiCC", kTH3F, {axisPt, axisEta, axisXiCCMass});
histos.add("hEtaXiCC", "hEtaXiCC", kTH1D, {axisEta});
histos.add("hPtXiCC", "hPtXiCC", kTH1D, {axisPt});
histos.add("hMcPtXiCC", "hMcPtXiCC", kTH1D, {axisPt});
histos.add("h3dMassXiCC", "h3dMassXiCC", kTH3D, {axisPt, axisEta, axisXiCCMass});

histos.add("hDCAXiCDaughters", "hDCAXiCDaughters", kTH1F, {axisDCAXiCDaughters});
histos.add("hDCAXiCCDaughters", "hDCAXiCCDaughters", kTH1F, {axisDCAXiCCDaughters});
histos.add("hDCAXiCDaughters", "hDCAXiCDaughters", kTH1D, {axisDCAXiCDaughters});
histos.add("hDCAXiCCDaughters", "hDCAXiCCDaughters", kTH1D, {axisDCAXiCCDaughters});

// These histograms bookkeep the exact number of combinations attempted
// CombinationsXiC: triplets Xi-pi-pi considered per Xi
// CombinationsXiCC: doublets XiC-pi considered per XiC
histos.add("hCombinationsXiC", "hCombinationsXiC", kTH1F, {axisNConsidered});
histos.add("hCombinationsXiCC", "hCombinationsXiCC", kTH1F, {axisNConsidered});
histos.add("hCombinationsXiC", "hCombinationsXiC", kTH1D, {axisNConsidered});
histos.add("hCombinationsXiCC", "hCombinationsXiCC", kTH1D, {axisNConsidered});

if (doDCAplots) {
histos.add("h2dDCAxyVsPtXiFromXiC", "h2dDCAxyVsPtXiFromXiC", kTH2F, {axisPt, axisDCA});
histos.add("h2dDCAxyVsPtPiFromXiC", "h2dDCAxyVsPtPiFromXiC", kTH2F, {axisPt, axisDCA});
histos.add("h2dDCAxyVsPtPiFromXiCC", "h2dDCAxyVsPtPiFromXiCC", kTH2F, {axisPt, axisDCA});
histos.add("h2dDCAxyVsPtXiFromXiC", "h2dDCAxyVsPtXiFromXiC", kTH2D, {axisPt, axisDCA});
histos.add("h2dDCAxyVsPtPiFromXiC", "h2dDCAxyVsPtPiFromXiC", kTH2D, {axisPt, axisDCA});
histos.add("h2dDCAxyVsPtPiFromXiCC", "h2dDCAxyVsPtPiFromXiCC", kTH2D, {axisPt, axisDCA});
}
}

Expand All @@ -373,8 +410,10 @@ struct alice3multicharm {
histos.fill(HIST("h2dGenXi"), mcParticle.pt(), mcParticle.eta());
for (auto const& mcParticle : trueXiC)
histos.fill(HIST("h2dGenXiC"), mcParticle.pt(), mcParticle.eta());
for (auto const& mcParticle : trueXiCC)
for (auto const& mcParticle : trueXiCC) {
histos.fill(HIST("h2dGenXiCC"), mcParticle.pt(), mcParticle.eta());
histos.fill(HIST("hMcPtXiCC"), mcParticle.pt());
}
}

//*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*+-+*
Expand Down Expand Up @@ -404,6 +443,10 @@ struct alice3multicharm {

for (auto const& xiCand : cascades) {
histos.fill(HIST("hMassXi"), xiCand.mXi());

if (std::abs(xiCand.mXi() - o2::constants::physics::MassXiMinus) > massWindowXi)
continue; // out of mass region

uint32_t nCombinationsC = 0;
auto xi = xiCand.cascadeTrack_as<alice3tracks>(); // de-reference cascade track
auto piFromXi = xiCand.bachTrack_as<alice3tracks>(); // de-reference bach track
Expand All @@ -418,6 +461,8 @@ struct alice3multicharm {
continue;
if (xiCand.posTrackId() == pi1c.globalIndex() || xiCand.negTrackId() == pi1c.globalIndex() || xiCand.bachTrackId() == pi1c.globalIndex())
continue; // avoid using any track that was already used
if (pi1c.pt() < minPiCPt)
continue;

// second pion from XiC decay for starts here
for (auto const& pi2c : tracksPiFromXiCgrouped) {
Expand All @@ -428,6 +473,8 @@ struct alice3multicharm {
continue; // avoid same-mother, avoid double-counting
if (xiCand.posTrackId() == pi2c.globalIndex() || xiCand.negTrackId() == pi2c.globalIndex() || xiCand.bachTrackId() == pi2c.globalIndex())
continue; // avoid using any track that was already used
if (pi2c.pt() < minPiCPt)
continue;

// if I am here, it means this is a triplet to be considered for XiC vertexing.
// will now attempt to build a three-body decay candidate with these three track rows.
Expand All @@ -436,6 +483,9 @@ struct alice3multicharm {
histos.fill(HIST("hCharmBuilding"), 0.0f);
if (!buildDecayCandidateThreeBody(xi, pi1c, pi2c, 1.32171, 0.139570, 0.139570))
continue; // failed at building candidate

if (std::abs(thisXiCcandidate.mass - o2::constants::physics::MassXiCPlus) > massWindowXiC)
continue; // out of mass region
histos.fill(HIST("hCharmBuilding"), 1.0f);

const std::array<float, 3> momentumC = {
Expand All @@ -445,6 +495,9 @@ struct alice3multicharm {

o2::track::TrackParCov xicTrack(thisXiCcandidate.xyz, momentumC, thisXiCcandidate.parentTrackCovMatrix, +1);

if (std::hypot(thisXiCcandidate.xyz[0], thisXiCcandidate.xyz[1]) < minXiCRadius)
continue; // do not take if radius too small, likely a primary combination

o2::dataformats::DCA dcaInfo;
float xicdcaXY = 1e+10, xicdcaZ = 1e+10;
o2::track::TrackParCov xicTrackCopy(xicTrack); // paranoia
Expand All @@ -466,8 +519,10 @@ struct alice3multicharm {

if (xiCand.posTrackId() == picc.globalIndex() || xiCand.negTrackId() == picc.globalIndex() || xiCand.bachTrackId() == picc.globalIndex())
continue; // avoid using any track that was already used

// to-do: check same mother here
if (picc.pt() < minPiCCPt)
continue;
if (mcSameMotherCheck && !checkSameMotherExtra(xi, picc))
continue;
o2::track::TrackParCov piccTrack = getTrackParCov(picc);
nCombinationsCC++;
histos.fill(HIST("hCharmBuilding"), 2.0f);
Expand Down Expand Up @@ -495,18 +550,20 @@ struct alice3multicharm {
}

// produce multi-charm table for posterior analysis
multiCharmCore(
thisXiCcandidate.dca, thisXiCCcandidate.dca,
thisXiCcandidate.mass, thisXiCCcandidate.mass,
thisXiCCcandidate.pt, thisXiCCcandidate.eta,
xi.nSiliconHits(), piFromXi.nSiliconHits(),
piFromLa.nSiliconHits(), prFromLa.nSiliconHits(),
pi1c.nSiliconHits(), pi2c.nSiliconHits(), picc.nSiliconHits(),
piFromXi.nTPCHits(), piFromLa.nTPCHits(), prFromLa.nTPCHits(),
pi1c.nTPCHits(), pi2c.nTPCHits(), picc.nTPCHits(),
xi.dcaXY(), xicdcaXY, xiccdcaXY,
piFromXi.dcaXY(), piFromLa.dcaXY(), prFromLa.dcaXY(),
pi1c.dcaXY(), pi2c.dcaXY(), picc.dcaXY());
if (fillDerivedTable) {
multiCharmCore(
thisXiCcandidate.dca, thisXiCCcandidate.dca,
thisXiCcandidate.mass, thisXiCCcandidate.mass,
thisXiCCcandidate.pt, thisXiCCcandidate.eta,
xi.nSiliconHits(), piFromXi.nSiliconHits(),
piFromLa.nSiliconHits(), prFromLa.nSiliconHits(),
pi1c.nSiliconHits(), pi2c.nSiliconHits(), picc.nSiliconHits(),
piFromXi.nTPCHits(), piFromLa.nTPCHits(), prFromLa.nTPCHits(),
pi1c.nTPCHits(), pi2c.nTPCHits(), picc.nTPCHits(),
xi.dcaXY(), xicdcaXY, xiccdcaXY,
piFromXi.dcaXY(), piFromLa.dcaXY(), prFromLa.dcaXY(),
pi1c.dcaXY(), pi2c.dcaXY(), picc.dcaXY());
}
}
histos.fill(HIST("hCombinationsXiCC"), nCombinationsCC);
}
Expand Down
6 changes: 6 additions & 0 deletions Common/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ o2physics_add_library(AnalysisCore
EventPlaneHelper.cxx
TableHelper.cxx
MetadataHelper.cxx
CollisionTypeHelper.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2::DataFormatsParameters ROOT::EG O2::CCDB ROOT::Physics O2::FT0Base O2::FV0Base)

o2physics_target_root_dictionary(AnalysisCore
Expand All @@ -31,4 +32,9 @@ o2physics_target_root_dictionary(AnalysisCore
PID/DetectorResponse.h
PID/PIDTOF.h
PID/TPCPIDResponse.h
CollisionTypeHelper.h
LINKDEF AnalysisCoreLinkDef.h)

o2physics_add_header_only_library(TPCDriftManager
HEADERS TPCVDriftManager.h
INTERFACE_LINK_LIBRARIES O2::DataFormatsTPC)
58 changes: 58 additions & 0 deletions Common/Core/CollisionTypeHelper.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

///
/// \file CollisionTypeHelper.h
/// \author Nicolò Jacazio [email protected]
/// \brief Utility to handle the collision type from the GRP information
///

#include "Common/Core/CollisionTypeHelper.h"
#include <fairlogger/Logger.h>
#include <string>
#include "DataFormatsParameters/GRPLHCIFData.h"

std::string CollisionSystemType::getCollisionSystemName(collType collSys)
{
switch (collSys) {
case kCollSyspp:
return "pp";
case kCollSysPbPb:
return "PbPb";
case kCollSysXeXe:
return "XeXe";
case kCollSyspPb:
return "pPb";
default:
LOG(fatal) << "Undefined collision system";
return "Undefined";
}
}

int CollisionSystemType::getCollisionTypeFromGrp(o2::parameters::GRPLHCIFData* grplhcif)
{
const int ZBeamA = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamA);
const int ZBeamC = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamC);
switch (ZBeamA * ZBeamC) {
case 1: // pp 1*1
return kCollSyspp;
case 6724: // Pb-Pb 82*82
return kCollSysPbPb;
case 225: // Xe-Xe 54*54
return kCollSysXeXe;
case 82: // p-Pb 82*1
return kCollSyspPb;
default:
LOG(fatal) << "Undefined collision system";
return kCollSysUndef;
}
return kCollSysUndef;
}
41 changes: 41 additions & 0 deletions Common/Core/CollisionTypeHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

///
/// \file CollisionTypeHelper.h
/// \author Nicolò Jacazio [email protected]
/// \brief Utility to handle the collision type from the GRP information
///

#ifndef COMMON_CORE_COLLISIONTYPEHELPER_H_
#define COMMON_CORE_COLLISIONTYPEHELPER_H_

#include <string>
#include "DataFormatsParameters/GRPLHCIFData.h"

// Container for the collision system type
struct CollisionSystemType {
// Enum type for the collision system
typedef int collType;

static constexpr collType kCollSysUndef = -1; // Undefined collision system
static constexpr collType kCollSyspp = 0; // pp
static constexpr collType kCollSysPbPb = 1; // PbPb
static constexpr collType kCollSysXeXe = 2; // XeXe
static constexpr collType kCollSyspPb = 3; // pPb
static constexpr collType kNCollSys = 4; // Number of collision systems

static std::string getCollisionSystemName(collType collSys);

static int getCollisionTypeFromGrp(o2::parameters::GRPLHCIFData* grplhcif);
};

#endif // COMMON_CORE_COLLISIONTYPEHELPER_H_
Loading

0 comments on commit c692941

Please sign in to comment.