Skip to content

Commit 98370a5

Browse files
authored
[PWGCF] FemtoUniverse - MCTruth producer update (#11842)
1 parent e4aa4c8 commit 98370a5

File tree

1 file changed

+60
-56
lines changed

1 file changed

+60
-56
lines changed

PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerMCTruthTask.cxx

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@
1414
/// \author Malgorzata Janik, WUT Warsaw, majanik@cern.ch
1515
/// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch
1616

17-
#include <CCDB/BasicCCDBManager.h>
18-
#include "Common/Core/trackUtilities.h"
19-
#include "Common/DataModel/EventSelection.h"
20-
#include "Common/DataModel/Multiplicity.h"
21-
#include "Common/DataModel/PIDResponse.h"
22-
#include "Common/DataModel/TrackSelectionTables.h"
23-
#include "DataFormatsParameters/GRPMagField.h"
24-
#include "DataFormatsParameters/GRPObject.h"
2517
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h"
2618
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h"
27-
#include "PWGCF/FemtoUniverse/Core/FemtoUniverseV0Selection.h"
28-
#include "PWGCF/FemtoUniverse/Core/FemtoUniversePhiSelection.h"
29-
#include "PWGCF/FemtoUniverse/Core/femtoUtils.h"
30-
#include "Framework/ASoAHelpers.h"
19+
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
20+
21+
#include "Common/CCDB/TriggerAliases.h"
22+
#include "Common/DataModel/EventSelection.h"
23+
#include "Common/DataModel/Multiplicity.h"
24+
3125
#include "Framework/AnalysisDataModel.h"
3226
#include "Framework/AnalysisTask.h"
3327
#include "Framework/HistogramRegistry.h"
3428
#include "Framework/runDataProcessing.h"
35-
#include "Math/Vector4D.h"
36-
#include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
37-
#include "PWGLF/DataModel/LFStrangenessTables.h"
38-
#include "ReconstructionDataFormats/Track.h"
39-
#include "TMath.h"
40-
#include "TLorentzVector.h"
29+
#include <CCDB/BasicCCDBManager.h>
30+
#include <CommonConstants/PhysicsConstants.h>
31+
#include <Framework/AnalysisHelpers.h>
32+
#include <Framework/Configurable.h>
33+
#include <Framework/InitContext.h>
34+
#include <Framework/OutputObjHeader.h>
35+
36+
#include <chrono>
37+
#include <cstddef>
38+
#include <cstdint>
39+
#include <vector>
4140

4241
using namespace o2;
4342
using namespace o2::analysis::femto_universe;
4443
using namespace o2::framework;
4544
using namespace o2::framework::expressions;
45+
using namespace o2::constants::physics;
4646

4747
namespace o2::aod
4848
{
@@ -71,7 +71,7 @@ int getRowDaughters(int daughID, T const& vecID)
7171
return rowInPrimaryTrackTableDaugh;
7272
}
7373

74-
struct femtoUniverseProducerMCTruthTask {
74+
struct FemtoUniverseProducerMCTruthTask {
7575
int mRunNumber;
7676
float mMagField;
7777
Service<o2::ccdb::BasicCCDBManager> ccdb; /// Accessing the CCDB
@@ -83,29 +83,26 @@ struct femtoUniverseProducerMCTruthTask {
8383
// Produces<aod::FdMCParticles> outputPartsMC;
8484

8585
// Analysis configs
86-
Configurable<bool> ConfIsTrigger{"ConfIsTrigger", false, "Store all collisions"}; // Choose if filtering or skimming version is run
87-
Configurable<bool> ConfIsRun3{"ConfIsRun3", false, "Running on Run3 or pilot"};
88-
Configurable<bool> ConfIsMC{"ConfIsMC", false, "Running on MC; implemented only for Run3"};
89-
Configurable<bool> ConfIsForceGRP{"ConfIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"};
90-
Configurable<bool> ConfIsActivateV0{"ConfIsActivateV0", true, "Activate filling of V0 into femtouniverse tables"};
91-
Configurable<bool> ConfIsActivatePhi{"ConfIsActivatePhi", true, "Activate filling of Phi into femtouniverse tables"};
92-
Configurable<std::vector<int>> ConfPDGCodes{"ConfPDGCodes", std::vector<int>{211, -211, 2212, -2212, 333}, "PDG of particles to be stored"};
93-
Configurable<bool> ConfAnalysisWithPID{"ConfAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles"};
86+
Configurable<bool> confIsRun3{"confIsRun3", false, "Running on Run3 or pilot"};
87+
Configurable<bool> confIsMC{"confIsMC", false, "Running on MC; implemented only for Run3"};
88+
Configurable<bool> confIsForceGRP{"confIsForceGRP", false, "Set true if the magnetic field configuration is not available in the usual CCDB directory (e.g. for Run 2 converted data or unanchorad Monte Carlo)"};
89+
Configurable<std::vector<int>> confPDGCodes{"confPDGCodes", std::vector<int>{211, -211, 2212, -2212, 333}, "PDG of particles to be stored"};
90+
Configurable<bool> confAnalysisWithPID{"confAnalysisWithPID", true, "1: take only particles with specified PDG, 0: all particles"};
9491

9592
/// Event cuts
96-
Configurable<bool> ConfEvtUseTPCmult{"ConfEvtUseTPCmult", false, "Use multiplicity based on the number of tracks with TPC information"};
97-
Configurable<float> ConfEvtZvtx{"ConfEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"};
98-
Configurable<bool> ConfEvtTriggerCheck{"ConfEvtTriggerCheck", true, "Evt sel: check for trigger"};
99-
Configurable<int> ConfEvtTriggerSel{"ConfEvtTriggerSel", kINT7, "Evt sel: trigger"};
100-
Configurable<bool> ConfEvtOfflineCheck{"ConfEvtOfflineCheck", false, "Evt sel: check for offline selection"};
101-
Configurable<float> ConfCentFT0Min{"ConfCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"};
102-
Configurable<float> ConfCentFT0Max{"ConfCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"};
93+
Configurable<float> confEvtZvtx{"confEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"};
94+
Configurable<bool> confEvtTriggerCheck{"confEvtTriggerCheck", true, "Evt sel: check for trigger"};
95+
Configurable<int> confEvtTriggerSel{"confEvtTriggerSel", kINT7, "Evt sel: trigger"};
96+
Configurable<bool> confEvtOfflineCheck{"confEvtOfflineCheck", false, "Evt sel: check for offline selection"};
97+
Configurable<float> confCentFT0Min{"confCentFT0Min", 0.f, "Min CentFT0 value for centrality selection"};
98+
Configurable<float> confCentFT0Max{"confCentFT0Max", 200.f, "Max CentFT0 value for centrality selection"};
99+
Configurable<bool> confDoSpher{"confDoSpher", false, "Calculate sphericity. If false sphericity will take value of 2."};
103100

104101
// Track cuts
105102
struct : o2::framework::ConfigurableGroup {
106-
Configurable<float> ConfPtLowFilterCut{"ConfPtLowFilterCut", 0.14, "Lower limit for Pt for the filtering tracks"}; // pT low
107-
Configurable<float> ConfPtHighFilterCut{"ConfPtHighFilterCut", 5.0, "Higher limit for Pt for the filtering tracks"}; // pT high
108-
Configurable<float> ConfEtaFilterCut{"ConfEtaFilterCut", 0.8, "Eta cut for the filtering tracks"};
103+
Configurable<float> confPtLowFilterCut{"confPtLowFilterCut", 0.14, "Lower limit for Pt for the filtering tracks"}; // pT low
104+
Configurable<float> confPtHighFilterCut{"confPtHighFilterCut", 5.0, "Higher limit for Pt for the filtering tracks"}; // pT high
105+
Configurable<float> confEtaFilterCut{"confEtaFilterCut", 0.8, "Eta cut for the filtering tracks"};
109106
} ConfFilteringTracks;
110107

111108
FemtoUniverseCollisionSelection colCuts;
@@ -118,7 +115,7 @@ struct femtoUniverseProducerMCTruthTask {
118115
LOGF(fatal, "Neither processFullData nor processFullMC enabled. Please choose one.");
119116
}
120117

121-
colCuts.setCuts(ConfEvtZvtx, ConfEvtTriggerCheck, ConfEvtTriggerSel, ConfEvtOfflineCheck, ConfIsRun3, ConfCentFT0Min, ConfCentFT0Max);
118+
colCuts.setCuts(confEvtZvtx, confEvtTriggerCheck, confEvtTriggerSel, confEvtOfflineCheck, confIsRun3, confCentFT0Min, confCentFT0Max);
122119

123120
colCuts.init(&qaRegistry);
124121
trackCuts.init<aod::femtouniverseparticle::ParticleType::kTrack, aod::femtouniverseparticle::TrackType::kNoChild, aod::femtouniverseparticle::CutContainerType>(&qaRegistry);
@@ -135,16 +132,23 @@ struct femtoUniverseProducerMCTruthTask {
135132
}
136133

137134
template <typename CollisionType, typename TrackType>
138-
void fillCollisions(CollisionType const& col, TrackType const& /*tracks*/)
135+
void fillCollisions(CollisionType const& col, TrackType const& tracks)
139136
{
140-
for (auto& c : col) {
137+
for (const auto& c : col) {
141138
const auto vtxZ = c.posZ();
142-
const auto spher = 0; // colCuts.computeSphericity(col, tracks);
143-
int mult = 0;
144-
int multNtr = 0;
139+
float mult = confIsRun3 ? c.multFV0M() : 0.5 * (c.multFV0M());
140+
int multNtr = confIsRun3 ? c.multNTracksPV() : c.multTracklets();
145141

142+
// Removing collisions with Zvtx > 10 cm
143+
if (std::abs(vtxZ) > confEvtZvtx) {
144+
continue;
145+
}
146146
// colCuts.fillQA(c); //for now, TODO: create a configurable so in the FemroUniverseCollisionSelection.h there is an option to plot QA just for the posZ
147-
outputCollision(vtxZ, mult, multNtr, spher, mMagField);
147+
if (confDoSpher) {
148+
outputCollision(vtxZ, mult, multNtr, colCuts.computeSphericity(col, tracks), mMagField);
149+
} else {
150+
outputCollision(vtxZ, mult, multNtr, 2, mMagField);
151+
}
148152
}
149153
}
150154

@@ -153,26 +157,26 @@ struct femtoUniverseProducerMCTruthTask {
153157
{
154158
std::vector<int> childIDs = {0, 0}; // these IDs are necessary to keep track of the children
155159

156-
for (auto& particle : tracks) {
160+
for (const auto& particle : tracks) {
157161
/// if the most open selection criteria are not fulfilled there is no
158162
/// point looking further at the track
159163

160-
if (particle.eta() < -ConfFilteringTracks.ConfEtaFilterCut || particle.eta() > ConfFilteringTracks.ConfEtaFilterCut)
164+
if (particle.eta() < -ConfFilteringTracks.confEtaFilterCut || particle.eta() > ConfFilteringTracks.confEtaFilterCut)
161165
continue;
162-
if (particle.pt() < ConfFilteringTracks.ConfPtLowFilterCut || particle.pt() > ConfFilteringTracks.ConfPtHighFilterCut)
166+
if (particle.pt() < ConfFilteringTracks.confPtLowFilterCut || particle.pt() > ConfFilteringTracks.confPtHighFilterCut)
163167
continue;
164168

165-
uint32_t pdgCode = (uint32_t)particle.pdgCode();
169+
int pdgCode = particle.pdgCode();
166170

167-
if (ConfAnalysisWithPID) {
171+
if (confAnalysisWithPID) {
168172
bool pass = false;
169-
std::vector<int> tmpPDGCodes = ConfPDGCodes; // necessary due to some features of the Configurable
170-
for (uint32_t pdg : tmpPDGCodes) {
171-
if (pdgCode == 333) { // phi meson
173+
std::vector<int> tmpPDGCodes = confPDGCodes; // necessary due to some features of the Configurable
174+
for (const int& pdg : tmpPDGCodes) {
175+
if (pdgCode == Pdg::kPhi) { // phi meson
172176
pass = true;
173-
} else if (pdgCode == 421) { // D0 meson
177+
} else if (pdgCode == Pdg::kD0) { // D0 meson
174178
pass = true;
175-
} else if (pdgCode == 411) { // D+ meson
179+
} else if (pdgCode == Pdg::kDPlus) { // D+ meson
176180
pass = true;
177181
} else if (static_cast<int>(pdg) == static_cast<int>(pdgCode)) {
178182
if (particle.isPhysicalPrimary())
@@ -220,11 +224,11 @@ struct femtoUniverseProducerMCTruthTask {
220224
fillCollisions(collisions, mcParticles);
221225
fillParticles(mcParticles);
222226
}
223-
PROCESS_SWITCH(femtoUniverseProducerMCTruthTask, processTrackMC, "Provide MC data for track analysis", true);
227+
PROCESS_SWITCH(FemtoUniverseProducerMCTruthTask, processTrackMC, "Provide MC data for track analysis", true);
224228
};
225229

226230
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
227231
{
228-
WorkflowSpec workflow{adaptAnalysisTask<femtoUniverseProducerMCTruthTask>(cfgc)};
232+
WorkflowSpec workflow{adaptAnalysisTask<FemtoUniverseProducerMCTruthTask>(cfgc)};
229233
return workflow;
230234
}

0 commit comments

Comments
 (0)