@@ -123,6 +123,7 @@ struct FlowGfwLightIons {
123123 O2_DEFINE_CONFIGURABLE (cfgFixedMultMin, int , 1 , " Minimum for fixed nch range" );
124124 O2_DEFINE_CONFIGURABLE (cfgFixedMultMax, int , 3000 , " Maximum for fixed nch range" );
125125 O2_DEFINE_CONFIGURABLE (cfgUseMultiplicityFlowWeights, bool , true , " Enable or disable the use of multiplicity-based event weighting" );
126+ O2_DEFINE_CONFIGURABLE (cfgConsistentEventFlag, int , 0 , " Flag to select consistent events - 0: off, 1: v2{2} gap calculable, 2: v2{4} full calculable, 4: v2{4} gap calculable, 8: v2{4} 3sub calculable" );
126127 O2_DEFINE_CONFIGURABLE (cfgUseDensityDependentCorrection, bool , false , " Use density dependent efficiency correction based on Run 2 measurements" );
127128 Configurable<std::vector<double >> cfgTrackDensityP0{" cfgTrackDensityP0" , std::vector<double >{0.7217476707 , 0.7384792571 , 0.7542625668 , 0.7640680200 , 0.7701951667 , 0.7755299053 , 0.7805901710 , 0.7849446786 , 0.7957356586 , 0.8113039262 , 0.8211968966 , 0.8280558878 , 0.8329342135 }, " parameter 0 for track density efficiency correction" };
128129 Configurable<std::vector<double >> cfgTrackDensityP1{" cfgTrackDensityP1" , std::vector<double >{-2.169488e-05 , -2.191913e-05 , -2.295484e-05 , -2.556538e-05 , -2.754463e-05 , -2.816832e-05 , -2.846502e-05 , -2.843857e-05 , -2.705974e-05 , -2.477018e-05 , -2.321730e-05 , -2.203315e-05 , -2.109474e-05 }, " parameter 1 for track density efficiency correction" };
@@ -183,7 +184,6 @@ struct FlowGfwLightIons {
183184 kCentNGlobal ,
184185 kCentMFT
185186 };
186-
187187 enum EventSelFlags {
188188 kFilteredEvent = 1 ,
189189 kSel8 ,
@@ -226,6 +226,12 @@ struct FlowGfwLightIons {
226226 DensityCorr () : psi2Est(0 .), psi3Est(0 .), psi4Est(0 .), v2(0 .), v3(0 .), v4(0 .), density(0 ) {}
227227 };
228228
229+ // region indices for consistency flag
230+ int posRegionIndex = -1 ;
231+ int negRegionIndex = -1 ;
232+ int fullRegionIndex = -1 ;
233+ int midRegionIndex = -1 ;
234+
229235 // Event selection cuts - Alex
230236 TF1* fMultPVCutLow = nullptr ;
231237 TF1* fMultPVCutHigh = nullptr ;
@@ -276,7 +282,6 @@ struct FlowGfwLightIons {
276282 cfgGFWBinning->Print ();
277283 o2::analysis::gfw::multGlobalCorrCutPars = cfgMultGlobalCutPars;
278284 o2::analysis::gfw::multPVCorrCutPars = cfgMultPVCutPars;
279-
280285 o2::analysis::gfw::firstRunsOfFill = cfgFirstRunsOfFill;
281286 if (cfgTimeDependent && !std::is_sorted (o2::analysis::gfw::firstRunsOfFill.begin (), o2::analysis::gfw::firstRunsOfFill.end ())) {
282287 std::sort (o2::analysis::gfw::firstRunsOfFill.begin (), o2::analysis::gfw::firstRunsOfFill.end ());
@@ -458,7 +463,6 @@ struct FlowGfwLightIons {
458463 fPtDepDCAxy = new TF1 (" ptDepDCAxy" , Form (" [0]*%s" , cfgDCAxy->c_str ()), 0.001 , 100 );
459464 fPtDepDCAxy ->SetParameter (0 , cfgDCAxyNSigma);
460465 LOGF (info, " DCAxy pt-dependence function: %s" , Form (" [0]*%s" , cfgDCAxy->c_str ()));
461-
462466 if (cfgUseAdditionalEventCut) {
463467 fMultPVCutLow = new TF1 (" fMultPVCutLow" , cfgMultCorrLowCutFunction->c_str (), 0 , 100 );
464468 fMultPVCutLow ->SetParameters (&(o2::analysis::gfw::multPVCorrCutPars[0 ]));
@@ -487,6 +491,32 @@ struct FlowGfwLightIons {
487491 funcV4 = new TF1 (" funcV4" , " [0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x" , 0 , 100 );
488492 funcV4->SetParameters (0.008845 , 0.000259668 , -3.24435e-06 , 4.54837e-08 , -6.01825e-10 );
489493 }
494+ if (cfgConsistentEventFlag) {
495+ posRegionIndex = [&]() {
496+ auto begin = cfgRegions->GetNames ().begin ();
497+ auto end = cfgRegions->GetNames ().end ();
498+ auto it = std::find (begin, end, " refP" );
499+ return (it != end) ? std::distance (begin, it) : -1 ;
500+ }();
501+ negRegionIndex = [&]() {
502+ auto begin = cfgRegions->GetNames ().begin ();
503+ auto end = cfgRegions->GetNames ().end ();
504+ auto it = std::find (begin, end, " refN" );
505+ return (it != end) ? std::distance (begin, it) : -1 ;
506+ }();
507+ fullRegionIndex = [&]() {
508+ auto begin = cfgRegions->GetNames ().begin ();
509+ auto end = cfgRegions->GetNames ().end ();
510+ auto it = std::find (begin, end, " refFull" );
511+ return (it != end) ? std::distance (begin, it) : -1 ;
512+ }();
513+ midRegionIndex = [&]() {
514+ auto begin = cfgRegions->GetNames ().begin ();
515+ auto end = cfgRegions->GetNames ().end ();
516+ auto it = std::find (begin, end, " refMid" );
517+ return (it != end) ? std::distance (begin, it) : -1 ;
518+ }();
519+ }
490520 }
491521
492522 static constexpr std::string_view FillTimeName[] = {" before/" , " after/" };
@@ -757,6 +787,13 @@ struct FlowGfwLightIons {
757787 double time;
758788 };
759789
790+ struct AcceptedTracks {
791+ int nPos;
792+ int nNeg;
793+ int nFull;
794+ int nMid;
795+ };
796+
760797 template <DataType dt, typename TCollision, typename TTracks>
761798 void processCollision (TCollision collision, TTracks tracks, const XAxis& xaxis, const int & run)
762799 {
@@ -819,9 +856,21 @@ struct FlowGfwLightIons {
819856 densitycorrections.v4 = v4;
820857 densitycorrections.density = tracks.size ();
821858 }
822-
859+ AcceptedTracks acceptedTracks{ 0 , 0 , 0 , 0 };
823860 for (const auto & track : tracks) {
824- processTrack (track, vtxz, xaxis.multiplicity , run, densitycorrections);
861+ processTrack (track, vtxz, xaxis.multiplicity , run, densitycorrections, acceptedTracks);
862+ if (cfgConsistentEventFlag & 1 )
863+ if (!acceptedTracks.nPos || !acceptedTracks.nNeg )
864+ return ;
865+ if (cfgConsistentEventFlag & 2 )
866+ if (acceptedTracks.nFull < 4 ) // o2-linter: disable=magic-number (at least four tracks in full acceptance)
867+ return ;
868+ if (cfgConsistentEventFlag & 4 )
869+ if (acceptedTracks.nPos < 2 || acceptedTracks.nNeg < 2 ) // o2-linter: disable=magic-number (at least two tracks in each subevent)
870+ return ;
871+ if (cfgConsistentEventFlag & 8 )
872+ if (acceptedTracks.nPos < 2 || acceptedTracks.nMid < 2 || acceptedTracks.nNeg < 2 ) // o2-linter: disable=magic-number (at least two tracks in all three subevents)
873+ return ;
825874 }
826875 if (!cfgFillWeights)
827876 fillOutputContainers<dt>((cfgTimeDependent) ? xaxis.time : (cfgUseNch) ? xaxis.multiplicity
@@ -845,7 +894,20 @@ struct FlowGfwLightIons {
845894 }
846895
847896 template <typename TTrack>
848- inline void processTrack (TTrack const & track, const float & vtxz, const int & multiplicity, const int & run, DensityCorr densitycorrections)
897+ void fillAcceptedTracks (TTrack track, AcceptedTracks& acceptedTracks)
898+ {
899+ if (posRegionIndex >= 0 && track.eta () > o2::analysis::gfw::regions.GetEtaMin ()[posRegionIndex] && track.eta () < o2::analysis::gfw::regions.GetEtaMax ()[posRegionIndex])
900+ ++acceptedTracks.nPos ;
901+ if (negRegionIndex >= 0 && track.eta () > o2::analysis::gfw::regions.GetEtaMin ()[negRegionIndex] && track.eta () < o2::analysis::gfw::regions.GetEtaMax ()[negRegionIndex])
902+ ++acceptedTracks.nNeg ;
903+ if (fullRegionIndex >= 0 && track.eta () > o2::analysis::gfw::regions.GetEtaMin ()[fullRegionIndex] && track.eta () < o2::analysis::gfw::regions.GetEtaMax ()[fullRegionIndex])
904+ ++acceptedTracks.nFull ;
905+ if (midRegionIndex >= 0 && track.eta () > o2::analysis::gfw::regions.GetEtaMin ()[midRegionIndex] && track.eta () < o2::analysis::gfw::regions.GetEtaMax ()[midRegionIndex])
906+ ++acceptedTracks.nMid ;
907+ }
908+
909+ template <typename TTrack>
910+ inline void processTrack (TTrack const & track, const float & vtxz, const int & multiplicity, const int & run, DensityCorr densitycorrections, AcceptedTracks& acceptedTracks)
849911 {
850912 if constexpr (framework::has_type_v<aod::mctracklabel::McParticleId, typename TTrack::all_columns>) {
851913 if (track.mcParticleId () < 0 || !(track.has_mcParticle ()))
@@ -868,6 +930,7 @@ struct FlowGfwLightIons {
868930 } else {
869931 fillPtSums<kReco >(track);
870932 fillGFW<kReco >(track, vtxz, densitycorrections);
933+ fillAcceptedTracks (track, acceptedTracks);
871934 }
872935
873936 if (cfgFillQA) {
@@ -885,7 +948,7 @@ struct FlowGfwLightIons {
885948
886949 fillPtSums<kGen >(track);
887950 fillGFW<kGen >(track, vtxz, densitycorrections);
888-
951+ fillAcceptedTracks (track, acceptedTracks);
889952 if (cfgFillQA) {
890953 fillTrackQA<kGen , kAfter >(track, vtxz);
891954 registry.fill (HIST (" MCGen/trackQA/nch_pt" ), multiplicity, track.pt ());
@@ -903,6 +966,7 @@ struct FlowGfwLightIons {
903966 } else {
904967 fillPtSums<kReco >(track);
905968 fillGFW<kReco >(track, vtxz, densitycorrections);
969+ fillAcceptedTracks (track, acceptedTracks);
906970 }
907971 if (cfgFillQA) {
908972 fillTrackQA<kReco , kAfter >(track, vtxz);
@@ -914,6 +978,7 @@ struct FlowGfwLightIons {
914978 }
915979 }
916980 }
981+ return ;
917982 }
918983
919984 template <DataType dt, typename TTrack>
@@ -954,7 +1019,7 @@ struct FlowGfwLightIons {
9541019 double weff = (dt == kGen ) ? 1 . : getEfficiency (track);
9551020 if (weff < 0 )
9561021 return ;
957- if (std::abs (track.eta ()) < cfgEtaPtPt) {
1022+ if (std::abs (track.eta ()) < cfgEtaPtPt && track. pt () > o2::analysis::gfw::ptreflow && track. pt () < o2::analysis::gfw::ptrefup ) {
9581023 (dt == kGen ) ? fFCptgen ->fill (1 ., track.pt ()) : fFCpt ->fill (weff, track.pt ());
9591024 }
9601025 }
0 commit comments