diff --git a/PWGCF/TwoParticleCorrelations/Tasks/corrFit.cxx b/PWGCF/TwoParticleCorrelations/Tasks/corrFit.cxx index 15265a76dab..1e61e681202 100644 --- a/PWGCF/TwoParticleCorrelations/Tasks/corrFit.cxx +++ b/PWGCF/TwoParticleCorrelations/Tasks/corrFit.cxx @@ -16,6 +16,7 @@ #include "PWGCF/Core/CorrelationContainer.h" #include "Common/CCDB/EventSelectionParams.h" +#include "Common/CCDB/RCTSelectionFlags.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/EventSelection.h" @@ -56,6 +57,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::aod::rctsel; using namespace constants::math; // define the filtered collisions and tracks @@ -69,6 +71,7 @@ struct CorrFit { O2_DEFINE_CONFIGURABLE(cfgZVtxCut, float, 10.0f, "Accepted z-vertex range") O2_DEFINE_CONFIGURABLE(cfgUseTransverseMomentum, bool, false, "Use transverse momentum for correlation container") O2_DEFINE_CONFIGURABLE(cfgQaCheck, bool, true, "Enable QA histograms for event selection") + O2_DEFINE_CONFIGURABLE(cfgStrictTrackCounter, bool, false, "Strict track counter for multiplicity correlation cut, counts only tracks that pass all cuts and are used in the correlation") struct : ConfigurableGroup{ O2_DEFINE_CONFIGURABLE(cfgPtCutMin, float, 0.2f, "minimum accepted track pT") O2_DEFINE_CONFIGURABLE(cfgPtCutMax, float, 10.0f, "maximum accepted track pT") @@ -216,26 +219,6 @@ struct CorrFit { // define global variables TRandom3* gRandom = new TRandom3(); - enum EventCutTypes { - kFilteredEvents = 0, - kAfterSel8, - kUseNoTimeFrameBorder, - kUseNoITSROFrameBorder, - kUseNoSameBunchPileup, - kUseGoodZvtxFT0vsPV, - kUseNoCollInTimeRangeStandard, - kUseGoodITSLayersAll, - kUseGoodITSLayer0123, - kUseNoCollInRofStandard, - kUseNoHighMultCollInPrevRof, - kUseOccupancy, - kUseMultCorrCut, - kUseT0AV0ACut, - kUseVertexITSTPC, - kUseTVXinTRD, - kNEventCuts - }; - enum EventType { SameEvent = 1, MixedEvent = 3 @@ -246,26 +229,11 @@ struct CorrFit { kFT0C = 1 }; - enum DetectorChannels { - kFT0AInnerRingMin = 0, - kFT0AInnerRingMax = 31, - kFT0AOuterRingMin = 32, - kFT0AOuterRingMax = 95, - kFT0CInnerRingMin = 96, - kFT0CInnerRingMax = 143, - kFT0COuterRingMin = 144, - kFT0COuterRingMax = 207 - }; - - std::array, 16> eventCuts; + RCTFlagsChecker rctChecker{"CBT"}; void init(InitContext&) { - const AxisSpec axisPhi{72, 0.0, constants::math::TwoPI, "#varphi"}; - const AxisSpec axisEta{40, -1., 1., "#eta"}; - const AxisSpec axisEtaFull{90, -4., 5., "#eta"}; - ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); @@ -274,6 +242,9 @@ struct CorrFit { LOGF(info, "Starting init"); if (doprocessSameFt0aFt0c || doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameTPC) { + registry.add("hEventCountRct", "Number of Event;; Count", {HistType::kTH1D, {{2, 0, 2}}}); + registry.get(HIST("hEventCountRct"))->GetXaxis()->SetBinLabel(1, "rct fail"); + registry.get(HIST("hEventCountRct"))->GetXaxis()->SetBinLabel(2, "rct pass"); registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{13, 0, 13}}}); registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8"); registry.get(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup"); @@ -291,7 +262,7 @@ struct CorrFit { } if ((doprocessSameFt0aFt0c || doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameTPC) && cfgQaCheck) { - registry.add("hPassedEventSelection", "Number of Event;; Count", {HistType::kTH1D, {{13, 0, 13}}}); + registry.add("hPassedEventSelection", "Number of Event;; Count", {HistType::kTH1D, {{12, 0, 12}}}); registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(1, "all tracks"); registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(2, "after sel8"); registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(3, "kNoSameBunchPileup"); @@ -304,7 +275,6 @@ struct CorrFit { registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(10, "kNoCollInRofStandard"); registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(11, "kNoHighMultCollInPrevRof"); registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(12, "occupancy"); - registry.get(HIST("hPassedEventSelection"))->GetXaxis()->SetBinLabel(13, "cfgEvSelV0AT0ACut"); } if (doprocessSameTPC || doprocessSameFt0aFt0c || doprocessSameTpcFt0a || doprocessSameTpcFt0c) { @@ -405,9 +375,23 @@ struct CorrFit { LOGF(info, "End of init"); } + template + bool eventRct(TCollision const& collision, const bool fillCounter) + { + if (!rctChecker(collision)) { + if (fillCounter) + registry.fill(HIST("hEventCountRct"), 0.5); + + return 0; + } + if (fillCounter) + registry.fill(HIST("hEventCountRct"), 1.5); + + return 1; + } template - bool eventSelected(TCollision collision, const int multTrk, const bool fillCounter) + bool eventSelected(TCollision const& collision, const int multTrk, const bool fillCounter) { registry.fill(HIST("hEventCountSpecific"), 0.5); if (cfgEventSelection.cfgEvSelkNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { @@ -505,7 +489,7 @@ struct CorrFit { } template - void eventSelectedIndividually(TCollision collision) + void eventSelectedIndividually(TCollision const& collision) { registry.fill(HIST("hPassedEventSelection"), 0.5); @@ -549,6 +533,11 @@ struct CorrFit { if (collision.selection_bit(o2::aod::evsel::kNoHighMultCollInPrevRof)) { registry.fill(HIST("hPassedEventSelection"), 10.5); } + + auto occupancy = collision.trackOccupancyInTimeRange(); + if (cfgEventSelection.cfgEvSelOccupancy && (occupancy < cfgEventSelection.cfgCutOccupancyLow || occupancy > cfgEventSelection.cfgCutOccupancyHigh)) { + registry.fill(HIST("hPassedEventSelection"), 11.5); + } } double getPhiFT0(uint64_t chno, int i) @@ -591,13 +580,13 @@ struct CorrFit { } template - bool trackSelected(TTrack track) + bool trackSelected(TTrack const& track) { return ((track.tpcNClsFound() >= cfgTrackCuts.cfgCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgTrackCuts.cfgCutTPCCrossedRows) && (track.itsNCls() >= cfgTrackCuts.cfgCutITSclu)); } template - bool trackSelectedSystematics(TTrack track) + bool trackSelectedSystematics(TTrack const& track) { return ((track.tpcNClsFound() >= cfgSystematics.cfgSystematicsCutTPCclu) && (track.tpcNClsCrossedRows() >= cfgSystematics.cfgSystematicsCutTPCCrossedRows) && (track.itsNCls() >= cfgSystematics.cfgSystematicsCutITSclu)); } @@ -752,25 +741,21 @@ struct CorrFit { } template - void fillCorrelationsTPCFT0(TTracks tracks1, TFT0s const& ft0, float posZ, int system, int corType, float multiplicity, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillCorrelationsTPCFT0(TTracks tracks1, TFT0s const& ft0, float posZ, int system, int multiplicity, int corType, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { - if (system == SameEvent) { - registry.fill(HIST("Nch"), multiplicity); - } - int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); float triggerWeight = 1.0f; // loop over all tracks for (auto const& track1 : tracks1) { + if (!trackSelected(track1)) + continue; + if (cfgSystematics.cfgSystematicsVariation) { if (!trackSelectedSystematics(track1)) continue; - } else { - if (!trackSelected(track1)) - continue; } if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) @@ -806,12 +791,14 @@ struct CorrFit { if (system == SameEvent) { if (corType == kFT0A) { if (cfgQaCheck) { + registry.fill(HIST("Nch"), multiplicity); registry.fill(HIST("Assoc_amp_same_TPC_FT0A"), chanelid, ampl); registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0A"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } sameTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), multiplicity, deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } else if (corType == kFT0C) { if (cfgQaCheck) { + registry.fill(HIST("Nch"), multiplicity); registry.fill(HIST("Assoc_amp_same_TPC_FT0C"), chanelid, ampl); registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0C"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight); } @@ -861,10 +848,13 @@ struct CorrFit { } template - void fillCorrelationsFT0AFT0C(TFT0s const& ft0Col1, TFT0s const& ft0Col2, float posZ, int system, float multiplicity, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillCorrelationsFT0AFT0C(TFT0s const& ft0Col1, TFT0s const& ft0Col2, float posZ, int system, int multiplicity, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); + if (cfgQaCheck) { + registry.fill(HIST("Nch"), multiplicity); + } float triggerWeight = 1.0f; std::size_t channelASize = ft0Col1.channelA().size(); std::size_t channelCSize = ft0Col2.channelC().size(); @@ -907,7 +897,7 @@ struct CorrFit { } template - void fillCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, float multiplicity, int system, int magneticField) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms + void fillCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, int multiplicity, int magneticField) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms { int fSampleIndex = gRandom->Uniform(0, cfgSampleSize); @@ -917,12 +907,12 @@ struct CorrFit { // loop over all tracks for (auto const& track1 : tracks1) { + if (!trackSelected(track1)) + continue; + if (cfgSystematics.cfgSystematicsVariation) { if (!trackSelectedSystematics(track1)) continue; - } else { - if (!trackSelected(track1)) - continue; } if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ)) @@ -993,6 +983,9 @@ struct CorrFit { if (!collision.sel8()) return; + if (!eventRct(collision, true)) + return; + auto bc = collision.bc_as(); if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true)) @@ -1012,8 +1005,14 @@ struct CorrFit { fillYield(collision, tracks); + int multiplicity = tracks.size(); + + if (cfgStrictTrackCounter) { + trackCounter(tracks, multiplicity); + } + const auto& ft0 = collision.foundFT0(); - fillCorrelationsTPCFT0(tracks, ft0, collision.posZ(), SameEvent, kFT0A, tracks.size(), eventWeight); + fillCorrelationsTPCFT0(tracks, ft0, collision.posZ(), SameEvent, multiplicity, kFT0A, eventWeight); } PROCESS_SWITCH(CorrFit, processSameTpcFt0a, "Process same event for TPC-FT0 correlation", false); @@ -1038,6 +1037,9 @@ struct CorrFit { if (!collision1.sel8() || !collision2.sel8()) continue; + if (!eventRct(collision1, false) || !eventRct(collision2, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false)) continue; if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), false)) @@ -1053,8 +1055,14 @@ struct CorrFit { loadCorrection(bc.timestamp()); float eventWeight = 1.0f; + int multiplicity = tracks1.size(); + + if (cfgStrictTrackCounter) { + trackCounter(tracks1, multiplicity); + } + const auto& ft0 = collision2.foundFT0(); - fillCorrelationsTPCFT0(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0A, tracks1.size(), eventWeight); + fillCorrelationsTPCFT0(tracks1, ft0, collision1.posZ(), MixedEvent, multiplicity, kFT0A, eventWeight); } } PROCESS_SWITCH(CorrFit, processMixedTpcFt0a, "Process mixed events for TPC-FT0A correlation", false); @@ -1068,6 +1076,10 @@ struct CorrFit { if (!collision.sel8()) return; + + if (!eventRct(collision, true)) + return; + auto bc = collision.bc_as(); if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true)) @@ -1084,10 +1096,13 @@ struct CorrFit { const auto& ft0 = collision.foundFT0(); - int multiplicity = 0; - trackCounter(tracks, multiplicity); + int multiplicity = tracks.size(); - fillCorrelationsTPCFT0(tracks, ft0, collision.posZ(), SameEvent, kFT0C, multiplicity, 1.0f); + if (cfgStrictTrackCounter) { + trackCounter(tracks, multiplicity); + } + + fillCorrelationsTPCFT0(tracks, ft0, collision.posZ(), SameEvent, multiplicity, kFT0C, 1.0f); } PROCESS_SWITCH(CorrFit, processSameTpcFt0c, "Process same event for TPC-FT0C correlation", false); @@ -1111,6 +1126,9 @@ struct CorrFit { if (!collision1.sel8() || !collision2.sel8()) continue; + if (!eventRct(collision1, false) || !eventRct(collision2, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false)) continue; @@ -1127,11 +1145,13 @@ struct CorrFit { float eventWeight = 1.0f; const auto& ft0 = collision2.foundFT0(); + int multiplicity = tracks1.size(); - int multiplicity = 0; - trackCounter(tracks1, multiplicity); + if (cfgStrictTrackCounter) { + trackCounter(tracks, multiplicity); + } - fillCorrelationsTPCFT0(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0C, multiplicity, eventWeight); + fillCorrelationsTPCFT0(tracks1, ft0, collision1.posZ(), MixedEvent, multiplicity, kFT0C, eventWeight); } } PROCESS_SWITCH(CorrFit, processMixedTpcFt0c, "Process mixed events for TPC-FT0C correlation", false); @@ -1145,6 +1165,10 @@ struct CorrFit { if (!collision.sel8()) return; + + if (!eventRct(collision, true)) + return; + auto bc = collision.bc_as(); if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true)) @@ -1159,11 +1183,17 @@ struct CorrFit { float eventWeight = 1.0f; const auto& ft0 = collision.foundFT0(); - int multiplicity = 0; - trackCounter(tracks, multiplicity); fillYield(collision, tracks); + registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin + + int multiplicity = tracks.size(); + + if (cfgStrictTrackCounter) { + trackCounter(tracks, multiplicity); + } + fillCorrelationsFT0AFT0C(ft0, ft0, collision.posZ(), SameEvent, multiplicity, eventWeight); } PROCESS_SWITCH(CorrFit, processSameFt0aFt0c, "Process same event for FT0A-FT0C correlation", true); @@ -1190,6 +1220,9 @@ struct CorrFit { if (!collision1.sel8() || !collision2.sel8()) continue; + if (!eventRct(collision1, false) || !eventRct(collision2, false)) + continue; + if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false)) continue; if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), false)) @@ -1206,9 +1239,13 @@ struct CorrFit { const auto& ft0Col1 = collision1.foundFT0(); const auto& ft0Col2 = collision2.foundFT0(); - int multiplicity = 0; + int multiplicity = tracks1.size(); - trackCounter(tracks, multiplicity); + if (cfgStrictTrackCounter) { + trackCounter(tracks1, multiplicity); + } + + registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin fillCorrelationsFT0AFT0C(ft0Col1, ft0Col2, collision1.posZ(), MixedEvent, multiplicity, eventWeight); } @@ -1221,6 +1258,8 @@ struct CorrFit { if (cfgQaCheck) { eventSelectedIndividually(collision); } + if (!eventRct(collision, true)) + return; if (!collision.sel8()) return; @@ -1232,12 +1271,15 @@ struct CorrFit { registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin - int multiplicity = 0; - trackCounter(tracks, multiplicity); - fillYield(collision, tracks); - fillCorrelations(tracks, tracks, collision.posZ(), multiplicity, SameEvent, getMagneticField(bc.timestamp())); + int multiplicity = tracks.size(); + + if (cfgStrictTrackCounter) { + trackCounter(tracks, multiplicity); + } + + fillCorrelations(tracks, tracks, collision.posZ(), SameEvent, multiplicity, getMagneticField(bc.timestamp())); } PROCESS_SWITCH(CorrFit, processSameTPC, "Process same event for TPC-TPC correlation", false); @@ -1258,6 +1300,10 @@ struct CorrFit { Pair pairs{binningOnVtxAndMult, cfgMinMixEventNum, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip for (auto it = pairs.begin(); it != pairs.end(); it++) { auto& [collision1, tracks1, collision2, tracks2] = *it; + + if (!eventRct(collision1, false) || !eventRct(collision2, false)) + continue; + if (!collision1.sel8() || !collision2.sel8()) continue; @@ -1268,10 +1314,13 @@ struct CorrFit { registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin - int multiplicity = 0; - trackCounter(tracks1, multiplicity); + int multiplicity = tracks1.size(); + + if (cfgStrictTrackCounter) { + trackCounter(tracks1, multiplicity); + } - fillCorrelations(tracks1, tracks2, collision1.posZ(), multiplicity, MixedEvent, getMagneticField(collision1.bc_as().timestamp())); + fillCorrelations(tracks1, tracks2, collision1.posZ(), MixedEvent, multiplicity, getMagneticField(collision1.bc_as().timestamp())); } } PROCESS_SWITCH(CorrFit, processMixedTPC, "Process mixed events for TPC-TPC correlation", false);