@@ -247,6 +247,22 @@ struct spvector {
247247 Configurable<std::string> confRecentereVzTimeSp3{" confRecentereVzTimeSp3" , " Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter" , " TH3F path for (Vz,time) recentering, cycle 3" };
248248 Configurable<std::string> confRecentereVzTimeSp4{" confRecentereVzTimeSp4" , " Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter" , " TH3F path for (Vz,time) recentering, cycle 4" };
249249 Configurable<std::string> confRecentereVzTimeSp5{" confRecentereVzTimeSp5" , " Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter" , " TH3F path for (Vz,time) recentering, cycle 5" };
250+
251+ Configurable<bool > useWidthEqualization{
252+ " useWidthEqualization" ,
253+ false ,
254+ " Apply Q-vector width equalization" };
255+
256+ Configurable<std::string> confWidthSigma{
257+ " confWidthSigma" ,
258+ " Users/p/prottay/My/Object/ZDC/widthEq" ,
259+ " TH2F path for Q-vector width equalization" };
260+
261+ Configurable<std::string> confWidthMean{
262+ " confWidthMean" ,
263+ " Users/p/prottay/My/Object/ZDC/widthEq" ,
264+ " TH2F path for Q-vector mean equalization" };
265+
250266 } confignewpro;
251267
252268 struct : ConfigurableGroup {
@@ -503,6 +519,59 @@ struct spvector {
503519 std::array<TH3F *, 6 > hrecenterecentvySpA{};
504520 std::array<TH3F *, 6 > hrecenterecentvzSpA{};
505521 std::array<TH3F *, 5 > hrecenterevztimeSpA{};
522+ TH2F * hWidthMean = nullptr ;
523+ TH2F * hWidthSigma = nullptr ;
524+
525+ bool CorrectWidthEqualization (TH2F * hMean,
526+ TH2F * hWidth,
527+ auto centrality,
528+ auto & qxZDCA,
529+ auto & qyZDCA,
530+ auto & qxZDCC,
531+ auto & qyZDCC)
532+ {
533+
534+ if (!hMean || !hWidth) {
535+ return false ;
536+ }
537+
538+ const double meanQxA = hMean->GetBinContent (
539+ hMean->FindBin (centrality + 0.00001 , 0.5 ));
540+
541+ const double meanQyA = hMean->GetBinContent (
542+ hMean->FindBin (centrality + 0.00001 , 1.5 ));
543+
544+ const double meanQxC = hMean->GetBinContent (
545+ hMean->FindBin (centrality + 0.00001 , 2.5 ));
546+
547+ const double meanQyC = hMean->GetBinContent (
548+ hMean->FindBin (centrality + 0.00001 , 3.5 ));
549+
550+ const double sigmaQxA = hWidth->GetBinContent (
551+ hWidth->FindBin (centrality + 0.00001 , 0.5 ));
552+
553+ const double sigmaQyA = hWidth->GetBinContent (
554+ hWidth->FindBin (centrality + 0.00001 , 1.5 ));
555+
556+ const double sigmaQxC = hWidth->GetBinContent (
557+ hWidth->FindBin (centrality + 0.00001 , 2.5 ));
558+
559+ const double sigmaQyC = hWidth->GetBinContent (
560+ hWidth->FindBin (centrality + 0.00001 , 3.5 ));
561+
562+ if (sigmaQxA <= 0.0 || sigmaQyA <= 0.0 ||
563+ sigmaQxC <= 0.0 || sigmaQyC <= 0.0 ) {
564+ return false ;
565+ }
566+
567+ qxZDCA = (qxZDCA - meanQxA) / sigmaQxA;
568+ qyZDCA = (qyZDCA - meanQyA) / sigmaQyA;
569+
570+ qxZDCC = (qxZDCC - meanQxC) / sigmaQxC;
571+ qyZDCC = (qyZDCC - meanQyC) / sigmaQyC;
572+
573+ return true ;
574+ }
506575
507576 bool CorrectfineCent (TH2F * hrecenterecentSp,
508577 auto centrality,
@@ -1404,6 +1473,19 @@ struct spvector {
14041473 LOGF (fatal, " Cannot apply fine (cent,Vz) recentering, stage 6" );
14051474 }
14061475 }
1476+
1477+ // -------------------- Width equalization --------------------
1478+ if (confignewpro.useWidthEqualization ) {
1479+ if (currentRunNumber != lastRunNumber) {
1480+
1481+ hWidthMean = ccdb->getForTimeStamp <TH2F >(confignewpro.confWidthMean .value , bc.timestamp ());
1482+ hWidthSigma = ccdb->getForTimeStamp <TH2F >(confignewpro.confWidthSigma .value , bc.timestamp ());
1483+ }
1484+
1485+ if (!CorrectWidthEqualization (hWidthMean, hWidthSigma, centrality, qxZDCA, qyZDCA, qxZDCC, qyZDCC)) {
1486+ LOGF (fatal, " Cannot apply Q-vector width equalization" );
1487+ }
1488+ }
14071489 }
14081490
14091491 histos.fill (HIST (" hpQxZDCAvstime" ), timeMin, qxZDCA);
0 commit comments