@@ -55,52 +55,54 @@ struct Filter2Prong {
5555 O2_DEFINE_CONFIGURABLE (cfgImCutPt, float , 0 .2f , " Minimal pT for candidates" )
5656 O2_DEFINE_CONFIGURABLE (cfgImMinInvMass, float , 0 .95f , " Minimum invariant mass for generic 2 prong" )
5757 O2_DEFINE_CONFIGURABLE (cfgImMaxInvMass, float , 1 .07f , " Maximum invariant mass for generic 2 prong" )
58- O2_DEFINE_CONFIGURABLE (cfgImSigmaFormula, std::string, " (z < 0.5 && abs(x) < 3.0) || (z >= 0.5 && abs(x) < 2.5 && abs(y) < 3.0)" , " pT dependent daughter track sigma pass condition (x = TPC sigma, y = TOF sigma, z = pT)" )
59-
60- struct : ConfigurableGroup{
61- O2_DEFINE_CONFIGURABLE (tpcNClsCrossedRowsTrackMin, float , 70 , " Minimum number of crossed rows in TPC" )
62- O2_DEFINE_CONFIGURABLE (etaTrackMax, float , 0.8 , " Maximum pseudorapidity" )
63- O2_DEFINE_CONFIGURABLE (ptTrackMin, float , 0.1 , " Minimum transverse momentum" )
64- O2_DEFINE_CONFIGURABLE (minV0DCAPr, float , 0.1 , " Min V0 proton DCA" )
65- O2_DEFINE_CONFIGURABLE (minV0DCAPiLambda, float , 0.1 , " Min V0 pion DCA for lambda" )
66- O2_DEFINE_CONFIGURABLE (minV0DCAPiK0s, float , 0.1 , " Min V0 pion DCA for K0s" )
67- O2_DEFINE_CONFIGURABLE (daughPIDCuts, float , 4.0 , " PID nsigma for V0s" )
68- O2_DEFINE_CONFIGURABLE (massK0Min, float , 0.4 , " Minimum mass for K0" )
69- O2_DEFINE_CONFIGURABLE (massK0Max, float , 0.6 , " Maximum mass for K0" )
70- O2_DEFINE_CONFIGURABLE (massLambdaMin, float , 1.0 , " Minimum mass for lambda" )
71- O2_DEFINE_CONFIGURABLE (massLambdaMax, float , 1.3 , " Maximum mass for lambda" )
72- O2_DEFINE_CONFIGURABLE (radiusMaxLambda, float , 2.3 , " Maximum decay radius (cm) for lambda" )
73- O2_DEFINE_CONFIGURABLE (radiusMinLambda, float , 0.0 , " Minimum decay radius (cm) for lambda" )
74- O2_DEFINE_CONFIGURABLE (radiusMaxK0s, float , 2.3 , " Maximum decay radius (cm) for K0s" )
75- O2_DEFINE_CONFIGURABLE (radiusMinK0s, float , 0.0 , " Minimum decay radius (cm) for K0s" )
76- O2_DEFINE_CONFIGURABLE (cosPaMinLambda, float , 0.98 , " Minimum cosine of pointing angle for lambda" )
77- O2_DEFINE_CONFIGURABLE (cosPaMinK0s, float , 0.98 , " Minimum cosine of pointing angle for K0s" )
78- O2_DEFINE_CONFIGURABLE (dcaV0DaughtersMaxLambda, float , 0.2 , " Maximum DCA among the V0 daughters (cm) for lambda" )
79- O2_DEFINE_CONFIGURABLE (dcaV0DaughtersMaxK0s, float , 0.2 , " Maximum DCA among the V0 daughters (cm) for K0s" )
80- O2_DEFINE_CONFIGURABLE (qtArmenterosMinForK0s, float , 0.12 , " Minimum Armenteros' qt for K0s" )
81- O2_DEFINE_CONFIGURABLE (maxLambdaLifeTime, float , 30 , " Maximum lambda lifetime (in cm)" )
82- O2_DEFINE_CONFIGURABLE (maxK0sLifeTime, float , 30 , " Maximum K0s lifetime (in cm)" )} grpV0;
83-
84- struct : ConfigurableGroup{
85- O2_DEFINE_CONFIGURABLE (ImMinInvMassPhiMeson, float , 0 .98f , " Minimum invariant mass Phi meson (GeV)" )
86- O2_DEFINE_CONFIGURABLE (ImMaxInvMassPhiMeson, float , 1 .07f , " Maximum invariant mass Phi meson (GeV)" )
87- O2_DEFINE_CONFIGURABLE (ITSPIDSelection, bool , true , " PID ITS" )
88- O2_DEFINE_CONFIGURABLE (ITSPIDPthreshold, float , 1.0 , " Momentum threshold for ITS PID (GeV/c) (only used if ITSPIDSelection is true)" )
89- O2_DEFINE_CONFIGURABLE (lowITSPIDNsigma, float , 3.0 , " lower cut on PID nsigma for ITS" )
90- O2_DEFINE_CONFIGURABLE (highITSPIDNsigma, float , 3.0 , " higher cut on PID nsigma for ITS" )
91- O2_DEFINE_CONFIGURABLE (ITSclusterPhiMeson, int , 5 , " Minimum number of ITS cluster for phi meson track" )
92- O2_DEFINE_CONFIGURABLE (TPCCrossedRowsPhiMeson, int , 80 , " Minimum number of TPC Crossed Rows for phi meson track" )
93- O2_DEFINE_CONFIGURABLE (cutDCAxyPhiMeson, float , 0.1 , " Maximum DCAxy for phi meson track" )
94- O2_DEFINE_CONFIGURABLE (cutDCAzPhiMeson, float , 0.1 , " Maximum DCAz for phi meson track" )
95- O2_DEFINE_CONFIGURABLE (cutEtaPhiMeson, float , 0.8 , " Maximum eta for phi meson track" )
96- O2_DEFINE_CONFIGURABLE (cutPTPhiMeson, float , 0.15 , " Maximum pt for phi meson track" )
97- O2_DEFINE_CONFIGURABLE (isDeepAngle, bool , true , " Flag for applying deep angle" )
98- O2_DEFINE_CONFIGURABLE (deepAngle, float , 0.04 , " Deep angle cut" )
99- O2_DEFINE_CONFIGURABLE (nsigmaCutTPC, float , 2.5 , " nsigma tpc" )
100- O2_DEFINE_CONFIGURABLE (nsigmaCutTOF, float , 2.5 , " nsigma tof" )
101- O2_DEFINE_CONFIGURABLE (cutTOFBeta, float , 0.5 , " TOF beta" )
102- O2_DEFINE_CONFIGURABLE (confFakeKaonCut, float , 0.15 , " Cut based on track from momentum difference" )
103- O2_DEFINE_CONFIGURABLE (removefaketrack, bool , true , " Flag to remove fake kaon" )} grpPhi;
58+ O2_DEFINE_CONFIGURABLE (cfgImSigmaFormula, std::string, " (([p] < 0.5 || [hasTOF] <= 0.0) && abs([sTPC]) < 3.0) || ([p] >= 0.5 && abs([sTPC]) < 2.5 && abs([sTOF]) < 3.0)" , " pT dependent daughter track sigma pass condition. Parameters: [p] momentum, [sTPC] sigma TPC, [sTOF] sigma TOF, [hasTOF] has TOF." )
59+
60+ struct : ConfigurableGroup {
61+ O2_DEFINE_CONFIGURABLE (tpcNClsCrossedRowsTrackMin, float , 70 , " Minimum number of crossed rows in TPC" );
62+ O2_DEFINE_CONFIGURABLE (etaTrackMax, float , 0.8 , " Maximum pseudorapidity" );
63+ O2_DEFINE_CONFIGURABLE (ptTrackMin, float , 0.1 , " Minimum transverse momentum" );
64+ O2_DEFINE_CONFIGURABLE (minV0DCAPr, float , 0.1 , " Min V0 proton DCA" );
65+ O2_DEFINE_CONFIGURABLE (minV0DCAPiLambda, float , 0.1 , " Min V0 pion DCA for lambda" );
66+ O2_DEFINE_CONFIGURABLE (minV0DCAPiK0s, float , 0.1 , " Min V0 pion DCA for K0s" );
67+ O2_DEFINE_CONFIGURABLE (daughPIDCuts, float , 4.0 , " PID nsigma for V0s" );
68+ O2_DEFINE_CONFIGURABLE (massK0Min, float , 0.4 , " Minimum mass for K0" );
69+ O2_DEFINE_CONFIGURABLE (massK0Max, float , 0.6 , " Maximum mass for K0" );
70+ O2_DEFINE_CONFIGURABLE (massLambdaMin, float , 1.0 , " Minimum mass for lambda" );
71+ O2_DEFINE_CONFIGURABLE (massLambdaMax, float , 1.3 , " Maximum mass for lambda" );
72+ O2_DEFINE_CONFIGURABLE (radiusMaxLambda, float , 2.3 , " Maximum decay radius (cm) for lambda" );
73+ O2_DEFINE_CONFIGURABLE (radiusMinLambda, float , 0.0 , " Minimum decay radius (cm) for lambda" );
74+ O2_DEFINE_CONFIGURABLE (radiusMaxK0s, float , 2.3 , " Maximum decay radius (cm) for K0s" );
75+ O2_DEFINE_CONFIGURABLE (radiusMinK0s, float , 0.0 , " Minimum decay radius (cm) for K0s" );
76+ O2_DEFINE_CONFIGURABLE (cosPaMinLambda, float , 0.98 , " Minimum cosine of pointing angle for lambda" );
77+ O2_DEFINE_CONFIGURABLE (cosPaMinK0s, float , 0.98 , " Minimum cosine of pointing angle for K0s" );
78+ O2_DEFINE_CONFIGURABLE (dcaV0DaughtersMaxLambda, float , 0.2 , " Maximum DCA among the V0 daughters (cm) for lambda" );
79+ O2_DEFINE_CONFIGURABLE (dcaV0DaughtersMaxK0s, float , 0.2 , " Maximum DCA among the V0 daughters (cm) for K0s" );
80+ O2_DEFINE_CONFIGURABLE (qtArmenterosMinForK0s, float , 0.12 , " Minimum Armenteros' qt for K0s" );
81+ O2_DEFINE_CONFIGURABLE (maxLambdaLifeTime, float , 30 , " Maximum lambda lifetime (in cm)" );
82+ O2_DEFINE_CONFIGURABLE (maxK0sLifeTime, float , 30 , " Maximum K0s lifetime (in cm)" );
83+ } grpV0;
84+
85+ struct : ConfigurableGroup {
86+ O2_DEFINE_CONFIGURABLE (ImMinInvMassPhiMeson, float , 0 .98f , " Minimum invariant mass Phi meson (GeV)" );
87+ O2_DEFINE_CONFIGURABLE (ImMaxInvMassPhiMeson, float , 1 .07f , " Maximum invariant mass Phi meson (GeV)" );
88+ O2_DEFINE_CONFIGURABLE (ITSPIDSelection, bool , true , " PID ITS" );
89+ O2_DEFINE_CONFIGURABLE (ITSPIDPthreshold, float , 1.0 , " Momentum threshold for ITS PID (GeV/c) (only used if ITSPIDSelection is true)" );
90+ O2_DEFINE_CONFIGURABLE (lowITSPIDNsigma, float , 3.0 , " lower cut on PID nsigma for ITS" );
91+ O2_DEFINE_CONFIGURABLE (highITSPIDNsigma, float , 3.0 , " higher cut on PID nsigma for ITS" );
92+ O2_DEFINE_CONFIGURABLE (ITSclusterPhiMeson, int , 5 , " Minimum number of ITS cluster for phi meson track" );
93+ O2_DEFINE_CONFIGURABLE (TPCCrossedRowsPhiMeson, int , 80 , " Minimum number of TPC Crossed Rows for phi meson track" );
94+ O2_DEFINE_CONFIGURABLE (cutDCAxyPhiMeson, float , 0.1 , " Maximum DCAxy for phi meson track" );
95+ O2_DEFINE_CONFIGURABLE (cutDCAzPhiMeson, float , 0.1 , " Maximum DCAz for phi meson track" );
96+ O2_DEFINE_CONFIGURABLE (cutEtaPhiMeson, float , 0.8 , " Maximum eta for phi meson track" );
97+ O2_DEFINE_CONFIGURABLE (cutPTPhiMeson, float , 0.15 , " Maximum pt for phi meson track" );
98+ O2_DEFINE_CONFIGURABLE (isDeepAngle, bool , true , " Flag for applying deep angle" );
99+ O2_DEFINE_CONFIGURABLE (deepAngle, float , 0.04 , " Deep angle cut" );
100+ O2_DEFINE_CONFIGURABLE (nsigmaCutTPC, float , 2.5 , " nsigma tpc" );
101+ O2_DEFINE_CONFIGURABLE (nsigmaCutTOF, float , 2.5 , " nsigma tof" );
102+ O2_DEFINE_CONFIGURABLE (cutTOFBeta, float , 0.5 , " TOF beta" );
103+ O2_DEFINE_CONFIGURABLE (confFakeKaonCut, float , 0.15 , " Cut based on track from momentum difference" );
104+ O2_DEFINE_CONFIGURABLE (removefaketrack, bool , true , " Flag to remove fake kaon" );
105+ } grpPhi;
104106
105107 HfHelper hfHelper;
106108 Produces<aod::CF2ProngTracks> output2ProngTracks;
@@ -121,11 +123,25 @@ struct Filter2Prong {
121123 using ResoV0s = aod::V0Datas;
122124
123125 std::unique_ptr<TFormula> sigmaFormula;
126+ std::array<uint, 4 > sigmaFormulaParamIndex;
124127
125128 void init (InitContext&)
126129 {
127- if (doprocessDataInvMass)
130+ if (doprocessDataInvMass) {
131+ if (static_cast <std::size_t >(sigmaFormula->GetNpar ()) > std::size (sigmaFormulaParamIndex))
132+ LOGF (fatal, " Number of parameters in cfgImSigmaFormula can not be larger than %d." , std::size (sigmaFormulaParamIndex));
128133 sigmaFormula = std::make_unique<TFormula>(" sigmaFormula" , cfgImSigmaFormula.value .c_str ());
134+ // could do SetParameter(name,value) directly, but pre-lookup of the names will result in faster process
135+ std::array<std::string, 4 > pars = {" p" , " sTPC" , " sTOF" , " hasTOF" };
136+ std::fill_n (sigmaFormulaParamIndex.begin (), std::size (sigmaFormulaParamIndex), ~0u );
137+ for (uint i = 0 , n = sigmaFormula->GetNpar (); i < n; ++i) {
138+ auto m = std::find (pars.begin (), pars.end (), sigmaFormula->GetParName (i));
139+ if (m != pars.end ())
140+ sigmaFormulaParamIndex[std::distance (pars.begin (), m)] = i;
141+ else
142+ LOGF (warning, " Unrecognized cfgImSigmaFormula parameter %s." , sigmaFormula->GetParName (i));
143+ }
144+ }
129145 }
130146
131147 template <class HFCandidatesType >
@@ -389,15 +405,23 @@ struct Filter2Prong {
389405 const auto & p1 = tracks.iteratorAt (cftrack1.trackId () - tracks.begin ().globalIndex ());
390406 if (p1.sign () != 1 )
391407 continue ;
392- if (sigmaFormula->Eval (o2::aod::pidutils::tpcNSigma (cfgImPart1PID, p1), o2::aod::pidutils::tofNSigma (cfgImPart1PID, p1)) <= 0 .0f )
408+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[0 ], p1.p ());
409+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[1 ], o2::aod::pidutils::tpcNSigma (cfgImPart1PID, p1));
410+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[2 ], o2::aod::pidutils::tofNSigma (cfgImPart1PID, p1));
411+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[3 ], static_cast <double >(p1.hasTOF ()));
412+ if (sigmaFormula->Eval () <= 0 .0f )
393413 continue ;
394414 for (const auto & cftrack2 : cftracks) {
395415 if (cftrack2.globalIndex () == cftrack1.globalIndex ())
396416 continue ;
397417 const auto & p2 = tracks.iteratorAt (cftrack2.trackId () - tracks.begin ().globalIndex ());
398418 if (p2.sign () != -1 )
399419 continue ;
400- if (sigmaFormula->Eval (o2::aod::pidutils::tpcNSigma (cfgImPart2PID, p2), o2::aod::pidutils::tofNSigma (cfgImPart2PID, p2)) <= 0 .0f )
420+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[0 ], p2.p ());
421+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[1 ], o2::aod::pidutils::tpcNSigma (cfgImPart1PID, p2));
422+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[2 ], o2::aod::pidutils::tofNSigma (cfgImPart1PID, p2));
423+ sigmaFormula->SetParameter (sigmaFormulaParamIndex[3 ], static_cast <double >(p2.hasTOF ()));
424+ if (sigmaFormula->Eval () <= 0 .0f )
401425 continue ;
402426 ROOT::Math::PtEtaPhiMVector vec1 (p1.pt (), p1.eta (), p1.phi (), cfgImPart1Mass);
403427 ROOT::Math::PtEtaPhiMVector vec2 (p2.pt (), p2.eta (), p2.phi (), cfgImPart2Mass);
0 commit comments