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)); }
130 void finalize(
const bool useGausFits =
true);
157 void writeTTree(std::string_view fileName)
const;
173 constexpr static float scaleTgl(
float tgl,
GEMstack rocType) {
return tgl / conf_dedx_corr::TglScale[rocType]; }
174 constexpr static float recoverTgl(
float scaledTgl,
GEMstack rocType) {
return scaledTgl * conf_dedx_corr::TglScale[rocType]; }
177 void dumpToFile(
const char* outFile,
const char* outName)
const;
190 bool mApplyCuts{
true};
191 TrackCuts mCuts{0.3, 0.7, 60};
192 int mSectorThreshold = 1000;
193 int m1DThreshold = 500;
194 int m2DThreshold = 5000;
196 float mFitLowCutFactor = 1.5;
199 float mSigmaUpper = 1.;
200 float mSigmaLower = 1.5;
203 CalibdEdxCorrection mCalib{};
204 CalibdEdxCorrection mCalibIn{};
208 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugOutputStreamer;
210 THnF* getTHnF()
const;
213 void fitHistGaus(TLinearFitter& fitter, CalibdEdxCorrection& corr,
const CalibdEdxCorrection* stackMean =
nullptr);
216 void setFromRootHist(
const THnF* hist);
218 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...
void finalize(const bool useGausFits=true)
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
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
void dumpToFile(const char *outFile, const char *outName) const
dump this object to a file - the boost histogram is converted to a ROOT histogram -
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 finalizeDebugOutput() const
Write debug output to file.
void writeTTree(std::string_view fileName) const
Save the histograms to a TTree.
static CalibdEdx readFromFile(const char *inFile, const char *inName)
read the object from a file
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
bool hasEnoughData(float minEntries) const
Check if there are enough data to compute the calibration.
void setApplyCuts(bool apply)
o2::dataformats::TFIDInfo TFIDInfo
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