Skip to content

Commit c391c5e

Browse files
Add files via upload
1 parent 980a3ee commit c391c5e

File tree

1 file changed

+179
-3
lines changed

1 file changed

+179
-3
lines changed

PWGCF/TwoParticleCorrelations/Tasks/flowDecorrelation.cxx

Lines changed: 179 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ struct FlowDecorrelation {
144144
ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"};
145145
ConfigurableAxis axisDeltaEtaTpcFt0a{"axisDeltaEtaTpcFt0a", {32, -5.8, -2.6}, "delta eta axis, -5.8~-2.6 for TPC-FT0A,"};
146146
ConfigurableAxis axisDeltaEtaTpcFt0c{"axisDeltaEtaTpcFt0c", {32, 1.2, 4.2}, "delta eta axis, 1.2~4.2 for TPC-FT0C"};
147+
ConfigurableAxis axisDeltaEtaFt0aFt0c{"axisDeltaEtaFt0aFt0c", {32, 4.2, 8.2}, "delta eta axis, 4.2~8.2 for FT0A-FT0C"};
147148
ConfigurableAxis axisDeltaEtaTpcMft{"axisDeltaEtaTpcMft", {32, 1.3, 4.8}, "delta eta axis, 1.3~4.8 for TPC-MFT"};
148-
ConfigurableAxis axisDeltaEtaTpcFv0{"axisDeltaEtaTpcFv0", {32, -6.1, -1.2}, "delta eta axis for TPC-FV0 histograms"};
149+
ConfigurableAxis axisDeltaEtaTpcFv0{"axisDeltaEtaTpcFv0", {32, -1.2, -6.1}, "delta eta axis for TPC-FV0 histograms"};
149150
ConfigurableAxis axisEtaTrigger{"axisEtaTrigger", {VARIABLE_WIDTH, -3.3, -2.1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 3.5, 4.9}, "eta trigger axis for histograms"};
150151
ConfigurableAxis axisEtaAssoc{"axisEtaAssoc", {VARIABLE_WIDTH, -3.3, -2.1, -0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.8, 3.5, 4.9}, "eta associated axis for histograms"};
151152
ConfigurableAxis axisVtxMix{"axisVtxMix", {VARIABLE_WIDTH, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, "vertex axis for mixed event histograms"};
@@ -250,7 +251,7 @@ struct FlowDecorrelation {
250251

251252
LOGF(info, "Starting init");
252253
// Event Counter
253-
if ((doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameTpcMft || doprocessSameTpcFv0) && cfgUseAdditionalEventCut) {
254+
if ((doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameFt0aFt0c || doprocessSameTpcMft || doprocessSameTpcFv0) && cfgUseAdditionalEventCut) {
254255
registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}});
255256
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8");
256257
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup");
@@ -299,7 +300,7 @@ struct FlowDecorrelation {
299300

300301
std::string hCentTitle = "Centrality distribution, Estimator " + std::to_string(cfgCentEstimator);
301302
// Make histograms to check the distributions after cuts
302-
if (doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameTpcMft || doprocessSameTpcFv0) {
303+
if (doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameFt0aFt0c || doprocessSameTpcMft || doprocessSameTpcFv0) {
303304
registry.add("Phi", "Phi", {HistType::kTH1D, {axisPhi}});
304305
registry.add("Eta", "Eta", {HistType::kTH1D, {axisEta}});
305306
registry.add("EtaCorrected", "EtaCorrected", {HistType::kTH1D, {axisEta}});
@@ -332,6 +333,13 @@ struct FlowDecorrelation {
332333
registry.add("Assoc_amp_mixed_TPC_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}});
333334
registry.add("Trig_hist_TPC_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisEtaTrigger}}});
334335
}
336+
if (doprocessSameFt0aFt0c) {
337+
registry.add("deltaEta_deltaPhi_same_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0aFt0c}}); // check to see the delta eta and delta phi distribution
338+
registry.add("deltaEta_deltaPhi_mixed_FT0A_FT0C", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaFt0aFt0c}});
339+
registry.add("Assoc_amp_same_FT0A_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}});
340+
registry.add("Assoc_amp_mixed_FT0A_FT0C", "", {HistType::kTH2D, {axisChannelFt0aAxis, axisAmplitudeFt0a}});
341+
registry.add("Trig_hist_FT0A_FT0C", "", {HistType::kTHnSparseF, {{axisSample, axisVertex, axisEtaTrigger}}});
342+
}
335343
if (doprocessSameTpcMft) {
336344
registry.add("deltaEta_deltaPhi_same_TPC_MFT", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcMft}}); // check to see the delta eta and delta phi distribution
337345
registry.add("deltaEta_deltaPhi_mixed_TPC_MFT", "", {HistType::kTH2D, {axisDeltaPhi, axisDeltaEtaTpcMft}});
@@ -370,6 +378,13 @@ struct FlowDecorrelation {
370378
{axisDeltaPhi, "#Delta#varphi (rad)"},
371379
{axisDeltaEtaTpcFt0c, "#Delta#eta"}};
372380

381+
std::vector<AxisSpec> corrAxisFt0aFt0c = {{axisSample, "Sample"},
382+
{axisVertex, "z-vtx (cm)"},
383+
{axisEtaTrigger, "#eta"},
384+
{axisEtaAssoc, "#eta"},
385+
{axisDeltaPhi, "#Delta#varphi (rad)"},
386+
{axisDeltaEtaFt0aFt0c, "#Delta#eta"}};
387+
373388
std::vector<AxisSpec> corrAxisTpcMft = {{axisSample, "Sample"},
374389
{axisVertex, "z-vtx (cm)"},
375390
{axisEtaTrigger, "#eta"},
@@ -392,6 +407,10 @@ struct FlowDecorrelation {
392407
same.setObject(new CorrelationContainer("sameEvent_TPC_FT0C", "sameEvent_TPC_FT0C", corrAxisTpcFt0c, effAxis, userAxis));
393408
mixed.setObject(new CorrelationContainer("mixedEvent_TPC_FT0C", "mixedEvent_TPC_FT0C", corrAxisTpcFt0c, effAxis, userAxis));
394409
}
410+
if (doprocessSameFt0aFt0c) {
411+
same.setObject(new CorrelationContainer("sameEvent_FT0A_FT0C", "sameEvent_FT0A_FT0C", corrAxisFt0aFt0c, effAxis, userAxis));
412+
mixed.setObject(new CorrelationContainer("mixedEvent_FT0A_FT0C", "mixedEvent_FT0A_FT0C", corrAxisFt0aFt0c, effAxis, userAxis));
413+
}
395414
if (doprocessSameTpcMft) {
396415
same.setObject(new CorrelationContainer("sameEvent_TPC_MFT", "sameEvent_TPC_MFT", corrAxisTpcMft, effAxis, userAxis));
397416
mixed.setObject(new CorrelationContainer("mixedEvent_TPC_MFT", "mixedEvent_TPC_MFT", corrAxisTpcMft, effAxis, userAxis));
@@ -750,6 +769,60 @@ struct FlowDecorrelation {
750769
}
751770
}
752771

772+
template <CorrelationContainer::CFStep step, typename TFT0s>
773+
void fillCorrelationsFT0AFT0C(TFT0s const& ft0Trig, TFT0s const& ft0Assoc, float posZ, int multTrk, int system, float cent, float eventWeight)
774+
{
775+
if (system == SameEvent) {
776+
if (!cfgCentTableUnavailable)
777+
registry.fill(HIST("Centrality_used"), cent);
778+
registry.fill(HIST("Nch_used"), multTrk);
779+
}
780+
781+
int fSampleIndex = gRandom->Uniform(0, cfgSampleSize);
782+
783+
for (std::size_t iChA = 0; iChA < ft0Trig.channelA().size(); iChA++) {
784+
int channelIdA = 0;
785+
float amplA = 0.f;
786+
getChannel(ft0Trig, iChA, channelIdA, amplA, kFT0A);
787+
if ((cfgRejectFT0AInside && (channelIdA >= kFT0AInnerRingMin && channelIdA <= kFT0AInnerRingMax)) || (cfgRejectFT0AOutside && (channelIdA >= kFT0AOuterRingMin && channelIdA <= kFT0AOuterRingMax))) {
788+
continue;
789+
}
790+
791+
const double phiA = getPhiFT0(channelIdA, kFT0A);
792+
const double etaA = getEtaFT0(channelIdA, kFT0A);
793+
794+
if (system == SameEvent) {
795+
registry.fill(HIST("Trig_hist_FT0A_FT0C"), fSampleIndex, posZ, etaA, eventWeight * amplA);
796+
}
797+
798+
for (std::size_t iChC = 0; iChC < ft0Assoc.channelC().size(); iChC++) {
799+
int channelIdC = 0;
800+
float amplC = 0.f;
801+
getChannel(ft0Assoc, iChC, channelIdC, amplC, kFT0C);
802+
if ((cfgRejectFT0CInside && (channelIdC >= kFT0CInnerRingMin && channelIdC <= kFT0CInnerRingMax)) || (cfgRejectFT0COutside && (channelIdC >= kFT0COuterRingMin && channelIdC <= kFT0COuterRingMax))) {
803+
continue;
804+
}
805+
806+
const double phiC = getPhiFT0(channelIdC, kFT0C);
807+
const double etaC = getEtaFT0(channelIdC, kFT0C);
808+
809+
const float deltaPhi = RecoDecay::constrainAngle(phiA - phiC, -PIHalf);
810+
const float deltaEta = etaA - etaC;
811+
const float pairWeight = amplA * amplC * eventWeight;
812+
813+
if (system == SameEvent) {
814+
registry.fill(HIST("Assoc_amp_same_FT0A_FT0C"), channelIdC, amplC);
815+
same->getPairHist()->Fill(step, fSampleIndex, posZ, etaA, etaC, deltaPhi, deltaEta, pairWeight);
816+
registry.fill(HIST("deltaEta_deltaPhi_same_FT0A_FT0C"), deltaPhi, deltaEta, pairWeight);
817+
} else if (system == MixedEvent) {
818+
registry.fill(HIST("Assoc_amp_mixed_FT0A_FT0C"), channelIdC, amplC);
819+
mixed->getPairHist()->Fill(step, fSampleIndex, posZ, etaA, etaC, deltaPhi, deltaEta, pairWeight);
820+
registry.fill(HIST("deltaEta_deltaPhi_mixed_FT0A_FT0C"), deltaPhi, deltaEta, pairWeight);
821+
}
822+
}
823+
}
824+
}
825+
753826
template <CorrelationContainer::CFStep step, typename TTracks, typename TFT0s>
754827
void fillCorrelationsTPCFV0(TTracks tracks1, TFT0s const& fv0, float posZ, int system, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
755828
{
@@ -1112,6 +1185,109 @@ struct FlowDecorrelation {
11121185
}
11131186
PROCESS_SWITCH(FlowDecorrelation, processMixedTpcFt0c, "Process mixed events for TPC-FT0C correlation", false);
11141187

1188+
void processSameFt0aFt0c(FilteredCollisions::iterator const& collision, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&)
1189+
{
1190+
if (!collision.sel8())
1191+
return;
1192+
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
1193+
float cent = -1.;
1194+
float weightCent = 1.0f;
1195+
if (!cfgCentTableUnavailable) {
1196+
cent = getCentrality(collision);
1197+
}
1198+
if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), cent, true))
1199+
return;
1200+
if (!collision.has_foundFT0())
1201+
return;
1202+
loadAlignParam(bc.timestamp());
1203+
loadGain(bc);
1204+
loadCorrection(bc.timestamp());
1205+
if (!cfgCentTableUnavailable) {
1206+
getCentralityWeight(weightCent, cent);
1207+
registry.fill(HIST("Centrality"), cent);
1208+
registry.fill(HIST("CentralityWeighted"), cent, weightCent);
1209+
}
1210+
registry.fill(HIST("Nch"), tracks.size());
1211+
registry.fill(HIST("zVtx"), collision.posZ());
1212+
1213+
if (cfgSelCollByNch && (tracks.size() < cfgCutMultMin || tracks.size() >= cfgCutMultMax)) {
1214+
return;
1215+
}
1216+
if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent < cfgCutCentMin || cent >= cfgCutCentMax)) {
1217+
return;
1218+
}
1219+
1220+
registry.fill(HIST("eventcount"), SameEvent);
1221+
1222+
same->fillEvent(tracks.size(), CorrelationContainer::kCFStepReconstructed);
1223+
const auto& ft0 = collision.foundFT0();
1224+
fillCorrelationsFT0AFT0C<CorrelationContainer::kCFStepReconstructed>(ft0, ft0, collision.posZ(), tracks.size(), SameEvent, cent, weightCent);
1225+
}
1226+
PROCESS_SWITCH(FlowDecorrelation, processSameFt0aFt0c, "Process same event for FT0A-FT0C correlation", false);
1227+
1228+
void processMixedFt0aFt0c(FilteredCollisions const& collisions, FilteredTracks const& tracks, aod::FT0s const&, aod::BCsWithTimestamps const&)
1229+
{
1230+
auto getTracksSize = [&tracks, this](FilteredCollisions::iterator const& collision) {
1231+
auto associatedTracks = tracks.sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), this->cache);
1232+
auto mult = associatedTracks.size();
1233+
return mult;
1234+
};
1235+
1236+
using MixedBinning = FlexibleBinningPolicy<std::tuple<decltype(getTracksSize)>, aod::collision::PosZ, decltype(getTracksSize)>;
1237+
1238+
MixedBinning binningOnVtxAndMult{{getTracksSize}, {axisVtxMix, axisMultMix}, true};
1239+
1240+
auto tracksTuple = std::make_tuple(tracks, tracks);
1241+
Pair<FilteredCollisions, FilteredTracks, FilteredTracks, MixedBinning> pairs{binningOnVtxAndMult, cfgMixEventNumMin, -1, collisions, tracksTuple, &cache};
1242+
for (auto it = pairs.begin(); it != pairs.end(); it++) {
1243+
auto& [collision1, tracks1, collision2, tracks2] = *it;
1244+
if (!collision1.sel8() || !collision2.sel8())
1245+
continue;
1246+
1247+
if (cfgSelCollByNch && (tracks1.size() < cfgCutMultMin || tracks1.size() >= cfgCutMultMax))
1248+
continue;
1249+
1250+
if (cfgSelCollByNch && (tracks2.size() < cfgCutMultMin || tracks2.size() >= cfgCutMultMax))
1251+
continue;
1252+
1253+
float cent1 = -1;
1254+
float cent2 = -1;
1255+
if (!cfgCentTableUnavailable) {
1256+
cent1 = getCentrality(collision1);
1257+
cent2 = getCentrality(collision2);
1258+
}
1259+
if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), cent1, false))
1260+
continue;
1261+
if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), cent2, false))
1262+
continue;
1263+
1264+
if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent1 < cfgCutCentMin || cent1 >= cfgCutCentMax))
1265+
continue;
1266+
1267+
if (!cfgSelCollByNch && !cfgCentTableUnavailable && (cent2 < cfgCutCentMin || cent2 >= cfgCutCentMax))
1268+
continue;
1269+
1270+
if (!(collision1.has_foundFT0() && collision2.has_foundFT0()))
1271+
continue;
1272+
1273+
registry.fill(HIST("eventcount"), MixedEvent);
1274+
auto bc = collision1.bc_as<aod::BCsWithTimestamps>();
1275+
loadAlignParam(bc.timestamp());
1276+
loadCorrection(bc.timestamp());
1277+
float eventWeight = 1.0f;
1278+
if (cfgUseEventWeights) {
1279+
eventWeight = 1.0f / it.currentWindowNeighbours();
1280+
}
1281+
float weightCent = 1.0f;
1282+
if (!cfgCentTableUnavailable)
1283+
getCentralityWeight(weightCent, cent1);
1284+
const auto& ft0Trig = collision1.foundFT0();
1285+
const auto& ft0Assoc = collision2.foundFT0();
1286+
fillCorrelationsFT0AFT0C<CorrelationContainer::kCFStepReconstructed>(ft0Trig, ft0Assoc, collision1.posZ(), tracks1.size(), MixedEvent, cent1, eventWeight * weightCent);
1287+
}
1288+
}
1289+
PROCESS_SWITCH(FlowDecorrelation, processMixedFt0aFt0c, "Process mixed events for FT0A-FT0C correlation", false);
1290+
11151291
template <CorrelationContainer::CFStep step, typename TTracks, typename TTracksAssoc>
11161292
void fillCorrelationsTPCMFT(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, float cent, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
11171293
{

0 commit comments

Comments
 (0)