@@ -123,6 +123,15 @@ struct JetSpectraEseTask {
123123 float psi3;
124124 };
125125
126+ struct EventPlaneFiller {
127+ bool psi;
128+ bool hist;
129+ };
130+
131+ static constexpr EventPlaneFiller PsiFillerEse = {true , true };
132+ static constexpr EventPlaneFiller PsiFillerBkg = {true , false };
133+ static constexpr EventPlaneFiller PsiFillerOcc = {false , false };
134+
126135 void init (o2::framework::InitContext&)
127136 {
128137 eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits (static_cast <std::string>(eventSelections));
@@ -267,7 +276,7 @@ struct JetSpectraEseTask {
267276 registry.fill (HIST (" hEventCounter" ), counter++);
268277 registry.fill (HIST (" hCentralitySel" ), collision.centrality ());
269278
270- const auto psi{procEP<true >(collision)};
279+ const auto psi{procEP<PsiFillerEse >(collision)};
271280 const auto qPerc{collision.qPERCFT0C ()};
272281 if (qPerc[0 ] < 0 )
273282 return ;
@@ -279,7 +288,7 @@ struct JetSpectraEseTask {
279288 auto rho = collision.rho ();
280289 std::unique_ptr<TF1> rhoFit{nullptr };
281290 if (cfgrhoPhi)
282- rhoFit = fitRho (collision, psi, tracks);
291+ rhoFit = fitRho< true > (collision, psi, tracks);
283292
284293 registry.fill (HIST (" hEventCounter" ), counter++);
285294 registry.fill (HIST (" hRho" ), rho);
@@ -319,7 +328,7 @@ struct JetSpectraEseTask {
319328 {
320329 float count{0.5 };
321330 registry.fill (HIST (" hEventCounterOcc" ), count++);
322- const auto psi{procEP<false >(collision)};
331+ const auto psi{procEP<PsiFillerOcc >(collision)};
323332 const auto qPerc{collision.qPERCFT0C ()};
324333
325334 auto occupancy{collision.trackOccupancyInTimeRange ()};
@@ -483,30 +492,33 @@ struct JetSpectraEseTask {
483492 else
484493 return true ;
485494 }
486- template <bool Fill, typename EPCol>
495+ // template <bool FillAllPsi, bool FillHist, typename EPCol>
496+ template <EventPlaneFiller P, typename EPCol>
487497 EventPlane procEP (EPCol const & vec)
488498 {
489499 constexpr std::array<float , 2 > AmpCut{1e-8 , 0.0 };
490500 auto computeEP = [&AmpCut](std::vector<float > vec, auto det, float n) { return vec[2 ] > AmpCut[det] ? (1.0 / n) * std::atan2 (vec[1 ], vec[0 ]) : 999 .; };
491501 std::map<std::string, float > epMap;
492502 std::map<std::string, float > ep3Map;
493- auto vec1{qVecNoESE<DetID::FT0A, Fill >(vec)};
503+ auto vec1{qVecNoESE<DetID::FT0A, P. hist >(vec)};
494504 epMap[" FT0A" ] = computeEP (vec1, 0 , 2.0 );
495505 ep3Map[" FT0A" ] = computeEP (vec1, 0 , 3.0 );
496- if constexpr (Fill ) {
506+ if constexpr (P. psi ) {
497507 auto vec2{qVecNoESE<DetID::FT0C, false >(vec)};
498508 epMap[" FT0C" ] = computeEP (vec2, 0 , 2.0 );
499509 ep3Map[" FT0C" ] = computeEP (vec2, 0 , 3.0 );
500510 epMap[" FV0A" ] = computeEP (qVecNoESE<DetID::FV0A, false >(vec), 0 , 2.0 );
501511 epMap[" TPCpos" ] = computeEP (qVecNoESE<DetID::TPCpos, false >(vec), 1 , 2.0 );
502512 epMap[" TPCneg" ] = computeEP (qVecNoESE<DetID::TPCneg, false >(vec), 1 , 2.0 );
503- fillEP (/* std::make_index_sequence<5>{},*/ vec, epMap);
513+ if constexpr (P.hist )
514+ fillEP (/* std::make_index_sequence<5>{},*/ vec, epMap);
504515 auto cosPsi = [](float psiX, float psiY) { return (static_cast <double >(psiX) == 999 . || static_cast <double >(psiY) == 999 .) ? 999 . : std::cos (2.0 * (psiX - psiY)); };
505516 std::array<float , 3 > epCorrContainer{};
506517 epCorrContainer[0 ] = cosPsi (epMap.at (cfgEPRefA), epMap.at (cfgEPRefC));
507518 epCorrContainer[1 ] = cosPsi (epMap.at (cfgEPRefA), epMap.at (cfgEPRefB));
508519 epCorrContainer[2 ] = cosPsi (epMap.at (cfgEPRefB), epMap.at (cfgEPRefC));
509- fillEPCos (/* std::make_index_sequence<3>{},*/ vec, epCorrContainer);
520+ if constexpr (P.hist )
521+ fillEPCos (/* std::make_index_sequence<3>{},*/ vec, epCorrContainer);
510522 }
511523 EventPlane localPlane;
512524 localPlane.psi2 = epMap.at (cfgEPRefA);
@@ -596,15 +608,16 @@ struct JetSpectraEseTask {
596608 return true ;
597609 }
598610
599- template <typename C, typename T>
611+ template <bool fillHist, typename C, typename T>
600612 std::unique_ptr<TF1> fitRho (const C& col, const EventPlane& ep, T const & tracks)
601613 {
602614 auto hPhiPt = std::unique_ptr<TH1F>(new TH1F (" h_ptsum_sumpt_fit" , " h_ptsum_sumpt fit use" , TMath::CeilNint (std::sqrt (tracks.size ())), 0 ., o2::constants::math::TwoPI));
603615
604616 for (const auto & track : tracks) {
605617 if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
606618 hPhiPt->Fill (track.phi (), track.pt ());
607- registry.fill (HIST (" hPhiPtsum" ), track.phi (), track.pt ());
619+ if constexpr (fillHist)
620+ registry.fill (HIST (" hPhiPtsum" ), track.phi (), track.pt ());
608621 }
609622 }
610623 auto modulationFit = std::unique_ptr<TF1>(new TF1 (" fit_rholoc" , " [0] * (1. + 2. * ([1] * cos(2. * (x - [2])) + [3] * cos(3. * (x - [4]))))" , 0 , o2::constants::math::TwoPI));
@@ -623,11 +636,13 @@ struct JetSpectraEseTask {
623636 fitParams[i] = modulationFit->GetParameter (i);
624637 }
625638
626- registry.fill (HIST (" hfitPar0" ), col.centrality (), fitParams[0 ]);
627- registry.fill (HIST (" hfitPar1" ), col.centrality (), fitParams[1 ]);
628- registry.fill (HIST (" hfitPar2" ), col.centrality (), fitParams[2 ]);
629- registry.fill (HIST (" hfitPar3" ), col.centrality (), fitParams[3 ]);
630- registry.fill (HIST (" hfitPar4" ), col.centrality (), fitParams[4 ]);
639+ if constexpr (fillHist) {
640+ registry.fill (HIST (" hfitPar0" ), col.centrality (), fitParams[0 ]);
641+ registry.fill (HIST (" hfitPar1" ), col.centrality (), fitParams[1 ]);
642+ registry.fill (HIST (" hfitPar2" ), col.centrality (), fitParams[2 ]);
643+ registry.fill (HIST (" hfitPar3" ), col.centrality (), fitParams[3 ]);
644+ registry.fill (HIST (" hfitPar4" ), col.centrality (), fitParams[4 ]);
645+ }
631646
632647 double chi2{0 .};
633648 for (int i{0 }; i < hPhiPt->GetXaxis ()->GetNbins (); i++) {
@@ -644,8 +659,10 @@ struct JetSpectraEseTask {
644659
645660 auto cDF = 1 . - TMath::Gamma (nDF, chi2);
646661
647- registry.fill (HIST (" hPValueCentCDF" ), col.centrality (), cDF);
648- registry.fill (HIST (" hCentChi2Ndf" ), col.centrality (), chi2 / (static_cast <float >(nDF)));
662+ if constexpr (fillHist) {
663+ registry.fill (HIST (" hPValueCentCDF" ), col.centrality (), cDF);
664+ registry.fill (HIST (" hCentChi2Ndf" ), col.centrality (), chi2 / (static_cast <float >(nDF)));
665+ }
649666
650667 return modulationFit;
651668 }
@@ -669,7 +686,7 @@ struct JetSpectraEseTask {
669686 if (cfgEvSelOccupancy && !isOccupancyWithin (collision))
670687 return ;
671688
672- const auto psi{procEP<true >(collision)};
689+ const auto psi{procEP<PsiFillerBkg >(collision)};
673690 auto qPerc{collision.qPERCFT0C ()};
674691 if (qPerc[0 ] < 0 )
675692 return ;
@@ -729,7 +746,7 @@ struct JetSpectraEseTask {
729746 auto rho = collision.rho ();
730747 std::unique_ptr<TF1> rhoFit{nullptr };
731748 if (cfgrhoPhi) {
732- rhoFit = fitRho (collision, psi, tracks);
749+ rhoFit = fitRho< false > (collision, psi, tracks);
733750 rho = evalRho (rhoFit.get (), randomConePhi, rho);
734751 }
735752 float dPhi{RecoDecay::constrainAngle (randomConePhi - psi.psi2 , -o2::constants::math::PI)};
0 commit comments