Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions DPG/Tasks/ITS/filterTracks.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@
DECLARE_SOA_COLUMN(MainBeautyAncestorY, mainBeautyAncestorY, float); //! original index in MCParticle tree of main mother: needed when chekcing if particles come from same mother
DECLARE_SOA_COLUMN(MaxEtaDaughter, maxEtaDaughter, float); //! max (abs) eta of daughter particles, needed to reproduce acceptance cut
} // namespace filterTracks
DECLARE_SOA_TABLE(FilterColl, "AOD", "FILTERCOLL",
o2::aod::collision::BCId,
o2::aod::collision::PosX,
o2::aod::collision::PosY,
o2::aod::collision::PosZ,
o2::aod::collision::CovXX,
o2::aod::collision::CovXY,
o2::aod::collision::CovYY,
o2::aod::collision::CovXZ,
o2::aod::collision::CovYZ,
o2::aod::collision::CovZZ,
o2::aod::collision::Flags,
o2::aod::collision::Chi2,
o2::aod::collision::NumContrib,
o2::aod::collision::CollisionTime,
o2::aod::collision::CollisionTimeRes);
DECLARE_SOA_TABLE(FilterTrack, "AOD", "FILTERTRACK",
o2::aod::track::CollisionId,
aod::filterTracks::IsInsideBeamPipe,
Expand Down Expand Up @@ -128,6 +144,7 @@
Produces<aod::FiltTracExtDet> filteredTracksTableExtraDet;
Produces<aod::FilterTrackMC> filteredTracksMC;
Produces<aod::GenParticles> selectedGenParticles;
Produces<aod::FilterColl> filterCollTable;

// Configurable<int> dummy{"dummy", 0, "dummy"};
Configurable<float> minTrackPt{"minTrackPt", 0.25, "min track pt"};
Expand All @@ -137,14 +154,15 @@
Configurable<float> trackPtWeightMidPt{"trackPtWeightMidPt", 0.10f, "trackPtWeightMidPt"};

Filter trackFilter = requireGlobalTrackWoDCAInFilter() && aod::track::pt > minTrackPt&& nabs(aod::track::dcaXY) < trackDcaXyMax;
using CollisionsWithEvSel = soa::Join<aod::Collisions, aod::EvSels>;
using TracksWithSelAndDca = soa::Join<aod::Tracks, aod::TracksCov, aod::TracksDCA, aod::TracksDCACov, aod::TracksExtra, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPr, aod::pidTOFFullPr>;
using TracksWithSelAndDcaMc = soa::Join<TracksWithSelAndDca, aod::McTrackLabels>;
Partition<soa::Filtered<TracksWithSelAndDca>> lowPtTracks = aod::track::pt < 2.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightLowPt * 2.f);
Partition<soa::Filtered<TracksWithSelAndDca>> midPtTracks = aod::track::pt > 2.f && aod::track::pt < 5.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightMidPt * 2.f);
Partition<soa::Filtered<TracksWithSelAndDca>> lowPtTracks = aod::track::pt < 2.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightLowPt.node() * 2.f);
Partition<soa::Filtered<TracksWithSelAndDca>> midPtTracks = aod::track::pt > 2.f && aod::track::pt < 5.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightMidPt.node() * 2.f);
Partition<soa::Filtered<TracksWithSelAndDca>> highPtTracks = aod::track::pt > 5.f;

Partition<soa::Filtered<TracksWithSelAndDcaMc>> lowPtTracksMC = aod::track::pt < 2.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightLowPt * 2.f);
Partition<soa::Filtered<TracksWithSelAndDcaMc>> midPtTracksMC = aod::track::pt > 2.f && aod::track::pt < 5.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightMidPt * 2.f);
Partition<soa::Filtered<TracksWithSelAndDcaMc>> lowPtTracksMC = aod::track::pt < 2.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightLowPt.node() * 2.f);
Partition<soa::Filtered<TracksWithSelAndDcaMc>> midPtTracksMC = aod::track::pt > 2.f && aod::track::pt < 5.f && (nabs(aod::track::pt * 10000.f - nround(aod::track::pt * 10000.f)) < trackPtWeightMidPt.node() * 2.f);
Partition<soa::Filtered<TracksWithSelAndDcaMc>> highPtTracksMC = aod::track::pt > 5.f;

std::array<int, 3> pdgSignalParticleArray = {310, 421, 4122}; // K0s, D0 and Lc
Expand Down Expand Up @@ -185,7 +203,7 @@
// just for internal check
// double mass=particleMother.e()*particleMother.e()-particleMother.pt()*particleMother.pt()-particleMother.pz()*particleMother.pz();
// filteredTracksMC(mcparticle.pdgCode(),mcparticle.isPhysicalPrimary(),particleMother.pdgCode(),0,motherIndex,0,particleMother.pt(),particleMother.y(),std::sqrt(mass),0);
if (pdgParticleMother == 310) {

Check failure on line 206 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
auto daughtersSlice = mcparticle.template daughters_as<aod::McParticles>();
int ndaught = daughtersSlice.size(); // might not be accurate in case K0s interact with material before decaying
if (ndaught != 2)
Expand All @@ -197,13 +215,13 @@

int ndaught = 0;
std::vector<int> indxDaughers;
if (pdgParticleMother == 421) {

Check failure on line 218 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
if (RecoDecay::isMatchedMCGen<true, false>(mcParticles, particleMother, pdgParticleMother, pdgDecayDzero, true, nullptr, 3, &indxDaughers)) {
ndaught = 2;
// std::cout<<"######## FOUND D0, MATCHED! pdg: " <<particleMother.pdgCode()<<"################ size array "<<indxDaughers.size()<<std::endl;
} else
ndaught = -indxDaughers.size();
} else if (pdgParticleMother == 4122) {

Check failure on line 224 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
if (RecoDecay::isMatchedMCGen<true, false>(mcParticles, particleMother, pdgParticleMother, pdgDecayLc, true, nullptr, 3, &indxDaughers)) {
ndaught = 3;
} else
Expand Down Expand Up @@ -239,14 +257,14 @@
void processData(soa::Filtered<TracksWithSelAndDca> const& tracks)
{
if (trackPtSampling == 0) {
for (auto& track : tracks) {

Check failure on line 260 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fillTableData(track);
}
} else {
for (auto& track : lowPtTracks) {

Check failure on line 264 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fillTableData(track);
}
for (auto& track : midPtTracks) {

Check failure on line 267 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
fillTableData(track);
}
for (auto& track : highPtTracks) {
Expand All @@ -255,6 +273,11 @@
}
}
PROCESS_SWITCH(FilterTracks, processData, "process data", true);
void processCollisions(CollisionsWithEvSel::iterator const& collision)
{
filterCollTable(collision.bcId(), collision.posX(), collision.posY(), collision.posZ(), collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ(), collision.flags(), collision.chi2(), collision.numContrib(), collision.collisionTime(), collision.collisionTimeRes());
}
PROCESS_SWITCH(FilterTracks, processCollisions, "process collisions", true);

void processMC(soa::Filtered<TracksWithSelAndDcaMc> const& tracks, aod::McParticles const& mcParticles)
{
Expand All @@ -281,12 +304,12 @@
std::vector<int> indxDaughers;
float etamax = 0;
bool isMatchedToSignal = false;
if (std::abs(pdgCode) == 310) {

Check failure on line 307 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
isMatchedToSignal = RecoDecay::isMatchedMCGen<true, false>(mcParticles, mcpart, 310, pdgDecayKzero, true, nullptr, 1, &indxDaughers);
}
if (std::abs(pdgCode) == 421) {

Check failure on line 310 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
isMatchedToSignal = RecoDecay::isMatchedMCGen<true, false>(mcParticles, mcpart, 421, pdgDecayDzero, true, nullptr, 3, &indxDaughers);
} else if (std::abs(pdgCode) == 4122) {

Check failure on line 312 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
isMatchedToSignal = RecoDecay::isMatchedMCGen<true, false>(mcParticles, mcpart, 4122, pdgDecayLc, true, nullptr, 3, &indxDaughers);
// std::cout<<"Lc found, matched to MC? "<<isMatchedToSignal<<std::endl;
// if(!isMatchedToSignal){
Expand All @@ -305,7 +328,7 @@
etamax = eta;
}
}
if (pdgCode == 310) {

Check failure on line 331 in DPG/Tasks/ITS/filterTracks.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[pdg/explicit-code]

Avoid hard-coded PDG codes. Use named values from PDG_t or o2::constants::physics::Pdg instead.
selectedGenParticles(mcpart.pdgCode(), mcpart.mcCollisionId(), 0, mcpart.pt(), mcpart.y(), etamax, 0, 0);
continue;
}
Expand Down
Loading