Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 34 additions & 14 deletions PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,45 @@
/// \brief Tasks that produces the track tables used for the pairing
/// \author Laura Serksnyte, TU München, laura.serksnyte@tum.de

#include <CCDB/BasicCCDBManager.h>
#include <fairlogger/Logger.h>
#include <vector>
#include <string>
#include "PWGCF/DataModel/FemtoDerived.h"
#include "PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h"
#include "PWGCF/FemtoDream/Core/femtoDreamV0Selection.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"

#include "Common/Core/trackUtilities.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/Multiplicity.h"
#include "Common/DataModel/Centrality.h"
#include "Common/DataModel/PIDResponse.h"
#include "Common/DataModel/PIDResponseITS.h"
#include "Common/DataModel/TrackSelectionTables.h"
#include "EventFiltering/Zorro.h"

#include "DataFormatsParameters/GRPMagField.h"
#include "DataFormatsParameters/GRPObject.h"
#include "PWGCF/FemtoDream/Core/femtoDreamCollisionSelection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamTrackSelection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamV0Selection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamCascadeSelection.h"
#include "PWGCF/FemtoDream/Core/femtoDreamUtils.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/runDataProcessing.h"
#include "EventFiltering/Zorro.h"
#include "PWGCF/DataModel/FemtoDerived.h"
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "ReconstructionDataFormats/Track.h"
#include "TMath.h"
#include <CCDB/BasicCCDBManager.h>

#include "Math/Vector4D.h"
#include "TMath.h"

#include <fairlogger/Logger.h>

#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::aod::rctsel;
using namespace o2::analysis::femtoDream;

namespace o2::aod
Expand Down Expand Up @@ -103,8 +109,8 @@
Produces<aod::FDExtMCParticles> outputDebugPartsMC;
Produces<aod::FDExtMCLabels> outputPartsExtMCLabels;

Configurable<bool> ConfIsDebug{"ConfIsDebug", true, "Enable Debug tables"};

Check failure on line 112 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
Configurable<bool> ConfUseItsPid{"ConfUseItsPid", false, "Enable Debug tables"};

Check failure on line 113 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/function-variable]

Use lowerCamelCase for names of functions and variables.
Configurable<bool> ConfIsRun3{"ConfIsRun3", false, "Running on Run3 or pilot"};
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)"};
/// Event cuts
Expand Down Expand Up @@ -205,6 +211,12 @@

} OptionTrackSpecialSelections;

struct : o2::framework::ConfigurableGroup {
Configurable<bool> requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"};
Configurable<std::string> cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"};
Configurable<bool> cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"};
} rctCut;

HistogramRegistry qaRegistry{"QAHistos", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry TrackRegistry{"Tracks", {}, OutputObjHandlingPolicy::AnalysisObject};
HistogramRegistry V0Registry{"V0", {}, OutputObjHandlingPolicy::AnalysisObject};
Expand All @@ -214,6 +226,7 @@
float mMagField;
std::string zorroTriggerNames = "";
Service<o2::ccdb::BasicCCDBManager> ccdb; /// Accessing the CCDB
RCTFlagsChecker rctChecker;

void init(InitContext&)
{
Expand All @@ -239,15 +252,15 @@
ResoRegistry.add("AnalysisQA/Reso/InvMass_selected", "Invariant mass V0s;M_{KK};Entries", HistType::kTH1F, {{7000, 0.8, 1.5}});
ResoRegistry.add("AnalysisQA/Reso/Daughter1/Pt", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}});
ResoRegistry.add("AnalysisQA/Reso/Daughter1/Eta", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}});
ResoRegistry.add("AnalysisQA/Reso/Daughter1/Phi", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}});

Check failure on line 255 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
ResoRegistry.add("AnalysisQA/Reso/Daughter2/Pt", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}});
ResoRegistry.add("AnalysisQA/Reso/Daughter2/Eta", "Pseudorapidity of all processed tracks;#eta;Entries", HistType::kTH1F, {{1000, -2, 2}});
ResoRegistry.add("AnalysisQA/Reso/Daughter2/Phi", "Azimuthal angle of all processed tracks;#phi;Entries", HistType::kTH1F, {{720, 0, TMath::TwoPi()}});

Check failure on line 258 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[external-pi]

Use the PI constant (and its multiples and fractions) defined in o2::constants::math.
ResoRegistry.add("AnalysisQA/Reso/PtD1_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}});
ResoRegistry.add("AnalysisQA/Reso/PtD2_selected", "Transverse momentum of all processed tracks;p_{T} (GeV/c);Entries", HistType::kTH1F, {{1000, 0, 10}});

if (ConfEnableTriggerSelection) {
for (const std::string& triggerName : softwareTriggers::triggerNames) {

Check failure on line 263 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if (ConfTriggerSwitches->get("Switch", triggerName.c_str())) {
zorroTriggerNames += triggerName + ",";
}
Expand All @@ -255,6 +268,8 @@
zorroTriggerNames.pop_back();
}

rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, false, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad);

colCuts.setCuts(ConfEvtZvtx.value, ConfEvtTriggerCheck.value, ConfEvtTriggerSel.value, ConfEvtOfflineCheck.value, ConfEvtAddOfflineCheck.value, ConfIsRun3.value);
colCuts.init(&qaRegistry);

Expand Down Expand Up @@ -473,7 +488,7 @@
TrackRegistry.fill(HIST("AnalysisQA/getGenStatusCode"), particleMC.getGenStatusCode());
TrackRegistry.fill(HIST("AnalysisQA/getProcess"), particleMC.getProcess());
// if this fails, the particle is a fake
if (abs(pdgCode) == abs(ConfTrkPDGCode.value)) {

Check failure on line 491 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
// check first if particle is from pile up
// check if the collision associated with the particle is the same as the analyzed collision by checking their Ids
if ((col.has_mcCollision() && (particleMC.mcCollisionId() != col.mcCollisionId())) || !col.has_mcCollision()) {
Expand All @@ -485,7 +500,7 @@
// particle is from a decay -> getProcess() == 4
// particle is generated during transport -> getGenStatusCode() == -1
// list of mothers is not empty
} else if (particleMC.getProcess() == 4 && particleMC.getGenStatusCode() == -1 && !motherparticlesMC.empty()) {

Check failure on line 503 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// get direct mother
auto motherparticleMC = motherparticlesMC.front();
pdgCodeMother = motherparticleMC.pdgCode();
Expand All @@ -494,7 +509,7 @@
// check if particle is material
// particle is from inelastic hadronic interaction -> getProcess() == 23
// particle is generated during transport -> getGenStatusCode() == -1
} else if (particleMC.getProcess() == 23 && particleMC.getGenStatusCode() == -1) {

Check failure on line 512 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
particleOrigin = aod::femtodreamMCparticle::ParticleOriginMCTruth::kMaterial;
// cross check to see if we missed a case
} else {
Expand Down Expand Up @@ -568,6 +583,7 @@
if (!colCuts.isSelectedCollision(col)) {
return;
}

if (ConfIsActivateV0.value) {
if (colCuts.isEmptyCollision(col, tracks, trackCuts) && colCuts.isEmptyCollision(col, fullV0s, v0Cuts, tracks)) {
return;
Expand All @@ -578,6 +594,10 @@
}
}

if (rctCut.requireRCTFlagChecker && !rctChecker(col)) {
return;
}

outputCollision(vtxZ, mult, multNtr, spher, mMagField);
if constexpr (isMC) {
fillMCCollision(col);
Expand All @@ -587,7 +607,7 @@
std::vector<int> tmpIDtrack; // this vector keeps track of the matching of the primary track table row <-> aod::track table global index
std::vector<typename TrackTypeWithItsPid::iterator> Daughter1, Daughter2;

for (auto& track : tracksWithItsPid) {

Check failure on line 610 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
/// if the most open selection criteria are not fulfilled there is no
/// point looking further at the track
trackCuts.fillQA<aod::femtodreamparticle::ParticleType::kTrack, aod::femtodreamparticle::TrackType::kNoChild, 0>(track);
Expand Down Expand Up @@ -660,7 +680,7 @@
}

if (ConfIsActivateV0.value) {
for (auto& v0 : fullV0s) {

Check failure on line 683 in PWGCF/FemtoDream/TableProducer/femtoDreamProducerTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.

auto postrack = v0.template posTrack_as<TrackType>();
auto negtrack = v0.template negTrack_as<TrackType>();
Expand Down
Loading