Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tables for the compressed Nsigma values
- Add dedicated tasks for the PID - Add dedicated tasks for the PID usage - Store int8_t instead of floats in the Nsigma tables - Derive nbins from type used to store the Nsigma values in table - Use dynamic columns for the float version of the stored Nsigma values
- Loading branch information
Showing
7 changed files
with
536 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright CERN and copyright holders of ALICE O2. This software is | ||
// distributed under the terms of the GNU General Public License v3 (GPL | ||
// Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// See http://alice-o2.web.cern.ch/license for full licensing information. | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
// O2 includes | ||
#include "ReconstructionDataFormats/Track.h" | ||
#include "Framework/runDataProcessing.h" | ||
#include "Framework/AnalysisTask.h" | ||
#include "Framework/AnalysisDataModel.h" | ||
#include "Framework/ASoAHelpers.h" | ||
#include "AnalysisDataModel/PID/PIDResponse.h" | ||
#include "AnalysisDataModel/TrackSelectionTables.h" | ||
|
||
using namespace o2; | ||
using namespace o2::framework; | ||
using namespace o2::framework::expressions; | ||
|
||
struct TOFSpectraTaskTiny { | ||
static constexpr int Np = 9; | ||
static constexpr const char* pT[Np] = {"e", "#mu", "#pi", "K", "p", "d", "t", "^{3}He", "#alpha"}; | ||
static constexpr std::string_view hp[Np] = {"p/El", "p/Mu", "p/Pi", "p/Ka", "p/Pr", "p/De", "p/Tr", "p/He", "p/Al"}; | ||
static constexpr std::string_view hpt[Np] = {"pt/El", "pt/Mu", "pt/Pi", "pt/Ka", "pt/Pr", "pt/De", "pt/Tr", "pt/He", "pt/Al"}; | ||
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; | ||
|
||
void init(o2::framework::InitContext&) | ||
{ | ||
histos.add("p/Unselected", "Unselected;#it{p} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); | ||
histos.add("pt/Unselected", "Unselected;#it{p}_{T} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); | ||
for (int i = 0; i < Np; i++) { | ||
histos.add(hp[i].data(), Form("%s;#it{p} (GeV/#it{c})", pT[i]), kTH1F, {{100, 0, 20}}); | ||
histos.add(hpt[i].data(), Form("%s;#it{p}_{T} (GeV/#it{c})", pT[i]), kTH1F, {{100, 0, 20}}); | ||
} | ||
} | ||
|
||
template <std::size_t i, typename T> | ||
void fillParticleHistos(const T& track, const float& nsigma) | ||
{ | ||
if (abs(nsigma) > nsigmacut.value) { | ||
return; | ||
} | ||
histos.fill(HIST(hp[i]), track.p()); | ||
histos.fill(HIST(hpt[i]), track.pt()); | ||
} | ||
|
||
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; | ||
Configurable<float> cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; | ||
Configurable<float> nsigmacut{"nsigmacut", 3, "Value of the Nsigma cut"}; | ||
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; | ||
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::isGlobalTrack == (uint8_t) true) && (aod::track::tofSignal > 0.f); | ||
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, | ||
aod::pidRespTOFTEl, aod::pidRespTOFTMu, aod::pidRespTOFTPi, | ||
aod::pidRespTOFTKa, aod::pidRespTOFTPr, aod::pidRespTOFTDe, | ||
aod::pidRespTOFTTr, aod::pidRespTOFTHe, aod::pidRespTOFTAl, | ||
aod::pidRespTOFbeta, aod::TrackSelection>>; | ||
void process(TrackCandidates::iterator const& track) | ||
{ | ||
histos.fill(HIST("p/Unselected"), track.p()); | ||
histos.fill(HIST("pt/Unselected"), track.pt()); | ||
|
||
fillParticleHistos<0>(track, track.tofNSigmaEl()); | ||
fillParticleHistos<1>(track, track.tofNSigmaMu()); | ||
fillParticleHistos<2>(track, track.tofNSigmaPi()); | ||
fillParticleHistos<3>(track, track.tofNSigmaKa()); | ||
fillParticleHistos<4>(track, track.tofNSigmaPr()); | ||
fillParticleHistos<5>(track, track.tofNSigmaDe()); | ||
fillParticleHistos<6>(track, track.tofNSigmaTr()); | ||
fillParticleHistos<7>(track, track.tofNSigmaHe()); | ||
fillParticleHistos<8>(track, track.tofNSigmaAl()); | ||
} | ||
}; | ||
|
||
WorkflowSpec defineDataProcessing(ConfigContext const&) | ||
{ | ||
WorkflowSpec workflow{adaptAnalysisTask<TOFSpectraTaskTiny>("tofspectra-split-task")}; | ||
return workflow; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright CERN and copyright holders of ALICE O2. This software is | ||
// distributed under the terms of the GNU General Public License v3 (GPL | ||
// Version 3), copied verbatim in the file "COPYING". | ||
// | ||
// See http://alice-o2.web.cern.ch/license for full licensing information. | ||
// | ||
// In applying this license CERN does not waive the privileges and immunities | ||
// granted to it by virtue of its status as an Intergovernmental Organization | ||
// or submit itself to any jurisdiction. | ||
|
||
// O2 includes | ||
#include "ReconstructionDataFormats/Track.h" | ||
#include "Framework/AnalysisTask.h" | ||
#include "Framework/AnalysisDataModel.h" | ||
#include "Framework/ASoAHelpers.h" | ||
#include "AnalysisDataModel/PID/PIDResponse.h" | ||
#include "AnalysisDataModel/TrackSelectionTables.h" | ||
|
||
using namespace o2; | ||
using namespace o2::framework; | ||
using namespace o2::framework::expressions; | ||
|
||
void customize(std::vector<o2::framework::ConfigParamSpec>& workflowOptions) | ||
{ | ||
std::vector<ConfigParamSpec> options{ | ||
{"add-tof-histos", VariantType::Int, 0, {"Generate TPC with TOF histograms"}}}; | ||
std::swap(workflowOptions, options); | ||
} | ||
|
||
#include "Framework/runDataProcessing.h" | ||
|
||
template <typename T> | ||
void makelogaxis(T h) | ||
{ | ||
const int nbins = h->GetNbinsX(); | ||
double binp[nbins + 1]; | ||
double max = h->GetXaxis()->GetBinUpEdge(nbins); | ||
double min = h->GetXaxis()->GetBinLowEdge(1); | ||
if (min <= 0) { | ||
min = 0.00001; | ||
} | ||
double lmin = TMath::Log10(min); | ||
double ldelta = (TMath::Log10(max) - lmin) / ((double)nbins); | ||
for (int i = 0; i < nbins; i++) { | ||
binp[i] = TMath::Exp(TMath::Log(10) * (lmin + i * ldelta)); | ||
} | ||
binp[nbins] = max + 1; | ||
h->GetXaxis()->Set(nbins, binp); | ||
} | ||
|
||
struct TPCSpectraTaskTiny { | ||
static constexpr int Np = 9; | ||
static constexpr const char* pT[Np] = {"e", "#mu", "#pi", "K", "p", "d", "t", "^{3}He", "#alpha"}; | ||
static constexpr std::string_view hp[Np] = {"p/El", "p/Mu", "p/Pi", "p/Ka", "p/Pr", "p/De", "p/Tr", "p/He", "p/Al"}; | ||
static constexpr std::string_view hpt[Np] = {"pt/El", "pt/Mu", "pt/Pi", "pt/Ka", "pt/Pr", "pt/De", "pt/Tr", "pt/He", "pt/Al"}; | ||
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; | ||
|
||
void init(o2::framework::InitContext&) | ||
{ | ||
histos.add("p/Unselected", "Unselected;#it{p} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); | ||
histos.add("pt/Unselected", "Unselected;#it{p}_{T} (GeV/#it{c})", kTH1F, {{100, 0, 20}}); | ||
for (int i = 0; i < Np; i++) { | ||
histos.add(hp[i].data(), Form("%s;#it{p} (GeV/#it{c})", pT[i]), kTH1F, {{100, 0, 20}}); | ||
histos.add(hpt[i].data(), Form("%s;#it{p}_{T} (GeV/#it{c})", pT[i]), kTH1F, {{100, 0, 20}}); | ||
} | ||
} | ||
|
||
template <std::size_t i, typename T> | ||
void fillParticleHistos(const T& track, const float& nsigma) | ||
{ | ||
if (abs(nsigma) > nsigmacut.value) { | ||
return; | ||
} | ||
histos.fill(HIST(hp[i]), track.p()); | ||
histos.fill(HIST(hpt[i]), track.pt()); | ||
} | ||
|
||
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; | ||
Configurable<float> cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"}; | ||
Configurable<float> nsigmacut{"nsigmacut", 3, "Value of the Nsigma cut"}; | ||
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; | ||
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::isGlobalTrack == (uint8_t) true); | ||
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, | ||
aod::pidRespTPCTEl, aod::pidRespTPCTMu, aod::pidRespTPCTPi, | ||
aod::pidRespTPCTKa, aod::pidRespTPCTPr, aod::pidRespTPCTDe, | ||
aod::pidRespTPCTTr, aod::pidRespTPCTHe, aod::pidRespTPCTAl, | ||
aod::TrackSelection>>; | ||
|
||
void process(TrackCandidates::iterator const& track) | ||
{ | ||
histos.fill(HIST("p/Unselected"), track.p()); | ||
histos.fill(HIST("pt/Unselected"), track.pt()); | ||
|
||
fillParticleHistos<0>(track, track.tpcNSigmaEl()); | ||
fillParticleHistos<1>(track, track.tpcNSigmaMu()); | ||
fillParticleHistos<2>(track, track.tpcNSigmaPi()); | ||
fillParticleHistos<3>(track, track.tpcNSigmaKa()); | ||
fillParticleHistos<4>(track, track.tpcNSigmaPr()); | ||
fillParticleHistos<5>(track, track.tpcNSigmaDe()); | ||
fillParticleHistos<6>(track, track.tpcNSigmaTr()); | ||
fillParticleHistos<7>(track, track.tpcNSigmaHe()); | ||
fillParticleHistos<8>(track, track.tpcNSigmaAl()); | ||
} | ||
}; | ||
|
||
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) | ||
{ | ||
WorkflowSpec workflow{adaptAnalysisTask<TPCSpectraTaskTiny>("tpcspectra-tiny-task")}; | ||
return workflow; | ||
} |
Oops, something went wrong.