@@ -123,6 +123,15 @@ struct JetSpectraEseTask {
123
123
float psi3;
124
124
};
125
125
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
+
126
135
void init (o2::framework::InitContext&)
127
136
{
128
137
eventSelectionBits = jetderiveddatautilities::initialiseEventSelectionBits (static_cast <std::string>(eventSelections));
@@ -267,7 +276,7 @@ struct JetSpectraEseTask {
267
276
registry.fill (HIST (" hEventCounter" ), counter++);
268
277
registry.fill (HIST (" hCentralitySel" ), collision.centrality ());
269
278
270
- const auto psi{procEP<true >(collision)};
279
+ const auto psi{procEP<PsiFillerEse >(collision)};
271
280
const auto qPerc{collision.qPERCFT0C ()};
272
281
if (qPerc[0 ] < 0 )
273
282
return ;
@@ -279,7 +288,7 @@ struct JetSpectraEseTask {
279
288
auto rho = collision.rho ();
280
289
std::unique_ptr<TF1> rhoFit{nullptr };
281
290
if (cfgrhoPhi)
282
- rhoFit = fitRho (collision, psi, tracks);
291
+ rhoFit = fitRho< true > (collision, psi, tracks);
283
292
284
293
registry.fill (HIST (" hEventCounter" ), counter++);
285
294
registry.fill (HIST (" hRho" ), rho);
@@ -319,7 +328,7 @@ struct JetSpectraEseTask {
319
328
{
320
329
float count{0.5 };
321
330
registry.fill (HIST (" hEventCounterOcc" ), count++);
322
- const auto psi{procEP<false >(collision)};
331
+ const auto psi{procEP<PsiFillerOcc >(collision)};
323
332
const auto qPerc{collision.qPERCFT0C ()};
324
333
325
334
auto occupancy{collision.trackOccupancyInTimeRange ()};
@@ -483,30 +492,33 @@ struct JetSpectraEseTask {
483
492
else
484
493
return true ;
485
494
}
486
- template <bool Fill, typename EPCol>
495
+ // template <bool FillAllPsi, bool FillHist, typename EPCol>
496
+ template <EventPlaneFiller P, typename EPCol>
487
497
EventPlane procEP (EPCol const & vec)
488
498
{
489
499
constexpr std::array<float , 2 > AmpCut{1e-8 , 0.0 };
490
500
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 .; };
491
501
std::map<std::string, float > epMap;
492
502
std::map<std::string, float > ep3Map;
493
- auto vec1{qVecNoESE<DetID::FT0A, Fill >(vec)};
503
+ auto vec1{qVecNoESE<DetID::FT0A, P. hist >(vec)};
494
504
epMap[" FT0A" ] = computeEP (vec1, 0 , 2.0 );
495
505
ep3Map[" FT0A" ] = computeEP (vec1, 0 , 3.0 );
496
- if constexpr (Fill ) {
506
+ if constexpr (P. psi ) {
497
507
auto vec2{qVecNoESE<DetID::FT0C, false >(vec)};
498
508
epMap[" FT0C" ] = computeEP (vec2, 0 , 2.0 );
499
509
ep3Map[" FT0C" ] = computeEP (vec2, 0 , 3.0 );
500
510
epMap[" FV0A" ] = computeEP (qVecNoESE<DetID::FV0A, false >(vec), 0 , 2.0 );
501
511
epMap[" TPCpos" ] = computeEP (qVecNoESE<DetID::TPCpos, false >(vec), 1 , 2.0 );
502
512
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);
504
515
auto cosPsi = [](float psiX, float psiY) { return (static_cast <double >(psiX) == 999 . || static_cast <double >(psiY) == 999 .) ? 999 . : std::cos (2.0 * (psiX - psiY)); };
505
516
std::array<float , 3 > epCorrContainer{};
506
517
epCorrContainer[0 ] = cosPsi (epMap.at (cfgEPRefA), epMap.at (cfgEPRefC));
507
518
epCorrContainer[1 ] = cosPsi (epMap.at (cfgEPRefA), epMap.at (cfgEPRefB));
508
519
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);
510
522
}
511
523
EventPlane localPlane;
512
524
localPlane.psi2 = epMap.at (cfgEPRefA);
@@ -596,15 +608,16 @@ struct JetSpectraEseTask {
596
608
return true ;
597
609
}
598
610
599
- template <typename C, typename T>
611
+ template <bool fillHist, typename C, typename T>
600
612
std::unique_ptr<TF1> fitRho (const C& col, const EventPlane& ep, T const & tracks)
601
613
{
602
614
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));
603
615
604
616
for (const auto & track : tracks) {
605
617
if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
606
618
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 ());
608
621
}
609
622
}
610
623
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 {
623
636
fitParams[i] = modulationFit->GetParameter (i);
624
637
}
625
638
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
+ }
631
646
632
647
double chi2{0 .};
633
648
for (int i{0 }; i < hPhiPt->GetXaxis ()->GetNbins (); i++) {
@@ -644,8 +659,10 @@ struct JetSpectraEseTask {
644
659
645
660
auto cDF = 1 . - TMath::Gamma (nDF, chi2);
646
661
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
+ }
649
666
650
667
return modulationFit;
651
668
}
@@ -669,7 +686,7 @@ struct JetSpectraEseTask {
669
686
if (cfgEvSelOccupancy && !isOccupancyWithin (collision))
670
687
return ;
671
688
672
- const auto psi{procEP<true >(collision)};
689
+ const auto psi{procEP<PsiFillerBkg >(collision)};
673
690
auto qPerc{collision.qPERCFT0C ()};
674
691
if (qPerc[0 ] < 0 )
675
692
return ;
@@ -729,7 +746,7 @@ struct JetSpectraEseTask {
729
746
auto rho = collision.rho ();
730
747
std::unique_ptr<TF1> rhoFit{nullptr };
731
748
if (cfgrhoPhi) {
732
- rhoFit = fitRho (collision, psi, tracks);
749
+ rhoFit = fitRho< false > (collision, psi, tracks);
733
750
rho = evalRho (rhoFit.get (), randomConePhi, rho);
734
751
}
735
752
float dPhi{RecoDecay::constrainAngle (randomConePhi - psi.psi2 , -o2::constants::math::PI)};
0 commit comments