Skip to content

Commit 6f62f47

Browse files
author
Pengchong Hu
committed
add phihistogram
1 parent 40ac982 commit 6f62f47

1 file changed

Lines changed: 48 additions & 16 deletions

File tree

PWGCF/MultiparticleCorrelations/Tasks/multiharmonicCorrelations.cxx

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
9595

9696
// *) Define configurables:
9797
Configurable<bool> cfDryRun{"cfDryRun", false, "book all histos and run without filling and calculating anything"}; // example for built-in type (float, string, etc.)
98-
Configurable<std::vector<float>> cfPtBins{"cfPtBins", {1000, 0., 100.}, "nPtBins, ptMin, ptMax"}; // example for an array
99-
Configurable<std::vector<float>> cfPhiBins{"cfPhiBins", {100, 0., o2::constants::math::TwoPI}, "nPhiBins, phiMin, phiMax"};
100-
Configurable<std::vector<float>> cfCentrBins{"cfCentrBins", {100, 0., 100.}, "nCentrBins, centrMin, centrMax"};
101-
Configurable<std::vector<float>> cfXBins{"cfXBins", {1000, -100., 100.}, "nXBins, xMin, xMax"};
102-
Configurable<std::vector<float>> cfYBins{"cfYBins", {1000, -100., 100.}, "nYBins, yMin, yMax"};
103-
Configurable<std::vector<float>> cfZBins{"cfZBins", {1000, -100., 100.}, "nZBins, zMin, zMax"};
104-
Configurable<std::vector<float>> cfMultBins{"cfMultBins", {50, 0, 3e3}, "nMultBins, multMin, multMax"};
105-
Configurable<std::vector<float>> cfTPCnclsBins{"cfTPCnclsBins", {100, 0., 1000.}, "ntpcnclsBins, tpnclsMin, tpcnclsMax"};
106-
Configurable<std::vector<float>> cfDCAxyBins{"cfDCAxyBins", {1000, -20., 20.}, "ndcaxyBins, dcaxyMin, dcaxyMax"};
107-
Configurable<std::vector<float>> cfDCAzBins{"cfDCAzBins", {1000, -10., 10.}, "ndcazBins, dcazMin, dcazMax"};
108-
Configurable<std::vector<float>> cfNcontrBins{"cfNcontrBins", {100, 0., 1000}, "nNContrBins, NContrMin, NContrMax"};
98+
Configurable<std::vector<float>> cfPtBins{"cfPtBins", {1000, 0., 8.}, "nPtBins, ptMin, ptMax"}; // example for an array
99+
Configurable<std::vector<float>> cfPhiBins{"cfPhiBins", {360, 0., o2::constants::math::TwoPI}, "nPhiBins, phiMin, phiMax"};
100+
Configurable<std::vector<float>> cfCentrBins{"cfCentrBins", {100, 0., 80.}, "nCentrBins, centrMin, centrMax"};
101+
Configurable<std::vector<float>> cfXBins{"cfXBins", {1000, -0.04, -0.01}, "nXBins, xMin, xMax"};
102+
Configurable<std::vector<float>> cfYBins{"cfYBins", {1000, -0.01, 0.006}, "nYBins, yMin, yMax"};
103+
Configurable<std::vector<float>> cfZBins{"cfZBins", {1000, -20., 20.}, "nZBins, zMin, zMax"};
104+
Configurable<std::vector<float>> cfMultBins{"cfMultBins", {50, 0, 2e4}, "nMultBins, multMin, multMax"};
105+
Configurable<std::vector<float>> cfTPCnclsBins{"cfTPCnclsBins", {100, 0., 200.}, "ntpcnclsBins, tpnclsMin, tpcnclsMax"};
106+
Configurable<std::vector<float>> cfDCAxyBins{"cfDCAxyBins", {1000, -0.5, 0.5}, "ndcaxyBins, dcaxyMin, dcaxyMax"};
107+
Configurable<std::vector<float>> cfDCAzBins{"cfDCAzBins", {1000, -3., 3.}, "ndcazBins, dcazMin, dcazMax"};
108+
Configurable<std::vector<float>> cfNcontrBins{"cfNcontrBins", {100, 0., 10000.}, "nNContrBins, NContrMin, NContrMax"};
109109

110110
Configurable<std::string> cfCent{"cfCent", "FT0C", "centrality estimator"};
111111
Configurable<std::string> cfMult{"cfMult", "TPC", "multiplicity"};
@@ -115,7 +115,8 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
115115
Configurable<std::vector<float>> cfPt{"cfPt", {0.2, 5.0}, "transverse momentum range"};
116116
Configurable<std::vector<float>> cfEta{"cfEta", {-0.8, 0.8}, "eta range"};
117117

118-
Configurable<std::string> cfFileWithWeights{"cfFileWithWeights", "/alice-ccdb.cern.ch/Users/p/pengchon/test04", "path to external ROOT file which holds all particle weights"};
118+
Configurable<std::vector<int>> cfRuns{"cfRuns", {544091, 544095, 544098, 544116, 544121, 544122, 544123, 544124}, "List of run numbers to analyze"};
119+
Configurable<std::string> cfFileWithWeights{"cfFileWithWeights", "/alice-ccdb.cern.ch/Users/p/pengchon/weightsfile01", "path to external ROOT file which holds all particle weights"};
119120

120121
// *) Define and initialize all data members to be called in the main process* functions:
121122
// **) Task configuration:
@@ -150,6 +151,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
150151
struct QA {
151152
TList* fQAList = NULL;
152153
TH2F* fQA = NULL;
154+
TH2F* fQAM_NC = NULL;
153155
} qa;
154156

155157
static constexpr int maxHarmonic = 7;
@@ -163,6 +165,11 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
163165
TComplex Qvector[maxHarmonic];
164166
} cor;
165167

168+
struct PhiHist {
169+
TList* fPhiHistList = NULL;
170+
std::unordered_map<int, TH1F*> histMap;
171+
} phih;
172+
166173
TObject* GetObjectFromList(TList* list, const char* objectName)
167174
{
168175
// Get TObject pointer from TList, even if it's in some nested TList. Foreseen
@@ -384,7 +391,8 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
384391
}
385392
// Print current run number:
386393
// LOGF(info, "Run number: %d", collision.bc().runNumber());
387-
394+
int currentRun = collision.bc().runNumber();
395+
auto it = phih.histMap.find(currentRun);
388396
float zrec = 0., zsim = 0., centr = 0, M = 0.;
389397

390398
if constexpr (rs == eRec || rs == eRecAndSim) {
@@ -414,6 +422,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
414422
else if (cfMult.value == "NTracksPV")
415423
M = collision.multNTracksPV();
416424
event.fHistMult[eRec]->Fill(M);
425+
qa.fQAM_NC->Fill(M, collision.numContrib());
417426

418427
if constexpr (rs == eRecAndSim) {
419428
auto mccollision = collision.mcCollision();
@@ -440,7 +449,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
440449
}
441450

442451
// before loop over particles
443-
float phi = 0;
452+
float phi = 0, weight = 0;
444453
for (int ih = 0; ih < maxHarmonic; ih++) {
445454
cor.Qvector[ih] = TComplex(0., 0.);
446455
}
@@ -456,12 +465,17 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
456465
event.fEventHistograms[ePt][eRec][0]->Fill(track.pt());
457466
ptrec = track.pt();
458467
phi = track.phi();
468+
if (it != phih.histMap.end()) {
469+
it->second->Fill(phi);
470+
}
459471
pc.fHistPhi[eRec]->Fill(track.phi());
460472
pc.fHistCharge[eRec]->Fill(track.sign());
461473
pc.fHistTPCncls[eRec]->Fill(track.tpcNClsFindable());
462474
pc.fHistTracksdcaXY[eRec]->Fill(track.dcaXY());
463475
pc.fHistTracksdcaZ[eRec]->Fill(track.dcaZ());
464476

477+
weight = 1.; // pc.histWeights->GetBinContent(phi);
478+
465479
// ... and corresponding MC truth simulated:
466480
// See https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/mcHistograms.cxx
467481
// See https://aliceo2group.github.io/analysis-framework/docs/datamodel/ao2dTables.html#montecarlo
@@ -494,7 +508,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
494508

495509
// analysis in the loop over particle
496510
for (int ih = 0; ih < maxHarmonic; ih++) {
497-
cor.Qvector[ih] += TComplex(TMath::Cos(ih * phi), TMath::Sin(ih * phi));
511+
cor.Qvector[ih] += TComplex(weight * TMath::Cos(ih * phi), weight * TMath::Sin(ih * phi));
498512
}
499513
} // end of for (auto track: tracks)
500514
// calculate correlations
@@ -551,6 +565,11 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
551565
cor.fCorrelationVariablesList->SetOwner(true);
552566
fBaseList->Add(cor.fCorrelationVariablesList);
553567

568+
phih.fPhiHistList = new TList();
569+
phih.fPhiHistList->SetName("PhiHistograms");
570+
phih.fPhiHistList->SetOwner(true);
571+
fBaseList->Add(phih.fPhiHistList);
572+
554573
// *) Book pt distribution with binning defined through configurables in the json file:
555574
vector<float> l_pt_bins = cfPtBins.value; // define local array and initialize it from an array set in the configurables
556575
vector<float> l_phi_bins = cfPhiBins.value;
@@ -563,6 +582,7 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
563582
vector<float> l_dcaxy_bins = cfDCAxyBins.value;
564583
vector<float> l_dcaz_bins = cfDCAzBins.value;
565584
vector<float> l_ncontr_bins = cfNcontrBins.value;
585+
vector<int> targetRuns = cfRuns.value;
566586
int nBins = static_cast<int>(l_pt_bins[0]);
567587
int nBinsphi = static_cast<int>(l_phi_bins[0]);
568588
int nBinscentr = static_cast<int>(l_centr_bins[0]);
@@ -695,9 +715,11 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
695715
}
696716
}
697717

698-
qa.fQA = new TH2F("QA", "quality assurance", nBinscentr, mincentr, maxcentr, nBinscentr, mincentr, maxcentr);
718+
qa.fQA = new TH2F("QA_centr", "quality assurance of centrality", nBinscentr, mincentr, maxcentr, nBinscentr, mincentr, maxcentr);
719+
qa.fQAM_NC = new TH2F("QAM_NC", "quality assurance of mult vs. NContributors", nBinsmult, minmult, maxmult, nBinsncontr, minncontr, maxncontr);
699720
if (cfQA) {
700721
qa.fQAList->Add(qa.fQA);
722+
qa.fQAList->Add(qa.fQAM_NC);
701723
}
702724

703725
// float quantiles[10] = {0, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};
@@ -723,6 +745,16 @@ struct MultiharmonicCorrelations { // this name is used in lower-case format to
723745
cor.fCorrelationVariablesList->Add(cor.pfour32_centr);
724746
cor.fCorrelationVariablesList->Add(cor.pfour42_centr);
725747

748+
// init of phi hist for different runs
749+
for (const int& run : targetRuns) {
750+
std::string histName = "hphi_run_" + std::to_string(run);
751+
std::string histTitle = "Phi dis for Run " + std::to_string(run);
752+
753+
TH1F* h = new TH1F(histName.c_str(), histTitle.c_str(), nBinsphi, minphi, maxphi);
754+
phih.fPhiHistList->Add(h);
755+
phih.histMap[run] = h;
756+
}
757+
726758
} // end of void init(InitContext&) {
727759

728760
// A) Process only reconstructed data:

0 commit comments

Comments
 (0)