Skip to content

Commit 4a3df15

Browse files
committed
MeanpTfluct
1 parent ab365df commit 4a3df15

File tree

1 file changed

+78
-80
lines changed

1 file changed

+78
-80
lines changed

PWGCF/EbyEFluctuations/Tasks/eventMeanPtId.cxx

Lines changed: 78 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,34 @@
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 "PWGCF/Core/CorrelationContainer.h"
17-
#include "PWGCF/Core/PairCuts.h"
16+
#include <vector>
17+
#include <fstream>
18+
#include <string>
19+
#include <sstream>
1820

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"
21+
#include "Framework/AnalysisTask.h"
22+
#include "Framework/runDataProcessing.h"
2423
#include "Common/DataModel/EventSelection.h"
25-
#include "Common/DataModel/FT0Corrected.h"
2624
#include "Common/DataModel/Multiplicity.h"
2725
#include "Common/DataModel/PIDResponse.h"
26+
#include "Common/Core/trackUtilities.h"
27+
#include "Common/CCDB/EventSelectionParams.h"
28+
#include "Common/Core/TrackSelection.h"
2829
#include "Common/DataModel/TrackSelectionTables.h"
29-
30-
#include "CCDB/BasicCCDBManager.h"
30+
#include "Common/DataModel/Centrality.h"
3131
#include "CommonConstants/MathConstants.h"
32-
#include "CommonConstants/PhysicsConstants.h"
33-
#include "Framework/ASoAHelpers.h"
32+
#include "Common/DataModel/FT0Corrected.h"
3433
#include "Framework/AnalysisDataModel.h"
35-
#include "Framework/AnalysisTask.h"
34+
#include "Framework/ASoAHelpers.h"
3635
#include "Framework/HistogramRegistry.h"
37-
#include "Framework/O2DatabasePDGPlugin.h"
3836
#include "Framework/RunningWorkflowInfo.h"
39-
#include "Framework/runDataProcessing.h"
40-
37+
#include "PWGCF/Core/CorrelationContainer.h"
38+
#include "PWGCF/Core/PairCuts.h"
4139
#include <TPDGCode.h>
42-
43-
#include <fstream>
44-
#include <sstream>
45-
#include <string>
46-
#include <vector>
40+
#include "Common/CCDB/TriggerAliases.h"
41+
#include "CCDB/BasicCCDBManager.h"
42+
#include "Framework/O2DatabasePDGPlugin.h"
43+
#include "CommonConstants/PhysicsConstants.h"
4744

4845
double massPi = o2::constants::physics::MassPionCharged;
4946
double massKa = o2::constants::physics::MassKaonCharged;
@@ -91,15 +88,15 @@ struct EventMeanPtId {
9188

9289
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
9390
TH1D* ptHistogramAllchargeRec = 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;
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;
103100

104101
Configurable<float> ptMax{"ptMax", 2.0, "maximum pT"};
105102
Configurable<float> ptMin{"ptMin", 0.15, "minimum pT"};
@@ -108,30 +105,30 @@ struct EventMeanPtId {
108105

109106
void init(o2::framework::InitContext&)
110107
{
111-
if (cfgLoadEff) {
108+
if (cfgLoadEff) {
112109
// Set CCDB url
113110
ccdb->setURL(cfgUrlCCDB.value);
114111
ccdb->setCaching(true);
115112
ccdb->setLocalObjectValidityChecking();
116-
// ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
117-
// LOGF(info, "Getting object %s", ccdbPath.value.data());
118-
113+
//ccdb->setCreatedNotAfter(ccdbNoLaterThan.value);
114+
//LOGF(info, "Getting object %s", ccdbPath.value.data());
115+
119116
TList* lst = ccdb->getForTimeStamp<TList>(cfgPathCCDB.value, -1);
120117
ptHistogramAllchargeRec = reinterpret_cast<TH1D*>(lst->FindObject("ptHistogramAllchargeRec"));
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) {
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) {
132129
LOGF(info, "FATAL!! Could not find required histograms in CCDB");
133130
}
134-
}
131+
}
135132

136133
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};
137134
// AxisSpec ptAxis = {ptBinning, "#it{p}_{T} (GeV/#it{c})"};
@@ -643,12 +640,11 @@ struct EventMeanPtId {
643640
return false;
644641
}
645642

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-
}
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+
}
652648

653649
//++++++++++++++++++++++++++++++++++++DATA CALCULATION +++++++++++++++++++++++++++++++++++++++++++++++++++++//
654650

@@ -673,7 +669,7 @@ struct EventMeanPtId {
673669
double var1Pi = 0., var2Pi = 0.;
674670
double var1Ka = 0., var2Ka = 0.;
675671
double var1Pr = 0., var2Pr = 0.;
676-
672+
677673
int sample = histos.get<TH1>(HIST("Data/hZvtx_after_sel8"))->GetEntries();
678674
sample = sample % 30; // subsample error estimation
679675
for (const auto& track : inputTracks) {
@@ -820,8 +816,8 @@ struct EventMeanPtId {
820816
if (nchAll < cTwoPtlCut2)
821817
return;
822818
var1 = (q1 * q1 - q2) / (nchAll * (nchAll - 1));
823-
var2 = (q1 / nchAll);
824-
819+
var2 = (q1 / nchAll);
820+
825821
//------------------ all charges-------------------------------------
826822
histos.fill(HIST("Data/hVar1"), sample, cent, var1);
827823
histos.fill(HIST("Data/hVar2"), sample, cent, var2);
@@ -833,20 +829,20 @@ struct EventMeanPtId {
833829
//---------------------- pions ----------------------------------------
834830
if (nchPi >= cTwoPtlCut2) {
835831
var1Pi = (q1Pi * q1Pi - q2Pi) / (nchPi * (nchPi - 1));
836-
var2Pi = (q1Pi / nchPi);
832+
var2Pi = (q1Pi / nchPi);
837833
}
838834

839835
//----------------------- kaons ---------------------------------------
840836
if (nchKa >= cTwoPtlCut2) {
841837
var1Ka = (q1Ka * q1Ka - q2Ka) / (nchKa * (nchKa - 1));
842838
var2Ka = (q1Ka / nchKa);
843-
}
839+
}
844840

845841
//---------------------------- protons ----------------------------------
846842
if (nchPr >= cTwoPtlCut2) {
847843
var1Pr = (q1Pr * q1Pr - q2Pr) / (nchPr * (nchPr - 1));
848844
var2Pr = (q1Pr / nchPr);
849-
}
845+
}
850846

851847
//========================centrality==========================================
852848
histos.fill(HIST("Data/hVar1pi"), sample, cent, var1Pi);
@@ -936,6 +932,7 @@ struct EventMeanPtId {
936932
double sumPtWeightKa = 0., sumWeightKa = 0., sumPtPtWeightKa = 0., var1EffKa = 0., var2EffKa = 0.;
937933
double sumPtWeightPr = 0., sumWeightPr = 0., sumPtPtWeightPr = 0., var1EffPr = 0., var2EffPr = 0.;
938934

935+
939936
int sample = histos.get<TH1>(HIST("Rec/hZvtx_after_sel8"))->GetEntries();
940937
sample = sample % 30;
941938

@@ -995,10 +992,10 @@ struct EventMeanPtId {
995992
q2 += (track.pt() * track.pt());
996993

997994
double eff = getEfficiency(track.pt(), ptHistogramAllchargeRec);
998-
// LOGF(info, " with value %.2f", eff);
999-
sumPtWeight += track.pt() / eff;
1000-
sumPtPtWeight += (track.pt() * track.pt()) / (eff * eff);
1001-
sumWeight += 1. / eff;
995+
// LOGF(info, " with value %.2f", eff);
996+
sumPtWeight += track.pt()/eff ;
997+
sumPtPtWeight += (track.pt()*track.pt())/(eff * eff) ;
998+
sumWeight += 1. / eff ;
1002999

10031000
if (std::abs(mcParticle.pdgCode()) == PDG_t::kPiPlus)
10041001
histos.fill(HIST("ptHistogramPionrec_pdg"), track.pt());
@@ -1066,11 +1063,11 @@ struct EventMeanPtId {
10661063
q1Pi += track.pt();
10671064
q2Pi += (track.pt() * track.pt());
10681065

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;
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 ;
10741071

10751072
histos.fill(HIST("hPyPion_rec"), track.p(), track.rapidity(massPi));
10761073
histos.fill(HIST("hPtyPion_rec"), track.pt(), track.rapidity(massPi));
@@ -1106,11 +1103,11 @@ struct EventMeanPtId {
11061103
q1Ka += track.pt();
11071104
q2Ka += (track.pt() * track.pt());
11081105

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;
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 ;
11141111

11151112
histos.fill(HIST("hPyKaon_rec"), track.p(), track.rapidity(massKa));
11161113
histos.fill(HIST("hPtyKaon_rec"), track.pt(), track.rapidity(massKa));
@@ -1146,11 +1143,11 @@ struct EventMeanPtId {
11461143
q1Pr += track.pt();
11471144
q2Pr += (track.pt() * track.pt());
11481145

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;
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 ;
11541151

11551152
histos.fill(HIST("hPyProton_rec"), track.p(), track.rapidity(massPr));
11561153
histos.fill(HIST("hPtyProton_rec"), track.pt(), track.rapidity(massPr));
@@ -1166,8 +1163,8 @@ struct EventMeanPtId {
11661163

11671164
//------------------ Efficiency corrected histograms ---------------
11681165

1169-
var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1));
1170-
var2Eff = (sumPtWeight / sumWeight);
1166+
var1Eff = (sumPtWeight * sumPtWeight - sumPtPtWeight) / (sumWeight * (sumWeight - 1));
1167+
var2Eff = (sumPtWeight / sumWeight);
11711168

11721169
histos.fill(HIST("Rec/hVar1"), sample, cent, var1);
11731170
histos.fill(HIST("Rec/hVar2"), sample, cent, var2);
@@ -1234,7 +1231,7 @@ struct EventMeanPtId {
12341231
histos.fill(HIST("hEffVar2x"), sample, nchAll, var2Eff);
12351232
histos.fill(HIST("hEffVarx"), sample, nchAll);
12361233
histos.fill(HIST("hEffVar2Meanptx"), nchAll, var2Eff);
1237-
1234+
12381235
histos.fill(HIST("hEffVar1pix"), sample, nchAll, var1EffPi);
12391236
histos.fill(HIST("hEffVar2pix"), sample, nchAll, var2EffPi);
12401237
histos.fill(HIST("hEffVarpix"), sample, nchAll);
@@ -1250,6 +1247,7 @@ struct EventMeanPtId {
12501247
histos.fill(HIST("hEffVarpx"), sample, nchAll);
12511248
histos.fill(HIST("hEffVar2Meanptpx"), nchAll, var2EffPr);
12521249

1250+
12531251
//================= generated level==============================
12541252

12551253
const auto& mccolgen = coll.mcCollision_as<aod::McCollisions>();

0 commit comments

Comments
 (0)