@@ -60,6 +60,7 @@ struct ConfD0Filters : o2::framework::ConfigurableGroup {
6060 // invariant-mass window
6161 o2::framework::Configurable<float > massMin{" massMin" , 1 .7f , " Minimum invariant mass for D0" };
6262 o2::framework::Configurable<float > massMax{" massMax" , 2 .0f , " Maximum invariant mass for D0" };
63+ o2::framework::Configurable<bool > rejectAmbiguousHypothesis{" rejectAmbiguousHypothesis" , false , " Reject candidates selected under both D0 and D0bar hypotheses" };
6364};
6465
6566// derived selection bits for D0s
@@ -73,8 +74,9 @@ struct ConfD0Bits : o2::framework::ConfigurableGroup {
7374};
7475
7576// base selection for analysis task for D0s
77+ template <auto & Prefix>
7678struct ConfD0Selection : o2::framework::ConfigurableGroup {
77- std::string prefix = std::string( " D0Selection " ) ;
79+ std::string prefix = Prefix ;
7880 o2::framework::Configurable<int > pdgCodeAbs{" pdgCodeAbs" , o2::constants::physics::Pdg::kD0 , " PDG code (D0)" };
7981 o2::framework::Configurable<int > sign{" sign" , 0 , " Particle sign (+1: D0; -1: D0bar; 0: both)" };
8082 o2::framework::Configurable<float > ptMin{" ptMin" , 1 .f , " Minimum pT" };
@@ -91,6 +93,11 @@ struct ConfD0Selection : o2::framework::ConfigurableGroup {
9193 o2::framework::Configurable<datatypes::CharmHadronMaskType> mask{" mask" , 0 , " Bitmask for D0 selection" };
9294};
9395
96+ constexpr const char PrefixD0Selection1[] = " D0Selection1" ;
97+ constexpr const char PrefixD0Selection2[] = " D0Selection2" ;
98+ using ConfD0Selection1 = ConfD0Selection<PrefixD0Selection1>;
99+ using ConfD0Selection2 = ConfD0Selection<PrefixD0Selection2>;
100+
94101// / The different selections for D0s
95102enum D0Sels {
96103 // topological selections
@@ -125,6 +132,7 @@ enum D0Filters {
125132 kYMax ,
126133 kMassMin ,
127134 kMassMax ,
135+ kRejectAmbiguous ,
128136 kD0FiltersMax
129137};
130138
@@ -142,7 +150,8 @@ const std::unordered_map<D0Filters, std::string> d0FilterNames = {
142150 {kYMin , " Minimum rapidity" },
143151 {kYMax , " Maximum rapidity" },
144152 {kMassMin , " Minimum invariant mass" },
145- {kMassMax , " Maximum invariant mass" }};
153+ {kMassMax , " Maximum invariant mass" },
154+ {kRejectAmbiguous , " Reject ambiguous D0/D0bar hypothesis" }};
146155
147156template <modes::CharmHadron hadronType, auto & SelectionHistName, auto & FilterHistName>
148157class D0Selection : public baseselection ::BaseSelection<float , o2::analysis::femto::datatypes::CharmHadronMaskType, kD0SelsMax >
@@ -167,6 +176,7 @@ class D0Selection : public baseselection::BaseSelection<float, o2::analysis::fem
167176 mUseYCut = filter.useYCut .value ;
168177 mYMin = filter.yMin .value ;
169178 mYMax = filter.yMax .value ;
179+ mRejectAmbiguousHypothesis = filter.rejectAmbiguousHypothesis .value ;
170180
171181 this ->addSelection (kCpaMin , d0SelectionNames.at (kCpaMin ), config.cpaMin .value , limits::kLowerLimit , true , true , false );
172182 this ->addSelection (kDecayLengthMin , d0SelectionNames.at (kDecayLengthMin ), config.decayLengthMin .value , limits::kLowerLimit , true , true , false );
@@ -189,6 +199,7 @@ class D0Selection : public baseselection::BaseSelection<float, o2::analysis::fem
189199 {d0FilterNames.at (kYMax ), mYMax },
190200 {d0FilterNames.at (kMassMin ), mMassMin },
191201 {d0FilterNames.at (kMassMax ), mMassMax },
202+ {d0FilterNames.at (kRejectAmbiguous ), static_cast <float >(mRejectAmbiguousHypothesis )},
192203 });
193204 }
194205
@@ -223,6 +234,16 @@ class D0Selection : public baseselection::BaseSelection<float, o2::analysis::fem
223234 this ->template fillFilter <FilterHistName>(kHypothesis , p);
224235 pass &= p;
225236
237+ bool competing = false ;
238+ if constexpr (modes::isEqual (hadronType, modes::CharmHadron::kD0 )) {
239+ competing = d0candidate.isSelD0bar ();
240+ } else {
241+ competing = d0candidate.isSelD0 ();
242+ }
243+ p = !mRejectAmbiguousHypothesis || !competing;
244+ this ->template fillFilter <FilterHistName>(kRejectAmbiguous , p);
245+ pass &= p;
246+
226247 p = d0candidate.pt () > mPtMin ;
227248 this ->template fillFilter <FilterHistName>(kPtMin , p);
228249 pass &= p;
@@ -286,6 +307,7 @@ class D0Selection : public baseselection::BaseSelection<float, o2::analysis::fem
286307 bool mUseYCut = true ;
287308 float mYMin = -0 .8f ;
288309 float mYMax = 0 .8f ;
310+ bool mRejectAmbiguousHypothesis = false ;
289311};
290312
291313// tables produced by the D0 builder: kinematics, bitmask and QA
0 commit comments