16#ifndef ALICEO2_TPC_CALIBDEDX_H_
17#define ALICEO2_TPC_CALIBDEDX_H_
33#include <boost/histogram.hpp>
56 using IntAxis = boost::histogram::axis::integer<int, boost::histogram::use_default, boost::histogram::axis::option::none_t>;
58 using FloatAxis = boost::histogram::axis::regular<float, boost::histogram::use_default, boost::histogram::use_default, boost::histogram::axis::option::none_t>;
72 using Hist = boost::histogram::histogram<AxesType>;
79 CalibdEdx(
int dEdxBins = 70,
float mindEdx = 10,
float maxdEdx = 90,
int angularBins = 36,
bool fitSnp =
false);
106 mFitLowCutFactor = lowCutFactor;
114 void fill(
const gsl::span<const TrackTPC>);
115 void fill(
const std::vector<TrackTPC>& tracks) {
fill(gsl::span(tracks)); }
117 void fill(
const TFIDInfo& tfid,
const gsl::span<const TrackTPC> tracks)
122 void fill(
const TFIDInfo& tfid,
const std::vector<TrackTPC>& tracks) {
fill(tfid, gsl::span(tracks)); }
134 void finalize(
const bool useGausFits =
true,
const bool averageSectors =
false);
161 void writeTTree(std::string_view fileName)
const;
177 constexpr static float scaleTgl(
float tgl,
GEMstack rocType) {
return tgl / conf_dedx_corr::TglScale[rocType]; }
178 constexpr static float recoverTgl(
float scaledTgl,
GEMstack rocType) {
return scaledTgl * conf_dedx_corr::TglScale[rocType]; }
194 bool mApplyCuts{
true};
195 TrackCuts mCuts{0.3, 0.7, 60};
196 int mSectorThreshold = 1000;
197 int m1DThreshold = 500;
198 int m2DThreshold = 5000;
200 float mFitLowCutFactor = 1.5;
203 float mSigmaUpper = 1.;
204 float mSigmaLower = 1.5;
207 CalibdEdxCorrection mCalib{};
208 CalibdEdxCorrection mCalibIn{};
212 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugOutputStreamer;
214 THnF* getTHnF()
const;
217 void fitHistGaus(TLinearFitter& fitter, CalibdEdxCorrection& corr,
const CalibdEdxCorrection* stackMean =
nullptr);
220 void setFromRootHist(
const THnF* hist);
222 ClassDefNV(CalibdEdx, 5);
Class that creates dE/dx histograms from a sequence of tracks objects.
const CalibdEdxCorrection & getCalibrationInput() const
int getSectorFitThreshold() const
void disableDebugOutput()
Disable debug output to file. Also writes and closes stored time slots.
void setElectronCut(float cut, int passes=3, float lowCutFactor=1.5)
Params used to remove electron points from the fit. The fit to find the MIP peak will be performed pa...
static constexpr float recoverTgl(float scaledTgl, GEMstack rocType)
static constexpr float scaleTgl(float tgl, GEMstack rocType)
void setCalibrationInput(const CalibdEdxCorrection &calib)
calibration used during reconstruction
void print() const
Print statistics info.
std::tuple< FloatAxis, FloatAxis, FloatAxis, IntAxis, IntAxis, IntAxis > AxesType
void finalize(const bool useGausFits=true, const bool averageSectors=false)
boost::histogram::histogram< AxesType > Hist
boost::histogram::axis::regular< float, boost::histogram::use_default, boost::histogram::use_default, boost::histogram::axis::option::none_t > FloatAxis
void setSectorFitThreshold(int minEntries)
boost::histogram::axis::integer< int, boost::histogram::use_default, boost::histogram::axis::option::none_t > IntAxis
static int findTrackSector(const TrackTPC &track, GEMstack, bool &ok)
Find the sector of a track at a given GEM stack type.
void merge(const CalibdEdx *other)
Add counts from another container.
bool hasDebugOutput() const
const Hist & getHist() const
Return calib data histogram.
void setMaterialType(o2::base::Propagator::MatCorrType materialType)
setting the material type for track propagation
THnF * getRootHist() const
Return calib data as a THn.
int minStackEntries() const
Return the number of hist entries of the gem stack with less statistics.
const CalibdEdxCorrection & getCalib() const
void dumpToFile(const char *outFile)
dump this object to a file - the boost histogram is converted to a ROOT histogram -
void finalizeDebugOutput() const
Write debug output to file.
void writeTTree(std::string_view fileName) const
Save the histograms to a TTree.
void fill(const TFIDInfo &tfid, const gsl::span< const TrackTPC > tracks)
void set2DFitThreshold(int minEntries)
void fill(const TrackTPC &tracks)
Fill histograms using tracks data.
void setSigmaFitRange(const float lowerSigma, const float upperSigma)
void setCuts(const TrackCuts &cuts)
int getTglFitThreshold() const
void enableDebugOutput(std::string_view fileName)
Enable debug output to file of the time slots calibrations outputs and dE/dx histograms.
void fill(const TFIDInfo &tfid, const std::vector< TrackTPC > &tracks)
bool getApplyCuts() const
const TFIDInfo & getTFID() const
bool hasEnoughData(float minEntries) const
Check if there are enough data to compute the calibration.
void setApplyCuts(bool apply)
o2::dataformats::TFIDInfo TFIDInfo
static CalibdEdx readFromFile(const char *inFile)
read the object from a file
static constexpr float MipScale
Inverse of target dE/dx value for MIPs.
int getSnpFitThreshold() const
void fill(const std::vector< TrackTPC > &tracks)
void set1DFitThreshold(int minEntries)
Global TPC definitions and constants.
GEMstack
TPC GEM stack types.
VectorOfTObjectPtrs other