Skip to content

Commit 5a007a9

Browse files
[PWGLF,Trigger] Update tofpidgeneric for secondary tracks to use TOFResoParamsV3 (#12395)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent e9cb5f4 commit 5a007a9

File tree

11 files changed

+972
-757
lines changed

11 files changed

+972
-757
lines changed

EventFiltering/PWGLF/nucleiFilter.cxx

Lines changed: 37 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,48 @@
1010
// or submit itself to any jurisdiction.
1111
// O2 includes
1212

13-
#include <cmath>
14-
#include <string>
13+
#include "../filterTables.h"
1514

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"
1822
#include "Common/DataModel/EventSelection.h"
1923
#include "Common/DataModel/PIDResponse.h"
2024
#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"
2131
#include "DataFormatsTPC/BetheBlochAleph.h"
32+
#include "DetectorsBase/GeometryManager.h"
33+
#include "DetectorsBase/Propagator.h"
34+
#include "Framework/ASoAHelpers.h"
2235
#include "Framework/AnalysisDataModel.h"
2336
#include "Framework/AnalysisTask.h"
24-
#include "Framework/ASoAHelpers.h"
2537
#include "Framework/HistogramRegistry.h"
2638
#include "Framework/runDataProcessing.h"
2739
#include "ReconstructionDataFormats/Track.h"
2840

29-
#include "PWGLF/DataModel/Vtx3BodyTables.h"
30-
#include "../filterTables.h"
41+
#include "Math/GenVector/Boost.h"
42+
#include "Math/Vector4D.h"
3143

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>
4448

4549
using namespace o2;
4650
using namespace o2::framework;
4751
using namespace o2::framework::expressions;
4852

53+
o2::common::core::MetadataHelper metadataInfo;
54+
4955
namespace
5056
{
5157

@@ -120,7 +126,9 @@ struct nucleiFilter {
120126
o2::base::MatLayerCylSet* lut = nullptr;
121127
o2::vertexing::DCAFitterN<2> fitter2body;
122128
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
124132
// configurable for hypertriton 3body decay
125133
struct : ConfigurableGroup {
126134
Configurable<double> bFieldInput{"trgH3L3Body.mBz", -999, "bz field, -999 is automatic"};
@@ -153,20 +161,12 @@ struct nucleiFilter {
153161
Configurable<std::string> grpmagPath{"trgH3L3Body.grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
154162
Configurable<std::string> lutPath{"trgH3L3Body.lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
155163
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"};
164164
} trgH3L3Body;
165165

166166
HistogramRegistry qaHists{"qaHists", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
167167
OutputObj<TH1D> hProcessedEvents{TH1D("hProcessedEvents", ";;Number of filtered events", kNtriggers + 1, -0.5, static_cast<double>(kNtriggers) + 0.5)};
168168

169-
void init(InitContext&)
169+
void init(InitContext& initContext)
170170
{
171171
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.};
172172

@@ -214,6 +214,11 @@ struct nucleiFilter {
214214
ccdb->setCaching(true);
215215
ccdb->setLocalObjectValidityChecking();
216216
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
217222
}
218223

219224
void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
@@ -264,65 +269,7 @@ struct nucleiFilter {
264269
o2::base::Propagator::Instance()->setMatLUT(lut);
265270
}
266271

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);
326273
}
327274

328275
enum {
@@ -568,7 +515,7 @@ struct nucleiFilter {
568515
float tofNSigmaDeuteron = -999;
569516
if (track2.has_collision() && track2.hasTOF()) {
570517
auto originalcol = track2.collision_as<ColWithEvTime>();
571-
tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(track2, originalcol, collision);
518+
tofNSigmaDeuteron = bachelorTOFPID.GetTOFNSigma(mRespParamsV3, track2, originalcol, collision);
572519
}
573520
if (track2.p() > trgH3L3Body.minDeuteronPUseTOF && (tofNSigmaDeuteron < trgH3L3Body.tofPIDNSigmaMin || tofNSigmaDeuteron > trgH3L3Body.tofPIDNSigmaMax)) {
574521
continue;
@@ -671,6 +618,7 @@ struct nucleiFilter {
671618

672619
WorkflowSpec defineDataProcessing(ConfigContext const& cfg)
673620
{
621+
metadataInfo.initMetadata(cfg);
674622
return WorkflowSpec{
675623
adaptAnalysisTask<nucleiFilter>(cfg)};
676624
}

PWGLF/DataModel/LFHyperNucleiKinkTables.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ DECLARE_SOA_COLUMN(ItsClusterSizesMoth, itsClusterSizesMoth, uint32_t); //! ITS
5555
DECLARE_SOA_COLUMN(ItsClusterSizesDaug, itsClusterSizesDaug, uint32_t); //! ITS cluster size of the daughter track
5656
DECLARE_SOA_COLUMN(NSigmaTPCDaug, nSigmaTPCDaug, float); //! Number of tpc sigmas of the daughter track
5757
DECLARE_SOA_COLUMN(NSigmaITSDaug, nSigmaITSDaug, float); //! Number of ITS sigmas of the daughter track
58+
DECLARE_SOA_COLUMN(NSigmaTOFDaug, nSigmaTOFDaug, float); //! Number of TOF sigmas of the daughter track
5859

5960
DECLARE_SOA_COLUMN(IsSignal, isSignal, bool); //! bool: true for hyperhelium4signal
6061
DECLARE_SOA_COLUMN(IsSignalReco, isSignalReco, bool); //! bool: true if the signal is reconstructed
@@ -94,7 +95,7 @@ DECLARE_SOA_TABLE(HypKinkCand, "AOD", "HYPKINKCANDS",
9495
hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV,
9596
hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo,
9697
hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug,
97-
hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug);
98+
hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug);
9899

99100
DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS",
100101
o2::soa::Index<>,
@@ -109,7 +110,7 @@ DECLARE_SOA_TABLE(MCHypKinkCand, "AOD", "MCHYPKINKCANDS",
109110
hyperkink::PxDaugSV, hyperkink::PyDaugSV, hyperkink::PzDaugSV,
110111
hyperkink::DcaMothPv, hyperkink::DcaDaugPv, hyperkink::DcaKinkTopo,
111112
hyperkink::ItsChi2Moth, hyperkink::ItsClusterSizesMoth, hyperkink::ItsClusterSizesDaug,
112-
hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug,
113+
hyperkink::NSigmaTPCDaug, hyperkink::NSigmaITSDaug, hyperkink::NSigmaTOFDaug,
113114
hyperkink::IsSignal, hyperkink::IsSignalReco, hyperkink::IsCollReco, hyperkink::IsSurvEvSelection,
114115
hyperkink::TrueXSV, hyperkink::TrueYSV, hyperkink::TrueZSV,
115116
hyperkink::TruePxMothPV, hyperkink::TruePyMothPV, hyperkink::TruePzMothPV,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
//
12+
/// \file LFPIDTOFGenericTables.h
13+
/// \brief Table for event time without remving track bias
14+
/// \author Yuanzhe Wang <yuanzhe.wang@cern.ch>
15+
16+
#include "Framework/ASoAHelpers.h"
17+
#include "Framework/AnalysisDataModel.h"
18+
19+
#ifndef PWGLF_DATAMODEL_LFPIDTOFGENERICTABLES_H_
20+
#define PWGLF_DATAMODEL_LFPIDTOFGENERICTABLES_H_
21+
#include "Common/Core/PID/PIDTOF.h"
22+
23+
#include "CommonDataFormat/InteractionRecord.h"
24+
25+
namespace o2::aod
26+
{
27+
namespace evtime
28+
{
29+
30+
DECLARE_SOA_COLUMN(EvTime, evTime, float); //! Event time. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
31+
DECLARE_SOA_COLUMN(EvTimeErr, evTimeErr, float); //! Error of event time. Can be obtained via a combination of detectors e.g. TOF, FT0A, FT0C
32+
DECLARE_SOA_COLUMN(EvTimeTOF, evTimeTOF, float); //! Event time computed with the TOF detector
33+
DECLARE_SOA_COLUMN(EvTimeTOFErr, evTimeTOFErr, float); //! Error of the event time computed with the TOF detector
34+
DECLARE_SOA_COLUMN(EvTimeFT0, evTimeFT0, float); //! Event time computed with the FT0 detector
35+
DECLARE_SOA_COLUMN(EvTimeFT0Err, evTimeFT0Err, float); //! Error of the event time computed with the FT0 detector
36+
} // namespace evtime
37+
38+
DECLARE_SOA_TABLE(EvTimeTOFFT0, "AOD", "EvTimeTOFFT0", //! Table of the event time. One entry per collision.
39+
evtime::EvTime,
40+
evtime::EvTimeErr,
41+
evtime::EvTimeTOF,
42+
evtime::EvTimeTOFErr,
43+
evtime::EvTimeFT0,
44+
evtime::EvTimeFT0Err);
45+
46+
namespace tracktime
47+
{
48+
49+
DECLARE_SOA_COLUMN(EvTimeForTrack, evTimeForTrack, float); //! Event time. Removed the bias for the specific track
50+
DECLARE_SOA_COLUMN(EvTimeErrForTrack, evTimeErrForTrack, float); //! Error of event time. Removed the bias for the specific track
51+
} // namespace tracktime
52+
53+
DECLARE_SOA_TABLE(EvTimeTOFFT0ForTrack, "AOD", "EvTimeForTrack", //! Table of the event time. One entry per track.
54+
tracktime::EvTimeForTrack,
55+
tracktime::EvTimeErrForTrack);
56+
57+
} // namespace o2::aod
58+
59+
#endif // PWGLF_DATAMODEL_LFPIDTOFGENERICTABLES_H_

0 commit comments

Comments
 (0)