Skip to content

Commit

Permalink
Extra adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
David Dobrigkeit Chinellato committed Jan 5, 2024
1 parent 4ac00c5 commit fe5d387
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 42 deletions.
31 changes: 18 additions & 13 deletions PWGLF/DataModel/LFStrangenessPIDTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ namespace v0data
{
// ==== TOF INFORMATION ===
// lengths as stored in the AO2D for TOF calculations
DECLARE_SOA_COLUMN(PosTOFLength, posTOFLength, float); //! positive track length
DECLARE_SOA_COLUMN(NegTOFLength, negTOFLength, float); //! negative track length
DECLARE_SOA_COLUMN(PosTOFLengthToPV, posTOFLengthToPV, float); //! positive track length to PV
DECLARE_SOA_COLUMN(NegTOFLengthToPV, negTOFLengthToPV, float); //! negative track length to PV
DECLARE_SOA_COLUMN(PosTOFSignal, posTOFSignal, float); //! positive track signal
DECLARE_SOA_COLUMN(NegTOFSignal, negTOFSignal, float); //! negative track signal
DECLARE_SOA_COLUMN(PosTOFEventTime, posTOFEventTime, float); //! positive track event time
DECLARE_SOA_COLUMN(NegTOFEventTime, negTOFEventTime, float); //! negative track event time

// recalculated lengths
DECLARE_SOA_COLUMN(PosTOFLength, posTOFLength, float); //! positive track length, recalculated
DECLARE_SOA_COLUMN(NegTOFLength, negTOFLength, float); //! negative track length, recalculated

// delta-times
DECLARE_SOA_COLUMN(PosTOFDeltaTLaPi, posTOFDeltaTLaPi, float); //! positive track TOFDeltaT from pion <- lambda expectation
DECLARE_SOA_COLUMN(PosTOFDeltaTLaPr, posTOFDeltaTLaPr, float); //! positive track TOFDeltaT from proton <- lambda expectation
Expand All @@ -68,13 +72,14 @@ DECLARE_SOA_COLUMN(NegNSigmaK0Pi, negNSigmaK0Pi, float); //! positive track NSig
} // namespace v0data

DECLARE_SOA_TABLE(V0TOFs, "AOD", "V0TOF", // raw information table (for debug, etc)
v0data::PosTOFLength, v0data::NegTOFLength,
v0data::PosTOFLengthToPV, v0data::NegTOFLengthToPV,
v0data::PosTOFSignal, v0data::NegTOFSignal,
v0data::PosTOFEventTime, v0data::NegTOFEventTime,
v0data::PosTOFEventTime, v0data::NegTOFEventTime);
DECLARE_SOA_TABLE(V0TOFPIDs, "AOD", "V0TOFPID", // processed info table (for analysis)
v0data::PosTOFLength, v0data::NegTOFLength,
v0data::PosTOFDeltaTLaPi, v0data::PosTOFDeltaTLaPr,
v0data::NegTOFDeltaTLaPi, v0data::NegTOFDeltaTLaPr,
v0data::PosTOFDeltaTK0Pi, v0data::NegTOFDeltaTK0Pi);
DECLARE_SOA_TABLE(V0TOFPIDs, "AOD", "V0TOFPID", // nsigma table (for analysis)
v0data::PosTOFDeltaTK0Pi, v0data::NegTOFDeltaTK0Pi,
v0data::PosNSigmaLaPi, v0data::PosNSigmaLaPr,
v0data::NegNSigmaLaPi, v0data::NegNSigmaLaPr,
v0data::PosNSigmaK0Pi, v0data::NegNSigmaK0Pi);
Expand All @@ -83,9 +88,9 @@ namespace cascdata
{
// ==== TOF INFORMATION ===
// lengths as stored in the AO2D for TOF calculations
DECLARE_SOA_COLUMN(PosTOFLength, posTOFLength, float); //! positive track length
DECLARE_SOA_COLUMN(NegTOFLength, negTOFLength, float); //! negative track length
DECLARE_SOA_COLUMN(BachTOFLength, bachTOFLength, float); //! bachelor track length
DECLARE_SOA_COLUMN(PosTOFLengthToPV, posTOFLengthToPV, float); //! positive track length
DECLARE_SOA_COLUMN(NegTOFLengthToPV, negTOFLengthToPV, float); //! negative track length
DECLARE_SOA_COLUMN(BachTOFLengthToPV, bachTOFLengthToPV, float); //! bachelor track length
DECLARE_SOA_COLUMN(PosTOFSignal, posTOFSignal, float); //! positive track signal
DECLARE_SOA_COLUMN(NegTOFSignal, negTOFSignal, float); //! negative track signal
DECLARE_SOA_COLUMN(BachTOFSignal, bachTOFSignal, float); //! bachelor track signal
Expand Down Expand Up @@ -119,16 +124,16 @@ DECLARE_SOA_COLUMN(BachNSigmaOmKa, bachNSigmaOmKa, float); //! bachelor tr
} // namespace cascdata

DECLARE_SOA_TABLE(CascTOFs, "AOD", "CascTOF", // raw information table (for debug, etc)
cascdata::PosTOFLength, cascdata::NegTOFLength, cascdata::BachTOFLength,
cascdata::PosTOFLengthToPV, cascdata::NegTOFLengthToPV, cascdata::BachTOFLengthToPV,
cascdata::PosTOFSignal, cascdata::NegTOFSignal, cascdata::BachTOFSignal,
cascdata::PosTOFEventTime, cascdata::NegTOFEventTime, cascdata::BachTOFEventTime,
cascdata::PosTOFEventTime, cascdata::NegTOFEventTime, cascdata::BachTOFEventTime);
DECLARE_SOA_TABLE(CascTOFPIDs, "AOD", "CASCTOFPID", // processed information for analysis
cascdata::PosTOFDeltaTXiPi, cascdata::PosTOFDeltaTXiPr,
cascdata::NegTOFDeltaTXiPi, cascdata::NegTOFDeltaTXiPr,
cascdata::BachTOFDeltaTXiPi,
cascdata::PosTOFDeltaTOmPi, cascdata::PosTOFDeltaTOmPr,
cascdata::NegTOFDeltaTOmPi, cascdata::NegTOFDeltaTOmPr,
cascdata::BachTOFDeltaTOmPi);
DECLARE_SOA_TABLE(CascTOFPIDs, "AOD", "CASCTOFPID", // nsigma table (for analysis)
cascdata::BachTOFDeltaTOmPi,
cascdata::PosNSigmaXiPi, cascdata::PosNSigmaXiPr,
cascdata::NegNSigmaXiPi, cascdata::NegNSigmaXiPr,
cascdata::BachNSigmaXiPi,
Expand Down
9 changes: 0 additions & 9 deletions PWGLF/TableProducer/cascadepid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ using LabeledTracksExtra = soa::Join<aod::TracksExtra, aod::McTrackLabels>;

struct cascadepid {
// TOF pid for strangeness (recalculated with topology)
Produces<aod::CascTOFs> casctof; // raw table for checks
Produces<aod::CascTOFPIDs> casctofpid; // table with Nsigmas

Service<o2::ccdb::BasicCCDBManager> ccdb;
Expand Down Expand Up @@ -246,14 +245,6 @@ struct cascadepid {
auto negTrack = cascade.negTrack_as<FullTracksExtIU>();

// FIXME: TOF calculation: under construction, to follow

if (fillRawPID) {
casctof(posTrack.length(), negTrack.length(), bachTrack.length(),
posTrack.tofSignal(), negTrack.tofSignal(), bachTrack.tofSignal(),
posTrack.tofEvTime(), negTrack.tofEvTime(), bachTrack.tofEvTime(),
0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
}
}
}
}
Expand Down
15 changes: 5 additions & 10 deletions PWGLF/TableProducer/lambdakzeropid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ using LabeledTracksExtra = soa::Join<aod::TracksExtra, aod::McTrackLabels>;

struct lambdakzeropid {
// TOF pid for strangeness (recalculated with topology)
Produces<aod::V0TOFs> v0tof; // raw table for checks
Produces<aod::V0TOFPIDs> v0tofpid; // table with Nsigmas

Service<o2::ccdb::BasicCCDBManager> ccdb;
Expand All @@ -91,7 +90,6 @@ struct lambdakzeropid {
Configurable<double> d_bz_input{"d_bz", -999, "bz field, -999 is automatic"};
Configurable<float> tofPosition{"tofPosition", 377.934f, "TOF effective (inscribed) radius"};
Configurable<bool> checkTPCCompatibility{"checkTPCCompatibility", true, "check compatibility with dE/dx in QA plots"};
Configurable<bool> fillRawPID{"fillRawPID", true, "fill raw PID tables for debug/x-check"};

// CCDB options
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Expand Down Expand Up @@ -357,14 +355,11 @@ struct lambdakzeropid {
deltaTimePositiveK0ShortPi = (posTrackRow.tofSignal() - posTrackRow.tofEvTime()) - (timeK0Short + timeNegativePi);
deltaTimeNegativeK0ShortPi = (negTrackRow.tofSignal() - negTrackRow.tofEvTime()) - (timeK0Short + timeNegativePi);

if (fillRawPID) {
v0tof(posTrackRow.length(), negTrackRow.length(),
posTrackRow.tofSignal(), negTrackRow.tofSignal(),
posTrackRow.tofEvTime(), negTrackRow.tofEvTime(),
deltaTimePositiveLambdaPi, deltaTimePositiveLambdaPr,
deltaTimeNegativeLambdaPi, deltaTimeNegativeLambdaPr,
deltaTimePositiveK0ShortPi, deltaTimeNegativeK0ShortPi);
}
v0tofpid(lengthPositive, lengthNegative,
deltaTimePositiveLambdaPi, deltaTimePositiveLambdaPr,
deltaTimeNegativeLambdaPi, deltaTimeNegativeLambdaPr,
deltaTimePositiveK0ShortPi, deltaTimeNegativeK0ShortPi,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); //FIXME

auto originalV0 = v0.v0_as<TaggedV0s>(); // this could look confusing, so:
// the first v0 is the v0data row; the getter de-references the v0 (stored indices) row
Expand Down
50 changes: 40 additions & 10 deletions PWGLF/TableProducer/strangederivedbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ using namespace o2::framework::expressions;
using std::array;

using TracksWithExtra = soa::Join<aod::TracksIU, aod::TracksExtra, aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTPCFullHe>;
using FullTracksExtIUTOF = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::TOFEvTime, aod::TOFSignal>;

// simple checkers
#define bitset(var, nbit) ((var) |= (1 << (nbit)))
Expand Down Expand Up @@ -88,6 +89,11 @@ struct strangederivedbuilder {
Produces<aod::CascMCMothers> cascmothers; // casc mother references
Produces<aod::MotherMCParts> motherMCParts; // mc particles for mothers

//__________________________________________________
// raw TOF PID for posterior use if requested
Produces<aod::V0TOFs> v0tofs; // V0 part
Produces<aod::CascTOFs> casctofs; // cascade part

// histogram registry for bookkeeping
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

Expand Down Expand Up @@ -119,8 +125,11 @@ struct strangederivedbuilder {
Preslice<aod::KFCascDatas> KFCascperCollision = o2::aod::cascdata::collisionId;
Preslice<aod::TraCascDatas> TraCascperCollision = o2::aod::cascdata::collisionId;

int64_t currentCollIdx;

void init(InitContext& context)
{
currentCollIdx = -1;
// setup map for fast checking if enabled
static_for<0, nSpecies - 1>([&](auto i) {
constexpr int index = i.value;
Expand Down Expand Up @@ -158,7 +167,6 @@ struct strangederivedbuilder {

void processCollisions(soa::Join<aod::Collisions, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As> const& collisions, aod::V0Datas const& V0s, aod::CascDatas const& Cascades, aod::KFCascDatas const& KFCascades, aod::TraCascDatas const& TraCascades)
{
int currentCollIdx = -1;
for (const auto& collision : collisions) {
const uint64_t collIdx = collision.globalIndex();
auto V0Table_thisColl = V0s.sliceBy(V0perCollision, collIdx);
Expand All @@ -171,21 +179,19 @@ struct strangederivedbuilder {
TraCascTable_thisColl.size() > 0;
// casc table sliced
if (strange || fillEmptyCollisions) {
if (currentCollIdx != collIdx) {
strangeColl(collision.posX(), collision.posY(), collision.posZ());
strangeCents(collision.centFT0M(), collision.centFT0A(),
strangeColl(collision.posX(), collision.posY(), collision.posZ());
strangeCents(collision.centFT0M(), collision.centFT0A(),
collision.centFT0C(), collision.centFV0A());
currentCollIdx = collIdx;
}
currentCollIdx++;
}
for (int i = 0; i < V0Table_thisColl.size(); i++)
v0collref(strangeColl.lastIndex());
v0collref(currentCollIdx);
for (int i = 0; i < CascTable_thisColl.size(); i++)
casccollref(strangeColl.lastIndex());
casccollref(currentCollIdx);
for (int i = 0; i < KFCascTable_thisColl.size(); i++)
kfcasccollref(strangeColl.lastIndex());
kfcasccollref(currentCollIdx);
for (int i = 0; i < TraCascTable_thisColl.size(); i++)
tracasccollref(strangeColl.lastIndex());
tracasccollref(currentCollIdx);
}
}

Expand Down Expand Up @@ -418,6 +424,28 @@ struct strangederivedbuilder {
}
}

void processProduceV0TOFs(aod::Collision const& collision, aod::V0Datas const& V0s, FullTracksExtIUTOF const&)
{
for (auto const& v0 : V0s) {
auto const& posTrackRow = v0.posTrack_as<FullTracksExtIUTOF>();
auto const& negTrackRow = v0.negTrack_as<FullTracksExtIUTOF>();
v0tofs(posTrackRow.length(), negTrackRow.length(),
posTrackRow.tofSignal(), negTrackRow.tofSignal(),
posTrackRow.tofEvTime(), negTrackRow.tofEvTime());
}
}
void processProduceCascTOFs(aod::Collision const& collision, aod::CascDatas const& Cascades, FullTracksExtIUTOF const&)
{
for (auto const& cascade : Cascades) {
auto const& posTrackRow = cascade.posTrack_as<FullTracksExtIUTOF>();
auto const& negTrackRow = cascade.negTrack_as<FullTracksExtIUTOF>();
auto const& bachTrackRow = cascade.bachelor_as<FullTracksExtIUTOF>();
casctofs(posTrackRow.length(), negTrackRow.length(), bachTrackRow.length(),
posTrackRow.tofSignal(), negTrackRow.tofSignal(), bachTrackRow.tofSignal(),
posTrackRow.tofEvTime(), negTrackRow.tofEvTime(), bachTrackRow.tofEvTime());
}
}

PROCESS_SWITCH(strangederivedbuilder, processCollisionsV0sOnly, "Produce collisions (V0s only)", true);
PROCESS_SWITCH(strangederivedbuilder, processCollisions, "Produce collisions (V0s + casc)", true);
PROCESS_SWITCH(strangederivedbuilder, processTrackExtrasV0sOnly, "Produce track extra information (V0s only)", true);
Expand All @@ -426,6 +454,8 @@ struct strangederivedbuilder {
PROCESS_SWITCH(strangederivedbuilder, processCascadeInterlinkTracked, "Produce tables interconnecting cascades", false);
PROCESS_SWITCH(strangederivedbuilder, processCascadeInterlinkKF, "Produce tables interconnecting cascades", false);
PROCESS_SWITCH(strangederivedbuilder, processSimulation, "Produce simulated information", true);
PROCESS_SWITCH(strangederivedbuilder, processProduceV0TOFs, "Produce V0TOFs table", true);
PROCESS_SWITCH(strangederivedbuilder, processProduceCascTOFs, "Produce CascTOFs table", true);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down

0 comments on commit fe5d387

Please sign in to comment.