Skip to content

Commit 638d5b4

Browse files
Merge branch 'AliceO2Group:master' into Analysis
2 parents e1a41f2 + 42dbd4f commit 638d5b4

72 files changed

Lines changed: 7162 additions & 2388 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common/TableProducer/qVectorsTable.cxx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
///
2020

2121
// C++/ROOT includes.
22+
#include <TComplex.h>
23+
#include <TH3F.h>
24+
2225
#include <chrono>
2326
#include <string>
27+
#include <unordered_map>
2428
#include <vector>
25-
#include <TComplex.h>
26-
#include <TH3F.h>
2729

2830
// o2Physics includes.
2931
#include "Framework/AnalysisDataModel.h"
@@ -78,6 +80,9 @@ struct qVectorsTable {
7880

7981
Configurable<float> cfgMinPtOnTPC{"cfgMinPtOnTPC", 0.15, "minimum transverse momentum selection for TPC tracks participating in Q-vector reconstruction"};
8082
Configurable<float> cfgMaxPtOnTPC{"cfgMaxPtOnTPC", 5., "maximum transverse momentum selection for TPC tracks participating in Q-vector reconstruction"};
83+
Configurable<float> cfgEtaMax{"cfgEtaMax", 0.8, "Maximum pseudorapidiy for charged track"};
84+
Configurable<float> cfgEtaMin{"cfgEtaMin", -0.8, "Minimum pseudorapidiy for charged track"};
85+
8186
Configurable<int> cfgCorrLevel{"cfgCorrLevel", 4, "calibration step: 0 = no corr, 1 = gain corr, 2 = rectr, 3 = twist, 4 = full"};
8287
Configurable<std::vector<int>> cfgnMods{"cfgnMods", {2, 3}, "Modulation of interest"};
8388
Configurable<float> cfgMaxCentrality{"cfgMaxCentrality", 100.f, "max. centrality for Q vector calibration"};
@@ -437,7 +442,10 @@ struct qVectorsTable {
437442
continue;
438443
}
439444
histosQA.fill(HIST("ChTracks"), trk.pt(), trk.eta(), trk.phi(), cent);
440-
if (std::abs(trk.eta()) > 0.8) {
445+
if (trk.eta() > cfgEtaMax) {
446+
continue;
447+
}
448+
if (trk.eta() < cfgEtaMin) {
441449
continue;
442450
}
443451
qVectTPCall[0] += trk.pt() * std::cos(trk.phi() * nmode);

DPG/Tasks/AOTEvent/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ o2physics_add_dpl_workflow(rof-occupancy-qa
4444
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase
4545
COMPONENT_NAME Analysis)
4646

47+
o2physics_add_dpl_workflow(light-ions-evsel-qa
48+
SOURCES lightIonsEvSelQa.cxx
49+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase
50+
COMPONENT_NAME Analysis)
51+
4752
o2physics_add_dpl_workflow(occupancy-vs-dedx-qa
4853
SOURCES dEdxVsOccupancyWithTrackQAinfo.cxx
4954
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase

DPG/Tasks/AOTEvent/eventSelectionQa.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ struct EventSelectionQaTask {
11851185
histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks);
11861186
}
11871187
} // end of hasTPC
1188-
if (track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) {
1188+
if (col.sel8() && fabs(col.posZ()) < 10 && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) {
11891189
nContributorsAfterEtaTPCCuts++;
11901190
// ROF border QA
11911191
histos.fill(HIST("ITSROFborderQA/hFoundBC_kTVX_nITSlayers_for_ITSTPCtracks"), localBC, track.itsNCls());

DPG/Tasks/AOTEvent/lightIonsEvSelQa.cxx

Lines changed: 1128 additions & 0 deletions
Large diffs are not rendered by default.

EventFiltering/PWGEM/EMPhotonFilter.cxx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ struct EMPhotonFilter {
131131
return false;
132132
}
133133

134-
if (track.pt() < minpt || abs(track.eta()) > maxeta) {
134+
if (track.pt() < minpt || std::fabs(track.eta()) > maxeta) {
135135
return false;
136136
}
137137

@@ -161,7 +161,7 @@ struct EMPhotonFilter {
161161
dca_3d = 999.f;
162162
} else {
163163
float chi2 = (track.dcaXY() * track.dcaXY() * track.cZZ() + track.dcaZ() * track.dcaZ() * track.cYY() - 2. * track.dcaXY() * track.dcaZ() * track.cZY()) / det;
164-
dca_3d = std::sqrt(std::abs(chi2) / 2.);
164+
dca_3d = std::sqrt(std::fabs(chi2) / 2.);
165165
}
166166
if (dca_3d > dca_3d_sigma_max) {
167167
return false;
@@ -177,23 +177,23 @@ struct EMPhotonFilter {
177177
template <uint8_t system, typename TCollisions, typename TPhotons1, typename TPhotons2, typename TPhotons3, typename TV0Legs, typename TDielectrons, typename TEMPrimaryElectrons>
178178
void runFilter(TCollisions const& collisions, TPhotons1 const& photons1, TPhotons2 const& photons2, TPhotons3 const& /*photons3*/, TV0Legs const&, TDielectrons const& dielectrons, TEMPrimaryElectrons const& /*emprimaryelectrons*/)
179179
{
180-
for (auto& collision : collisions) {
180+
for (const auto& collision : collisions) {
181181
mHistManager.fill(HIST("hEventCounter"), 1.);
182182
bool keepEvent[kNtrg]{false};
183183

184184
if (collision.sel8()) {
185185
mHistManager.fill(HIST("hEventCounter"), 2.);
186186
}
187-
if (abs(collision.posZ()) < 10.f) {
187+
if (std::fabs(collision.posZ()) < 10.f) {
188188
mHistManager.fill(HIST("hEventCounter"), 3.);
189189
}
190190
if (collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) {
191191
mHistManager.fill(HIST("hEventCounter"), 4.);
192192
}
193-
if (collision.sel8() && abs(collision.posZ()) < 10.f) {
193+
if (collision.sel8() && std::fabs(collision.posZ()) < 10.f) {
194194
mHistManager.fill(HIST("hEventCounter"), 5.);
195195
}
196-
if (collision.sel8() && abs(collision.posZ()) < 10.f && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) {
196+
if (collision.sel8() && std::fabs(collision.posZ()) < 10.f && collision.selection_bit(aod::evsel::kNoTimeFrameBorder)) {
197197
mHistManager.fill(HIST("hEventCounter"), 6.);
198198
}
199199

@@ -206,7 +206,7 @@ struct EMPhotonFilter {
206206
auto photons1_per_coll = photons1.sliceBy(perCollision_pcm, collision.globalIndex());
207207
auto dielectrons_per_coll = dielectrons.sliceBy(perCollision_ee, collision.globalIndex());
208208

209-
for (auto& v0photon : photons1_per_coll) {
209+
for (const auto& v0photon : photons1_per_coll) {
210210
auto pos_sv = v0photon.template posTrack_as<TV0Legs>();
211211
auto ele_sv = v0photon.template negTrack_as<TV0Legs>();
212212
if (!isSelectedSecondary(pos_sv) || !isSelectedSecondary(ele_sv)) {
@@ -218,7 +218,7 @@ struct EMPhotonFilter {
218218
}
219219
} // end of single v0 photon loop
220220

221-
for (auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) {
221+
for (const auto& [g1, g2] : combinations(CombinationsFullIndexPolicy(photons1_per_coll, dielectrons_per_coll))) {
222222
auto pos_sv = g1.template posTrack_as<TV0Legs>();
223223
auto ele_sv = g1.template negTrack_as<TV0Legs>();
224224
if (!isSelectedSecondary(pos_sv) || !isSelectedSecondary(ele_sv)) {
@@ -282,8 +282,8 @@ struct EMPhotonFilter {
282282
if (clu2.trackdist() < 1.) { // select neutral clusters. Disp, Ncell cuts?
283283
continue;
284284
}
285-
double m = pow(clu.e() + clu2.e(), 2) - pow(clu.px() + clu2.px(), 2) -
286-
pow(clu.py() + clu2.py(), 2) - pow(clu.pz() + clu2.pz(), 2);
285+
double m = std::pow(clu.e() + clu2.e(), 2) - std::pow(clu.px() + clu2.px(), 2) -
286+
std::pow(clu.py() + clu2.py(), 2) - std::pow(clu.pz() + clu2.pz(), 2);
287287
if (m > ePair * ePair) {
288288
keepEvent[kPHOS_Pair] |= true;
289289
break;

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
}

0 commit comments

Comments
 (0)