Skip to content
Merged
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
28 changes: 14 additions & 14 deletions DPG/Tasks/qaEfficiency.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ struct QaEfficiency {
"MC/ka/pos/prm/pt/num", "MC/pr/pos/prm/pt/num", "MC/de/pos/prm/pt/num",
"MC/tr/pos/prm/pt/num", "MC/he/pos/prm/pt/num", "MC/al/pos/prm/pt/num",
"MC/all/pos/prm/pt/num",
"MC/el/den/prm/pt/num", "MC/mu/den/prm/pt/num", "MC/pi/den/prm/pt/num",
"MC/ka/den/prm/pt/num", "MC/pr/den/prm/pt/num", "MC/de/den/prm/pt/num",
"MC/tr/den/prm/pt/num", "MC/he/den/prm/pt/num", "MC/al/den/prm/pt/num",
"MC/all/den/prm/pt/num"};
"MC/el/neg/prm/pt/num", "MC/mu/neg/prm/pt/num", "MC/pi/neg/prm/pt/num",
"MC/ka/neg/prm/pt/num", "MC/pr/neg/prm/pt/num", "MC/de/neg/prm/pt/num",
"MC/tr/neg/prm/pt/num", "MC/he/neg/prm/pt/num", "MC/al/neg/prm/pt/num",
"MC/all/neg/prm/pt/num"};
static constexpr std::string_view hPtPrmNumTrk[nHistograms] = {"MC/el/sum/prm/pt/numtrk", "MC/mu/sum/prm/pt/numtrk", "MC/pi/sum/prm/pt/numtrk",
"MC/ka/sum/prm/pt/numtrk", "MC/pr/sum/prm/pt/numtrk", "MC/de/sum/prm/pt/numtrk",
"MC/tr/sum/prm/pt/numtrk", "MC/he/sum/prm/pt/numtrk", "MC/al/sum/prm/pt/numtrk",
Expand Down Expand Up @@ -191,10 +191,10 @@ struct QaEfficiency {
"MC/ka/pos/dec/pt/num", "MC/pr/pos/dec/pt/num", "MC/de/pos/dec/pt/num",
"MC/tr/pos/dec/pt/num", "MC/he/pos/dec/pt/num", "MC/al/pos/dec/pt/num",
"MC/all/pos/dec/pt/num",
"MC/el/den/dec/pt/num", "MC/mu/den/dec/pt/num", "MC/pi/den/dec/pt/num",
"MC/ka/den/dec/pt/num", "MC/pr/den/dec/pt/num", "MC/de/den/dec/pt/num",
"MC/tr/den/dec/pt/num", "MC/he/den/dec/pt/num", "MC/al/den/dec/pt/num",
"MC/all/den/dec/pt/num"};
"MC/el/neg/dec/pt/num", "MC/mu/neg/dec/pt/num", "MC/pi/neg/dec/pt/num",
"MC/ka/neg/dec/pt/num", "MC/pr/neg/dec/pt/num", "MC/de/neg/dec/pt/num",
"MC/tr/neg/dec/pt/num", "MC/he/neg/dec/pt/num", "MC/al/neg/dec/pt/num",
"MC/all/neg/dec/pt/num"};
static constexpr std::string_view hPtDecNumTrk[nHistograms] = {"MC/el/sum/dec/pt/numtrk", "MC/mu/sum/dec/pt/numtrk", "MC/pi/sum/dec/pt/numtrk",
"MC/ka/sum/dec/pt/numtrk", "MC/pr/sum/dec/pt/numtrk", "MC/de/sum/dec/pt/numtrk",
"MC/tr/sum/dec/pt/numtrk", "MC/he/sum/dec/pt/numtrk", "MC/al/sum/dec/pt/numtrk",
Expand Down Expand Up @@ -240,10 +240,10 @@ struct QaEfficiency {
"MC/ka/pos/mat/pt/num", "MC/pr/pos/mat/pt/num", "MC/de/pos/mat/pt/num",
"MC/tr/pos/mat/pt/num", "MC/he/pos/mat/pt/num", "MC/al/pos/mat/pt/num",
"MC/all/pos/mat/pt/num",
"MC/el/den/mat/pt/num", "MC/mu/den/mat/pt/num", "MC/pi/den/mat/pt/num",
"MC/ka/den/mat/pt/num", "MC/pr/den/mat/pt/num", "MC/de/den/mat/pt/num",
"MC/tr/den/mat/pt/num", "MC/he/den/mat/pt/num", "MC/al/den/mat/pt/num",
"MC/all/den/mat/pt/num"};
"MC/el/neg/mat/pt/num", "MC/mu/neg/mat/pt/num", "MC/pi/neg/mat/pt/num",
"MC/ka/neg/mat/pt/num", "MC/pr/neg/mat/pt/num", "MC/de/neg/mat/pt/num",
"MC/tr/neg/mat/pt/num", "MC/he/neg/mat/pt/num", "MC/al/neg/mat/pt/num",
"MC/all/neg/mat/pt/num"};
static constexpr std::string_view hPtMatNumTrk[nHistograms] = {"MC/el/sum/mat/pt/numtrk", "MC/mu/sum/mat/pt/numtrk", "MC/pi/sum/mat/pt/numtrk",
"MC/ka/sum/mat/pt/numtrk", "MC/pr/sum/mat/pt/numtrk", "MC/de/sum/mat/pt/numtrk",
"MC/tr/sum/mat/pt/numtrk", "MC/he/sum/mat/pt/numtrk", "MC/al/sum/mat/pt/numtrk",
Expand Down Expand Up @@ -1189,11 +1189,11 @@ struct QaEfficiency {
if (!isTrackSelected(track)) { // Check general cuts
continue;
}
histos.fill(HIST("MC/trackSelection"), 11);
histos.fill(HIST("MC/trackSelection"), 9);
if (!track.has_collision()) {
continue;
}
histos.fill(HIST("MC/trackSelection"), 12);
histos.fill(HIST("MC/trackSelection"), 10);
// Filling variable histograms
histos.fill(HIST("MC/trackLength"), track.length());
if (doEl) {
Expand Down
40 changes: 31 additions & 9 deletions DPG/Tasks/qaEventTrackLite.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ struct qaEventTrackLite {
Configurable<float> dcaXYmaxSel3{"dcaXYMaxSel3", 999., "Max dca XY sel3"};

// MC selections
Configurable<int> pdgCodeSel{"pdgCodeSel", 2, "pdgCode based particle selection, 1 defines pi,K,p,mu,e, 2 all final-state charged particles including light (hyper)nuclei"};
Configurable<int> pdgCodeSel{"pdgCodeSel", 0, "pdgCode based particle selection. Provide a PDG code required for particles to have. To be used in combo with pdgCodeSelMode"};
Configurable<int> pdgCodeSelMode{"pdgCodeSelMode", 2, "multiple pdgCode based particle selection. `1` accepts pi,K,p,mu,e, `2` accepts all final-state charged particles including light (hyper)nuclei"};

Configurable<bool> checkPdgAtReco{"checkPdgAtReco", false, "check pdg code also at reco levo for data-like reference"};

// TPC dEdx splines
Expand Down Expand Up @@ -578,18 +580,38 @@ struct qaEventTrackLite {
return true;
}

bool isPdgSelected(const Int_t pdgcode)
bool isPdgSelected(const int pdgcode)
{ // mimics selection of charged particles or id particles
Int_t abspdgcode = TMath::Abs(pdgcode);
if (abspdgcode == pdgCodeSel)

if (pdgcode == pdgCodeSel) { // Check that the pdg code is exactly what was asked
return true;
if (pdgCodeSel == 1 || pdgCodeSel == 2) {
if (abspdgcode == 211 || abspdgcode == 321 || abspdgcode == 2212 || abspdgcode == 11 || abspdgcode == 13)
return true;
if (pdgCodeSel == 2) {
if (abspdgcode == 3222 || abspdgcode == 3112 || abspdgcode == 3312 || abspdgcode == 3334 || abspdgcode == 1000010020 || abspdgcode == 1000010030 || abspdgcode == 1000020030 || abspdgcode == 1000020040 || abspdgcode == 1010010030 || abspdgcode == 1010020040)
}
const int abspdgcode = abs(pdgcode);
if (pdgCodeSelMode == 1 || pdgCodeSelMode == 2) {
switch (abspdgcode) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my ignorance: are you sure that this switch statement does the same thing of the original if? Reading this code I naively interpret that return true; is done only for case 2212

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does the same, but now it's more clear, I also removed the abs value for the first selection

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably because there are no break statements anywhere and then it continues until return true;, anyway I trust you

case 11: // electron
case 13: // muon
case 211: // pion
case 321: // kaon
case 2212: // proton
return true;
}

if (pdgCodeSelMode == 2) {
switch (abspdgcode) {
case 3222: // Σ+
case 3112: // Σ−
case 3312: // Ξ−
case 3334: // Ω−
case 1000010020: // deuteron
case 1000010030: // triton
case 1000020030: // helium3
case 1000020040: // helium4
case 1010010030: // hyper triton
case 1010020040: // hyper helium4
return true;
}
}
}
return false;
}
Expand Down
67 changes: 62 additions & 5 deletions DPG/Tasks/qaPIDTOF.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct tofPidQa {
Configurable<int> nBinsNSigma{"nBinsNSigma", 200, "Number of bins for the NSigma"};
Configurable<float> minNSigma{"minNSigma", -10.f, "Minimum NSigma in range"};
Configurable<float> maxNSigma{"maxNSigma", 10.f, "Maximum NSigma in range"};
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply rapidity cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply event selection cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
Configurable<bool> applyTrackCut{"applyTrackCut", false, "Flag to apply standard track cuts"};
Configurable<bool> applyRapidityCut{"applyRapidityCut", false, "Flag to apply rapidity cut"};
Configurable<bool> enableEvTimeSplitting{"enableEvTimeSplitting", false, "Flag to enable histograms splitting depending on the Event Time used"};
Expand Down Expand Up @@ -482,6 +482,8 @@ struct tofPidBetaQa {
Configurable<int> nBinsBeta{"nBinsBeta", 4000, "Number of bins for the beta"};
Configurable<float> minBeta{"minBeta", 0, "Minimum beta in range"};
Configurable<float> maxBeta{"maxBeta", 2.f, "Maximum beta in range"};
Configurable<int> applyEvSel{"applyEvSel", 2, "Flag to apply event selection cut: 0 -> no event selection, 1 -> Run 2 event selection, 2 -> Run 3 event selection"};
Configurable<bool> applyTrackCut{"applyTrackCut", false, "Flag to apply standard track cuts"};

void init(o2::framework::InitContext&)
{
Expand All @@ -502,11 +504,24 @@ struct tofPidBetaQa {
// Event properties
histos.add("event/tofsignal", "", HistType::kTH2F, {pAxis, tofAxis});
histos.add("event/tofbeta", "", HistType::kTH2F, {pAxis, betaAxis});
histos.add("event/tofbetaEvTimeTOF", "", HistType::kTH2F, {pAxis, betaAxis});
histos.add("event/tofbetaEvTimeTOF", "Ev. Time TOF", HistType::kTH2F, {pAxis, betaAxis});
histos.add("event/tofbetaEvTimeTOFOnly", "Ev. Time TOF Only", HistType::kTH2F, {pAxis, betaAxis});
histos.add("event/tofbetaEvTimeT0AC", "Ev. Time T0AC", HistType::kTH2F, {pAxis, betaAxis});
histos.add("event/tofbetaEvTimeT0ACOnly", "Ev. Time T0AC Only", HistType::kTH2F, {pAxis, betaAxis});
histos.add("event/eta", "", HistType::kTH1F, {etaAxis});
histos.add("event/length", "", HistType::kTH1F, {lAxis});
histos.add("event/pt", "", HistType::kTH1F, {ptAxis});
histos.add("event/p", "", HistType::kTH1F, {pAxis});
auto h = histos.add<TH1>("event/evsel", "", kTH1F, {{10, 0.5, 10.5, "Ev. Sel."}});
h->GetXaxis()->SetBinLabel(1, "Events read");
h->GetXaxis()->SetBinLabel(2, "Passed ev. sel.");
h->GetXaxis()->SetBinLabel(3, "Passed mult.");
h->GetXaxis()->SetBinLabel(4, "Passed vtx Z");

h = histos.add<TH1>("event/trackselection", "", kTH1F, {{10, 0.5, 10.5, "Selection passed"}});
h->GetXaxis()->SetBinLabel(1, "Tracks read");
h->GetXaxis()->SetBinLabel(2, "hasTOF");
h->GetXaxis()->SetBinLabel(3, "isGlobalTrack");
}

template <uint8_t i, typename T>
Expand All @@ -516,20 +531,62 @@ struct tofPidBetaQa {
histos.fill(HIST(hexpected_diff[i]), t.p(), exp_diff);
histos.fill(HIST(hnsigma[i]), t.p(), nsigma);
}
void process(soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTOFbeta, aod::TrackSelection, aod::TOFSignal, aod::pidEvTimeFlags> const& tracks,
aod::Collisions const&)

using CollisionCandidate = soa::Join<aod::Collisions, aod::EvSels>::iterator;
void process(CollisionCandidate const& collision,
soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTOFbeta, aod::TrackSelection, aod::TOFSignal, aod::pidEvTimeFlags> const& tracks)
{
for (auto const& track : tracks) {

histos.fill(HIST("event/evsel"), 1);
if (applyEvSel == 1) {
if (!collision.sel7()) {
return;
}
} else if (applyEvSel == 2) {
if (!collision.sel8()) {
return;
}
}

histos.fill(HIST("event/evsel"), 2);

// Computing Multiplicity first
float ntracks = 0;
for (auto t : tracks) {
if (applyTrackCut && !t.isGlobalTrack()) {
continue;
}
ntracks += 1;
}
histos.fill(HIST("event/evsel"), 3);
if (abs(collision.posZ()) > 10.f) {
return;
}

histos.fill(HIST("event/evsel"), 4);

for (auto const& track : tracks) {
histos.fill(HIST("event/trackselection"), 1.f);
if (!track.hasTOF()) { // Skipping tracks without TOF
continue;
}
histos.fill(HIST("event/trackselection"), 2.f);
if (!track.isGlobalTrack()) {
continue;
}
histos.fill(HIST("event/trackselection"), 3.f);
if (track.isEvTimeTOF()) {
histos.fill(HIST("event/tofbetaEvTimeTOF"), track.p(), track.beta());
}
if (track.isEvTimeTOF() && !track.isEvTimeT0AC()) {
histos.fill(HIST("event/tofbetaEvTimeTOFOnly"), track.p(), track.beta());
}
if (track.isEvTimeT0AC()) {
histos.fill(HIST("event/tofbetaEvTimeT0AC"), track.p(), track.beta());
}
if (track.isEvTimeT0AC() && !track.isEvTimeTOF()) {
histos.fill(HIST("event/tofbetaEvTimeT0ACOnly"), track.p(), track.beta());
}
histos.fill(HIST("event/tofbeta"), track.p(), track.beta());
histos.fill(HIST("event/length"), track.length());
histos.fill(HIST("event/eta"), track.eta());
Expand Down
Loading