Skip to content

Commit 75d6966

Browse files
authored
[PWGCF] added the possibility of ft0-A and ft0-C correlations, but removed mftreassociated3D (#15500)
1 parent 7834b62 commit 75d6966

File tree

1 file changed

+152
-21
lines changed

1 file changed

+152
-21
lines changed

PWGCF/TwoParticleCorrelations/Tasks/corrSparse.cxx

Lines changed: 152 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct CorrSparse {
100100
O2_DEFINE_CONFIGURABLE(processFT0A, bool, true, "Process FT0A correlations")
101101
O2_DEFINE_CONFIGURABLE(processFT0C, bool, true, "Process FT0C correlations")
102102
O2_DEFINE_CONFIGURABLE(processMFT, bool, true, "Process MFT correlations")
103-
O2_DEFINE_CONFIGURABLE(withGain, bool, true, "Use gain for FT0A and FT0C")
103+
O2_DEFINE_CONFIGURABLE(withGain, bool, false, "Use gain for FT0A and FT0C")
104104

105105
} cfgDetectorConfig;
106106

@@ -216,6 +216,7 @@ struct CorrSparse {
216216
ConfigurableAxis axisDeltaEtaMftFt0c{"axisDeltaEtaMFTFT0C", {48, -2.0, 0.6}, "delta eta axis for MFT-FT0C histograms"};
217217
ConfigurableAxis axisDeltaEtaMftFt0a{"axisDeltaEtaMFTFT0A", {48, -8.5, -5.9}, "delta eta axis for MFT-FT0A histograms"};
218218
ConfigurableAxis axisDeltaEtaMftFv0{"axisDeltaEtaMFTFV0", {48, -8.6, -4.7}, "delta eta axis for MFT-FV0 histograms"};
219+
ConfigurableAxis axisDeltaEtaFt0s{"axisDeltaEtaFT0S", {48, -8.6, 5.0}, "delta eta axis for FT0S histograms"};
219220

220221
ConfigurableAxis axisPtTrigger{"axisPtTrigger", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt trigger axis for histograms"};
221222
ConfigurableAxis axisPtAssoc{"axisPtAssoc", {VARIABLE_WIDTH, 0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 6.0, 10.0}, "pt associated axis for histograms"};
@@ -343,7 +344,7 @@ struct CorrSparse {
343344
LOGF(info, "Starting init");
344345

345346
// Event Counter
346-
if ((doprocessSameTpcFIT || doprocessSameTpcMft || doprocessSameTPC || doprocessSameMFTFIT || doprocessSameTpcMftReassociated2D || doprocessSameTpcMftReassociated3D || doprocessSameMftReassociated2DFIT) && cfgUseAdditionalEventCut) {
347+
if ((doprocessSameTpcFIT || doprocessSameTpcMft || doprocessSameTPC || doprocessSameMFTFIT || doprocessSameTpcMftReassociated2D || doprocessSameMftReassociated2DFIT || doprocessSameFT0s) && cfgUseAdditionalEventCut) {
347348
registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{13, 0, 13}}});
348349
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8");
349350
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup");
@@ -360,7 +361,7 @@ struct CorrSparse {
360361
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(13, "cfgEvSelV0AT0ACut");
361362
}
362363

363-
if (doprocessSameTpcMftReassociated2D || doprocessSameTpcMftReassociated3D || doprocessSameMftReassociated2DFIT) {
364+
if (doprocessSameTpcMftReassociated2D || doprocessSameMftReassociated2DFIT) {
364365
registry.add("hEventCountMftReassoc", "Number of Events;; Count", {HistType::kTH1D, {{4, 0, 4}}});
365366
registry.get<TH1>(HIST("hEventCountMftReassoc"))->GetXaxis()->SetBinLabel(1, "all MFT tracks");
366367
registry.get<TH1>(HIST("hEventCountMftReassoc"))->GetXaxis()->SetBinLabel(2, "MFT tracks after selection");
@@ -373,12 +374,12 @@ struct CorrSparse {
373374
}
374375

375376
// Make histograms to check the distributions after cuts
376-
if (doprocessSameTpcFIT || doprocessSameTpcMft || doprocessSameTPC || doprocessSameMFTFIT || doprocessSameTpcMftReassociated2D || doprocessSameTpcMftReassociated3D || doprocessSameMftReassociated2DFIT) {
377+
if (doprocessSameTpcFIT || doprocessSameTpcMft || doprocessSameTPC || doprocessSameMFTFIT || doprocessSameTpcMftReassociated2D || doprocessSameMftReassociated2DFIT || doprocessSameFT0s) {
377378
registry.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}});
378379
if (doprocessSameMFTFIT) {
379380
registry.add("Eta", "EtaMFT", {HistType::kTH1D, {axisEtaMft}});
380381
}
381-
if (doprocessSameTpcFIT || doprocessSameTpcMft || doprocessSameTPC || doprocessSameTpcMftReassociated2D || doprocessSameTpcMftReassociated3D) {
382+
if (doprocessSameTpcFIT || doprocessSameTpcMft || doprocessSameTPC || doprocessSameTpcMftReassociated2D) {
382383
registry.add("Eta", "Eta", {HistType::kTH1D, {axisEta}});
383384
}
384385
registry.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}});
@@ -389,7 +390,7 @@ struct CorrSparse {
389390
registry.add("zVtx", "zVtx", {HistType::kTH1D, {axisVertex}});
390391
registry.add("zVtx_used", "zVtx_used", {HistType::kTH1D, {axisVertex}});
391392

392-
if (doprocessSameTpcFIT || doprocessSameMFTFIT || doprocessSameMftReassociated2DFIT) {
393+
if (doprocessSameTpcFIT || doprocessSameMFTFIT || doprocessSameMftReassociated2DFIT || doprocessSameFT0s) {
393394
registry.add("FT0Amp", "", {HistType::kTH2F, {axisChID, axisFit}});
394395
registry.add("FV0Amp", "", {HistType::kTH2F, {axisChID, axisFit}});
395396
registry.add("FT0AmpCorrect", "", {HistType::kTH2F, {axisChID, axisFit}});
@@ -446,7 +447,7 @@ struct CorrSparse {
446447
}
447448
}
448449

449-
if (doprocessSameTpcMft || doprocessSameTpcMftReassociated2D || doprocessSameTpcMftReassociated3D) {
450+
if (doprocessSameTpcMft || doprocessSameTpcMftReassociated2D) {
450451
registry.add("deltaEta_deltaPhi_same_TPC_MFT", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcMft}}); // check to see the delta eta and delta phi distribution
451452
registry.add("deltaEta_deltaPhi_mixed_TPC_MFT", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcMft}});
452453
registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}});
@@ -458,6 +459,12 @@ struct CorrSparse {
458459
registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}});
459460
}
460461

462+
if (doprocessSameFT0s) {
463+
registry.add("deltaEta_deltaPhi_same_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0s}}); // check to see the delta eta and delta phi distribution
464+
registry.add("deltaEta_deltaPhi_mixed_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0s}});
465+
registry.add("Trig_hist", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisPtTrigger}}});
466+
}
467+
461468
registry.add("eventcount", "bin", {HistType::kTH1F, {{4, 0, 4, "bin"}}}); // histogram to see how many events are in the same and mixed event
462469

463470
LOGF(info, "Initializing correlation container");
@@ -528,6 +535,13 @@ struct CorrSparse {
528535
{axisDeltaPhi, "#Delta#varphi (rad)"},
529536
{axisDeltaEtaMftFv0, "#Delta#eta"}};
530537

538+
std::vector<AxisSpec> corrAxisFT0s = {{axisSample, "Sample"},
539+
{axisVertex, "z-vtx (cm)"},
540+
{axisPtTrigger, "p_{T} (GeV/c)"},
541+
{axisPtAssoc, "p_{T} (GeV/c)"},
542+
{axisDeltaPhi, "#Delta#varphi (rad)"},
543+
{axisDeltaEtaFt0s, "#Delta#eta"}};
544+
531545
if (doprocessSameTpcFIT) {
532546
if (cfgDetectorConfig.processFT0A) {
533547
same.setObject(new CorrelationContainer("sameEvent_TPC_FT0A", "sameEvent_TPC_FT0A", corrAxisTpcFt0a, effAxis, userAxis));
@@ -588,9 +602,9 @@ struct CorrSparse {
588602
mixed.setObject(new CorrelationContainer("mixedEvent_TPC_MFT_Reassociated2D", "mixedEvent_TPC_MFT_Reassociated2D", corrAxisTpcMft, effAxis, userAxis));
589603
}
590604

591-
if (doprocessSameTpcMftReassociated3D) {
592-
same.setObject(new CorrelationContainer("sameEvent_TPC_MFT_Reassociated3D", "sameEvent_TPC_MFT_Reassociated3D", corrAxisTpcMft, effAxis, userAxis));
593-
mixed.setObject(new CorrelationContainer("mixedEvent_TPC_MFT_Reassociated3D", "mixedEvent_TPC_MFT_Reassociated3D", corrAxisTpcMft, effAxis, userAxis));
605+
if (doprocessSameFT0s) {
606+
same.setObject(new CorrelationContainer("sameEvent_FT0A_FT0C", "sameEvent_FT0A_FT0C", corrAxisTpcFt0c, effAxis, userAxis));
607+
mixed.setObject(new CorrelationContainer("mixedEvent_FT0A_FT0C", "mixedEvent_FT0A_FT0C", corrAxisTpcFt0c, effAxis, userAxis));
594608
}
595609
LOGF(info, "End of init");
596610
}
@@ -771,7 +785,7 @@ struct CorrSparse {
771785
auto theta = std::atan2(r, z);
772786
return -std::log(std::tan(0.5 * theta));
773787
}
774-
// checks if it is an accepted mft track
788+
775789
template <typename TTrack>
776790
bool isAcceptedMftTrack(TTrack const& mftTrack)
777791
{
@@ -1493,6 +1507,64 @@ struct CorrSparse {
14931507
}
14941508
}
14951509

1510+
template <CorrelationContainer::CFStep step, typename TFT0s>
1511+
void fillCorrelationsFT0s(TFT0s const& ft01, TFT0s const& ft02, float posZ, int multiplicity, int system, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
1512+
{
1513+
int fSampleIndex = gRandom->Uniform(0, cfgSampleSize);
1514+
1515+
if (cfgQaCheck) {
1516+
if (system == SameEvent) {
1517+
registry.fill(HIST("zVtx_used"), posZ);
1518+
registry.fill(HIST("Nch"), multiplicity);
1519+
registry.fill(HIST("Nch_used_ft0c"), ft02.channelC().size());
1520+
registry.fill(HIST("Nch_used_ft0a"), ft01.channelA().size());
1521+
}
1522+
}
1523+
1524+
float triggerWeight = 1.0f;
1525+
std::size_t channelASize = ft01.channelA().size();
1526+
std::size_t channelCSize = ft02.channelC().size();
1527+
// loop over all tracks
1528+
for (std::size_t iChA = 0; iChA < channelASize; iChA++) {
1529+
1530+
int chanelAid = 0;
1531+
float amplA = 0.;
1532+
if (cfgDetectorConfig.withGain) {
1533+
getChannelWithGain(ft01, iChA, chanelAid, amplA, kFT0A);
1534+
} else {
1535+
getChannelFT0(ft01, iChA, chanelAid, amplA, kFT0A);
1536+
}
1537+
auto phiA = getPhiFT0(chanelAid, kFT0A);
1538+
auto etaA = getEtaFT0(chanelAid, kFT0A);
1539+
1540+
if (system == SameEvent) {
1541+
registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, 0.5, eventWeight * amplA);
1542+
}
1543+
1544+
for (std::size_t iChC = 0; iChC < channelCSize; iChC++) {
1545+
int chanelCid = 0;
1546+
float amplC = 0.;
1547+
if (cfgDetectorConfig.withGain) {
1548+
getChannelWithGain(ft02, iChC, chanelCid, amplC, kFT0C);
1549+
} else {
1550+
getChannelFT0(ft02, iChC, chanelCid, amplC, kFT0C);
1551+
}
1552+
auto phiC = getPhiFT0(chanelCid, kFT0C);
1553+
auto etaC = getEtaFT0(chanelCid, kFT0C);
1554+
float deltaPhi = RecoDecay::constrainAngle(phiA - phiC, -PIHalf);
1555+
float deltaEta = etaA - etaC;
1556+
1557+
// fill the right sparse and histograms
1558+
if (system == SameEvent) {
1559+
registry.fill(HIST("deltaEta_deltaPhi_same_FT0A_FT0C"), deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight);
1560+
same->getPairHist()->Fill(step, fSampleIndex, posZ, 0.5, 0.5, deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight);
1561+
} else if (system == MixedEvent) {
1562+
registry.fill(HIST("deltaEta_deltaPhi_mixed_FT0A_FT0C"), deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight);
1563+
mixed->getPairHist()->Fill(step, fSampleIndex, posZ, 0.5, 0.5, deltaPhi, deltaEta, amplA * amplC * eventWeight * triggerWeight);
1564+
}
1565+
}
1566+
}
1567+
}
14961568
//////////////////////////////////////
14971569
////// Same event processing /////////
14981570
//////////////////////////////////////
@@ -1740,29 +1812,37 @@ struct CorrSparse {
17401812
}
17411813
PROCESS_SWITCH(CorrSparse, processSameTpcMftReassociated2D, "Process same event for TPC-MFT correlation with reassociated tracks", false);
17421814

1743-
void processSameTpcMftReassociated3D(AodCollisions::iterator const& collision, AodTracks const& tracks,
1744-
soa::SmallGroups<aod::BestCollisionsFwd3d> const& reassociatedMftTracks,
1745-
aod::BCsWithTimestamps const&)
1815+
void processSameFT0s(AodCollisions::iterator const& collision, AodTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&)
17461816
{
17471817
if (!collision.sel8())
17481818
return;
1819+
17491820
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
17501821

1751-
if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true))
1822+
if (cfgUseAdditionalEventCut && !eventSelected(collision, 0, true))
17521823
return;
17531824

1754-
registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin
1825+
if (!collision.has_foundFT0())
1826+
return;
1827+
1828+
loadAlignParam(bc.timestamp());
1829+
if (cfgDetectorConfig.withGain) {
1830+
loadGain(bc);
1831+
}
17551832
loadCorrection(bc.timestamp());
1756-
fillYield(collision, tracks);
17571833

1758-
if (tracks.size() < cfgEventSelection.cfgMinMult || tracks.size() >= cfgEventSelection.cfgMaxMult) {
1834+
if ((tracks.size() < cfgEventSelection.cfgMinMult || tracks.size() >= cfgEventSelection.cfgMaxMult)) {
17591835
return;
17601836
}
17611837

1762-
fillCorrelationsMftReassociatedTracks<CorrelationContainer::kCFStepReconstructed>(tracks, reassociatedMftTracks, tracks.size(), collision.posZ(), SameEvent, getMagneticField(bc.timestamp()), false);
1763-
}
1764-
PROCESS_SWITCH(CorrSparse, processSameTpcMftReassociated3D, "Process same event for TPC-MFT correlation with reassociated tracks", false);
1838+
registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin
1839+
1840+
const auto& ft0s = collision.foundFT0();
1841+
auto multiplicity = tracks.size();
17651842

1843+
fillCorrelationsFT0s<CorrelationContainer::kCFStepReconstructed>(ft0s, ft0s, collision.posZ(), multiplicity, SameEvent, 1.0f);
1844+
}
1845+
PROCESS_SWITCH(CorrSparse, processSameFT0s, "Process same event for FT0 correlation", false);
17661846
////////////////////////////////////
17671847
////// Mixed event processing //////
17681848
////////////////////////////////////
@@ -1983,6 +2063,57 @@ struct CorrSparse {
19832063
}
19842064
}
19852065
PROCESS_SWITCH(CorrSparse, processMixedTpcMFT, "Process mixed events for TPC-MFT correlation", false);
2066+
2067+
void processMixedFT0s(AodCollisions const& collisions, AodTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&)
2068+
{
2069+
2070+
auto getTracksSize = [&tracks, this](AodCollisions::iterator const& collision) {
2071+
auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache);
2072+
auto mult = associatedTracks.size();
2073+
return mult;
2074+
};
2075+
2076+
using MixedBinning = FlexibleBinningPolicy<std::tuple<decltype(getTracksSize)>, aod::collision::PosZ, decltype(getTracksSize)>;
2077+
2078+
MixedBinning binningOnVtxAndMult{{getTracksSize}, {vtxMix, multMix}, true};
2079+
2080+
auto tracksTuple = std::make_tuple(tracks, tracks);
2081+
Pair<AodCollisions, AodTracks, AodTracks, MixedBinning> pair{binningOnVtxAndMult, cfgMinMixEventNum, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
2082+
2083+
for (auto it = pair.begin(); it != pair.end(); it++) {
2084+
auto& [collision1, tracks1, collision2, tracks2] = *it;
2085+
2086+
if (!collision1.sel8() || !collision2.sel8())
2087+
continue;
2088+
2089+
if (collision1.globalIndex() == collision2.globalIndex()) {
2090+
continue;
2091+
}
2092+
2093+
if ((tracks1.size() < cfgEventSelection.cfgMinMult || tracks1.size() >= cfgEventSelection.cfgMaxMult))
2094+
continue;
2095+
2096+
if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false))
2097+
continue;
2098+
if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), false))
2099+
continue;
2100+
2101+
if (!(collision1.has_foundFT0() && collision2.has_foundFT0()))
2102+
continue;
2103+
2104+
registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin
2105+
auto bc = collision1.bc_as<aod::BCsWithTimestamps>();
2106+
loadAlignParam(bc.timestamp());
2107+
loadCorrection(bc.timestamp());
2108+
2109+
auto multiplicity = tracks1.size();
2110+
2111+
const auto& ft0_1 = collision1.foundFT0();
2112+
const auto& ft0_2 = collision2.foundFT0();
2113+
fillCorrelationsFT0s<CorrelationContainer::kCFStepReconstructed>(ft0_1, ft0_2, collision1.posZ(), multiplicity, MixedEvent, 1.0f);
2114+
}
2115+
}
2116+
PROCESS_SWITCH(CorrSparse, processMixedFT0s, "Process mixed events for FT0 correlation", false);
19862117
};
19872118
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
19882119
{

0 commit comments

Comments
 (0)