Skip to content

Commit 056aa4d

Browse files
committed
added RCT event selection with Qa plots
1 parent 5b33415 commit 056aa4d

1 file changed

Lines changed: 74 additions & 66 deletions

File tree

PWGCF/TwoParticleCorrelations/Tasks/corrFit.cxx

Lines changed: 74 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "PWGMM/Mult/DataModel/bestCollisionTable.h"
1818

1919
#include "Common/CCDB/EventSelectionParams.h"
20+
#include "Common/CCDB/RCTSelectionFlags.h"
2021
#include "Common/Core/RecoDecay.h"
2122
#include "Common/DataModel/Centrality.h"
2223
#include "Common/DataModel/EventSelection.h"
@@ -59,6 +60,7 @@
5960
using namespace o2;
6061
using namespace o2::framework;
6162
using namespace o2::framework::expressions;
63+
using namespace o2::aod::rctsel;
6264
using namespace constants::math;
6365

6466
// define the filtered collisions and tracks
@@ -219,26 +221,6 @@ struct CorrFit {
219221
// define global variables
220222
TRandom3* gRandom = new TRandom3();
221223

222-
enum EventCutTypes {
223-
kFilteredEvents = 0,
224-
kAfterSel8,
225-
kUseNoTimeFrameBorder,
226-
kUseNoITSROFrameBorder,
227-
kUseNoSameBunchPileup,
228-
kUseGoodZvtxFT0vsPV,
229-
kUseNoCollInTimeRangeStandard,
230-
kUseGoodITSLayersAll,
231-
kUseGoodITSLayer0123,
232-
kUseNoCollInRofStandard,
233-
kUseNoHighMultCollInPrevRof,
234-
kUseOccupancy,
235-
kUseMultCorrCut,
236-
kUseT0AV0ACut,
237-
kUseVertexITSTPC,
238-
kUseTVXinTRD,
239-
kNEventCuts
240-
};
241-
242224
enum EventType {
243225
SameEvent = 1,
244226
MixedEvent = 3
@@ -249,26 +231,11 @@ struct CorrFit {
249231
kFT0C = 1
250232
};
251233

252-
enum DetectorChannels {
253-
kFT0AInnerRingMin = 0,
254-
kFT0AInnerRingMax = 31,
255-
kFT0AOuterRingMin = 32,
256-
kFT0AOuterRingMax = 95,
257-
kFT0CInnerRingMin = 96,
258-
kFT0CInnerRingMax = 143,
259-
kFT0COuterRingMin = 144,
260-
kFT0COuterRingMax = 207
261-
};
262-
263-
std::array<std::array<int, 1>, 16> eventCuts;
234+
RCTFlagsChecker rctChecker{"CBT"};
264235

265236
void init(InitContext&)
266237
{
267238

268-
const AxisSpec axisPhi{72, 0.0, constants::math::TwoPI, "#varphi"};
269-
const AxisSpec axisEta{40, -1., 1., "#eta"};
270-
const AxisSpec axisEtaFull{90, -4., 5., "#eta"};
271-
272239
ccdb->setURL("http://alice-ccdb.cern.ch");
273240
ccdb->setCaching(true);
274241
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
@@ -277,6 +244,9 @@ struct CorrFit {
277244
LOGF(info, "Starting init");
278245

279246
if (doprocessSameFt0aFt0c || doprocessSameTpcFt0a || doprocessSameTpcFt0c || doprocessSameTPC) {
247+
registry.add("hEventCountRct", "Number of Event;; Count", {HistType::kTH1D, {{2, 0, 2}}});
248+
registry.get<TH1>(HIST("hEventCountRct"))->GetXaxis()->SetBinLabel(1, "rct fail");
249+
registry.get<TH1>(HIST("hEventCountRct"))->GetXaxis()->SetBinLabel(2, "rct pass");
280250
registry.add("hEventCountSpecific", "Number of Event;; Count", {HistType::kTH1D, {{13, 0, 13}}});
281251
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(1, "after sel8");
282252
registry.get<TH1>(HIST("hEventCountSpecific"))->GetXaxis()->SetBinLabel(2, "kNoSameBunchPileup");
@@ -408,6 +378,20 @@ struct CorrFit {
408378

409379
LOGF(info, "End of init");
410380
}
381+
template <typename TCollision>
382+
bool eventRct(TCollision collision, const bool fillCounter)
383+
{
384+
if (!rctChecker(collision)) {
385+
if (fillCounter)
386+
registry.fill(HIST("hEventCountRct"), 0.5);
387+
388+
return 0;
389+
}
390+
if (fillCounter)
391+
registry.fill(HIST("hEventCountRct"), 1.5);
392+
393+
return 1;
394+
}
411395

412396
template <typename TCollision>
413397
bool eventSelected(TCollision collision, const int multTrk, const bool fillCounter)
@@ -755,25 +739,24 @@ struct CorrFit {
755739
}
756740

757741
template <CorrelationContainer::CFStep step, typename TTracks, typename TFT0s>
758-
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
742+
void fillCorrelationsTPCFT0(TTracks tracks1, TFT0s const& ft0, float posZ, int system, int corType, float eventWeight) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
759743
{
760744

761-
if (system == SameEvent) {
762-
registry.fill(HIST("Nch"), multiplicity);
763-
}
764-
765745
int fSampleIndex = gRandom->Uniform(0, cfgSampleSize);
766746

747+
int multiplicity = 0;
748+
767749
float triggerWeight = 1.0f;
768750
// loop over all tracks
769751
for (auto const& track1 : tracks1) {
770752

753+
if (!trackSelected(track1))
754+
continue;
755+
multiplicity++;
756+
771757
if (cfgSystematics.cfgSystematicsVariation) {
772758
if (!trackSelectedSystematics(track1))
773759
continue;
774-
} else {
775-
if (!trackSelected(track1))
776-
continue;
777760
}
778761

779762
if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ))
@@ -809,12 +792,14 @@ struct CorrFit {
809792
if (system == SameEvent) {
810793
if (corType == kFT0A) {
811794
if (cfgQaCheck) {
795+
registry.fill(HIST("Nch"), multiplicity);
812796
registry.fill(HIST("Assoc_amp_same_TPC_FT0A"), chanelid, ampl);
813797
registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0A"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight);
814798
}
815799
sameTpcFt0a->getPairHist()->Fill(step, fSampleIndex, posZ, track1.pt(), multiplicity, deltaPhi, deltaEta, ampl * eventWeight * triggerWeight);
816800
} else if (corType == kFT0C) {
817801
if (cfgQaCheck) {
802+
registry.fill(HIST("Nch"), multiplicity);
818803
registry.fill(HIST("Assoc_amp_same_TPC_FT0C"), chanelid, ampl);
819804
registry.fill(HIST("deltaEta_deltaPhi_same_TPC_FT0C"), deltaPhi, deltaEta, ampl * eventWeight * triggerWeight);
820805
}
@@ -868,6 +853,9 @@ struct CorrFit {
868853
{
869854
int fSampleIndex = gRandom->Uniform(0, cfgSampleSize);
870855

856+
if (cfgQaCheck) {
857+
registry.fill(HIST("Nch"), multiplicity);
858+
}
871859
float triggerWeight = 1.0f;
872860
std::size_t channelASize = ft0Col1.channelA().size();
873861
std::size_t channelCSize = ft0Col2.channelC().size();
@@ -910,22 +898,26 @@ struct CorrFit {
910898
}
911899

912900
template <CorrelationContainer::CFStep step, typename TTracks, typename TTracksAssoc>
913-
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
901+
void fillCorrelations(TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, int magneticField) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
914902
{
915903

916904
int fSampleIndex = gRandom->Uniform(0, cfgSampleSize);
917905

906+
int multiplicity = 0;
907+
918908
float triggerWeight = 1.0f;
919909

920910
// loop over all tracks
921911
for (auto const& track1 : tracks1) {
922912

913+
if (!trackSelected(track1))
914+
continue;
915+
916+
multiplicity++;
917+
923918
if (cfgSystematics.cfgSystematicsVariation) {
924919
if (!trackSelectedSystematics(track1))
925920
continue;
926-
} else {
927-
if (!trackSelected(track1))
928-
continue;
929921
}
930922

931923
if (!getEfficiencyCorrection(triggerWeight, track1.eta(), track1.pt(), posZ))
@@ -996,6 +988,9 @@ struct CorrFit {
996988
if (!collision.sel8())
997989
return;
998990

991+
if (!eventRct(collision, true))
992+
return;
993+
999994
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
1000995

1001996
if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true))
@@ -1016,7 +1011,7 @@ struct CorrFit {
10161011
fillYield(collision, tracks);
10171012

10181013
const auto& ft0 = collision.foundFT0();
1019-
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks, ft0, collision.posZ(), SameEvent, kFT0A, tracks.size(), eventWeight);
1014+
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks, ft0, collision.posZ(), SameEvent, kFT0A, eventWeight);
10201015
}
10211016
PROCESS_SWITCH(CorrFit, processSameTpcFt0a, "Process same event for TPC-FT0 correlation", false);
10221017

@@ -1041,6 +1036,9 @@ struct CorrFit {
10411036
if (!collision1.sel8() || !collision2.sel8())
10421037
continue;
10431038

1039+
if (!eventRct(collision1, false) || !eventRct(collision2, false))
1040+
continue;
1041+
10441042
if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false))
10451043
continue;
10461044
if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), false))
@@ -1057,7 +1055,7 @@ struct CorrFit {
10571055
float eventWeight = 1.0f;
10581056

10591057
const auto& ft0 = collision2.foundFT0();
1060-
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0A, tracks1.size(), eventWeight);
1058+
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0A, eventWeight);
10611059
}
10621060
}
10631061
PROCESS_SWITCH(CorrFit, processMixedTpcFt0a, "Process mixed events for TPC-FT0A correlation", false);
@@ -1071,6 +1069,10 @@ struct CorrFit {
10711069

10721070
if (!collision.sel8())
10731071
return;
1072+
1073+
if (!eventRct(collision, true))
1074+
return;
1075+
10741076
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
10751077

10761078
if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true))
@@ -1087,10 +1089,7 @@ struct CorrFit {
10871089

10881090
const auto& ft0 = collision.foundFT0();
10891091

1090-
int multiplicity = 0;
1091-
trackCounter(tracks, multiplicity);
1092-
1093-
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks, ft0, collision.posZ(), SameEvent, kFT0C, multiplicity, 1.0f);
1092+
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks, ft0, collision.posZ(), SameEvent, kFT0C, 1.0f);
10941093
}
10951094
PROCESS_SWITCH(CorrFit, processSameTpcFt0c, "Process same event for TPC-FT0C correlation", false);
10961095

@@ -1114,6 +1113,9 @@ struct CorrFit {
11141113
if (!collision1.sel8() || !collision2.sel8())
11151114
continue;
11161115

1116+
if (!eventRct(collision1, false) || !eventRct(collision2, false))
1117+
continue;
1118+
11171119
if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false))
11181120
continue;
11191121

@@ -1131,10 +1133,7 @@ struct CorrFit {
11311133

11321134
const auto& ft0 = collision2.foundFT0();
11331135

1134-
int multiplicity = 0;
1135-
trackCounter(tracks1, multiplicity);
1136-
1137-
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0C, multiplicity, eventWeight);
1136+
fillCorrelationsTPCFT0<CorrelationContainer::kCFStepReconstructed>(tracks1, ft0, collision1.posZ(), MixedEvent, kFT0C, eventWeight);
11381137
}
11391138
}
11401139
PROCESS_SWITCH(CorrFit, processMixedTpcFt0c, "Process mixed events for TPC-FT0C correlation", false);
@@ -1148,6 +1147,10 @@ struct CorrFit {
11481147

11491148
if (!collision.sel8())
11501149
return;
1150+
1151+
if (!eventRct(collision, true))
1152+
return;
1153+
11511154
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
11521155

11531156
if (cfgUseAdditionalEventCut && !eventSelected(collision, tracks.size(), true))
@@ -1193,6 +1196,9 @@ struct CorrFit {
11931196
if (!collision1.sel8() || !collision2.sel8())
11941197
continue;
11951198

1199+
if (!eventRct(collision1, false) || !eventRct(collision2, false))
1200+
continue;
1201+
11961202
if (cfgUseAdditionalEventCut && !eventSelected(collision1, tracks1.size(), false))
11971203
continue;
11981204
if (cfgUseAdditionalEventCut && !eventSelected(collision2, tracks2.size(), false))
@@ -1213,6 +1219,8 @@ struct CorrFit {
12131219

12141220
trackCounter(tracks, multiplicity);
12151221

1222+
registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin
1223+
12161224
fillCorrelationsFT0AFT0C<CorrelationContainer::kCFStepReconstructed>(ft0Col1, ft0Col2, collision1.posZ(), MixedEvent, multiplicity, eventWeight);
12171225
}
12181226
}
@@ -1224,6 +1232,8 @@ struct CorrFit {
12241232
if (cfgQaCheck) {
12251233
eventSelectedIndividually(collision);
12261234
}
1235+
if (!eventRct(collision, true))
1236+
return;
12271237

12281238
if (!collision.sel8())
12291239
return;
@@ -1235,12 +1245,9 @@ struct CorrFit {
12351245

12361246
registry.fill(HIST("eventcount"), SameEvent); // because its same event i put it in the 1 bin
12371247

1238-
int multiplicity = 0;
1239-
trackCounter(tracks, multiplicity);
1240-
12411248
fillYield(collision, tracks);
12421249

1243-
fillCorrelations<CorrelationContainer::kCFStepReconstructed>(tracks, tracks, collision.posZ(), multiplicity, SameEvent, getMagneticField(bc.timestamp()));
1250+
fillCorrelations<CorrelationContainer::kCFStepReconstructed>(tracks, tracks, collision.posZ(), SameEvent, getMagneticField(bc.timestamp()));
12441251
}
12451252
PROCESS_SWITCH(CorrFit, processSameTPC, "Process same event for TPC-TPC correlation", false);
12461253

@@ -1261,6 +1268,10 @@ struct CorrFit {
12611268
Pair<FilteredCollisions, FilteredTracks, FilteredTracks, MixedBinning> pairs{binningOnVtxAndMult, cfgMinMixEventNum, -1, collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
12621269
for (auto it = pairs.begin(); it != pairs.end(); it++) {
12631270
auto& [collision1, tracks1, collision2, tracks2] = *it;
1271+
1272+
if (!eventRct(collision1, false) || !eventRct(collision2, false))
1273+
continue;
1274+
12641275
if (!collision1.sel8() || !collision2.sel8())
12651276
continue;
12661277

@@ -1271,10 +1282,7 @@ struct CorrFit {
12711282

12721283
registry.fill(HIST("eventcount"), MixedEvent); // fill the mixed event in the 3 bin
12731284

1274-
int multiplicity = 0;
1275-
trackCounter(tracks1, multiplicity);
1276-
1277-
fillCorrelations<CorrelationContainer::kCFStepReconstructed>(tracks1, tracks2, collision1.posZ(), multiplicity, MixedEvent, getMagneticField(collision1.bc_as<aod::BCsWithTimestamps>().timestamp()));
1285+
fillCorrelations<CorrelationContainer::kCFStepReconstructed>(tracks1, tracks2, collision1.posZ(), MixedEvent, getMagneticField(collision1.bc_as<aod::BCsWithTimestamps>().timestamp()));
12781286
}
12791287
}
12801288
PROCESS_SWITCH(CorrFit, processMixedTPC, "Process mixed events for TPC-TPC correlation", false);

0 commit comments

Comments
 (0)