1313// / \brief Analysis task to study Mean pT Fluctuations using two particle correlator using Cumulant Method
1414// / \author Sweta Singh (sweta.singh@cern.ch)
1515
16- #include < vector>
17- #include < fstream>
18- #include < string>
19- #include < sstream>
16+ #include " PWGCF/Core/CorrelationContainer.h"
17+ #include " PWGCF/Core/PairCuts.h"
2018
21- #include " Framework/AnalysisTask.h"
22- #include " Framework/runDataProcessing.h"
19+ #include " Common/CCDB/EventSelectionParams.h"
20+ #include " Common/CCDB/TriggerAliases.h"
21+ #include " Common/Core/TrackSelection.h"
22+ #include " Common/Core/trackUtilities.h"
23+ #include " Common/DataModel/Centrality.h"
2324#include " Common/DataModel/EventSelection.h"
25+ #include " Common/DataModel/FT0Corrected.h"
2426#include " Common/DataModel/Multiplicity.h"
2527#include " Common/DataModel/PIDResponse.h"
26- #include " Common/Core/trackUtilities.h"
27- #include " Common/CCDB/EventSelectionParams.h"
28- #include " Common/Core/TrackSelection.h"
2928#include " Common/DataModel/TrackSelectionTables.h"
30- #include " Common/DataModel/Centrality.h"
29+
30+ #include " CCDB/BasicCCDBManager.h"
3131#include " CommonConstants/MathConstants.h"
32- #include " Common/DataModel/FT0Corrected.h"
33- #include " Framework/AnalysisDataModel.h"
32+ #include " CommonConstants/PhysicsConstants.h"
3433#include " Framework/ASoAHelpers.h"
34+ #include " Framework/AnalysisDataModel.h"
35+ #include " Framework/AnalysisTask.h"
3536#include " Framework/HistogramRegistry.h"
37+ #include " Framework/O2DatabasePDGPlugin.h"
3638#include " Framework/RunningWorkflowInfo.h"
37- #include " PWGCF/Core/CorrelationContainer .h"
38- # include " PWGCF/Core/PairCuts.h "
39+ #include " Framework/runDataProcessing .h"
40+
3941#include < TPDGCode.h>
40- #include " Common/CCDB/TriggerAliases.h"
41- #include " CCDB/BasicCCDBManager.h"
42- #include " Framework/O2DatabasePDGPlugin.h"
43- #include " CommonConstants/PhysicsConstants.h"
42+
43+ #include < fstream>
44+ #include < sstream>
45+ #include < string>
46+ #include < vector>
4447
4548double massPi = o2::constants::physics::MassPionCharged;
4649double massKa = o2::constants::physics::MassKaonCharged;
@@ -88,15 +91,15 @@ struct EventMeanPtId {
8891
8992 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
9093 TH1D* ptHistogramAllchargeRec = nullptr ;
91- TH1D* ptHistogramPionrec = nullptr ;
92- TH1D* ptHistogramKaonrec = nullptr ;
93- TH1D* ptHistogramProtonrec = nullptr ;
94- TH1D* hRecoPi = nullptr ;
95- TH1D* hRecoKa = nullptr ;
96- TH1D* hRecoPr = nullptr ;
97- TH2D* hPtyPion = nullptr ;
98- TH2D* hPtyKaon = nullptr ;
99- TH2D* hPtyProton = nullptr ;
94+ TH1D* ptHistogramPionrec = nullptr ;
95+ TH1D* ptHistogramKaonrec = nullptr ;
96+ TH1D* ptHistogramProtonrec = nullptr ;
97+ TH1D* hRecoPi = nullptr ;
98+ TH1D* hRecoKa = nullptr ;
99+ TH1D* hRecoPr = nullptr ;
100+ TH2D* hPtyPion = nullptr ;
101+ TH2D* hPtyKaon = nullptr ;
102+ TH2D* hPtyProton = nullptr ;
100103
101104 Configurable<float > ptMax{" ptMax" , 2.0 , " maximum pT" };
102105 Configurable<float > ptMin{" ptMin" , 0.15 , " minimum pT" };
@@ -105,30 +108,30 @@ struct EventMeanPtId {
105108
106109 void init (o2::framework::InitContext&)
107110 {
108- if (cfgLoadEff) {
111+ if (cfgLoadEff) {
109112 // Set CCDB url
110113 ccdb->setURL (cfgUrlCCDB.value );
111114 ccdb->setCaching (true );
112115 ccdb->setLocalObjectValidityChecking ();
113- // ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
114- // LOGF(info, "Getting object %s", ccdbPath.value.data());
115-
116+ // ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
117+ // LOGF(info, "Getting object %s", ccdbPath.value.data());
118+
116119 TList* lst = ccdb->getForTimeStamp <TList>(cfgPathCCDB.value , -1 );
117120 ptHistogramAllchargeRec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramAllchargeRec" ));
118- ptHistogramPionrec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramPionrec" ));
119- ptHistogramKaonrec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramKaonrec" ));
120- ptHistogramProtonrec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramProtonrec" ));
121- hRecoPi = reinterpret_cast <TH1D*>(lst->FindObject (" hRecoPi" ));
122- hRecoKa = reinterpret_cast <TH1D*>(lst->FindObject (" hRecoKa" ));
123- hRecoPr = reinterpret_cast <TH1D*>(lst->FindObject (" hRecoPr" ));
124- hPtyPion = reinterpret_cast <TH2D*>(lst->FindObject (" hPtyPion" ));
125- hPtyKaon = reinterpret_cast <TH2D*>(lst->FindObject (" hPtyKaon" ));
126- hPtyProton = reinterpret_cast <TH2D*>(lst->FindObject (" hPtyProton" ));
127-
128- if (!ptHistogramAllchargeRec || !ptHistogramPionrec || !ptHistogramKaonrec || !ptHistogramProtonrec || !hRecoPi || !hRecoKa || !hRecoPr || !hPtyPion || !hPtyKaon || !hPtyProton) {
121+ ptHistogramPionrec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramPionrec" ));
122+ ptHistogramKaonrec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramKaonrec" ));
123+ ptHistogramProtonrec = reinterpret_cast <TH1D*>(lst->FindObject (" ptHistogramProtonrec" ));
124+ hRecoPi = reinterpret_cast <TH1D*>(lst->FindObject (" hRecoPi" ));
125+ hRecoKa = reinterpret_cast <TH1D*>(lst->FindObject (" hRecoKa" ));
126+ hRecoPr = reinterpret_cast <TH1D*>(lst->FindObject (" hRecoPr" ));
127+ hPtyPion = reinterpret_cast <TH2D*>(lst->FindObject (" hPtyPion" ));
128+ hPtyKaon = reinterpret_cast <TH2D*>(lst->FindObject (" hPtyKaon" ));
129+ hPtyProton = reinterpret_cast <TH2D*>(lst->FindObject (" hPtyProton" ));
130+
131+ if (!ptHistogramAllchargeRec || !ptHistogramPionrec || !ptHistogramKaonrec || !ptHistogramProtonrec || !hRecoPi || !hRecoKa || !hRecoPr || !hPtyPion || !hPtyKaon || !hPtyProton) {
129132 LOGF (info, " FATAL!! Could not find required histograms in CCDB" );
130133 }
131- }
134+ }
132135
133136 std::vector<double > ptBinning = {0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 , 1.1 , 1.2 , 1.3 , 1.4 , 1.5 , 1.6 , 1.7 , 1.8 , 1.9 , 2.0 , 2.1 , 2.2 , 2.3 , 2.4 , 2.5 , 2.6 , 2.7 , 2.8 , 2.9 , 3.0 , 3.1 , 3.2 , 3.3 , 3.4 , 3.5 , 3.6 , 3.7 , 3.8 , 3.9 , 4.0 };
134137 // AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"};
@@ -640,11 +643,12 @@ struct EventMeanPtId {
640643 return false ;
641644 }
642645
643- double getEfficiency (double pt, TH1D* ptHistogramAllchargeRec){
644- int bin = ptHistogramAllchargeRec->FindBin (pt);
645- double eff = ptHistogramAllchargeRec->GetBinContent (bin);
646- return (eff > 0 ) ? eff : 1e-6 ; // Avoid division by zero
647- }
646+ double getEfficiency (double pt, TH1D* ptHistogramAllchargeRec)
647+ {
648+ int bin = ptHistogramAllchargeRec->FindBin (pt);
649+ double eff = ptHistogramAllchargeRec->GetBinContent (bin);
650+ return (eff > 0 ) ? eff : 1e-6 ; // Avoid division by zero
651+ }
648652
649653 // ++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++//
650654
@@ -669,7 +673,7 @@ struct EventMeanPtId {
669673 double var1Pi = 0 ., var2Pi = 0 .;
670674 double var1Ka = 0 ., var2Ka = 0 .;
671675 double var1Pr = 0 ., var2Pr = 0 .;
672-
676+
673677 int sample = histos.get <TH1>(HIST (" Data/hZvtx_after_sel8" ))->GetEntries ();
674678 sample = sample % 30 ; // subsample error estimation
675679 for (const auto & track : inputTracks) {
@@ -816,8 +820,8 @@ struct EventMeanPtId {
816820 if (nchAll < cTwoPtlCut2)
817821 return ;
818822 var1 = (q1 * q1 - q2) / (nchAll * (nchAll - 1 ));
819- var2 = (q1 / nchAll);
820-
823+ var2 = (q1 / nchAll);
824+
821825 // ------------------ all charges-------------------------------------
822826 histos.fill (HIST (" Data/hVar1" ), sample, cent, var1);
823827 histos.fill (HIST (" Data/hVar2" ), sample, cent, var2);
@@ -829,20 +833,20 @@ struct EventMeanPtId {
829833 // ---------------------- pions ----------------------------------------
830834 if (nchPi >= cTwoPtlCut2) {
831835 var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1 ));
832- var2Pi = (q1Pi / nchPi);
836+ var2Pi = (q1Pi / nchPi);
833837 }
834838
835839 // ----------------------- kaons ---------------------------------------
836840 if (nchKa >= cTwoPtlCut2) {
837841 var1Ka = (q1Ka * q1Ka - q2Ka) / (nchKa * (nchKa - 1 ));
838842 var2Ka = (q1Ka / nchKa);
839- }
843+ }
840844
841845 // ---------------------------- protons ----------------------------------
842846 if (nchPr >= cTwoPtlCut2) {
843847 var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1 ));
844848 var2Pr = (q1Pr / nchPr);
845- }
849+ }
846850
847851 // ========================centrality==========================================
848852 histos.fill (HIST (" Data/hVar1pi" ), sample, cent, var1Pi);
@@ -932,7 +936,6 @@ struct EventMeanPtId {
932936 double sumPtWeightKa = 0 ., sumWeightKa = 0 ., sumPtPtWeightKa = 0 ., var1EffKa = 0 ., var2EffKa = 0 .;
933937 double sumPtWeightPr = 0 ., sumWeightPr = 0 ., sumPtPtWeightPr = 0 ., var1EffPr = 0 ., var2EffPr = 0 .;
934938
935-
936939 int sample = histos.get <TH1>(HIST (" Rec/hZvtx_after_sel8" ))->GetEntries ();
937940 sample = sample % 30 ;
938941
@@ -992,10 +995,10 @@ struct EventMeanPtId {
992995 q2 += (track.pt () * track.pt ());
993996
994997 double eff = getEfficiency (track.pt (), ptHistogramAllchargeRec);
995- // LOGF(info, " with value %.2f", eff);
996- sumPtWeight += track.pt ()/eff ;
997- sumPtPtWeight += (track.pt ()* track.pt ())/ (eff * eff) ;
998- sumWeight += 1 . / eff ;
998+ // LOGF(info, " with value %.2f", eff);
999+ sumPtWeight += track.pt () / eff ;
1000+ sumPtPtWeight += (track.pt () * track.pt ()) / (eff * eff);
1001+ sumWeight += 1 . / eff;
9991002
10001003 if (std::abs (mcParticle.pdgCode ()) == PDG_t::kPiPlus )
10011004 histos.fill (HIST (" ptHistogramPionrec_pdg" ), track.pt ());
@@ -1063,11 +1066,11 @@ struct EventMeanPtId {
10631066 q1Pi += track.pt ();
10641067 q2Pi += (track.pt () * track.pt ());
10651068
1066- double effPi = getEfficiency (track.pt (), ptHistogramPionrec);
1067- // LOGF(info, " with value %.2f", eff);
1068- sumPtWeightPi += track.pt ()/effPi ;
1069- sumPtPtWeightPi += (track.pt ()* track.pt ())/ (effPi * effPi) ;
1070- sumWeightPi += 1 . / effPi ;
1069+ double effPi = getEfficiency (track.pt (), ptHistogramPionrec);
1070+ // LOGF(info, " with value %.2f", eff);
1071+ sumPtWeightPi += track.pt () / effPi ;
1072+ sumPtPtWeightPi += (track.pt () * track.pt ()) / (effPi * effPi);
1073+ sumWeightPi += 1 . / effPi;
10711074
10721075 histos.fill (HIST (" hPyPion_rec" ), track.p (), track.rapidity (massPi));
10731076 histos.fill (HIST (" hPtyPion_rec" ), track.pt (), track.rapidity (massPi));
@@ -1103,11 +1106,11 @@ struct EventMeanPtId {
11031106 q1Ka += track.pt ();
11041107 q2Ka += (track.pt () * track.pt ());
11051108
1106- double effKa = getEfficiency (track.pt (), ptHistogramKaonrec);
1107- // LOGF(info, " with value %.2f", eff);
1108- sumPtWeightKa += track.pt ()/effKa ;
1109- sumPtPtWeightKa += (track.pt ()* track.pt ())/ (effKa * effKa) ;
1110- sumWeightKa += 1 . / effKa ;
1109+ double effKa = getEfficiency (track.pt (), ptHistogramKaonrec);
1110+ // LOGF(info, " with value %.2f", eff);
1111+ sumPtWeightKa += track.pt () / effKa ;
1112+ sumPtPtWeightKa += (track.pt () * track.pt ()) / (effKa * effKa);
1113+ sumWeightKa += 1 . / effKa;
11111114
11121115 histos.fill (HIST (" hPyKaon_rec" ), track.p (), track.rapidity (massKa));
11131116 histos.fill (HIST (" hPtyKaon_rec" ), track.pt (), track.rapidity (massKa));
@@ -1143,11 +1146,11 @@ struct EventMeanPtId {
11431146 q1Pr += track.pt ();
11441147 q2Pr += (track.pt () * track.pt ());
11451148
1146- double effPr = getEfficiency (track.pt (), ptHistogramProtonrec);
1147- // LOGF(info, " with value %.2f", eff);
1148- sumPtWeightPr += track.pt ()/effPr ;
1149- sumPtPtWeightPr += (track.pt ()* track.pt ())/ (effPr * effPr) ;
1150- sumWeightPr += 1 . / effPr ;
1149+ double effPr = getEfficiency (track.pt (), ptHistogramProtonrec);
1150+ // LOGF(info, " with value %.2f", eff);
1151+ sumPtWeightPr += track.pt () / effPr ;
1152+ sumPtPtWeightPr += (track.pt () * track.pt ()) / (effPr * effPr);
1153+ sumWeightPr += 1 . / effPr;
11511154
11521155 histos.fill (HIST (" hPyProton_rec" ), track.p (), track.rapidity (massPr));
11531156 histos.fill (HIST (" hPtyProton_rec" ), track.pt (), track.rapidity (massPr));
@@ -1163,8 +1166,8 @@ struct EventMeanPtId {
11631166
11641167 // ------------------ Efficiency corrected histograms ---------------
11651168
1166- var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1 ));
1167- var2Eff = (sumPtWeight / sumWeight);
1169+ var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1 ));
1170+ var2Eff = (sumPtWeight / sumWeight);
11681171
11691172 histos.fill (HIST (" Rec/hVar1" ), sample, cent, var1);
11701173 histos.fill (HIST (" Rec/hVar2" ), sample, cent, var2);
@@ -1231,7 +1234,7 @@ struct EventMeanPtId {
12311234 histos.fill (HIST (" hEffVar2x" ), sample, nchAll, var2Eff);
12321235 histos.fill (HIST (" hEffVarx" ), sample, nchAll);
12331236 histos.fill (HIST (" hEffVar2Meanptx" ), nchAll, var2Eff);
1234-
1237+
12351238 histos.fill (HIST (" hEffVar1pix" ), sample, nchAll, var1EffPi);
12361239 histos.fill (HIST (" hEffVar2pix" ), sample, nchAll, var2EffPi);
12371240 histos.fill (HIST (" hEffVarpix" ), sample, nchAll);
@@ -1247,7 +1250,6 @@ struct EventMeanPtId {
12471250 histos.fill (HIST (" hEffVarpx" ), sample, nchAll);
12481251 histos.fill (HIST (" hEffVar2Meanptpx" ), nchAll, var2EffPr);
12491252
1250-
12511253 // ================= generated level==============================
12521254
12531255 const auto & mccolgen = coll.mcCollision_as <aod::McCollisions>();
0 commit comments