Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 56 additions & 55 deletions PWGCF/MultiparticleCorrelations/Tasks/multiparticleCumulants.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
#include <TH2.h>
#include <TList.h>
#include <TObject.h>
#include <TParticlePDG.h>
#include <TString.h>
#include <TSystem.h>
#include <TParticlePDG.h>

#include <RtypesCore.h>

Expand Down Expand Up @@ -94,8 +94,7 @@ const char* eventHistNames[eEventHistograms_N] = {
"VertexX",
"VertexY",
"VertexZ",
"NumContrib"
};
"NumContrib"};

enum EnParticleHistograms {
ePt,
Expand Down Expand Up @@ -162,7 +161,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
Configurable<std::vector<float>> cfDCAXYCut{"cfDCAXYCut", {-3.2, 3.2}, "range of distance-of-closest-approach (DCA) of the extrapolated track to the primary position in XY-direction: {min, max}[cm]"};
Configurable<std::vector<float>> cfDCAZCut{"cfDCAZCut", {-2.4, 2.4}, "range of distance-of-closest-approach (DCA) of the extrapolated track to the primary position in Z-direction: {min, max}[cm]"};

// *)
// *)
Configurable<std::string> cfFileWithWeights{"cfFileWithWeights", "/scratch3/go52dab/O2tutorial/tutorial3-6/weights.root", "path to external ROOT file which holds all particle weights in O2 format"};
Configurable<std::string> cfRunNumber{"cfRunNumber", "000123456", "run number"};

Expand All @@ -185,7 +184,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
std::string fMultEstm = "FT0A";

bool fPrintSwitch = true;

bool fVertexZCutSwitch = true;
bool fSel8CutSwitch = true;
bool fCentCutSwitch = true;
Expand All @@ -208,7 +207,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
std::vector<float> fTpcNClsFoundCut = {70., 160.};
std::vector<float> fDCAXYCut = {-3.2, 3.2};
std::vector<float> fDCAZCut = {-2.4, 2.4};

std::string fFileWithWeights = "/scratch3/go52dab/O2tutorial/tutorial3-6/weights.root";
std::string fRunNumber = "000123456";
} tc; // you have to prepend "tc." for all objects name in this group later in the code
Expand Down Expand Up @@ -245,9 +244,6 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
int fNumContrib = 0.;
} ebye;




template <EnRlMc rm, typename T1>
bool EventCuts(T1 const& collision)
{
Expand All @@ -273,10 +269,18 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
CentCut = ebye.fCentralitySim < tc.fCentCut[1] && ebye.fCentralitySim > tc.fCentCut[0];
}

if (tc.fVertexZCutSwitch) {pass = pass && VertexZCut;}
if (tc.fSel8CutSwitch) {pass = pass && Sel8Cut;}
if (tc.fCentCutSwitch) {pass = pass && CentCut;}
if (tc.fNumContribCutSwitch) {pass = pass && NumContribCut;}
if (tc.fVertexZCutSwitch) {
pass = pass && VertexZCut;
}
if (tc.fSel8CutSwitch) {
pass = pass && Sel8Cut;
}
if (tc.fCentCutSwitch) {
pass = pass && CentCut;
}
if (tc.fNumContribCutSwitch) {
pass = pass && NumContribCut;
}

return pass;
}
Expand All @@ -296,7 +300,7 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
// *) For real event and MC event
PtCut = track.pt() < tc.fPtCut[1] && track.pt() > tc.fPtCut[0];
EtaCut = track.eta() < tc.fEtaCut[1] && track.eta() > tc.fEtaCut[0];

// *) For real event only
if constexpr (rm == eRl) {
SignCut = (track.sign() == -1 && tc.fSignCut[0]) || (track.sign() == 0 && tc.fSignCut[1]) || (track.sign() == 1 && tc.fSignCut[2]);
Expand All @@ -313,20 +317,31 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
if (!particle) {
// LOGF(warning, "PDG code %d not found", track.pdgCode());
SignCut = false;
}
else {
} else {
// LOGF(info, "PDG code %d found", track.pdgCode());
float charge = particle->Charge();
SignCut = (charge < 0 && tc.fSignCut[0]) || (charge == 0 && tc.fSignCut[1]) || (charge > 0 && tc.fSignCut[2]);
}
}

if (tc.fPtCutSwitch) {pass = pass && PtCut;}
if (tc.fEtaCutSwitch) {pass = pass && EtaCut;}
if (tc.fSignCutSwitch) {pass = pass && SignCut;}
if (tc.fTpcNClsFoundCutSwitch) {pass = pass && TpcNClsFoundCut;}
if (tc.fDCAXYCutSwitch) {pass = pass && DCAXYCut;}
if (tc.fDCAZCutSwitch) {pass = pass && DCAZCut;}
if (tc.fPtCutSwitch) {
pass = pass && PtCut;
}
if (tc.fEtaCutSwitch) {
pass = pass && EtaCut;
}
if (tc.fSignCutSwitch) {
pass = pass && SignCut;
}
if (tc.fTpcNClsFoundCutSwitch) {
pass = pass && TpcNClsFoundCut;
}
if (tc.fDCAXYCutSwitch) {
pass = pass && DCAXYCut;
}
if (tc.fDCAZCutSwitch) {
pass = pass && DCAZCut;
}

return pass;
}
Expand Down Expand Up @@ -559,13 +574,13 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
LOGF(info, "Vertex Y position: %f", collision.posY());
LOGF(info, "Vertex Z position: %f", collision.posZ());

//Print NContributors
// Print NContributors
LOGF(info, "NContributors: %f", static_cast<int>(rlCollisionNumContrib));
}
ebye.fCentrality = rlCollisionCent;
ebye.fReferenceMultiplicity = rlCollisionMult;
ebye.fNumContrib = rlCollisionNumContrib;

if constexpr (rs == eRec || rs == eRecAndSim) {
ev.fEventHistograms[eCent][eRec][0]->Fill(rlCollisionCent);
ev.fEventHistograms[eMult][eRec][0]->Fill(rlCollisionMult);
Expand Down Expand Up @@ -763,12 +778,10 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
if constexpr (histType == eCent) {
std::string nameRecNocutfull = tc.fCentEstm + eventHistNames[histType] + std::string(" distribution for reconstructed events");
std::string nameSimNocutfull = tc.fCentEstm + eventHistNames[histType] + std::string(" distribution for simulated events");
}
else if constexpr (histType == eMult) {
} else if constexpr (histType == eMult) {
std::string nameRecNocutfull = tc.fMultEstm + eventHistNames[histType] + std::string(" distribution for reconstructed events");
std::string nameSimNocutfull = tc.fMultEstm + eventHistNames[histType] + std::string(" distribution for simulated events");
}
else {
} else {
std::string nameRecNocutfull = eventHistNames[histType] + std::string(" distribution for reconstructed events");
std::string nameSimNocutfull = eventHistNames[histType] + std::string(" distribution for simulated events");
}
Expand All @@ -785,10 +798,8 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
ev.fEventHistograms[histType][eSim][0]->GetXaxis()->SetTitle(eventHistNames[histType]);
ev.fEventHistogramsList->Add(ev.fEventHistograms[histType][eSim][0]);
} // No nContrib and multiplicity for processSim

}


std::string nameRecCut = std::string("fHist") + eventHistNames[histType] + std::string("[eRec][after cut]");
std::string nameSimCut = std::string("fHist") + eventHistNames[histType] + std::string("[eSim][after cut]");
std::string nameRecCutfull;
Expand All @@ -797,12 +808,10 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
if constexpr (histType == eCent) {
std::string nameRecCutfull = tc.fCentEstm + eventHistNames[histType] + std::string(" distribution for reconstructed events");
std::string nameSimCutfull = tc.fCentEstm + eventHistNames[histType] + std::string(" distribution for simulated events");
}
else if constexpr (histType == eMult) {
} else if constexpr (histType == eMult) {
std::string nameRecCutfull = tc.fMultEstm + eventHistNames[histType] + std::string(" distribution for reconstructed events");
std::string nameSimCutfull = tc.fMultEstm + eventHistNames[histType] + std::string(" distribution for simulated events");
}
else {
} else {
std::string nameRecCutfull = eventHistNames[histType] + std::string(" distribution for reconstructed events");
std::string nameSimCutfull = eventHistNames[histType] + std::string(" distribution for simulated events");
}
Expand Down Expand Up @@ -844,48 +853,41 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
std::string nameNocutfull;
if constexpr (histType == eCent) {
std::string nameNocutfull = std::string("Quality assurance of ") + tc.fCentEstm + eventHistNames[histType];
}
else if constexpr (histType == eNumContrib) {
} else if constexpr (histType == eNumContrib) {
std::string nameNocutfull = std::string("Quality assurance of ") + tc.fMultEstm + eventHistNames[histType] + std::string(" vs. NContributors");
}
else {
} else {
std::string nameNocutfull = std::string("Quality assurance of ") + eventHistNames[histType];
}

qa.fQAHistograms[histType][0] = new TH2F(nameNocut.c_str(), nameNocutfull.c_str(), nBinsCent, minCent, maxCent, nBinsCent, minCent, maxCent);
if constexpr (histType == eNumContrib) {
qa.fQAHistograms[histType][0]->GetYaxis()->SetTitle("NContributors");
qa.fQAHistograms[histType][0]->GetXaxis()->SetTitle("Reference multiplicity");
}
else {
qa.fQAHistograms[histType][0]->GetXaxis()->SetTitle("Reference multiplicity");
} else {
qa.fQAHistograms[histType][0]->GetYaxis()->SetTitle(Form("Simulated %s", eventHistNames[histType]));
qa.fQAHistograms[histType][0]->GetXaxis()->SetTitle(Form("Reconstructed %s", eventHistNames[histType]));
qa.fQAHistograms[histType][0]->GetXaxis()->SetTitle(Form("Reconstructed %s", eventHistNames[histType]));
}
qa.fQAHistogramsList->Add(qa.fQAHistograms[histType][0]);

std::string nameCut = std::string("fHist") + eventHistNames[histType] + std::string("[after cut]");
std::string nameCutfull;
if constexpr (histType == eCent) {
std::string nameCutfull = std::string("Quality assurance of ") + tc.fCentEstm + eventHistNames[histType];
}
else if constexpr (histType == eNumContrib) {
} else if constexpr (histType == eNumContrib) {
std::string nameCutfull = std::string("Quality assurance of ") + tc.fMultEstm + eventHistNames[histType];
}
else {
} else {
std::string nameCutfull = std::string("Quality assurance of ") + eventHistNames[histType];
}

qa.fQAHistograms[histType][1] = new TH2F(nameCut.c_str(), nameCutfull.c_str(), nBinsCent, minCent, maxCent, nBinsCent, minCent, maxCent);
if constexpr (histType == eNumContrib) {
qa.fQAHistograms[histType][1]->GetYaxis()->SetTitle("NContributors");
qa.fQAHistograms[histType][1]->GetXaxis()->SetTitle("Reference multiplicity");
}
else {
qa.fQAHistograms[histType][1]->GetXaxis()->SetTitle("Reference multiplicity");
} else {
qa.fQAHistograms[histType][1]->GetYaxis()->SetTitle(Form("Simulated %s", eventHistNames[histType]));
qa.fQAHistograms[histType][1]->GetXaxis()->SetTitle(Form("Reconstructed %s", eventHistNames[histType]));
qa.fQAHistograms[histType][1]->GetXaxis()->SetTitle(Form("Reconstructed %s", eventHistNames[histType]));
}
qa.fQAHistogramsList->Add(qa.fQAHistograms[histType][1]);

}

// *) Initialize and book all objects:
Expand Down Expand Up @@ -982,7 +984,6 @@ struct MultiparticleCumulants { // this name is used in lower-case format to nam
}
}


} // end of void init(InitContext&) {

// A) Process only reconstructed data:
Expand Down Expand Up @@ -1021,4 +1022,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
return WorkflowSpec{
adaptAnalysisTask<MultiparticleCumulants>(cfgc),
};
} // WorkflowSpec...
} // WorkflowSpec...