diff --git a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h index 9dc72eaea38f6..9ccce72eb0835 100644 --- a/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h +++ b/Analysis/DataModel/include/AnalysisDataModel/HFSecondaryVertex.h @@ -27,6 +27,14 @@ using namespace o2::analysis; namespace o2::aod { +namespace hf_selcollision +{ +DECLARE_SOA_COLUMN(WhyRejectColl, whyRejectColl, int); //! +} // namespace hf_selcollision + +DECLARE_SOA_TABLE(HFSelCollision, "AOD", "HFSELCOLLISION", //! + hf_selcollision::WhyRejectColl); + namespace hf_seltrack { DECLARE_SOA_COLUMN(IsSelProng, isSelProng, int); //! @@ -49,12 +57,12 @@ using BigTracksPID = soa::Join, v0data::MK0Short); /*, - v0data::MLambda, - v0data::MAntiLambda, - v0data::MK0Short); + v0data::MLambda, + v0data::MAntiLambda, + v0data::MK0Short); */ // extended table with expression columns that can be used as arguments of dynamic columns DECLARE_SOA_EXTENDED_TABLE_USER(HfCandCascExt, HfCandCascBase, "HFCANDCASCEXT", //! diff --git a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx index a2684c9e08cf3..51d016bf5ee3a 100644 --- a/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx +++ b/Analysis/Tasks/PWGHF/HFTrackIndexSkimsCreator.cxx @@ -18,6 +18,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "DetectorsVertexing/DCAFitterN.h" +#include "AnalysisDataModel/EventSelection.h" #include "AnalysisDataModel/HFSecondaryVertex.h" #include "AnalysisCore/trackUtilities.h" #include "AnalysisCore/HFConfigurables.h" @@ -58,8 +59,57 @@ using MyTracks = soa::Join rowSelectedCollision; + + Configurable doValPlots{"doValPlots", true, "fill histograms"}; + Configurable triggerClassName{"triggerClassName", "kINT7", "trigger class"}; + int triggerClass = std::distance(aliasLabels, std::find(aliasLabels, aliasLabels + kNaliases, triggerClassName.value.data())); + + HistogramRegistry registry{ + "registry", + {{"hEvents", "Events;;entries", {HistType::kTH1F, {{3, 0.5, 3.5}}}}}}; + + void init(InitContext const&) + { + std::string labels[3] = {"processed collisions", "selected collisions", "rej. trigger class"}; + for (int iBin = 0; iBin < 3; iBin++) { + registry.get(HIST("hEvents"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); + } + } + + // event selection + void process(soa::Join::iterator const& collision) + { + int statusCollision = 0; + + if (doValPlots) { + registry.get(HIST("hEvents"))->Fill(1); + } + + if (!collision.alias()[triggerClass]) { + statusCollision |= BIT(0); + if (doValPlots) { + registry.get(HIST("hEvents"))->Fill(3); + } + } + + //TODO: add more event selection criteria + + // selected events + if (doValPlots && statusCollision == 0) { + registry.get(HIST("hEvents"))->Fill(2); + } + + // fill table row + rowSelectedCollision(statusCollision); + }; +}; + /// Track selection -struct SelectTracks { +struct HfTagSelTrack { // enum for candidate type enum CandidateType { @@ -264,7 +314,7 @@ struct SelectTracks { //____________________________________________________________________________________________________________________________________________ /// Pre-selection of 2-prong and 3-prong secondary vertices -struct HFTrackIndexSkimsCreator { +struct HfTrackIndexSkimsCreator { Produces rowTrackIndexProng2; Produces rowProng2CutStatus; Produces rowTrackIndexProng3; @@ -273,8 +323,6 @@ struct HFTrackIndexSkimsCreator { //Configurable nCollsMax{"nCollsMax", -1, "Max collisions per file"}; //can be added to run over limited collisions per file - for tesing purposes Configurable dovalplots{"dovalplots", true, "fill histograms"}; Configurable do3prong{"do3prong", 0, "do 3 prong"}; - // event selection - Configurable triggerindex{"triggerindex", -1, "trigger index"}; // vertexing parameters Configurable bz{"bz", 5., "magnetic field kG"}; Configurable propdca{"propdca", true, "create tracks version propagated to PCA"}; @@ -309,6 +357,9 @@ struct HFTrackIndexSkimsCreator { {"hmassXicToPKPi", "#Xi_{c} candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{500, 0., 5.}}}}}}; Filter filterSelectTracks = (aod::hf_seltrack::isSelProng > 0 && aod::hf_seltrack::isSelProng < 4); + Filter filterSelectCollisions = (aod::hf_selcollision::whyRejectColl == 0); + + using SelectedCollisions = soa::Filtered>; using SelectedTracks = soa::Filtered>; // FIXME @@ -323,7 +374,7 @@ struct HFTrackIndexSkimsCreator { // int nColls{0}; //can be added to run over limited collisions per file - for tesing purposes void process( //soa::Join::iterator const& collision, //FIXME add centrality when option for variations to the process function appears - aod::Collision const& collision, + SelectedCollisions::iterator const& collision, aod::BCs const& bcs, SelectedTracks const& tracks) { @@ -341,15 +392,6 @@ struct HFTrackIndexSkimsCreator { //auto centrality = collision.centV0M(); //FIXME add centrality when option for variations to the process function appears - int trigindex = int{triggerindex}; - if (trigindex != -1) { - uint64_t triggerMask = collision.bc().triggerMask(); - bool isTriggerClassFired = triggerMask & 1ul << (trigindex - 1); - if (!isTriggerClassFired) { - return; - } - } - //FIXME move above process function const int n2ProngDecays = hf_cand_prong2::DecayType::N2ProngDecays; // number of 2-prong hadron types const int n3ProngDecays = hf_cand_prong3::DecayType::N3ProngDecays; // number of 3-prong hadron types @@ -1003,7 +1045,7 @@ struct HFTrackIndexSkimsCreator { /// to run: o2-analysis-weak-decay-indices --aod-file AO2D.root -b | o2-analysis-lambdakzerobuilder -b | /// o2-analysis-trackextension -b | o2-analysis-hf-track-index-skims-creator -b -struct HFTrackIndexSkimsCreatorCascades { +struct HfTrackIndexSkimsCreatorCascades { Produces rowTrackIndexCasc; // Produces rowTrackIndexCasc; @@ -1072,9 +1114,12 @@ struct HFTrackIndexSkimsCreatorCascades { double massLc = RecoDecay::getMassPDG(pdg::Code::kLambdaCPlus); double mass2K0sP{0.}; // WHY HERE? + Filter filterSelectCollisions = (aod::hf_selcollision::whyRejectColl == 0); + using FullTracksExt = soa::Join; + using SelectedCollisions = soa::Filtered>; - void process(aod::Collision const& collision, + void process(SelectedCollisions::iterator const& collision, aod::BCs const& bcs, //soa::Filtered const& V0s, aod::V0Datas const& V0s, @@ -1265,12 +1310,13 @@ struct HFTrackIndexSkimsCreatorCascades { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { WorkflowSpec workflow{ - adaptAnalysisTask(cfgc, TaskName{"hf-produce-sel-track"}), - adaptAnalysisTask(cfgc, TaskName{"hf-track-index-skims-creator"})}; + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc), + adaptAnalysisTask(cfgc)}; const bool doLcK0Sp = cfgc.options().get("do-LcK0Sp"); if (doLcK0Sp) { - workflow.push_back(adaptAnalysisTask(cfgc, TaskName{"hf-track-index-skims-cascades-creator"})); + workflow.push_back(adaptAnalysisTask(cfgc)); } return workflow;