|
10 | 10 | // or submit itself to any jurisdiction. |
11 | 11 | // O2 includes |
12 | 12 |
|
13 | | -#include <cmath> |
14 | | -#include <string> |
| 13 | +#include "../filterTables.h" |
15 | 14 |
|
16 | | -#include "Math/Vector4D.h" |
17 | | -#include "Math/GenVector/Boost.h" |
| 15 | +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" |
| 16 | +#include "PWGLF/DataModel/LFStrangenessTables.h" |
| 17 | +#include "PWGLF/DataModel/Vtx3BodyTables.h" |
| 18 | +#include "PWGLF/Utils/pidTOFGeneric.h" |
| 19 | + |
| 20 | +#include "Common/Core/PID/PIDTOF.h" |
| 21 | +#include "Common/Core/trackUtilities.h" |
18 | 22 | #include "Common/DataModel/EventSelection.h" |
19 | 23 | #include "Common/DataModel/PIDResponse.h" |
20 | 24 | #include "Common/DataModel/TrackSelectionTables.h" |
| 25 | + |
| 26 | +#include "CCDB/BasicCCDBManager.h" |
| 27 | +#include "DCAFitter/DCAFitterN.h" |
| 28 | +#include "DataFormatsParameters/GRPMagField.h" |
| 29 | +#include "DataFormatsParameters/GRPObject.h" |
| 30 | +#include "DataFormatsTOF/ParameterContainers.h" |
21 | 31 | #include "DataFormatsTPC/BetheBlochAleph.h" |
| 32 | +#include "DetectorsBase/GeometryManager.h" |
| 33 | +#include "DetectorsBase/Propagator.h" |
| 34 | +#include "Framework/ASoAHelpers.h" |
22 | 35 | #include "Framework/AnalysisDataModel.h" |
23 | 36 | #include "Framework/AnalysisTask.h" |
24 | | -#include "Framework/ASoAHelpers.h" |
25 | 37 | #include "Framework/HistogramRegistry.h" |
26 | 38 | #include "Framework/runDataProcessing.h" |
27 | 39 | #include "ReconstructionDataFormats/Track.h" |
28 | 40 |
|
29 | | -#include "PWGLF/DataModel/Vtx3BodyTables.h" |
30 | | -#include "../filterTables.h" |
| 41 | +#include "Math/GenVector/Boost.h" |
| 42 | +#include "Math/Vector4D.h" |
31 | 43 |
|
32 | | -#include "ReconstructionDataFormats/Track.h" |
33 | | -#include "Common/Core/trackUtilities.h" |
34 | | -#include "DetectorsBase/Propagator.h" |
35 | | -#include "DetectorsBase/GeometryManager.h" |
36 | | -#include "DataFormatsParameters/GRPObject.h" |
37 | | -#include "DataFormatsParameters/GRPMagField.h" |
38 | | -#include "DataFormatsTOF/ParameterContainers.h" |
39 | | -#include "CCDB/BasicCCDBManager.h" |
40 | | -#include "DCAFitter/DCAFitterN.h" |
41 | | -#include "PWGLF/DataModel/pidTOFGeneric.h" |
42 | | -#include "PWGLF/DataModel/LFStrangenessTables.h" |
43 | | -#include "Common/Core/PID/PIDTOF.h" |
| 44 | +#include <cmath> |
| 45 | +#include <memory> |
| 46 | +#include <string> |
| 47 | +#include <vector> |
44 | 48 |
|
45 | 49 | using namespace o2; |
46 | 50 | using namespace o2::framework; |
47 | 51 | using namespace o2::framework::expressions; |
48 | 52 |
|
| 53 | +o2::common::core::MetadataHelper metadataInfo; |
| 54 | + |
49 | 55 | namespace |
50 | 56 | { |
51 | 57 |
|
@@ -120,7 +126,9 @@ struct nucleiFilter { |
120 | 126 | o2::base::MatLayerCylSet* lut = nullptr; |
121 | 127 | o2::vertexing::DCAFitterN<2> fitter2body; |
122 | 128 | o2::vertexing::DCAFitterN<3> fitter3body; |
123 | | - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; |
| 129 | + // TOF response and input parameters |
| 130 | + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; |
| 131 | + o2::aod::pidtofgeneric::TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration |
124 | 132 | // configurable for hypertriton 3body decay |
125 | 133 | struct : ConfigurableGroup { |
126 | 134 | Configurable<double> bFieldInput{"trgH3L3Body.mBz", -999, "bz field, -999 is automatic"}; |
@@ -153,20 +161,12 @@ struct nucleiFilter { |
153 | 161 | Configurable<std::string> grpmagPath{"trgH3L3Body.grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; |
154 | 162 | Configurable<std::string> lutPath{"trgH3L3Body.lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"}; |
155 | 163 | Configurable<std::string> geoPath{"trgH3L3Body.geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; |
156 | | - // CCDB TOF PID paras |
157 | | - Configurable<int64_t> timestamp{"trgH3L3Body.ccdb-timestamp", -1, "timestamp of the object"}; |
158 | | - Configurable<std::string> paramFileName{"trgH3L3Body.paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; |
159 | | - Configurable<std::string> parametrizationPath{"trgH3L3Body.parametrizationPath", "TOF/Calib/Params", "Path of the TOF parametrization on the CCDB or in the file, if the paramFileName is not empty"}; |
160 | | - Configurable<std::string> passName{"trgH3L3Body.passName", "", "Name of the pass inside of the CCDB parameter collection. If empty, the automatically deceted from metadata (to be implemented!!!)"}; |
161 | | - Configurable<std::string> timeShiftCCDBPath{"trgH3L3Body.timeShiftCCDBPath", "", "Path of the TOF time shift vs eta. If empty none is taken"}; |
162 | | - Configurable<bool> loadResponseFromCCDB{"trgH3L3Body.loadResponseFromCCDB", false, "Flag to load the response from the CCDB"}; |
163 | | - Configurable<bool> fatalOnPassNotAvailable{"trgH3L3Body.fatalOnPassNotAvailable", false, "Flag to throw a fatal if the pass is not available in the retrieved CCDB object"}; |
164 | 164 | } trgH3L3Body; |
165 | 165 |
|
166 | 166 | HistogramRegistry qaHists{"qaHists", {}, OutputObjHandlingPolicy::AnalysisObject, true, true}; |
167 | 167 | OutputObj<TH1D> hProcessedEvents{TH1D("hProcessedEvents", ";;Number of filtered events", kNtriggers + 1, -0.5, static_cast<double>(kNtriggers) + 0.5)}; |
168 | 168 |
|
169 | | - void init(InitContext&) |
| 169 | + void init(InitContext& initContext) |
170 | 170 | { |
171 | 171 | std::vector<double> ptBinning = {0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.8, 3.2, 3.6, 4., 5.}; |
172 | 172 |
|
@@ -214,6 +214,11 @@ struct nucleiFilter { |
214 | 214 | ccdb->setCaching(true); |
215 | 215 | ccdb->setLocalObjectValidityChecking(); |
216 | 216 | ccdb->setFatalWhenNull(false); |
| 217 | + |
| 218 | + // Initialization of TOF PID parameters for fH3L3Body |
| 219 | + mTOFCalibConfig.metadataInfo = metadataInfo; |
| 220 | + mTOFCalibConfig.inheritFromBaseTask(initContext); |
| 221 | + mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters |
217 | 222 | } |
218 | 223 |
|
219 | 224 | void initCCDB(aod::BCsWithTimestamps::iterator const& bc) |
@@ -264,65 +269,7 @@ struct nucleiFilter { |
264 | 269 | o2::base::Propagator::Instance()->setMatLUT(lut); |
265 | 270 | } |
266 | 271 |
|
267 | | - // Initial TOF PID Paras, copied from pidTOF.cxx |
268 | | - trgH3L3Body.timestamp.value = bc.timestamp(); |
269 | | - ccdb->setTimestamp(trgH3L3Body.timestamp.value); |
270 | | - // Not later than now objects |
271 | | - ccdb->setCreatedNotAfter(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()); |
272 | | - // TODO: implement the automatic pass name detection from metadata |
273 | | - if (trgH3L3Body.passName.value == "") { |
274 | | - trgH3L3Body.passName.value = "unanchored"; // temporary default |
275 | | - LOG(warning) << "Passed autodetect mode for pass, not implemented yet, waiting for metadata. Taking '" << trgH3L3Body.passName.value << "'"; |
276 | | - } |
277 | | - LOG(info) << "Using parameter collection, starting from pass '" << trgH3L3Body.passName.value << "'"; |
278 | | - |
279 | | - const std::string fname = trgH3L3Body.paramFileName.value; |
280 | | - if (!fname.empty()) { // Loading the parametrization from file |
281 | | - LOG(info) << "Loading exp. sigma parametrization from file " << fname << ", using param: " << trgH3L3Body.parametrizationPath.value; |
282 | | - if (1) { |
283 | | - o2::tof::ParameterCollection paramCollection; |
284 | | - paramCollection.loadParamFromFile(fname, trgH3L3Body.parametrizationPath.value); |
285 | | - LOG(info) << "+++ Loaded parameter collection from file +++"; |
286 | | - if (!paramCollection.retrieveParameters(mRespParamsV2, trgH3L3Body.passName.value)) { |
287 | | - if (trgH3L3Body.fatalOnPassNotAvailable) { |
288 | | - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); |
289 | | - } else { |
290 | | - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); |
291 | | - } |
292 | | - } else { |
293 | | - mRespParamsV2.setShiftParameters(paramCollection.getPars(trgH3L3Body.passName.value)); |
294 | | - mRespParamsV2.printShiftParameters(); |
295 | | - } |
296 | | - } else { |
297 | | - mRespParamsV2.loadParamFromFile(fname.data(), trgH3L3Body.parametrizationPath.value); |
298 | | - } |
299 | | - } else if (trgH3L3Body.loadResponseFromCCDB) { // Loading it from CCDB |
300 | | - LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << trgH3L3Body.parametrizationPath.value << " for timestamp " << trgH3L3Body.timestamp.value; |
301 | | - o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp<o2::tof::ParameterCollection>(trgH3L3Body.parametrizationPath.value, trgH3L3Body.timestamp.value); |
302 | | - paramCollection->print(); |
303 | | - if (!paramCollection->retrieveParameters(mRespParamsV2, trgH3L3Body.passName.value)) { // Attempt at loading the parameters with the pass defined |
304 | | - if (trgH3L3Body.fatalOnPassNotAvailable) { |
305 | | - LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); |
306 | | - } else { |
307 | | - LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", trgH3L3Body.passName.value.data()); |
308 | | - } |
309 | | - } else { // Pass is available, load non standard parameters |
310 | | - mRespParamsV2.setShiftParameters(paramCollection->getPars(trgH3L3Body.passName.value)); |
311 | | - mRespParamsV2.printShiftParameters(); |
312 | | - } |
313 | | - } |
314 | | - mRespParamsV2.print(); |
315 | | - if (trgH3L3Body.timeShiftCCDBPath.value != "") { |
316 | | - if (trgH3L3Body.timeShiftCCDBPath.value.find(".root") != std::string::npos) { |
317 | | - mRespParamsV2.setTimeShiftParameters(trgH3L3Body.timeShiftCCDBPath.value, "gmean_Pos", true); |
318 | | - mRespParamsV2.setTimeShiftParameters(trgH3L3Body.timeShiftCCDBPath.value, "gmean_Neg", false); |
319 | | - } else { |
320 | | - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp<TGraph>(Form("%s/pos", trgH3L3Body.timeShiftCCDBPath.value.c_str()), trgH3L3Body.timestamp.value), true); |
321 | | - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp<TGraph>(Form("%s/neg", trgH3L3Body.timeShiftCCDBPath.value.c_str()), trgH3L3Body.timestamp.value), false); |
322 | | - } |
323 | | - } |
324 | | - |
325 | | - bachelorTOFPID.SetParams(mRespParamsV2); |
| 272 | + mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bc); |
326 | 273 | } |
327 | 274 |
|
328 | 275 | enum { |
@@ -568,7 +515,7 @@ struct nucleiFilter { |
568 | 515 | float tofNSigmaDeuteron = -999; |
569 | 516 | if (track2.has_collision() && track2.hasTOF()) { |
570 | 517 | auto originalcol = track2.collision_as<ColWithEvTime>(); |
571 | | - tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(track2, originalcol, collision); |
| 518 | + tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(mRespParamsV3, track2, originalcol, collision); |
572 | 519 | } |
573 | 520 | if (track2.p() > trgH3L3Body.minDeuteronPUseTOF && (tofNSigmaDeuteron < trgH3L3Body.tofPIDNSigmaMin || tofNSigmaDeuteron > trgH3L3Body.tofPIDNSigmaMax)) { |
574 | 521 | continue; |
@@ -671,6 +618,7 @@ struct nucleiFilter { |
671 | 618 |
|
672 | 619 | WorkflowSpec defineDataProcessing(ConfigContext const& cfg) |
673 | 620 | { |
| 621 | + metadataInfo.initMetadata(cfg); |
674 | 622 | return WorkflowSpec{ |
675 | 623 | adaptAnalysisTask<nucleiFilter>(cfg)}; |
676 | 624 | } |
0 commit comments