Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions PWGLF/DataModel/LFhe3HadronTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
DECLARE_SOA_COLUMN(EtaHad, etaHad, float);
DECLARE_SOA_COLUMN(PhiHad, phiHad, float);

DECLARE_SOA_COLUMN(DCAxyHe3, dcaxyHe3, float);

Check failure on line 36 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(DCAzHe3, dcazHe3, float);

Check failure on line 37 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(DCAxyHad, dcaxyHad, float);

Check failure on line 38 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(DCAzHad, dcazHad, float);

Check failure on line 39 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.

DECLARE_SOA_COLUMN(SignalTPCHe3, signalTPCHe3, float);
DECLARE_SOA_COLUMN(InnerParamTPCHe3, innerParamTPCHe3, float);
Expand All @@ -56,8 +56,8 @@
DECLARE_SOA_COLUMN(Chi2TPCHad, chi2TPCHad, float);
DECLARE_SOA_COLUMN(MassTOFHe3, massTOFHe3, float);
DECLARE_SOA_COLUMN(MassTOFHad, massTOFHad, float);
DECLARE_SOA_COLUMN(PIDtrkHe3, pidTrkHe3, uint32_t);

Check failure on line 59 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(PIDtrkHad, pidTrkHad, uint32_t);

Check failure on line 60 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(TrackIDHe3, trackIDHe3, int);
DECLARE_SOA_COLUMN(TrackIDHad, trackIDHad, int);

Expand All @@ -80,9 +80,10 @@
DECLARE_SOA_COLUMN(MassMC, massMC, float);

DECLARE_SOA_COLUMN(CollisionId, collisionId, int64_t);
DECLARE_SOA_COLUMN(CollisionSelectionFlag, collisionSelectionFlag, int32_t);
DECLARE_SOA_COLUMN(ZVertex, zVertex, float);
DECLARE_SOA_COLUMN(Multiplicity, multiplicity, uint16_t);
DECLARE_SOA_COLUMN(CentralityFT0C, centFT0C, float);

Check failure on line 86 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-column]

Use UpperCamelCase for names of O2 columns and matching lowerCamelCase names for their getters.
DECLARE_SOA_COLUMN(MultiplicityFT0C, multiplicityFT0C, float);

/* Flags: 0 - both primary,
Expand All @@ -94,7 +95,7 @@

} // namespace he3HadronTablesNS

DECLARE_SOA_TABLE(he3HadronTable, "AOD", "HE3HADTABLE",

Check failure on line 98 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-table]

Use UpperCamelCase for names of O2 tables.
he3HadronTablesNS::PtHe3,
he3HadronTablesNS::EtaHe3,
he3HadronTablesNS::PhiHe3,
Expand All @@ -120,7 +121,7 @@
he3HadronTablesNS::ItsClusterSizeHe3,
he3HadronTablesNS::ItsClusterSizeHad,
he3HadronTablesNS::SharedClustersHe3)
DECLARE_SOA_TABLE(he3HadronTableMC, "AOD", "HE3HADTABLEMC",

Check failure on line 124 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-table]

Use UpperCamelCase for names of O2 tables.
he3HadronTablesNS::PtMCHe3,
he3HadronTablesNS::EtaMCHe3,
he3HadronTablesNS::PhiMCHe3,
Expand All @@ -130,8 +131,9 @@
he3HadronTablesNS::SignedPtMC,
he3HadronTablesNS::MassMC,
he3HadronTablesNS::Flags)
DECLARE_SOA_TABLE(he3HadronMult, "AOD", "HE3HADMULT",

Check failure on line 134 in PWGLF/DataModel/LFhe3HadronTables.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-table]

Use UpperCamelCase for names of O2 tables.
he3HadronTablesNS::CollisionId,
he3HadronTablesNS::CollisionSelectionFlag,
he3HadronTablesNS::ZVertex,
he3HadronTablesNS::Multiplicity,
he3HadronTablesNS::CentralityFT0C,
Expand Down
43 changes: 31 additions & 12 deletions PWGLF/TableProducer/Nuspex/he3HadronFemto.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ struct he3HadronFemto {
o2::aod::ITSResponse mResponseITS;

std::vector<bool> mGoodCollisions;
std::vector<uint32_t> mCollisionSelectionFlags;
std::vector<SVCand> mTrackPairs;
o2::vertexing::DCAFitterN<2> mFitter;
svPoolCreator mSvPoolCreator{He3PDG, ProtonPDG};
Expand Down Expand Up @@ -431,8 +432,8 @@ struct he3HadronFemto {
}

mQaRegistry.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(1, "All");
for (int iSel = 1; iSel < nuclei::evSel::kNevSels + 1; iSel++) {
mQaRegistry.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(iSel + 1, nuclei::eventSelectionLabels[iSel].c_str());
for (int iSel = 0; iSel < nuclei::evSel::kNevSels + 2; iSel++) {
mQaRegistry.get<TH1>(HIST("hEventSelections"))->GetXaxis()->SetBinLabel(iSel + 2, nuclei::eventSelectionLabels[iSel].c_str());
}

const int nBetheBlochParameters = 5;
Expand Down Expand Up @@ -529,14 +530,14 @@ struct he3HadronFemto {
// ==================================================================================================================

template <bool isMC, typename Tcollision>
bool selectCollision(const Tcollision& collision, const aod::BCsWithTimestamps&)
bool selectCollision(const Tcollision& collision, const aod::BCsWithTimestamps&, uint32_t& collisionSelectionFlag)
{
mQaRegistry.fill(HIST("hEvents"), 0);

auto bc = collision.template bc_as<aod::BCsWithTimestamps>();
initCCDB(bc);

if (!nuclei::eventSelection(collision, mQaRegistry, settingEventSelections, cutSettings.settingCutVertex)) {
if (!nuclei::eventSelection(collision, mQaRegistry, settingEventSelections, cutSettings.settingCutVertex, collisionSelectionFlag)) {
return false;
}
if (settingSkimmedProcessing) {
Expand Down Expand Up @@ -980,6 +981,7 @@ struct he3HadronFemto {
template <typename Tcoll>
void fillTable(const He3HadCandidate& he3Hadcand, const Tcoll& collision, bool isMC = false)
{
const uint32_t collisionSelectionFlag = mCollisionSelectionFlags[he3Hadcand.collisionID];
outputDataTable(
he3Hadcand.recoPtHe3(), he3Hadcand.recoEtaHe3(), he3Hadcand.recoPhiHe3(),
he3Hadcand.recoPtHad(), he3Hadcand.recoEtaHad(), he3Hadcand.recoPhiHad(),
Expand All @@ -1000,8 +1002,8 @@ struct he3HadronFemto {
he3Hadcand.l4PtMC, he3Hadcand.l4MassMC, he3Hadcand.flags);
}
outputMultiplicityTable(
collision.globalIndex(), collision.posZ(), collision.numContrib(),
collision.centFT0C(), collision.multFT0C());
collision.globalIndex(), collisionSelectionFlag, collision.posZ(),
collision.numContrib(), collision.centFT0C(), collision.multFT0C());
outputQaTable(
he3Hadcand.trackIDHe3, he3Hadcand.trackIDHad, he3Hadcand.massTOFHe3,
he3Hadcand.pidtrkHad, he3Hadcand.sharedClustersHad);
Expand Down Expand Up @@ -1158,16 +1160,20 @@ struct he3HadronFemto {
{
mGoodCollisions.clear();
mGoodCollisions.resize(collisions.size(), false);
mCollisionSelectionFlags.clear();
mCollisionSelectionFlags.resize(collisions.size(), 0);

for (const auto& collision : collisions) {

mTrackPairs.clear();

if (!selectCollision</*isMC*/ false>(collision, bcs)) {
uint32_t collisionSelectionFlag = 0;
if (!selectCollision</*isMC*/ false>(collision, bcs, collisionSelectionFlag)) {
continue;
}

mGoodCollisions[collision.globalIndex()] = true;
mCollisionSelectionFlags[collision.globalIndex()] = collisionSelectionFlag;
const uint64_t collIdx = collision.globalIndex();
auto trackTableThisCollision = tracks.sliceBy(mPerCol, collIdx);
trackTableThisCollision.bindExternalIndices(&tracks);
Expand All @@ -1183,15 +1189,21 @@ struct he3HadronFemto {
}
PROCESS_SWITCH(he3HadronFemto, processSameEvent, "Process Same event", false);

void processMixedEvent(const CollisionsFull& collisions, const TrackCandidates& tracks)
void processMixedEvent(const CollisionsFull& collisions, const aod::BCsWithTimestamps& bcs, const TrackCandidates& tracks)
{
LOG(debug) << "Processing mixed event";
mTrackPairs.clear();
mCollisionSelectionFlags.clear();
mCollisionSelectionFlags.resize(collisions.size(), 0);

for (const auto& [c1, tracks1, c2, tracks2] : mPair) {
if (!c1.sel8() || !c2.sel8()) {
uint32_t collisionSelectionFlag1 = 0;
uint32_t collisionSelectionFlag2 = 0;
if (!selectCollision</*isMC*/ false>(c1, bcs, collisionSelectionFlag1) || !selectCollision</*isMC*/ false>(c2, bcs, collisionSelectionFlag2)) {
continue;
}
mCollisionSelectionFlags[c1.globalIndex()] = collisionSelectionFlag1;
mCollisionSelectionFlags[c2.globalIndex()] = collisionSelectionFlag2;

mQaRegistry.fill(HIST("hNcontributor"), c1.numContrib());
mQaRegistry.fill(HIST("hVtxZ"), c1.posZ());
Expand All @@ -1210,14 +1222,18 @@ struct he3HadronFemto {

mGoodCollisions.clear();
mGoodCollisions.resize(collisions.size(), false);
mCollisionSelectionFlags.clear();
mCollisionSelectionFlags.resize(collisions.size(), 0);

for (const auto& collision : collisions) {

mTrackPairs.clear();

if (!selectCollision</*isMC*/ true>(collision, bcs)) {
uint32_t collisionSelectionFlag = 0;
if (!selectCollision</*isMC*/ true>(collision, bcs, collisionSelectionFlag)) {
continue;
}
mCollisionSelectionFlags[collision.globalIndex()] = collisionSelectionFlag;

const uint64_t collIdx = collision.globalIndex();
mGoodCollisions[collIdx] = true;
Expand Down Expand Up @@ -1308,8 +1324,10 @@ struct he3HadronFemto {

void processPurity(const CollisionsFull::iterator& collision, const TrackCandidates& tracks, const aod::BCsWithTimestamps& bcs)
{
if (!selectCollision</*isMC*/ false>(collision, bcs))
uint32_t collisionSelectionFlag = 0; // dummy, purity study does not fill a tree
if (!selectCollision</*isMC*/ false>(collision, bcs, collisionSelectionFlag)) {
return;
}

for (const auto& track : tracks) {

Expand Down Expand Up @@ -1362,7 +1380,8 @@ struct he3HadronFemto {

void processPurityMc(const CollisionsFullMC::iterator& collision, const TrackCandidatesMC& tracks, const aod::BCsWithTimestamps& bcs, const aod::McParticles& /*mcParticles*/, const aod::McTrackLabels& /*mcTrackLabels*/)
{
if (!selectCollision</*isMC*/ false>(collision, bcs)) {
uint32_t collisionSelectionFlag = 0; // dummy, purity study does not fill a tree
if (!selectCollision</*isMC*/ false>(collision, bcs, collisionSelectionFlag)) {
return;
}

Expand Down
101 changes: 39 additions & 62 deletions PWGLF/Utils/nucleiUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,23 @@ constexpr int EvSelDefault[evSel::kNevSels][1]{
{0},
{0}};

template <typename Tcollision> // move to nucleiUtils
bool eventSelection(const Tcollision& collision, o2::framework::HistogramRegistry& registry, o2::framework::LabeledArray<int> eventSelections, const float cutVertex)
template <typename Tcollision>
bool eventSelection(const Tcollision& collision, o2::framework::HistogramRegistry& registry, o2::framework::LabeledArray<int> eventSelections, const float cutVertex, uint32_t& selectionFlag)
{
selectionFlag = 0;
bool isSelected = true;
auto checkCut = [&](int selIndex, bool pass) {
if (pass) {
selectionFlag |= (1u << selIndex);
}
if (eventSelections.get(selIndex) && !pass) {
isSelected = false;
}
if (isSelected) {
registry.fill(HIST("hEventSelections"), selIndex + 1);
}
};

if (!registry.contains(HIST("hVtxZBefore"))) {
registry.add("hVtxZBefore", "Vertex distribution in Z before selections;Z (cm)", {o2::framework::HistType::kTH1F, {{400, -20.0, 20.0}}});
}
Expand All @@ -344,69 +358,32 @@ bool eventSelection(const Tcollision& collision, o2::framework::HistogramRegistr
registry.fill(HIST("hEventSelections"), 0);
registry.fill(HIST("hVtxZBefore"), collision.posZ());

if (eventSelections.get(evSel::kTVX) && !collision.selection_bit(o2::aod::evsel::kIsTriggerTVX)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kTVX + 1);

if (eventSelections.get(evSel::kZvtx) && std::abs(collision.posZ()) > cutVertex) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kZvtx + 1);

if (eventSelections.get(evSel::kTFborder) && !collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kTFborder + 1);

if (eventSelections.get(evSel::kITSROFborder) && !collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kITSROFborder + 1);

if (eventSelections.get(evSel::kNoSameBunchPileup) && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kNoSameBunchPileup + 1);

if (eventSelections.get(evSel::kIsGoodZvtxFT0vsPV) && !collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kIsGoodZvtxFT0vsPV + 1);
checkCut(evSel::kTVX, collision.selection_bit(o2::aod::evsel::kIsTriggerTVX));
checkCut(evSel::kZvtx, std::abs(collision.posZ()) <= cutVertex);
checkCut(evSel::kTFborder, collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder));
checkCut(evSel::kITSROFborder, collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder));
checkCut(evSel::kNoSameBunchPileup, collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup));
checkCut(evSel::kIsGoodZvtxFT0vsPV, collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV));
checkCut(evSel::kIsGoodITSLayersAll, collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll));

if (eventSelections.get(evSel::kIsGoodITSLayersAll) && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kIsGoodITSLayersAll + 1);

if constexpr (
requires {
collision.triggereventep();
}) {
if (eventSelections.get(evSel::kIsEPtriggered) && !collision.triggereventep()) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kIsEPtriggered + 1);
if constexpr (requires { collision.triggereventep(); }) {
checkCut(evSel::kIsEPtriggered, collision.triggereventep());
}

if (eventSelections.get(evSel::kNoCollInRofStandard) && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kNoCollInRofStandard + 1);

if (eventSelections.get(evSel::kNoHighMultCollInPrevRof) && !collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kNoHighMultCollInPrevRof + 1);

if (eventSelections.get(evSel::kNoCollInTimeRangeStandard) && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
return false;
}
registry.fill(HIST("hEventSelections"), evSel::kNoCollInTimeRangeStandard + 1);
checkCut(evSel::kNoCollInRofStandard, collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard));
checkCut(evSel::kNoHighMultCollInPrevRof, collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof));
checkCut(evSel::kNoCollInTimeRangeStandard, collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard));

registry.fill(HIST("hVtxZ"), collision.posZ());

return true;
return isSelected;
}

template <typename Tcollision>
bool eventSelection(const Tcollision& collision, o2::framework::HistogramRegistry& registry, o2::framework::LabeledArray<int> eventSelections, const float cutVertex)
{
uint32_t dummyFlag = 0;
return eventSelection(collision, registry, eventSelections, cutVertex, dummyFlag);
}

/**
Expand All @@ -420,10 +397,10 @@ float getCentrality(Tcollision const& collision, const int centralityEstimator,
hFailCentrality->Fill(0.);
}
if constexpr (!o2::aod::HasCentrality<Tcollision>) { // requires aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentNTPVs
return -1.f;
if (hFailCentrality) {
hFailCentrality->Fill(1.);
}
return -1.f;
}
if (centralityEstimator == centDetectors::kFV0A) {
return collision.centFV0A();
Expand Down Expand Up @@ -633,11 +610,11 @@ class PidManager
}

private:
float mTpcBetheBlochParams[6];
float mTpcBetheBlochParams[6] = {-999.f, -999.f, -999.f, -999.f, -999.f, -999.f};
bool mUseTpcCentralCalibration = true; // this just becomes a check for the null pointer in the parameters
o2::aod::ITSResponse mResponseITS;
float mMomScaling[2]{1., 0.};
int mSpecies;
int mSpecies = -1;
};

} // namespace nuclei
Expand Down
Loading