Skip to content

Commit

Permalink
Merge branch 'AliceO2Group:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Astronica-Software authored Aug 30, 2024
2 parents a682063 + 6f238cc commit c17010d
Show file tree
Hide file tree
Showing 26 changed files with 2,162 additions and 1,489 deletions.
55 changes: 54 additions & 1 deletion ALICE3/DataModel/OTFMulticharm.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,35 @@ DECLARE_SOA_COLUMN(MXiCC, mXiCC, float);
DECLARE_SOA_COLUMN(Pt, pt, float);
DECLARE_SOA_COLUMN(Eta, eta, float);

// tracking counters
DECLARE_SOA_COLUMN(NSiliconHitsXi, nSiliconHitsXi, int);
DECLARE_SOA_COLUMN(NSiliconHitsPiFromXi, nSiliconHitsPiFromXi, int);
DECLARE_SOA_COLUMN(NSiliconHitsPiFromLa, nSiliconHitsPiFromLa, int);
DECLARE_SOA_COLUMN(NSiliconHitsPrFromLa, nSiliconHitsPrFromLa, int);
DECLARE_SOA_COLUMN(NSiliconHitsPiC1, nSiliconHitsPiC1, int);
DECLARE_SOA_COLUMN(NSiliconHitsPiC2, nSiliconHitsPiC2, int);
DECLARE_SOA_COLUMN(NSiliconHitsPiCC, nSiliconHitsPiCC, int);

DECLARE_SOA_COLUMN(NTPCHitsPiFromXi, nTPCHitsPiFromXi, int);
DECLARE_SOA_COLUMN(NTPCHitsPiFromLa, nTPCHitsPiFromLa, int);
DECLARE_SOA_COLUMN(NTPCHitsPrFromLa, nTPCHitsPrFromLa, int);
DECLARE_SOA_COLUMN(NTPCHitsPiC1, nTPCHitsPiC1, int);
DECLARE_SOA_COLUMN(NTPCHitsPiC2, nTPCHitsPiC2, int);
DECLARE_SOA_COLUMN(NTPCHitsPiCC, nTPCHitsPiCC, int);

// DCA to PV variables
DECLARE_SOA_COLUMN(DCAToPVXi, dcaToPVXi, float);
DECLARE_SOA_COLUMN(DCAToPVXiC, dcaToPVXiC, float);
DECLARE_SOA_COLUMN(DCAToPVXiCC, dcaToPVXiCC, float);

DECLARE_SOA_COLUMN(DCAToPVPiFromXi, dcaToPVPiFromXi, float);
DECLARE_SOA_COLUMN(DCAToPVPiFromLa, dcaToPVPiFromLa, float);
DECLARE_SOA_COLUMN(DCAToPVPrFromLa, dcaToPVPrFromLa, float);

DECLARE_SOA_COLUMN(DCAToPVPiC1, dcaToPVPiC1, float);
DECLARE_SOA_COLUMN(DCAToPVPiC2, dcaToPVPiC2, float);
DECLARE_SOA_COLUMN(DCAToPVPiCC, dcaToPVPiCC, float);

} // namespace otfmulticharm
DECLARE_SOA_TABLE(MCharmIndices, "AOD", "MCharmIndices",
o2::soa::Index<>,
Expand All @@ -56,7 +85,31 @@ DECLARE_SOA_TABLE(MCharmCores, "AOD", "MCharmCores",
otfmulticharm::MXiC,
otfmulticharm::MXiCC,
otfmulticharm::Pt,
otfmulticharm::Eta);
otfmulticharm::Eta,

otfmulticharm::NSiliconHitsXi,
otfmulticharm::NSiliconHitsPiFromXi,
otfmulticharm::NSiliconHitsPiFromLa,
otfmulticharm::NSiliconHitsPrFromLa,
otfmulticharm::NSiliconHitsPiC1,
otfmulticharm::NSiliconHitsPiC2,
otfmulticharm::NSiliconHitsPiCC,
otfmulticharm::NTPCHitsPiFromXi,
otfmulticharm::NTPCHitsPiFromLa,
otfmulticharm::NTPCHitsPrFromLa,
otfmulticharm::NTPCHitsPiC1,
otfmulticharm::NTPCHitsPiC2,
otfmulticharm::NTPCHitsPiCC,

otfmulticharm::DCAToPVXi,
otfmulticharm::DCAToPVXiC,
otfmulticharm::DCAToPVXiCC,
otfmulticharm::DCAToPVPiFromXi,
otfmulticharm::DCAToPVPiFromLa,
otfmulticharm::DCAToPVPrFromLa,
otfmulticharm::DCAToPVPiC1,
otfmulticharm::DCAToPVPiC2,
otfmulticharm::DCAToPVPiCC);

} // namespace o2::aod

Expand Down
2 changes: 1 addition & 1 deletion ALICE3/TableProducer/OTF/onTheFlyTracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ struct OnTheFlyTracker {
histos.fill(HIST("hXiBuilding"), 6.0f);
thisCascade.cascadeTrackId = lastTrackIndex + tracksAlice3.size(); // this is the next index to be filled -> should be it

tracksAlice3.push_back(TrackAlice3{cascadeTrack, mcParticle.globalIndex(), t, 100.f * 1e-3, false, false, 1});
tracksAlice3.push_back(TrackAlice3{cascadeTrack, mcParticle.globalIndex(), t, 100.f * 1e-3, false, false, 1, thisCascade.foundClusters});

if (doXiQA) {
histos.fill(HIST("h2dDeltaPtVsPt"), trackParCov.getPt(), cascadeTrack.getPt() - trackParCov.getPt());
Expand Down
50 changes: 49 additions & 1 deletion ALICE3/TableProducer/alice3-multicharm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#include "ALICE3/DataModel/OTFStrangeness.h"
#include "ALICE3/DataModel/OTFMulticharm.h"
#include "ALICE3/DataModel/tracksAlice3.h"
#include "DetectorsVertexing/PVertexer.h"
#include "DetectorsVertexing/PVertexerHelpers.h"

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -122,6 +124,7 @@ struct alice3multicharm {

// Helper struct to pass candidate information
struct {
// decay properties
float dca;
float mass;
float pt;
Expand All @@ -142,6 +145,12 @@ struct alice3multicharm {
std::array<float, 3> prong0mom;
std::array<float, 3> prong1mom;
std::array<float, 21> parentTrackCovMatrix;

float etaPiCC;

// charm daughters
int nSiliconHitsPiCC;
int nTPCHitsPiCC;
} thisXiCCcandidate;

template <typename TTrackType>
Expand Down Expand Up @@ -397,6 +406,10 @@ struct alice3multicharm {
histos.fill(HIST("hMassXi"), xiCand.mXi());
uint32_t nCombinationsC = 0;
auto xi = xiCand.cascadeTrack_as<alice3tracks>(); // de-reference cascade track
auto piFromXi = xiCand.bachTrack_as<alice3tracks>(); // de-reference bach track
auto piFromLa = xiCand.negTrack_as<alice3tracks>(); // de-reference neg track
auto prFromLa = xiCand.posTrack_as<alice3tracks>(); // de-reference pos track

if (!bitcheck(xi.decayMap(), kTrueXiFromXiC))
continue;

Expand All @@ -408,6 +421,7 @@ struct alice3multicharm {

// second pion from XiC decay for starts here
for (auto const& pi2c : tracksPiFromXiCgrouped) {

if (mcSameMotherCheck && !checkSameMother(xi, pi2c))
continue; // keep only if same mother
if (pi1c.globalIndex() >= pi2c.globalIndex())
Expand All @@ -431,12 +445,25 @@ struct alice3multicharm {

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

o2::dataformats::DCA dcaInfo;
float xicdcaXY = 1e+10, xicdcaZ = 1e+10;
o2::track::TrackParCov xicTrackCopy(xicTrack); // paranoia

o2::vertexing::PVertex primaryVertex;
primaryVertex.setXYZ(collision.posX(), collision.posY(), collision.posZ());

if (xicTrackCopy.propagateToDCA(primaryVertex, magneticField, &dcaInfo)) {
xicdcaXY = dcaInfo.getY();
xicdcaZ = dcaInfo.getZ();
}

histos.fill(HIST("hMassXiC"), thisXiCcandidate.mass);
histos.fill(HIST("hDCAXiCDaughters"), thisXiCcandidate.dca);

// attempt XiCC finding
uint32_t nCombinationsCC = 0;
for (auto const& picc : tracksPiFromXiCCgrouped) {

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

Expand All @@ -454,11 +481,32 @@ struct alice3multicharm {
histos.fill(HIST("h3dMassXiCC"), thisXiCCcandidate.pt, thisXiCCcandidate.eta, thisXiCCcandidate.mass);
histos.fill(HIST("hDCAXiCCDaughters"), thisXiCCcandidate.dca);

const std::array<float, 3> momentumCC = {
thisXiCCcandidate.prong0mom[0] + thisXiCCcandidate.prong1mom[0],
thisXiCCcandidate.prong0mom[1] + thisXiCCcandidate.prong1mom[1],
thisXiCCcandidate.prong0mom[2] + thisXiCCcandidate.prong1mom[2]};

o2::track::TrackParCov xiccTrack(thisXiCCcandidate.xyz, momentumCC, thisXiCCcandidate.parentTrackCovMatrix, +2);

float xiccdcaXY = 1e+10, xiccdcaZ = 1e+10;
if (xiccTrack.propagateToDCA(primaryVertex, magneticField, &dcaInfo)) {
xiccdcaXY = dcaInfo.getY();
xiccdcaZ = dcaInfo.getZ();
}

// produce multi-charm table for posterior analysis
multiCharmCore(
thisXiCcandidate.dca, thisXiCCcandidate.dca,
thisXiCcandidate.mass, thisXiCCcandidate.mass,
thisXiCCcandidate.pt, thisXiCCcandidate.eta);
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
20 changes: 17 additions & 3 deletions Common/TableProducer/timestamp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
#include "CCDB/BasicCCDBManager.h"
#include "CommonDataFormat/InteractionRecord.h"
#include "DetectorsRaw/HBFUtils.h"
#include "MetadataHelper.h"

using namespace o2::framework;
using namespace o2::header;
using namespace o2;

MetadataHelper metadataInfo; // Metadata helper

struct TimestampTask {
Produces<aod::Timestamps> timestampTable; /// Table with SOR timestamps produced by the task
Service<o2::ccdb::BasicCCDBManager> ccdb; /// CCDB manager to access orbit-reset timestamp
Expand All @@ -41,7 +44,7 @@ struct TimestampTask {
Configurable<std::string> rct_path{"rct-path", "RCT/Info/RunInformation", "path to the ccdb RCT objects for the SOR timestamps"};
Configurable<std::string> orbit_reset_path{"orbit-reset-path", "CTP/Calib/OrbitReset", "path to the ccdb orbit-reset objects"};
Configurable<std::string> url{"ccdb-url", "http://alice-ccdb.cern.ch", "URL of the CCDB database"};
Configurable<bool> isRun2MC{"isRun2MC", false, "Running mode: enable only for Run 2 MC. Timestamps are set to SOR timestamp"};
Configurable<int> isRun2MC{"isRun2MC", -1, "Running mode: enable only for Run 2 MC. Timestamps are set to SOR timestamp. Default: -1 (autoset from metadata) 0 (Standard) 1 (Run 2 MC)"};

void init(o2::framework::InitContext&)
{
Expand All @@ -51,6 +54,14 @@ struct TimestampTask {
if (!ccdb_api.isHostReachable()) {
LOGF(fatal, "CCDB host %s is not reacheable, cannot go forward", url.value.data());
}
if (isRun2MC.value == -1) {
if ((!metadataInfo.isRun3()) && metadataInfo.isMC()) {
isRun2MC.value = 1;
LOG(info) << "Autosetting the Run2 MC mode based on metadata";
} else {
isRun2MC.value = 0;
}
}
}

void process(aod::BC const& bc)
Expand All @@ -70,8 +81,8 @@ struct TimestampTask {
int64_t sorTimestamp = timestamps.first; // timestamp of the SOR in ms
int64_t eorTimestamp = timestamps.second; // timestamp of the EOR in ms

bool isUnanchoredRun3MC = runNumber >= 300000 && runNumber < 500000;
if (isRun2MC || isUnanchoredRun3MC) {
const bool isUnanchoredRun3MC = runNumber >= 300000 && runNumber < 500000;
if (isRun2MC.value == 1 || isUnanchoredRun3MC) {
// isRun2MC: bc/orbit distributions are not simulated in Run2 MC. All bcs are set to 0.
// isUnanchoredRun3MC: assuming orbit-reset is done in the beginning of each run
// Setting orbit-reset timestamp to start-of-run timestamp
Expand Down Expand Up @@ -106,5 +117,8 @@ struct TimestampTask {

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
// Parse the metadata
metadataInfo.initMetadata(cfgc);

return WorkflowSpec{adaptAnalysisTask<TimestampTask>(cfgc)};
}
61 changes: 58 additions & 3 deletions PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,61 @@ struct femtoUniverseProducerTask {
}
}

template <typename ParticleType>
void fillMCParticlePhi(ParticleType const& kaon1, ParticleType const& kaon2)
{
if (kaon1.has_mcParticle() && kaon2.has_mcParticle()) {
// get corresponding MC particle and its info
auto kaon1MC = kaon1.mcParticle();
auto kaon2MC = kaon2.mcParticle();
auto pdgCode1 = kaon1MC.pdgCode();
auto pdgCode2 = kaon2MC.pdgCode();

int phiOrigin = 99;
auto motherskaon1MC = kaon1MC.template mothers_as<aod::McParticles>();
auto motherskaon2MC = kaon2MC.template mothers_as<aod::McParticles>();

if (abs(pdgCode1) == abs(321) || abs(pdgCode2) == abs(-321)) {
if ((kaon1MC.isPhysicalPrimary() && kaon2MC.isPhysicalPrimary()) && (!motherskaon1MC.empty() && !motherskaon2MC.empty())) {
for (auto& particleMotherOfNeg : motherskaon1MC) {
for (auto& particleMotherOfPos : motherskaon2MC) {
if (particleMotherOfNeg.isPhysicalPrimary() && particleMotherOfNeg == particleMotherOfPos && particleMotherOfNeg.pdgCode() == 333) {
phiOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kPrimary;
} else {
phiOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kFake;
}
}
}
} else {
phiOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kFake;
}
} else {
phiOrigin = aod::femtouniverseMCparticle::ParticleOriginMCTruth::kFake;
}

TLorentzVector part1Vec;
TLorentzVector part2Vec;

float mMassOne = TDatabasePDG::Instance()->GetParticle(321)->Mass(); // FIXME: Get from the PDG service of the common header
float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header

part1Vec.SetPtEtaPhiM(kaon1MC.pt(), kaon1MC.eta(), kaon1MC.phi(), mMassOne);
part2Vec.SetPtEtaPhiM(kaon2MC.pt(), kaon2MC.eta(), kaon2MC.phi(), mMassTwo);

TLorentzVector sumVec(part1Vec);
sumVec += part2Vec;

float phiEta = sumVec.Eta();
float phiPt = sumVec.Pt();
float phiPhi = sumVec.Phi();

outputPartsMC(phiOrigin, 333, phiPt, phiEta, phiPhi);
outputPartsMCLabels(outputPartsMC.lastIndex());
} else {
outputPartsMCLabels(-1);
}
}

template <bool isMC, typename CollisionType, typename TrackType>
void fillCollisions(CollisionType const& col, TrackType const& tracks)
{
Expand Down Expand Up @@ -1312,9 +1367,9 @@ struct femtoUniverseProducerTask {
fillDebugParticle<true, false, false>(p2); // QA for negative daughter
fillDebugParticle<false, true, false>(p1); // QA for phi
}
// if constexpr (isMC) {
// fillMCParticle(v0, o2::aod::femtouniverseparticle::ParticleType::kV0);
// }
if constexpr (isMC) {
fillMCParticlePhi(p1, p2);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions PWGCF/FemtoUniverse/Tasks/femtoUniversePairTaskTrackPhi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,10 @@ struct femtoUniversePairTaskTrackPhi {
float mMassTwo = TDatabasePDG::Instance()->GetParticle(-321)->Mass(); // FIXME: Get from the PDG service of the common header

for (auto& [kaon1, kaon2] : combinations(CombinationsStrictlyUpperIndexPolicy(groupPartsKaons, groupPartsKaons))) {
if (!IsKaonNSigma(kaon1.p(), trackCuts.getNsigmaTPC(kaon1, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(kaon1, o2::track::PID::Kaon))) {
}
if (!IsKaonNSigma(kaon2.p(), trackCuts.getNsigmaTPC(kaon2, o2::track::PID::Kaon), trackCuts.getNsigmaTOF(kaon2, o2::track::PID::Kaon))) {
}
if ((kaon1.mAntiLambda() == 1) && (kaon2.mAntiLambda() == 1)) {
part1Vec.SetPtEtaPhiM(kaon1.pt(), kaon1.eta(), kaon1.phi(), mMassOne);
part2Vec.SetPtEtaPhiM(kaon2.pt(), kaon2.eta(), kaon2.phi(), mMassOne);
Expand Down
6 changes: 5 additions & 1 deletion PWGDQ/Core/MCProng.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ void MCProng::Print() const
for (int i = 0; i < fNGenerations; i++) {
std::cout << "Generation #" << i << " PDGcode(" << fPDGcodes[i] << ") CheckBothCharges(" << fCheckBothCharges[i]
<< ") ExcludePDG(" << fExcludePDG[i] << ") SourceBits(" << fSourceBits[i] << ") ExcludeSource(" << fExcludeSource[i]
<< ") UseANDonSource(" << fUseANDonSourceBitMap[i] << ") CheckGenerationsInTime(" << fCheckGenerationsInTime << ") PDGInHistory(" << fPDGInHistory[i] << ") ExcludePDGInHistory(" << fExcludePDGInHistory[i] << ")" << std::endl;
<< ") UseANDonSource(" << fUseANDonSourceBitMap[i] << ") CheckGenerationsInTime(" << fCheckGenerationsInTime << ")";
for (int j = 0; j < fPDGInHistory.size(); j++) {
std::cout << " #" << j << " PDGInHistory(" << fPDGInHistory[j] << ") ExcludePDGInHistory(" << fExcludePDGInHistory[j] << ")";
}
std::cout << std::endl;
}
}

Expand Down
16 changes: 10 additions & 6 deletions PWGDQ/Core/MCSignal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ MCSignal::MCSignal() : TNamed("", ""),
fProngs({}),
fNProngs(0),
fCommonAncestorIdxs({}),
fExcludeCommonAncestor(false),
fTempAncestorLabel(-1)
{
}
Expand All @@ -30,17 +31,19 @@ MCSignal::MCSignal(int nProngs, const char* name /*= ""*/, const char* title /*=
fProngs({}),
fNProngs(nProngs),
fCommonAncestorIdxs({}),
fExcludeCommonAncestor(false),
fTempAncestorLabel(-1)
{
fProngs.reserve(nProngs);
}

//________________________________________________________________________________________________
MCSignal::MCSignal(const char* name, const char* title, std::vector<MCProng> prongs, std::vector<short> commonAncestors) : TNamed(name, title),
fProngs(prongs),
fNProngs(prongs.size()),
fCommonAncestorIdxs(commonAncestors),
fTempAncestorLabel(-1)
MCSignal::MCSignal(const char* name, const char* title, std::vector<MCProng> prongs, std::vector<short> commonAncestors, bool excludeCommonAncestor) : TNamed(name, title),
fProngs(prongs),
fNProngs(prongs.size()),
fCommonAncestorIdxs(commonAncestors),
fExcludeCommonAncestor(excludeCommonAncestor),
fTempAncestorLabel(-1)
{
}

Expand All @@ -67,10 +70,11 @@ void MCSignal::AddProng(MCProng prong, short commonAncestor)
void MCSignal::PrintConfig()
{
cout << "Name/Title: " << fName << " / " << fTitle << endl;
cout << "Exclude common ancestor combinations: " << fExcludeCommonAncestor << endl;
cout << "Printing " << fNProngs << "/" << fProngs.size() << " prongs:" << endl;
int i = 0;
for (auto& pr : fProngs) {
cout << "Prong #" << i << " commonAncestor" << fCommonAncestorIdxs[i] << " ================ " << endl;
cout << "Prong #" << i << " commonAncestor: " << fCommonAncestorIdxs[i] << " ================ " << endl;
i++;
pr.Print();
}
Expand Down
Loading

0 comments on commit c17010d

Please sign in to comment.