Skip to content

Commit

Permalink
add (DCA,Pt,Mass) histogram to analyser - switch to histogram registry (
Browse files Browse the repository at this point in the history
#5421)

* add (DCA,Pt,Mass) histogram to result

* switch to histogram registries and fix some typos

Co-authored-by: alandou <aimeric.landou@cern.ch>
  • Loading branch information
aimeric-landou and alandou committed Feb 11, 2021
1 parent 8d157dc commit 0da06ab
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 54 deletions.
69 changes: 46 additions & 23 deletions Analysis/Tasks/PWGLF/lambdakzeroanalysis.cxx
Expand Up @@ -52,37 +52,51 @@ using std::array;

struct lambdakzeroQA {
//Basic checks
OutputObj<TH1F> hMassK0Short{TH1F("hMassK0Short", "", 3000, 0.0, 3.0)};
OutputObj<TH1F> hMassLambda{TH1F("hMassLambda", "", 3000, 0.0, 3.0)};
OutputObj<TH1F> hMassAntiLambda{TH1F("hMassAntiLambda", "", 3000, 0.0, 3.0)};
HistogramRegistry registry{
"registry",
{
{"hMassK0Short", "hMassK0Short", {HistType::kTH1F, {{3000, 0.0f, 3.0f}}}},
{"hMassLambda", "hMassLambda", {HistType::kTH1F, {{3000, 0.0f, 3.0f}}}},
{"hMassAntiLambda", "hMassAntiLambda", {HistType::kTH1F, {{3000, 0.0f, 3.0f}}}},

OutputObj<TH1F> hV0Radius{TH1F("hV0Radius", "", 1000, 0.0, 100)};
OutputObj<TH1F> hV0CosPA{TH1F("hV0CosPA", "", 1000, 0.95, 1.0)};
OutputObj<TH1F> hDCAPosToPV{TH1F("hDCAPosToPV", "", 1000, 0.0, 10.0)};
OutputObj<TH1F> hDCANegToPV{TH1F("hDCANegToPV", "", 1000, 0.0, 10.0)};
OutputObj<TH1F> hDCAV0Dau{TH1F("hDCAV0Dau", "", 1000, 0.0, 10.0)};
{"hV0Radius", "hV0Radius", {HistType::kTH1F, {{1000, 0.0f, 100.0f}}}},
{"hV0CosPA", "hV0CosPA", {HistType::kTH1F, {{1000, 0.95f, 1.0f}}}},
{"hDCAPosToPV", "hDCAPosToPV", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}},
{"hDCANegToPV", "hDCANegToPV", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}},
{"hDCAV0Dau", "hDCAV0Dau", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}},
},
};

void process(aod::Collision const& collision, aod::V0DataExt const& fullV0s)
{
for (auto& v0 : fullV0s) {
hMassLambda->Fill(v0.mLambda());
hMassAntiLambda->Fill(v0.mAntiLambda());
hMassK0Short->Fill(v0.mK0Short());

hV0Radius->Fill(v0.v0radius());
hV0CosPA->Fill(v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()));
for (auto& v0 : fullV0s) {
registry.fill(HIST("hMassK0Short"), v0.mK0Short());
registry.fill(HIST("hMassLambda"), v0.mLambda());
registry.fill(HIST("hMassAntiLambda"), v0.mAntiLambda());

hDCAPosToPV->Fill(v0.dcapostopv());
hDCANegToPV->Fill(v0.dcanegtopv());
hDCAV0Dau->Fill(v0.dcaV0daughters());
registry.fill(HIST("hV0Radius"), v0.v0radius());
registry.fill(HIST("hV0CosPA"), v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()));
registry.fill(HIST("hDCAPosToPV"), v0.dcapostopv());
registry.fill(HIST("hDCANegToPV"), v0.dcanegtopv());
registry.fill(HIST("hDCAV0Dau"), v0.dcaV0daughters());
}
}
};

struct lambdakzeroanalysis {
OutputObj<TH3F> h3dMassK0Short{TH3F("h3dMassK0Short", "", 20, 0, 100, 200, 0, 10, 200, 0.450, 0.550)};
OutputObj<TH3F> h3dMassLambda{TH3F("h3dMassLambda", "", 20, 0, 100, 200, 0, 10, 200, 1.115 - 0.100, 1.115 + 0.100)};
OutputObj<TH3F> h3dMassAntiLambda{TH3F("h3dMassAntiLambda", "", 20, 0, 100, 200, 0, 10, 200, 1.115 - 0.100, 1.115 + 0.100)};
HistogramRegistry registry{
"registry",
{
{"h3dMassK0Short", "h3dMassK0Short", {HistType::kTH3F, {{20, 0.0f, 100.0f}, {200, 0.0f, 10.0f}, {200, 0.450f, 0.550f}}}},
{"h3dMassLambda", "h3dMassLambda", {HistType::kTH3F, {{20, 0.0f, 100.0f}, {200, 0.0f, 10.0f}, {200, 1.015f, 1.215f}}}},
{"h3dMassAntiLambda", "h3dMassAntiLambda", {HistType::kTH3F, {{20, 0.0f, 100.0f}, {200, 0.0f, 10.0f}, {200, 1.015f, 1.215f}}}},

{"h3dMassK0ShortDca", "h3dMassK0ShortDca", {HistType::kTH3F, {{200, 0.0f, 1.0f}, {200, 0.0f, 10.0f}, {200, 0.450f, 0.550f}}}},
{"h3dMassLambdaDca", "h3dMassLambdaDca", {HistType::kTH3F, {{200, 0.0f, 1.0f}, {200, 0.0f, 10.0f}, {200, 1.015f, 1.215f}}}},
{"h3dMassAntiLambdaDca", "h3dMassAntiLambdaDca", {HistType::kTH3F, {{200, 0.0f, 1.0f}, {200, 0.0f, 10.0f}, {200, 1.015f, 1.215f}}}},
},
};

//Selection criteria
Configurable<double> v0cospa{"v0cospa", 0.995, "V0 CosPA"}; //double -> N.B. dcos(x)/dx = 0 at x=0)
Expand All @@ -91,6 +105,7 @@ struct lambdakzeroanalysis {
Configurable<float> dcapostopv{"dcapostopv", .1, "DCA Pos To PV"};
Configurable<float> v0radius{"v0radius", 5.0, "v0radius"};
Configurable<float> rapidity{"rapidity", 0.5, "rapidity"};
Configurable<int> saveDcaHist{"saveDcaHist", 0, "saveDcaHist"};

// Filter preFilterV0 = aod::v0data::dcapostopv > dcapostopv&&
// aod::v0data::dcanegtopv > dcanegtopv&& aod::v0data::dcaV0daughters < dcav0dau; we can use this again once (and if) math expressions can be used there
Expand All @@ -117,11 +132,19 @@ struct lambdakzeroanalysis {
continue;
}
if (TMath::Abs(v0.yLambda()) < rapidity) {
h3dMassLambda->Fill(collision.centV0M(), v0.pt(), v0.mLambda());
h3dMassAntiLambda->Fill(collision.centV0M(), v0.pt(), v0.mAntiLambda());
registry.fill(HIST("h3dMassLambda"), collision.centV0M(), v0.pt(), v0.mLambda());
registry.fill(HIST("h3dMassAntiLambda"), collision.centV0M(), v0.pt(), v0.mAntiLambda());

if (saveDcaHist == 1) {
registry.fill(HIST("h3dMassLambdaDca"), v0.dcaV0daughters(), v0.pt(), v0.mLambda());
registry.fill(HIST("h3dMassAntiLambdaDca"), v0.dcaV0daughters(), v0.pt(), v0.mAntiLambda());
}
}
if (TMath::Abs(v0.yK0Short()) < rapidity) {
h3dMassK0Short->Fill(collision.centV0M(), v0.pt(), v0.mK0Short());
registry.fill(HIST("h3dMassK0Short"), collision.centV0M(), v0.pt(), v0.mK0Short());
if (saveDcaHist == 1) {
registry.fill(HIST("h3dMassK0ShortDca"), v0.dcaV0daughters(), v0.pt(), v0.mK0Short());
}
}
}
}
Expand Down
30 changes: 20 additions & 10 deletions Analysis/Tasks/PWGLF/lambdakzerobuilder.cxx
Expand Up @@ -83,15 +83,20 @@ struct lambdakzeroprefilterpairs {
Configurable<int> mincrossedrows{"mincrossedrows", 70, "min crossed rows"};
Configurable<int> tpcrefit{"tpcrefit", 1, "demand TPC refit"};

OutputObj<TH1F> hGoodIndices{TH1F("hGoodIndices", "", 4, 0, 4)};
HistogramRegistry registry{
"registry",
{
{"hGoodIndices", "hGoodIndices", {HistType::kTH1F, {{4, 0.0f, 4.0f}}}},
},
};

Produces<aod::V0GoodIndices> v0goodindices;

void process(aod::Collision const& collision, aod::V0s const& V0s,
soa::Join<aod::FullTracks, aod::TracksExtended> const& tracks)
{
for (auto& V0 : V0s) {
hGoodIndices->Fill(0.5);
registry.fill(HIST("hGoodIndices"), 0.5);
if (tpcrefit) {
if (!(V0.posTrack_as<FullTracksExt>().trackType() & o2::aod::track::TPCrefit)) {
continue; //TPC refit
Expand All @@ -100,21 +105,21 @@ struct lambdakzeroprefilterpairs {
continue; //TPC refit
}
}
hGoodIndices->Fill(1.5);
registry.fill(HIST("hGoodIndices"), 1.5);
if (V0.posTrack_as<FullTracksExt>().tpcNClsCrossedRows() < mincrossedrows) {
continue;
}
if (V0.negTrack_as<FullTracksExt>().tpcNClsCrossedRows() < mincrossedrows) {
continue;
}
hGoodIndices->Fill(2.5);
registry.fill(HIST("hGoodIndices"), 2.5);
if (fabs(V0.posTrack_as<FullTracksExt>().dcaXY()) < dcapostopv) {
continue;
}
if (fabs(V0.negTrack_as<FullTracksExt>().dcaXY()) < dcanegtopv) {
continue;
}
hGoodIndices->Fill(3.5);
registry.fill(HIST("hGoodIndices"), 3.5);
v0goodindices(V0.posTrack_as<FullTracksExt>().globalIndex(),
V0.negTrack_as<FullTracksExt>().globalIndex(),
V0.posTrack_as<FullTracksExt>().collisionId());
Expand All @@ -127,8 +132,13 @@ struct lambdakzerobuilder {

Produces<aod::V0Data> v0data;

OutputObj<TH1F> hEventCounter{TH1F("hEventCounter", "", 1, 0, 1)};
OutputObj<TH1F> hV0Candidate{TH1F("hV0Candidate", "", 2, 0, 2)};
HistogramRegistry registry{
"registry",
{
{"hEventCounter", "hEventCounter", {HistType::kTH1F, {{1, 0.0f, 1.0f}}}},
{"hV0Candidate", "hV0Candidate", {HistType::kTH1F, {{2, 0.0f, 2.0f}}}},
},
};

//Configurables
Configurable<double> d_bz{"d_bz", -5.0, "bz field"};
Expand Down Expand Up @@ -158,15 +168,15 @@ struct lambdakzerobuilder {
fitter.setMaxChi2(1e9);
fitter.setUseAbsDCA(true); // use d_UseAbsDCA once we want to use the weighted DCA

hEventCounter->Fill(0.5);
registry.fill(HIST("hEventCounter"), 0.5);
std::array<float, 3> pVtx = {collision.posX(), collision.posY(), collision.posZ()};

for (auto& V0 : V0s) {
std::array<float, 3> pos = {0.};
std::array<float, 3> pvec0 = {0.};
std::array<float, 3> pvec1 = {0.};

hV0Candidate->Fill(0.5);
registry.fill(HIST("hV0Candidate"), 0.5);

auto pTrack = getTrackParCov(V0.posTrack_as<FullTracksExt>());
auto nTrack = getTrackParCov(V0.negTrack_as<FullTracksExt>());
Expand Down Expand Up @@ -198,7 +208,7 @@ struct lambdakzerobuilder {
continue;
}

hV0Candidate->Fill(1.5);
registry.fill(HIST("hV0Candidate"), 1.5);
v0data(
V0.posTrack_as<FullTracksExt>().globalIndex(),
V0.negTrack_as<FullTracksExt>().globalIndex(),
Expand Down
52 changes: 31 additions & 21 deletions Analysis/Tasks/PWGLF/lambdakzerofinder.cxx
Expand Up @@ -122,7 +122,12 @@ struct lambdakzeroprefilter {
struct lambdakzerofinder {
Produces<aod::V0Data> v0data;

OutputObj<TH1F> hCandPerEvent{TH1F("hCandPerEvent", "", 1000, 0, 1000)};
HistogramRegistry registry{
"registry",
{
{"hCandPerEvent", "hCandPerEvent", {HistType::kTH1F, {{1000, 0.0f, 1000.0f}}}},
},
};

//Configurables
Configurable<double> d_bz{"d_bz", +5.0, "bz field"};
Expand Down Expand Up @@ -202,7 +207,7 @@ struct lambdakzerofinder {
t0id.dcaXY(), t1id.dcaXY());
}
}
hCandPerEvent->Fill(lNCand);
registry.fill(HIST("hCandPerEvent"), lNCand);
}
};

Expand All @@ -215,17 +220,22 @@ struct lambdakzerofinderQA {
Configurable<float> dcapostopv{"dcapostopv", .1, "DCA Pos To PV"};
Configurable<float> v0radius{"v0radius", 5.0, "v0radius"};

OutputObj<TH1F> hCandPerEvent{TH1F("hCandPerEvent", "", 1000, 0, 1000)};
HistogramRegistry registry{
"registry",
{
{"hCandPerEvent", "hCandPerEvent", {HistType::kTH1F, {{1000, 0.0f, 1000.0f}}}},

OutputObj<TH1F> hV0Radius{TH1F("hV0Radius", "", 1000, 0.0, 100)};
OutputObj<TH1F> hV0CosPA{TH1F("hV0CosPA", "", 1000, 0.95, 1.0)};
OutputObj<TH1F> hDCAPosToPV{TH1F("hDCAPosToPV", "", 1000, 0.0, 10.0)};
OutputObj<TH1F> hDCANegToPV{TH1F("hDCANegToPV", "", 1000, 0.0, 10.0)};
OutputObj<TH1F> hDCAV0Dau{TH1F("hDCAV0Dau", "", 1000, 0.0, 10.0)};
{"hV0Radius", "hV0Radius", {HistType::kTH1F, {{1000, 0.0f, 100.0f}}}},
{"hV0CosPA", "hV0CosPA", {HistType::kTH1F, {{1000, 0.95f, 1.0f}}}},
{"hDCAPosToPV", "hDCAPosToPV", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}},
{"hDCANegToPV", "hDCANegToPV", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}},
{"hDCAV0Dau", "hDCAV0Dau", {HistType::kTH1F, {{1000, 0.0f, 10.0f}}}},

OutputObj<TH3F> h3dMassK0Short{TH3F("h3dMassK0Short", "", 20, 0, 100, 200, 0, 10, 200, 0.450, 0.550)};
OutputObj<TH3F> h3dMassLambda{TH3F("h3dMassLambda", "", 20, 0, 100, 200, 0, 10, 200, 1.115 - 0.100, 1.115 + 0.100)};
OutputObj<TH3F> h3dMassAntiLambda{TH3F("h3dMassAntiLambda", "", 20, 0, 100, 200, 0, 10, 200, 1.115 - 0.100, 1.115 + 0.100)};
{"h3dMassK0Short", "h3dMassK0Short", {HistType::kTH3F, {{20, 0.0f, 100.0f}, {200, 0.0f, 10.0f}, {200, 0.450f, 0.550f}}}},
{"h3dMassLambda", "h3dMassLambda", {HistType::kTH3F, {{20, 0.0f, 100.0f}, {200, 0.0f, 10.0f}, {200, 1.015f, 1.215f}}}},
{"h3dMassAntiLambda", "h3dMassAntiLambda", {HistType::kTH3F, {{20, 0.0f, 100.0f}, {200, 0.0f, 10.0f}, {200, 1.015f, 1.215f}}}},
},
};

//FIXME: figure out why this does not work?
//Filter preFilter1 = aod::v0data::dcapostopv > dcapostopv;
Expand All @@ -245,24 +255,24 @@ struct lambdakzerofinderQA {

Long_t lNCand = 0;
for (auto& v0 : fullV0s) {
if (v0.v0radius() > v0radius && v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) > v0cospa && v0.dcapostopv() > dcapostopv && v0.dcanegtopv() > dcanegtopv && v0.dcaV0daughters() > dcav0dau) {
hV0Radius->Fill(v0.v0radius());
hV0CosPA->Fill(v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()));
hDCAPosToPV->Fill(v0.dcapostopv());
hDCANegToPV->Fill(v0.dcanegtopv());
hDCAV0Dau->Fill(v0.dcaV0daughters());
if (v0.v0radius() > v0radius && v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) > v0cospa && fabs(v0.dcapostopv()) > dcapostopv && fabs(v0.dcanegtopv()) > dcanegtopv && v0.dcaV0daughters() < dcav0dau) {
registry.fill(HIST("hV0Radius"), v0.v0radius());
registry.fill(HIST("hV0CosPA"), v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()));
registry.fill(HIST("hDCAPosToPV"), v0.dcapostopv());
registry.fill(HIST("hDCANegToPV"), v0.dcanegtopv());
registry.fill(HIST("hDCAV0Dau"), v0.dcaV0daughters());

if (TMath::Abs(v0.yLambda()) < 0.5) {
h3dMassLambda->Fill(collision.centV0M(), v0.pt(), v0.mLambda());
h3dMassAntiLambda->Fill(collision.centV0M(), v0.pt(), v0.mAntiLambda());
registry.fill(HIST("h3dMassLambda"), collision.centV0M(), v0.pt(), v0.mLambda());
registry.fill(HIST("h3dMassAntiLambda"), collision.centV0M(), v0.pt(), v0.mAntiLambda());
}
if (TMath::Abs(v0.yK0Short()) < 0.5) {
h3dMassK0Short->Fill(collision.centV0M(), v0.pt(), v0.mK0Short());
registry.fill(HIST("h3dMassK0Short"), collision.centV0M(), v0.pt(), v0.mK0Short());
}
lNCand++;
}
}
hCandPerEvent->Fill(lNCand);
registry.fill(HIST("hCandPerEvent"), lNCand);
}
};

Expand Down

0 comments on commit 0da06ab

Please sign in to comment.