Skip to content

Commit

Permalink
Updated neutron skin process in FlowZDCtask.cxx
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabrina Hernandez committed Nov 4, 2024
1 parent 661e4ba commit 9f74a15
Showing 1 changed file with 85 additions and 11 deletions.
96 changes: 85 additions & 11 deletions PWGCF/Flow/Tasks/FlowZDCtask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using namespace o2;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::aod::mult;
using ColEvSels = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>;
using ColEvSels = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs, aod::Mults>;
using aodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>>;
using aodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra>>;
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
Expand Down Expand Up @@ -76,7 +76,6 @@ struct FlowZDCtask {
ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"};
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.30, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00}, "pt axis for histograms"};
ConfigurableAxis axisMultiplicity{"axisMultiplicity", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90}, "centrality axis for histograms"};

Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls);

Expand All @@ -102,6 +101,13 @@ struct FlowZDCtask {
OutputObj<TProfile> ZDC_ZEM_Energy{TProfile("ZDC_ZEM_Energy", "ZDC vs ZEM Energy", 10, 0, 1000)};
OutputObj<TProfile> pCosPsiDifferences{TProfile("pCosPsiDifferences", "Differences in cos(psi) vs Centrality;Centrality;Mean cos(psi) Difference", 200, 0, 100, -1, 1)};
OutputObj<TProfile> pSinPsiDifferences{TProfile("pSinPsiDifferences", "Differences in sin(psi) vs Centrality;Centrality;Mean sin(psi) Difference", 200, 0, 100, -1, 1)};
OutputObj<TProfile> pZNvsFT0MAmp{TProfile("pZNvsFT0MAmp", "ZN Energy vs FT0M Amplitude", 100, 0, 50000, 0, 500)};
OutputObj<TProfile> pZPvsFT0MAmp{TProfile("pZPvsFT0MAmp", "ZP Energy vs FT0M Amplitude", 100, 0, 50000, 0, 500)};

OutputObj<TProfile> pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 50000)};
OutputObj<TProfile> pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 50000)};
OutputObj<TProfile> pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)};
OutputObj<TProfile> pZPratiovscent{TProfile("pZPratiovscent", "Ratio ZPC/ZPA vs FT0C Centrality", 100, 0, 100, 0, 5)};

double sumCosPsiDiff = 0.0; // Sum of cos(psiZNC) - cos(psiZNA)
int countEvents = 0; // Count of processed events
Expand All @@ -120,11 +126,11 @@ struct FlowZDCtask {
const AxisSpec axisQZNA{100, -1, 1, "Q"};
const AxisSpec axisREQ{100, -1, 1, "real Q"};
const AxisSpec axisIMQ{100, -1, 1, "imag Q"};
const AxisSpec axisEnergy{100, 0, 50, "energy"};
const AxisSpec axisEnergy{100, 0, 50000., "energy"};

AxisSpec axisVtxcounts{2, -0.5f, 1.5f, "Vtx info (0=no, 1=yes)"};
AxisSpec axisZvert{120, -30.f, 30.f, "Vtx z (cm)"};
AxisSpec axisCent{8, 0.f, 100.f, "centrality"};
AxisSpec axisCent{8, 0.f, 105.f, "centrality"};
AxisSpec axisMult{1000, -0.5f, 1500.5f, "multiplicity"};
AxisSpec axisMultTPC{1000, -0.5f, 1999.5f, "TPCmultiplicity"};
AxisSpec axisCentBins{{0, 5., 10., 20., 30., 40., 50., 60., 70., 80.}, "centrality percentile"};
Expand Down Expand Up @@ -152,6 +158,7 @@ struct FlowZDCtask {

histos.add("EnergyZNA", "ZNA Sector Energy", kTH1F, {axisEnergy});
histos.add("EnergyZNC", "ZNC Sector Energy", kTH1F, {axisEnergy});
histos.add("hCentFT0C", "FT0C Centrality Distribution", kTH1F, {{100, 0, 105}});
// for q vector recentering
histos.add("revsimag", "revsimag", kTH2F, {axisREQ, axisIMQ});

Expand Down Expand Up @@ -179,6 +186,19 @@ struct FlowZDCtask {
histos.add("hSinDifferences", "Differences in sin(psi);sin(psiZNC) - sin(psiZNA);Entries", {HistType::kTH1F, {{100, -2, 2}}});
histos.add("CosPsiDifferencesAvg", "Differences in cos(psi);cos(psiZNC) - cos(psiZNA);Entries", {HistType::kTH2F, {{axisCent}, {100, -2, 2}}});
histos.add("ZDC_energy_vs_ZEM", "ZDCvsZEM; ZEM; ZNA+ZNC+ZPA+ZPC", {HistType::kTH2F, {{{nBinsAmp, -0.5, MaxZEM}, {nBinsAmp, -0.5, 2. * MaxZN}}}});
// common energies information for ZDC
histos.add("ZNCenergy", "ZN energy side c", kTH1F, {axisEnergy});
histos.add("ZNAenergy", "ZN energy side a", kTH1F, {axisEnergy});
histos.add("ZPCenergy", "ZP energy side c", kTH1F, {axisEnergy});
histos.add("ZPAenergy", "ZP energy side a", kTH1F, {axisEnergy});
histos.add("ZNenergy", "common zn (a + c sides) energy", kTH1F, {axisEnergy});
histos.add("ZPenergy", "common zp energy (a + c sides)", kTH1F, {axisEnergy});
histos.add("hFT0CAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 10000000}});
histos.add("hFT0AAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 10000000}});
histos.add("hFT0MAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 10000000}});
histos.add("hMultT0A", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}});
histos.add("hMultT0C", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}});
histos.add("hMultT0M", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}});
}
}

Expand Down Expand Up @@ -228,18 +248,47 @@ struct FlowZDCtask {
void processZdcCollAssoc(
ColEvSels const& cols,
BCsRun3 const& /*bcs*/,
aod::Zdcs const& /*zdcs*/)
aod::Zdcs const& /*zdcs*/,
aod::FT0s const& ft0s)
{
double sumCosPsiDiff = 0.0; // initialize Sum of cosPsiDiff for averaging
double sumSinPsiDiff = 0.0; // initialize Sum of cosPsiDiff for averaging
int countEvents = 0; // initialize Counter for the number of events processed
double FT0AAmp = 0;
double FT0CAmp = 0;
// init values for ft0 multiplicity
float multFT0A = 0.f;
float multFT0C = 0.f;
float multFT0M = 0.f;

// collision-based event selection
for (auto& collision : cols) {
const auto& foundBC = collision.foundBC_as<BCsRun3>();
multFT0A = collision.multFT0A();
multFT0C = collision.multFT0C();
multFT0M = multFT0A + multFT0C;

histos.fill(HIST("hMultT0A"), multFT0A);
histos.fill(HIST("hMultT0C"), multFT0C);
histos.fill(HIST("hMultT0M"), multFT0M);
if (collision.has_foundFT0()) {
auto ft0 = collision.foundFT0();
for (auto amplitude : ft0.amplitudeA()) {
FT0AAmp += amplitude;
histos.fill(HIST("hFT0AAmp"), FT0AAmp);
}
for (auto amplitude : ft0.amplitudeC()) {
FT0CAmp += amplitude;
histos.fill(HIST("hFT0CAmp"), FT0CAmp);
}
}
double FT0MAmp = FT0AAmp + FT0CAmp;
histos.fill(HIST("hFT0MAmp"), FT0MAmp);
if (foundBC.has_zdc()) {
const auto& zdcread = foundBC.zdc();
const auto cent = collision.centFT0C();

// ZDC data and histogram filling
histos.get<TH1>(HIST("ZNAcoll"))->Fill(zdcread.amplitudeZNA());
histos.get<TH1>(HIST("ZNCcoll"))->Fill(zdcread.amplitudeZNC());
histos.get<TH2>(HIST("ZNvsZEMcoll"))->Fill(zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2(), zdcread.amplitudeZNA() + zdcread.amplitudeZNC());
Expand All @@ -254,23 +303,47 @@ struct FlowZDCtask {
float sumZPA = (zdcread.energySectorZPA())[0] + (zdcread.energySectorZPA())[1] + (zdcread.energySectorZPA())[2] + (zdcread.energySectorZPA())[3];
float sumZDC = sumZPA + sumZPC + sumZNA + sumZNC;
float sumZEM = zdcread.amplitudeZEM1() + zdcread.amplitudeZEM2();

// common energies
float common_sumZNC = (zdcread.energyCommonZNC());
float common_sumZNA = (zdcread.energyCommonZNA());
float common_sumZPC = (zdcread.energyCommonZPC());
float common_sumZPA = (zdcread.energyCommonZPA());
float sumZN = (sumZNC) + (sumZNA);
float sumZP = (sumZPC) + (sumZPA);

histos.fill(HIST("ZNenergy"), sumZN);
histos.fill(HIST("ZPenergy"), sumZP);
histos.fill(HIST("ZNCenergy"), common_sumZNC);
histos.fill(HIST("ZNAenergy"), common_sumZNA);
histos.fill(HIST("ZPAenergy"), common_sumZPA);
histos.fill(HIST("ZPCenergy"), common_sumZPC);

float ratioZN = sumZNC / sumZNA;
float ratioZP = sumZPC / sumZPA;
pZNratiovscent->Fill(cent, ratioZN);
pZPratiovscent->Fill(cent, ratioZP);
pZNvsFT0Ccent->Fill(cent, sumZN);
pZPvsFT0Ccent->Fill(cent, sumZP);
pZPvsFT0MAmp->Fill(sumZP, FT0MAmp);
pZNvsFT0MAmp->Fill(sumZN, FT0MAmp);

histos.get<TH2>(HIST("ZDC_energy_vs_ZEM"))->Fill(sumZEM, sumZDC);

// Spectator plane angle calculations and histograms
const auto Ntot_ZNA = zdcread.amplitudeZNA();
const auto Ntot_ZNC = zdcread.amplitudeZNC();
double qZNA_real = 0.0; // Initialize qZNA_real
double qZNA_im = 0.0; // Initialize
double qZNC_real = 0.0; // Initialize qZNC_real
double qZNC_im = 0.0; // Initialize
double qZNA_real = 0.0;
double qZNA_im = 0.0;
double qZNC_real = 0.0;
double qZNC_im = 0.0;
const double phiRadians[4] = {45 * TMath::Pi() / 180, 135 * TMath::Pi() / 180, 225 * TMath::Pi() / 180, 315 * TMath::Pi() / 180};
TComplex qZNA(0, 0), qZNC(0, 0);

for (int sector = 0; sector < 4; ++sector) {
// energy for current sector for ZNA and ZNC
float energyZNA = zdcread.energySectorZNA()[sector];
float energyZNC = zdcread.energySectorZNC()[sector];

// Calculate q-vector from current sector and add it to the total q-vector
qZNA += TComplex(TMath::Cos(2 * phiRadians[sector]) * energyZNA / sumZNA, TMath::Sin(2 * phiRadians[sector]) * energyZNA / sumZNA);
qZNC += TComplex(TMath::Cos(2 * phiRadians[sector]) * energyZNC / sumZNC, TMath::Sin(2 * phiRadians[sector]) * energyZNC / sumZNC);
}
Expand Down Expand Up @@ -313,6 +386,7 @@ struct FlowZDCtask {
}
}
}

PROCESS_SWITCH(FlowZDCtask, processZdcCollAssoc, "Processing ZDC w. collision association", true);
PROCESS_SWITCH(FlowZDCtask, processQVector, "Process before recentering", true);

Expand Down

0 comments on commit 9f74a15

Please sign in to comment.