Skip to content

Commit 0888029

Browse files
matthias-kleinersawenzel
authored andcommitted
TPC: adding material type for dedx calibration as parameter
1 parent facbf10 commit 0888029

6 files changed

Lines changed: 24 additions & 8 deletions

File tree

Detectors/TPC/calibration/include/TPCCalibration/CalibdEdx.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "DataFormatsTPC/TrackCuts.h"
2727
#include "DataFormatsTPC/Defs.h"
2828
#include "DataFormatsTPC/CalibdEdxCorrection.h"
29+
#include "DetectorsBase/Propagator.h"
2930

3031
// boost includes
3132
#include <boost/histogram.hpp>
@@ -97,6 +98,9 @@ class CalibdEdx
9798
mFitLowCutFactor = lowCutFactor;
9899
}
99100

101+
/// setting the material type for track propagation
102+
void setMaterialType(o2::base::Propagator::MatCorrType materialType) { mMatType = materialType; }
103+
100104
/// Fill histograms using tracks data.
101105
void fill(const TrackTPC& tracks);
102106
void fill(const gsl::span<const TrackTPC>);
@@ -152,7 +156,9 @@ class CalibdEdx
152156
Hist mHist; ///< dEdx multidimensional histogram
153157
CalibdEdxCorrection mCalib{}; ///< Calibration output
154158

155-
ClassDefNV(CalibdEdx, 2);
159+
o2::base::Propagator::MatCorrType mMatType{}; ///< material type for track propagation
160+
161+
ClassDefNV(CalibdEdx, 3);
156162
};
157163

158164
} // namespace o2::tpc

Detectors/TPC/calibration/include/TPCCalibration/CalibratordEdx.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "DetectorsCalibration/TimeSlot.h"
3030
#include "TPCCalibration/CalibdEdx.h"
3131
#include "CommonUtils/TreeStreamRedirector.h"
32+
#include "DetectorsBase/Propagator.h"
3233

3334
namespace o2::tpc
3435
{
@@ -58,6 +59,7 @@ class CalibratordEdx final : public o2::calibration::TimeSlotCalibration<o2::tpc
5859
void setFitThresholds(int minEntriesSector, int minEntries1D, int minEntries2D) { mFitThreshold = {minEntriesSector, minEntries1D, minEntriesSector}; }
5960
void setApplyCuts(bool apply) { mApplyCuts = apply; }
6061
void setElectronCut(std::tuple<float, int, float> values) { mElectronCut = values; }
62+
void setMaterialType(o2::base::Propagator::MatCorrType materialType) { mMatType = materialType; }
6163

6264
/// \brief Check if there are enough data to compute the calibration.
6365
/// \return false if any of the histograms has less entries than mMinEntries
@@ -104,14 +106,15 @@ class CalibratordEdx final : public o2::calibration::TimeSlotCalibration<o2::tpc
104106
bool mApplyCuts{true}; ///< Flag to enable tracks cuts
105107
std::tuple<float, int, float> mElectronCut{}; ///< Values passed to CalibdEdx::setElectronCut
106108
TrackCuts mCuts; ///< Cut object
109+
o2::base::Propagator::MatCorrType mMatType{}; ///< material type for track propagation
107110

108111
TFinterval mTFIntervals; ///< start and end time frame IDs of each calibration time slots
109112
TimeInterval mTimeIntervals; ///< start and end times of each calibration time slots
110113
CalibVector mCalibs; ///< vector of MIP positions, each element is filled in "process" when we finalize one slot (multiple can be finalized during the same "process", which is why we have a vector. Each element is to be considered the output of the device
111114

112115
std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugOutputStreamer; ///< Debug output streamer
113116

114-
ClassDefOverride(CalibratordEdx, 1);
117+
ClassDefOverride(CalibratordEdx, 2);
115118
};
116119

117120
} // namespace o2::tpc

Detectors/TPC/calibration/src/CalibdEdx.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "DataFormatsTPC/TrackCuts.h"
3030
#include "Framework/Logger.h"
3131
#include "TPCBase/ParameterGas.h"
32-
#include "DetectorsBase/Propagator.h"
3332

3433
// root includes
3534
#include "TFile.h"
@@ -82,7 +81,7 @@ void CalibdEdx::fill(const TrackTPC& track)
8281
constexpr std::array<float, 4> xks{108.475f, 151.7f, 188.8f, 227.65f};
8382

8483
// propagate track
85-
const bool okProp = o2::base::Propagator::Instance()->PropagateToXBxByBz(cpTrack, xks[roc], 0.9f, 2., o2::base::Propagator::MatCorrType::USEMatCorrNONE);
84+
const bool okProp = o2::base::Propagator::Instance()->PropagateToXBxByBz(cpTrack, xks[roc], 0.9f, 2., mMatType);
8685
if (!okProp) {
8786
continue;
8887
}

Detectors/TPC/calibration/src/CalibratordEdx.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ CalibratordEdx::Slot& CalibratordEdx::emplaceNewSlot(bool front, TFType tstart,
7676
container->set2DFitThreshold(mFitThreshold[2]);
7777
const auto [cut, iterations, cutLowFactor] = mElectronCut;
7878
container->setElectronCut(cut, iterations, cutLowFactor);
79+
container->setMaterialType(mMatType);
7980

8081
slot.setContainer(std::move(container));
8182
return slot;

Detectors/TPC/workflow/src/CalibdEdxSpec.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class CalibdEdxDevice : public Task
5555
const auto maxdEdx = ic.options().get<float>("max-dedx");
5656
const auto angularBins = ic.options().get<int>("angularbins");
5757
const auto fitSnp = ic.options().get<bool>("fit-snp");
58+
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(ic.options().get<int>("material-type"));
5859

5960
mDumpToFile = ic.options().get<int>("file-dump");
6061

@@ -64,6 +65,7 @@ class CalibdEdxDevice : public Task
6465
mCalib->set1DFitThreshold(minEntries1D);
6566
mCalib->set2DFitThreshold(minEntries2D);
6667
mCalib->setElectronCut(fitThreshold, fitPasses, fitThresholdLowFactor);
68+
mCalib->setMaterialType(materialType);
6769
}
6870

6971
void finaliseCCDB(o2::framework::ConcreteDataMatcher& matcher, void* obj) final
@@ -131,7 +133,7 @@ DataProcessorSpec getCalibdEdxSpec()
131133
false, // GRPECS=true
132134
false, // GRPLHCIF
133135
true, // GRPMagField
134-
false, // askMatLUT
136+
true, // askMatLUT
135137
o2::base::GRPGeomRequest::None, // geometry
136138
inputs,
137139
true,
@@ -156,7 +158,8 @@ DataProcessorSpec getCalibdEdxSpec()
156158
{"angularbins", VariantType::Int, 36, {"number of angular bins: Tgl and Snp"}},
157159
{"fit-snp", VariantType::Bool, false, {"enable Snp correction"}},
158160

159-
{"file-dump", VariantType::Int, 0, {"directly dump calibration to file"}}}};
161+
{"file-dump", VariantType::Int, 0, {"directly dump calibration to file"}},
162+
{"material-type", VariantType::Int, 2, {"Type for the material buget during track propagation: 0=None, 1=Geo, 2=LUT"}}}};
160163
}
161164

162165
} // namespace o2::tpc

Detectors/TPC/workflow/src/CalibratordEdxSpec.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "TPCWorkflow/ProcessingHelpers.h"
3333
#include "DetectorsBase/GRPGeomHelper.h"
3434
#include "TPCBase/CDBInterface.h"
35+
#include "DetectorsBase/Propagator.h"
3536

3637
using namespace o2::framework;
3738

@@ -63,6 +64,7 @@ class CalibratordEdxDevice : public Task
6364
const auto fitSnp = ic.options().get<bool>("fit-snp");
6465

6566
const auto dumpData = ic.options().get<bool>("file-dump");
67+
auto materialType = static_cast<o2::base::Propagator::MatCorrType>(ic.options().get<int>("material-type"));
6668

6769
mCalibrator = std::make_unique<tpc::CalibratordEdx>();
6870
mCalibrator->setHistParams(dEdxBins, mindEdx, maxdEdx, angularBins, fitSnp);
@@ -72,6 +74,7 @@ class CalibratordEdxDevice : public Task
7274
mCalibrator->setSlotLength(slotLength);
7375
mCalibrator->setMaxSlotsDelay(maxDelay);
7476
mCalibrator->setElectronCut({fitThreshold, fitPasses, fitThresholdLowFactor});
77+
mCalibrator->setMaterialType(materialType);
7578

7679
if (dumpData) {
7780
mCalibrator->enableDebugOutput("calibratordEdx.root");
@@ -141,7 +144,7 @@ DataProcessorSpec getCalibratordEdxSpec()
141144
true, // GRPECS=true
142145
false, // GRPLHCIF
143146
true, // GRPMagField
144-
false, // askMatLUT
147+
true, // askMatLUT
145148
o2::base::GRPGeomRequest::None, // geometry
146149
inputs,
147150
true,
@@ -169,7 +172,8 @@ DataProcessorSpec getCalibratordEdxSpec()
169172
{"angularbins", VariantType::Int, 36, {"number of angular bins: Tgl and Snp"}},
170173
{"fit-snp", VariantType::Bool, false, {"enable Snp correction"}},
171174

172-
{"file-dump", VariantType::Bool, false, {"directly dump calibration to file"}}}};
175+
{"file-dump", VariantType::Bool, false, {"directly dump calibration to file"}},
176+
{"material-type", VariantType::Int, 2, {"Type for the material buget during track propagation: 0=None, 1=Geo, 2=LUT"}}}};
173177
}
174178

175179
} // namespace o2::tpc

0 commit comments

Comments
 (0)