1616
1717#include < fairlogger/Logger.h>
1818#include < cstdint>
19- #include < iostream>
2019#include < vector>
20+ #include < TDatabasePDG.h>
2121#include " Framework/AnalysisTask.h"
2222#include " Framework/runDataProcessing.h"
2323#include " Framework/HistogramRegistry.h"
2424#include " Framework/ASoAHelpers.h"
2525#include " Framework/RunningWorkflowInfo.h"
2626#include " Framework/StepTHn.h"
27+ #include " Framework/O2DatabasePDGPlugin.h"
2728#include " DataFormatsParameters/GRPObject.h"
2829
2930#include " PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
3031#include " PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h"
3132#include " PWGCF/FemtoUniverse/Core/FemtoUniverseEventHisto.h"
3233#include " PWGCF/FemtoUniverse/Core/femtoUtils.h"
34+ #include " PWGCF/FemtoUniverse/Core/FemtoUniverseMath.h"
3335
3436using namespace o2 ;
3537using namespace o2 ::analysis::femto_universe;
3638using namespace o2 ::framework;
3739using namespace o2 ::framework::expressions;
3840using namespace o2 ::soa;
3941
40- struct femtoUniverseDebugV0 {
42+ struct FemtoUniverseDebugV0 {
43+
44+ Service<o2::framework::O2DatabasePDG> pdg;
45+
4146 SliceCache cache;
4247
43- Configurable<int > ConfPDGCodeV0{ " ConfPDGCodePartOne " , 3122 , " V0 - PDG code" };
44- Configurable<int > ConfPDGCodeChildPos{ " ConfPDGCodeChildPos " , 2212 , " Positive Child - PDG code" };
45- Configurable<int > ConfPDGCodeChildNeg{ " ConfPDGCodeChildNeg " , 211 , " Negative Child- PDG code" };
46- Configurable<uint32_t > ConfCutV0{ " ConfCutV0 " , 338 , " V0 - Selection bit from cutCulator" };
47- ConfigurableAxis ConfV0TempFitVarBins{ " ConfV0TempFitVarBins " , {300 , 0.95 , 1 .}, " V0: binning of the TempFitVar in the pT vs. TempFitVar plot" };
48- ConfigurableAxis ConfV0TempFitVarpTBins{ " ConfV0TempFitVarpTBins " , {20 , 0.5 , 4.05 }, " V0: pT binning of the pT vs. TempFitVar plot" };
49-
50- Configurable<uint32_t > ConfCutChildPos{ " ConfCutChildPos " , 150 , " Positive Child of V0 - Selection bit from cutCulator" };
51- Configurable<uint32_t > ConfCutChildNeg{ " ConfCutChildNeg " , 149 , " Negative Child of V0 - Selection bit from cutCulator" };
52- Configurable<float > ConfChildPosPidnSigmaMax{ " ConfChildPosPidnSigmaMax " , 3 .f , " Positive Child of V0 - Selection bit from cutCulator" };
53- Configurable<float > ConfChildNegPidnSigmaMax{ " ConfChildNegPidnSigmaMax " , 3 .f , " Negative Child of V0 - Selection bit from cutCulator" };
54- Configurable<int > ConfChildPosIndex{ " ConfChildPosIndex " , 1 , " Positive Child of V0 - Index from cutCulator" };
55- Configurable<int > ConfChildNegIndex{ " ConfChildNegIndex " , 0 , " Negative Child of V0 - Index from cutCulator" };
56- Configurable<std::vector<float >> ConfChildPIDnSigmaMax{ " ConfChildPIDnSigmaMax " , std::vector<float >{4 .f , 3 .f }, " V0 child sel: Max . PID nSigma TPC" };
57- Configurable<int > ConfChildnSpecies{ " ConfChildnSpecies " , 2 , " Number of particle spieces (for V0 children) with PID info" };
58- ConfigurableAxis ConfChildTempFitVarBins{ " ConfChildTempFitVarBins " , {300 , -0.15 , 0.15 }, " V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot" };
59- ConfigurableAxis ConfChildTempFitVarpTBins{ " ConfChildTempFitVarpTBins " , {20 , 0.5 , 4.05 }, " V0 child: pT binning of the pT vs. TempFitVar plot" };
48+ Configurable<int > confPDGCodeV0{ " confPDGCodeV0 " , 3122 , " V0 - - PDG code" };
49+ Configurable<int > confPDGCodePositiveChild{ " confPDGCodePositiveChild " , 2212 , " Positive Child - - PDG code" };
50+ Configurable<int > confPDGCodeNegativeChild{ " confPDGCodeNegativeChild " , 211 , " Negative Child - - PDG code" };
51+ Configurable<uint32_t > confCutV0{ " confCutV0 " , 338 , " V0 - - Selection bit from cutCulator" };
52+ ConfigurableAxis confV0TempFitVarBins{ " confV0TempFitVarBins " , {300 , 0.95 , 1 .}, " V0: binning of the TempFitVar in the pT vs. TempFitVar plot" };
53+ ConfigurableAxis confV0TempFitVarpTBins{ " confV0TempFitVarpTBins " , {20 , 0.5 , 4.05 }, " V0: pT binning of the pT vs. TempFitVar plot" };
54+
55+ Configurable<uint32_t > confCutPositiveChild{ " confCutPositiveChild " , 150 , " Positive Child of V0 - - Selection bit from cutCulator" };
56+ Configurable<uint32_t > confCutNegativeChild{ " confCutNegativeChild " , 149 , " Negative Child of V0 - - Selection bit from cutCulator" };
57+ Configurable<float > confPositiveChildPIDnSigmaMax{ " confPositiveChildPIDnSigmaMax " , 3 .f , " Positive Child of V0 - - Selection bit from cutCulator" };
58+ Configurable<float > confNegativeChildPIDnSigmaMax{ " confNegativeChildPIDnSigmaMax " , 3 .f , " Negative Child of V0 - - Selection bit from cutCulator" };
59+ Configurable<int > confPositiveChildIndex{ " confPositiveChildIndex " , 1 , " Positive Child of V0 - - Index from cutCulator" };
60+ Configurable<int > confNegativeChildIndex{ " confNegativeChildIndex " , 0 , " Negative Child of V0 - - Index from cutCulator" };
61+ Configurable<std::vector<float >> confChildPIDnSigmaMax{ " confChildPIDnSigmaMax " , std::vector<float >{4 .f , 3 .f }, " V0 child selection: max . PID nSigma TPC" };
62+ Configurable<int > confChildnSpecies{ " confChildnSpecies " , 2 , " Number of particle spieces (for V0 children) with PID info" };
63+ ConfigurableAxis confChildTempFitVarBins{ " confChildTempFitVarBins " , {300 , -0.15 , 0.15 }, " V0 child: binning of the TempFitVar in the pT vs. TempFitVar plot" };
64+ ConfigurableAxis confChildTempFitVarpTBins{ " confChildTempFitVarpTBins " , {20 , 0.5 , 4.05 }, " V0 child: pT binning of the pT vs. TempFitVar plot" };
6065
6166 using FemtoFullParticles = soa::Join<aod::FDParticles, aod::FDExtParticles>;
62- Partition<FemtoFullParticles> partsOne = (aod::femtouniverseparticle::partType == uint8_t (aod::femtouniverseparticle::ParticleType::kV0 )) && ((aod::femtouniverseparticle::cut & ConfCutV0 ) == ConfCutV0 );
67+ Partition<FemtoFullParticles> partsOne = (aod::femtouniverseparticle::partType == uint8_t (aod::femtouniverseparticle::ParticleType::kV0 )) && ((aod::femtouniverseparticle::cut & confCutV0 ) == confCutV0 );
6368 Preslice<FemtoFullParticles> perCol = aod::femtouniverseparticle::fdCollisionId;
6469
6570 // / Histogramming
6671 FemtoUniverseEventHisto eventHisto;
67- FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child , 3 > posChildHistos ;
68- FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child , 4 > negChildHistos ;
72+ FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child , 3 > positiveChildHistos ;
73+ FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0Child , 4 > negativeChildHistos ;
6974 FemtoUniverseParticleHisto<aod::femtouniverseparticle::ParticleType::kV0 > V0Histos;
7075
7176 // / Histogram output
7277 HistogramRegistry EventRegistry{" Event" , {}, OutputObjHandlingPolicy::AnalysisObject};
7378 HistogramRegistry V0Registry{" FullV0QA" , {}, OutputObjHandlingPolicy::AnalysisObject};
79+ HistogramRegistry thetaRegistry{" ThetaQA" , {}, OutputObjHandlingPolicy::AnalysisObject};
7480
7581 void init (InitContext&)
7682 {
7783 eventHisto.init (&EventRegistry);
78- posChildHistos.init (&V0Registry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false , ConfPDGCodeChildPos.value , true );
79- negChildHistos.init (&V0Registry, ConfChildTempFitVarpTBins, ConfChildTempFitVarBins, false , ConfPDGCodeChildNeg, true );
80- V0Histos.init (&V0Registry, ConfV0TempFitVarpTBins, ConfV0TempFitVarBins, false , ConfPDGCodeV0.value , true );
84+ positiveChildHistos.init (&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false , confPDGCodePositiveChild.value , true );
85+ negativeChildHistos.init (&V0Registry, confChildTempFitVarpTBins, confChildTempFitVarBins, false , confPDGCodeNegativeChild, true );
86+ V0Histos.init (&V0Registry, confV0TempFitVarpTBins, confV0TempFitVarBins, false , confPDGCodeV0.value , true );
87+
88+ thetaRegistry.add (" Theta/hTheta" , " ; p (GeV/#it{c}); cos(#theta)" , kTH2F , {{100 , 0 , 10 }, {50 , -5 , 5 }});
8189 }
8290
83- // / Porduce QA plots for V0 selection in FemtoUniverse framework
91+ // / Produce QA plots for V0 selection in FemtoUniverse framework
8492 void process (o2::aod::FdCollision const & col, FemtoFullParticles const & parts)
8593 {
8694 auto groupPartsOne = partsOne->sliceByCached (aod::femtouniverseparticle::fdCollisionId, col.globalIndex (), cache);
8795 eventHisto.fillQA (col);
88- for (auto & part : groupPartsOne) {
96+ for (const auto & part : groupPartsOne) {
8997 if (!part.has_children ()) {
9098 continue ;
9199 }
92- const auto & posChild = parts.iteratorAt (part.index () - 2 );
93- const auto & negChild = parts.iteratorAt (part.index () - 1 );
94- if (posChild .globalIndex () != part.childrenIds ()[0 ] || negChild .globalIndex () != part.childrenIds ()[1 ]) {
100+ const auto & positiveChild = parts.iteratorAt (part.index () - 2 );
101+ const auto & negativeChild = parts.iteratorAt (part.index () - 1 );
102+ if (positiveChild .globalIndex () != part.childrenIds ()[0 ] || negativeChild .globalIndex () != part.childrenIds ()[1 ]) {
95103 LOG (warn) << " Indices of V0 children do not match" ;
96104 continue ;
97105 }
98- // check cuts on V0 children
99- if ((posChild.partType () == uint8_t (aod::femtouniverseparticle::ParticleType::kV0Child ) && (posChild.cut () & ConfCutChildPos) == ConfCutChildPos) &&
100- (negChild.partType () == uint8_t (aod::femtouniverseparticle::ParticleType::kV0Child ) && (negChild.cut () & ConfCutChildNeg) == ConfCutChildNeg) &&
101- isFullPIDSelected (posChild.pidCut (), posChild.p (), 999 .f , ConfChildPosIndex.value , ConfChildnSpecies.value , ConfChildPIDnSigmaMax.value , ConfChildPosPidnSigmaMax.value , 1 .f ) &&
102- isFullPIDSelected (negChild.pidCut (), negChild.p (), 999 .f , ConfChildNegIndex.value , ConfChildnSpecies.value , ConfChildPIDnSigmaMax.value , ConfChildNegPidnSigmaMax.value , 1 .f )) {
106+
107+ // Check cuts on V0 children
108+ if (positiveChild.partType () == uint8_t (aod::femtouniverseparticle::ParticleType::kV0Child ) &&
109+ negativeChild.partType () == uint8_t (aod::femtouniverseparticle::ParticleType::kV0Child ) &&
110+ isFullPIDSelected (positiveChild.pidCut (), positiveChild.p (), 999 .f , confPositiveChildIndex.value , confChildnSpecies.value , confChildPIDnSigmaMax.value , confPositiveChildPIDnSigmaMax.value , 1 .f ) &&
111+ isFullPIDSelected (negativeChild.pidCut (), negativeChild.p (), 999 .f , confNegativeChildIndex.value , confChildnSpecies.value , confChildPIDnSigmaMax.value , confNegativeChildPIDnSigmaMax.value , 1 .f )) {
112+ auto positiveChildMass = pdg->Mass (confPDGCodePositiveChild);
113+ auto negativeChildMass = pdg->Mass (confPDGCodeNegativeChild);
114+ auto positiveChildBoosted = FemtoUniverseMath::boostPRF<decltype (positiveChild)>(positiveChild, positiveChildMass, negativeChild, negativeChildMass);
115+ auto cosineTheta = (positiveChildBoosted.Px () * part.px () + positiveChildBoosted.Py () * part.py () + positiveChildBoosted.Pz () * part.pz ()) / (positiveChildBoosted.P () * part.p ());
116+
103117 V0Histos.fillQA <false , true >(part);
104- posChildHistos.fillQA <false , true >(posChild);
105- negChildHistos.fillQA <false , true >(negChild);
118+ positiveChildHistos.fillQA <false , true >(positiveChild);
119+ negativeChildHistos.fillQA <false , true >(negativeChild);
120+ thetaRegistry.fill (HIST (" Theta/hTheta" ), part.p (), cosineTheta);
106121 }
107122 }
108123 }
@@ -112,7 +127,7 @@ WorkflowSpec
112127 defineDataProcessing (ConfigContext const & cfgc)
113128{
114129 WorkflowSpec workflow{
115- adaptAnalysisTask<femtoUniverseDebugV0 >(cfgc),
130+ adaptAnalysisTask<FemtoUniverseDebugV0 >(cfgc),
116131 };
117132 return workflow;
118133}
0 commit comments