Skip to content

Commit 7254b41

Browse files
committed
personal developments
1 parent 468c78f commit 7254b41

File tree

9 files changed

+306
-29
lines changed

9 files changed

+306
-29
lines changed

PWGDQ/Core/CutsLibrary.cxx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,88 @@ AnalysisCompositeCut* o2::aod::dqcuts::GetCompositeCut(const char* cutName)
759759
return cut;
760760
}
761761

762+
// Sigurd D0 analysis track cuts
763+
if (!nameStr.compare("D0KaonTPC")) {
764+
cut->AddCut(GetAnalysisCut("kaonPIDnsigma"));
765+
return cut;
766+
}
767+
768+
if (!nameStr.compare("D0KaonTOF")) {
769+
cut->AddCut(GetAnalysisCut("kaonPID_TOF"));
770+
return cut;
771+
}
772+
773+
if (!nameStr.compare("D0KaonTOFIfHasTOF")) {
774+
AnalysisCompositeCut* cut = new AnalysisCompositeCut("kaon_nsigma", "kaon_nsigma", kFALSE);
775+
cut->AddCut(GetAnalysisCut("kaonPID_TOF"));
776+
cut->AddCut(GetAnalysisCut("noTOF"));
777+
return cut;
778+
}
779+
780+
if (!nameStr.compare("D0KaonTPCTOF")) {
781+
cut->AddCut(GetAnalysisCut("kaonPID_TPCnTOF"));
782+
return cut;
783+
}
784+
785+
if (!nameStr.compare("D0KaonTPCTOFIfHasTOF")) {
786+
AnalysisCompositeCut* cut_TOF = new AnalysisCompositeCut("cut_TOF", "cut_TOF", kFALSE);
787+
cut_TOF->AddCut(GetAnalysisCut("kaonPID_TOF"));
788+
cut_TOF->AddCut(GetAnalysisCut("noTOF"));
789+
790+
AnalysisCompositeCut* cut_TPC = new AnalysisCompositeCut("cut_noHasTOF", "cut_noHasTOF", kTRUE);
791+
cut_TPC->AddCut(GetAnalysisCut("kaonPIDnsigma"));
792+
793+
AnalysisCompositeCut* cut = new AnalysisCompositeCut("kaon_nsigma", "kaon_nsigma", kTRUE);
794+
cut->AddCut(cut_TOF);
795+
cut->AddCut(cut_TPC);
796+
return cut;
797+
}
798+
799+
if (!nameStr.compare("D0CommonTrackCuts")) {
800+
cut->AddCut(GetAnalysisCut("openEtaSel")); // |eta| < 0.9
801+
cut->AddCut(GetAnalysisCut("muonLowPt")); // pT > 0.5 GeV
802+
cut->AddCut(GetAnalysisCut("ITSibany"));
803+
cut->AddCut(GetAnalysisCut("pionQuality")); // TPC nCls > 50
804+
cut->AddCut(GetAnalysisCut("PrimaryTrack_DCAz")); // |DCAz| < 0.3 cm
805+
cut->AddCut(GetAnalysisCut("TPCchi2_4")); // TPCchi2 < 4
806+
return cut;
807+
}
808+
809+
if (!nameStr.compare("D0CommonTrackCutsEta")) {
810+
cut->AddCut(GetAnalysisCut("openEtaSel")); // |eta| < 0.9
811+
return cut;
812+
}
813+
814+
if (!nameStr.compare("D0CommonTrackCutsPt")) {
815+
cut->AddCut(GetAnalysisCut("muonLowPt")); // pT > 0.5 GeV
816+
return cut;
817+
}
818+
819+
if (!nameStr.compare("D0CommonTrackCutsITSib")) {
820+
cut->AddCut(GetAnalysisCut("ITSibany"));
821+
return cut;
822+
}
823+
824+
if (!nameStr.compare("D0CommonTrackCutsTPCncls")) {
825+
cut->AddCut(GetAnalysisCut("pionQuality")); // TPC nCls > 50
826+
return cut;
827+
}
828+
829+
if (!nameStr.compare("D0CommonTrackCutsDCAz")) {
830+
cut->AddCut(GetAnalysisCut("PrimaryTrack_DCAz")); // |DCAz| < 3 cm
831+
return cut;
832+
}
833+
834+
if (!nameStr.compare("D0CommonTrackCutsTPCchi2")) {
835+
cut->AddCut(GetAnalysisCut("TPCchi2_4")); // TPCchi2 < 4
836+
return cut;
837+
}
838+
839+
if (!nameStr.compare("noTrackCut")) {
840+
return cut;
841+
}
842+
// --------------------------------------------------------------
843+
762844
if (!nameStr.compare("PIDCalib")) {
763845
cut->AddCut(GetAnalysisCut("PIDStandardKine")); // standard kine cuts usually are applied via Filter in the task
764846
cut->AddCut(GetAnalysisCut("electronStandardQuality"));
@@ -4566,6 +4648,11 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName)
45664648
return cut;
45674649
}
45684650

4651+
if (!nameStr.compare("TPCchi2_4")) {
4652+
cut->AddCut(VarManager::kTPCchi2, 0.0, 4.0);
4653+
return cut;
4654+
}
4655+
45694656
// List of 30 variations in ITS and TPC parameters
45704657
std::vector<double> cutVar_ITSchi2 = {6., 6., 5., 4., 4., 6., 6., 5., 4., 5., 4., 5., 6., 5., 6., 5., 6., 5., 5., 4., 6., 4., 6., 5., 6., 4., 4., 6., 4., 5.};
45714658
std::vector<double> cutVar_TPCchi2 = {5., 5., 4., 3., 5., 4., 5., 3., 5., 4., 5., 3., 3., 5., 4., 5., 3., 5., 5., 5., 3., 5., 5., 4., 3., 4., 5., 5., 5., 3.};
@@ -5593,6 +5680,11 @@ AnalysisCut* o2::aod::dqcuts::GetAnalysisCut(const char* cutName)
55935680
return cut;
55945681
}
55955682

5683+
if (!nameStr.compare("kaonPID_TOF")) {
5684+
cut->AddCut(VarManager::kTOFnSigmaKa, -3.0, 3.0);
5685+
return cut;
5686+
}
5687+
55965688
if (!nameStr.compare("kaonPIDnsigma700")) {
55975689
cut->AddCut(VarManager::kTPCnSigmaKa, -3.0, 3.0);
55985690
cut->AddCut(VarManager::kPin, 0.0, 0.7);

PWGDQ/Core/HistogramsLibrary.cxx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
3131
TString subGroupStr = subGroupName;
3232
subGroupStr.ToLower();
3333
if (!groupStr.CompareTo("event")) {
34+
hm->AddHistogram(histClass, "IsNoITSROFBorder", "Event is not in ITS ROF border", false, 2, -0.5, 1.5, VarManager::kIsNoITSROFBorder);
35+
hm->AddHistogram(histClass, "IsNoTFBorder", "Event is not in TF border", false, 2, -0.5, 1.5, VarManager::kIsNoTFBorder);
36+
hm->AddHistogram(histClass, "MCIsNoITSROFBorder", "MC event is not in ITS ROF border", false, 2, -0.5, 1.5, VarManager::kMCIsNoITSROFBorder);
37+
hm->AddHistogram(histClass, "MCIsNoTFBorder", "MC event is not in TF border", false, 2, -0.5, 1.5, VarManager::kMCIsNoTFBorder);
3438
if (!subGroupStr.Contains("generator")) {
3539
hm->AddHistogram(histClass, "VtxZ", "Vtx Z", false, 60, -15.0, 15.0, VarManager::kVtxZ);
3640
hm->AddHistogram(histClass, "VtxZ_Run", "Vtx Z", true, 1, -0.5, 0.5, VarManager::kRunNo, 60, -15.0, 15.0, VarManager::kVtxZ, 1, 0, 1, VarManager::kNothing, "", "", "", VarManager::kNothing, VarManager::kNothing, false, true);
@@ -205,6 +209,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
205209
hm->AddHistogram(histClass, "MCVtxZ_VtxX", "Vtx X vs Vtx Z", false, 60, -15.0, 15.0, VarManager::kMCVtxZ, 200, -0.2, 0.2, VarManager::kMCVtxX);
206210
hm->AddHistogram(histClass, "MCVtxX_VtxY", "Vtx X vs Vtx Y", false, 200, 15.0, 15.0, VarManager::kMCVtxZ, 200, -0.2, 0.2, VarManager::kMCVtxY);
207211
hm->AddHistogram(histClass, "MCImpPar", "MC impact param", false, 20, 0.0, 20.0, VarManager::kMCEventImpParam);
212+
hm->AddHistogram(histClass, "MCTime", "MC time", false, 200, -1.0, 1.0, VarManager::kMCEventTime);
208213
}
209214
if (subGroupStr.Contains("subgen")) {
210215
hm->AddHistogram(histClass, "SubGenID", "SubGenerator ID", false, 11, -0.5, 10.5, VarManager::kMCEventSubGeneratorId);
@@ -920,10 +925,10 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
920925
hm->AddHistogram(histClass, "hMCPhi", "", false, 100, -TMath::Pi(), TMath::Pi(), VarManager::kMCPhi);
921926
}
922927
if (!groupStr.CompareTo("mctruth_track")) {
923-
hm->AddHistogram(histClass, "PtMC", "MC pT", false, 200, 0.0, 20.0, VarManager::kMCPt);
924-
hm->AddHistogram(histClass, "EtaMC", "MC #eta", false, 50, -5.0, 5.0, VarManager::kMCEta);
925-
hm->AddHistogram(histClass, "PhiMC", "MC #phi", false, 50, -6.3, 6.3, VarManager::kMCPhi);
926-
hm->AddHistogram(histClass, "YMC", "MC y", false, 50, -5.0, 5.0, VarManager::kMCY);
928+
hm->AddHistogram(histClass, "PtMC", "MC pT", false, 2000, 0.0, 20.0, VarManager::kMCPt);
929+
hm->AddHistogram(histClass, "EtaMC", "MC #eta", false, 500, -5.0, 5.0, VarManager::kMCEta);
930+
hm->AddHistogram(histClass, "PhiMC", "MC #phi", false, 500, -6.3, 6.3, VarManager::kMCPhi);
931+
hm->AddHistogram(histClass, "YMC", "MC y", false, 500, -5.0, 5.0, VarManager::kMCY);
927932
hm->AddHistogram(histClass, "CentFT0CMC", "MC Cent. FT0C", false, 18, 0., 90., VarManager::kCentFT0C);
928933
hm->AddHistogram(histClass, "PtMC_YMC", "MC pT vs MC y", false, 120, 0.0, 30.0, VarManager::kMCPt, 1000, -5.0, 5.0, VarManager::kMCY);
929934
hm->AddHistogram(histClass, "EtaMC_PtMC", "", false, 40, -2.0, 2.0, VarManager::kMCEta, 200, 0.0, 20.0, VarManager::kMCPt);
@@ -933,6 +938,7 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
933938
}
934939

935940
if (!groupStr.CompareTo("pair")) {
941+
hm->AddHistogram(histClass, "Pt", "", false, 2000, 0.0, 20., VarManager::kPt);
936942
if (subGroupStr.Contains("cepf")) {
937943
hm->AddHistogram(histClass, "Mass", "", false, 300, 0.0, 12.0, VarManager::kMass);
938944
hm->AddHistogram(histClass, "Mass_Pt", "", false, 300, 0.0, 12.0, VarManager::kMass, 10, 0.0, 20.0, VarManager::kPt);
@@ -947,7 +953,6 @@ void o2::aod::dqhistograms::DefineHistograms(HistogramManager* hm, const char* h
947953
if (subGroupStr.Contains("barrel")) {
948954
hm->AddHistogram(histClass, "Mass", "", false, 500, 0.0, 5.0, VarManager::kMass);
949955
hm->AddHistogram(histClass, "Mass_HighRange", "", false, 375, 0.0, 15.0, VarManager::kMass);
950-
hm->AddHistogram(histClass, "Pt", "", false, 2000, 0.0, 20., VarManager::kPt);
951956
hm->AddHistogram(histClass, "Mass_Pt", "", false, 125, 0.0, 5.0, VarManager::kMass, 40, 0.0, 20.0, VarManager::kPt);
952957
double massBins[76];
953958
for (int i = 0; i < 76; i++) {

PWGDQ/Core/MCSignalLibrary.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ MCSignal* o2::aod::dqmcsignals::GetMCSignal(const char* name)
8787
signal = new MCSignal(name, "Primary Kaons", {prong}, {-1}); // define the signal using the full constructor
8888
return signal;
8989
}
90+
if (!nameStr.compare("kaon")) {
91+
MCProng prong(1, {321}, {true}, {false}, {0}, {0}, {false}); // define 1-generation prong using the full constructor
92+
signal = new MCSignal(name, "Inclusive kaons", {prong}, {-1}); // define the signal using the full constructor
93+
return signal;
94+
}
9095
if (!nameStr.compare("protonPrimary")) {
9196
MCProng prong(1, {2212}, {true}, {false}, {0}, {0}, {false}); // define 1-generation prong using the full constructor
9297
prong.SetSourceBit(0, MCProng::kPhysicalPrimary); // set source to be ALICE primary particles

PWGDQ/Core/VarManager.cxx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ void VarManager::SetDefaultVarNames()
227227
fgVariableUnits[kMultDimuonsME] = "";
228228
fgVariableNames[kCentFT0C] = "Centrality FT0C";
229229
fgVariableUnits[kCentFT0C] = "%";
230+
fgVariableNames[kIsNoTFBorder] = "Is not TF border";
231+
fgVariableUnits[kIsNoTFBorder] = "";
232+
fgVariableNames[kIsNoITSROFBorder] = "Is not ITS ROF border";
233+
fgVariableUnits[kIsNoITSROFBorder] = "";
230234
fgVariableNames[kMCEventGeneratorId] = "MC Generator ID";
231235
fgVariableNames[kMCEventSubGeneratorId] = "MC SubGenerator ID";
232236
fgVariableNames[kMCVtxX] = "MC Vtx X";
@@ -243,6 +247,10 @@ void VarManager::SetDefaultVarNames()
243247
fgVariableUnits[kMCEventTime] = ""; // TODO: add proper unit
244248
fgVariableUnits[kMCEventWeight] = "";
245249
fgVariableUnits[kMCEventImpParam] = "b";
250+
fgVariableNames[kMCIsNoTFBorder] = "MC Is not TF border";
251+
fgVariableUnits[kMCIsNoTFBorder] = "";
252+
fgVariableNames[kMCIsNoITSROFBorder] = "MC Is not ITS ROF border";
253+
fgVariableUnits[kMCIsNoITSROFBorder] = "";
246254
fgVariableNames[kTwoEvPosZ1] = "vtx-z_{1}";
247255
fgVariableUnits[kTwoEvPosZ1] = "cm";
248256
fgVariableNames[kTwoEvPosZ2] = "vtx-z_{2}";
@@ -1075,6 +1083,8 @@ void VarManager::SetDefaultVarNames()
10751083
fgVarNamesMap["kIsNoTFBorder"] = kIsNoTFBorder;
10761084
fgVarNamesMap["kIsNoITSROFBorder"] = kIsNoITSROFBorder;
10771085
fgVarNamesMap["kIsNoITSROFBorderRecomputed"] = kIsNoITSROFBorderRecomputed;
1086+
fgVarNamesMap["kMCIsNoITSROFBorder"] = kMCIsNoITSROFBorder;
1087+
fgVarNamesMap["kMCIsNoTFBorder"] = kMCIsNoTFBorder;
10781088
fgVarNamesMap["kIsNoSameBunch"] = kIsNoSameBunch;
10791089
fgVarNamesMap["kIsGoodZvtxFT0vsPV"] = kIsGoodZvtxFT0vsPV;
10801090
fgVarNamesMap["kIsVertexITSTPC"] = kIsVertexITSTPC;

PWGDQ/Core/VarManager.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ class VarManager : public TObject
276276
kMCEventTime,
277277
kMCEventWeight,
278278
kMCEventImpParam,
279+
kMCIsNoITSROFBorder,
280+
kMCIsNoTFBorder,
279281
kQ1ZNAX,
280282
kQ1ZNAY,
281283
kQ1ZNCX,
@@ -1875,6 +1877,10 @@ void VarManager::FillEvent(T const& event, float* values)
18751877
values[kMCEventTime] = event.t();
18761878
values[kMCEventWeight] = event.weight();
18771879
values[kMCEventImpParam] = event.impactParameter();
1880+
1881+
// auto bc = event.template bc_as<o2::aod::BC>();
1882+
// uint16_t bcInITSROF = (bc.globalBC() + 3564 - fgITSROFbias) % fgITSROFlength;
1883+
// values[kMCIsNoITSROFBorder] = bcInITSROF > fgITSROFBorderMarginLow && bcInITSROF < fgITSROFlength - fgITSROFBorderMarginHigh ? 1.0 : 0.0;
18781884
}
18791885

18801886
if constexpr ((fillMap & ReducedEventMC) > 0) {
@@ -1886,6 +1892,9 @@ void VarManager::FillEvent(T const& event, float* values)
18861892
values[kMCEventTime] = event.t();
18871893
values[kMCEventWeight] = event.weight();
18881894
values[kMCEventImpParam] = event.impactParameter();
1895+
// TODO: Fill kMCIsNoITSROFBorder and kMCIsNoTFBorder at reduced truth level
1896+
values[kMCIsNoTFBorder] = event.selection_bit(o2::aod::evsel::kNoTimeFrameBorder);
1897+
values[kMCIsNoITSROFBorder] = event.selection_bit(o2::aod::evsel::kNoITSROFrameBorder);
18891898
}
18901899

18911900
if constexpr ((fillMap & EventFilter) > 0 || (fillMap & RapidityGapFilter) > 0) {

PWGDQ/DataModel/ReducedInfoTables.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ DECLARE_SOA_TABLE(ReducedEventsInfo, "AOD", "REDUCEVENTINFO", //! Main event i
210210
// can be constructed and the same data model could be used
211211
DECLARE_SOA_TABLE(ReducedMCEvents, "AOD", "REDUCEDMCEVENT", //! Event level MC truth information
212212
o2::soa::Index<>,
213+
evsel::Selection,
213214
mccollision::GeneratorsID, reducedevent::MCPosX, reducedevent::MCPosY, reducedevent::MCPosZ,
214215
mccollision::T, mccollision::Weight, mccollision::ImpactParameter);
215216

PWGDQ/TableProducer/tableMakerMC.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ struct TableMakerMC {
460460
eventInfo(collision.globalIndex());
461461
// make an entry for this MC event only if it was not already added to the table
462462
if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) {
463-
eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
463+
eventMC(0, mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
464464
mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter());
465465
fEventLabels[mcCollision.globalIndex()] = fCounters[1];
466466
fCounters[1]++;
@@ -1095,7 +1095,7 @@ struct TableMakerMC {
10951095
eventInfo(collision.globalIndex());
10961096
// make an entry for this MC event only if it was not already added to the table
10971097
if (!(fEventLabels.find(mcCollision.globalIndex()) != fEventLabels.end())) {
1098-
eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
1098+
eventMC(0, mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
10991099
mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter());
11001100
fEventLabels[mcCollision.globalIndex()] = fCounters[1];
11011101
fCounters[1]++;

PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
// The skimmed MC stack includes the MC truth particles corresponding to the list of user specified MC signals (see MCsignal.h)
1717
// and the MC truth particles corresponding to the reconstructed tracks selected by the specified track cuts on reconstructed data.
1818

19+
#include <DataFormatsParameters/AggregatedRunInfo.h>
20+
#include <ITSMFTBase/DPLAlpideParam.h>
21+
#include <fairlogger/Logger.h>
1922
#include <cstdint>
2023
#include <iostream>
2124
#include <map>
@@ -238,6 +241,18 @@ struct TableMakerMC {
238241

239242
std::map<uint32_t, bool> fBestMatch;
240243

244+
int lastRun = -1;
245+
int64_t bcSOR = -1; // global bc of the start of run
246+
uint64_t sorTimestamp = 0; // default SOR timestamp
247+
uint64_t eorTimestamp = 1; // default EOR timestamp
248+
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
249+
int rofOffset = -1; // ITS ROF offset, in bc
250+
int rofLength = -1; // ITS ROF length, in bc
251+
int mITSROFrameStartBorderMargin = 10; // default value
252+
int mITSROFrameEndBorderMargin = 20; // default value
253+
int mTimeFrameStartBorderMargin = 300; // default value
254+
int mTimeFrameEndBorderMargin = 4000; // default value
255+
241256
void init(o2::framework::InitContext& context)
242257
{
243258
// Check whether barrel or muon are enabled
@@ -427,14 +442,62 @@ struct TableMakerMC {
427442
// one has to do a mapping of the old vs new indices so that the skimmed labels are properly updated.
428443
VarManager::ResetValues(0, VarManager::kNVars);
429444

445+
auto firstBc = mcCollisions.begin().template bc_as<BCsWithTimestamps>();
446+
int run = firstBc.runNumber();
447+
// Update run information if necessary
448+
if (run != lastRun) {
449+
lastRun = run;
450+
if (run < 500000) {
451+
LOGF(fatal, "run < run3min (500000), unanchored Run3 MC");
452+
}
453+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
454+
sorTimestamp = runInfo.sor;
455+
eorTimestamp = runInfo.eor;
456+
// timestamp of the middle of the run used to access run-wise CCDB entries
457+
int64_t ts = sorTimestamp / 2 + eorTimestamp / 2;
458+
459+
auto alppar = fCCDB->getForTimeStamp<o2::itsmft::DPLAlpideParam<0>>("ITS/Config/AlpideParam", ts);
460+
rofOffset = alppar->roFrameBiasInBC;
461+
rofLength = alppar->roFrameLengthInBC;
462+
EventSelectionParams* par = fCCDB->getForTimeStamp<EventSelectionParams>("EventSelection/EventSelectionParams", ts);
463+
mITSROFrameStartBorderMargin = par->fITSROFrameStartBorderMargin;
464+
mITSROFrameEndBorderMargin = par->fITSROFrameEndBorderMargin;
465+
466+
bcSOR = runInfo.orbitSOR * o2::constants::lhc::LHCMaxBunches;
467+
nBCsPerTF = runInfo.orbitsPerTF * o2::constants::lhc::LHCMaxBunches;
468+
}
469+
430470
// Loop over MC collisions
431471
for (auto& mcCollision : mcCollisions) {
472+
uint64_t evSel = 0;
473+
// Get bc, calculate and fill TFborder and ITSROFborder quantities
474+
auto bc = mcCollision.template bc_as<BCsWithTimestamps>();
475+
uint64_t globalBC = bc.globalBC();
476+
// check if bc is far from start and end of the ITS RO Frame border
477+
uint16_t bcInITSROF = (globalBC + o2::constants::lhc::LHCMaxBunches - rofOffset) % rofLength;
478+
LOGF(debug, "bcInITSROF=%d", bcInITSROF);
479+
if (bcInITSROF > mITSROFrameStartBorderMargin && bcInITSROF < rofLength - mITSROFrameEndBorderMargin) {
480+
VarManager::fgValues[VarManager::kMCIsNoITSROFBorder] = 1.0;
481+
evSel |= BIT(evsel::EventSelectionFlags::kNoITSROFrameBorder);
482+
} else {
483+
VarManager::fgValues[VarManager::kMCIsNoITSROFBorder] = 0.0;
484+
}
485+
// check if bc is far from the Time Frame borders
486+
int64_t bcInTF = (globalBC - bcSOR) % nBCsPerTF;
487+
LOGF(debug, "bcInTF=%d", bcInTF);
488+
if (bcInTF > mTimeFrameStartBorderMargin && bcInTF < nBCsPerTF - mTimeFrameEndBorderMargin) {
489+
VarManager::fgValues[VarManager::kMCIsNoTFBorder] = 1;
490+
evSel |= BIT(evsel::EventSelectionFlags::kNoTimeFrameBorder);
491+
} else {
492+
VarManager::fgValues[VarManager::kMCIsNoTFBorder] = 0;
493+
}
494+
432495
// Get MC collision information into the VarManager
433496
VarManager::FillEvent<VarManager::ObjTypes::CollisionMC>(mcCollision);
434497
// Fill histograms
435498
fHistMan->FillHistClass("Event_MCTruth", VarManager::fgValues);
436499
// Create the skimmed table entry for this collision
437-
eventMC(mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
500+
eventMC(evSel, mcCollision.generatorsID(), mcCollision.posX(), mcCollision.posY(), mcCollision.posZ(),
438501
mcCollision.t(), mcCollision.weight(), mcCollision.impactParameter());
439502
}
440503
}
@@ -559,12 +622,15 @@ struct TableMakerMC {
559622
}
560623
(reinterpret_cast<TH2I*>(fStatsList->At(0)))->Fill(1.0, static_cast<float>(o2::aod::evsel::kNsel));
561624

625+
// For MC, don't reject the event if it didn't pass the rapidity gap selection, we still need it in the reduced tables for efficiencies!
626+
/*
562627
// apply the event filter
563628
if constexpr ((TEventFillMap & VarManager::ObjTypes::RapidityGapFilter) > 0) {
564629
if (!collision.eventFilter()) {
565630
continue;
566631
}
567632
}
633+
*/
568634

569635
auto bc = collision.template bc_as<BCsWithTimestamps>();
570636
// store the selection decisions

0 commit comments

Comments
 (0)