2727#include " Framework/OutputObjHeader.h"
2828
2929#include " Common/CCDB/EventSelectionParams.h"
30+ #include " Common/CCDB/RCTSelectionFlags.h"
3031#include " EventFiltering/Zorro.h"
3132#include " EventFiltering/ZorroSummary.h"
3233#include " PWGLF/DataModel/mcCentrality.h"
@@ -82,6 +83,7 @@ namespace o2::hf_evsel
8283// event rejection types
8384enum EventRejection {
8485 None = 0 ,
86+ Rct,
8587 SoftwareTrigger,
8688 Centrality,
8789 Trigger,
@@ -110,6 +112,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel
110112{
111113 // Puts labels on the collision monitoring histogram.
112114 hRejection->GetXaxis ()->SetBinLabel (EventRejection::None + 1 , " All" );
115+ hRejection->GetXaxis ()->SetBinLabel (EventRejection::Rct + 1 , " RCT" );
113116 hRejection->GetXaxis ()->SetBinLabel (EventRejection::SoftwareTrigger + 1 , softwareTriggerLabel.data ());
114117 hRejection->GetXaxis ()->SetBinLabel (EventRejection::Centrality + 1 , " Centrality" );
115118 hRejection->GetXaxis ()->SetBinLabel (EventRejection::Trigger + 1 , " Trigger" );
@@ -155,6 +158,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
155158 o2::framework::Configurable<std::string> ccdbPathSoftwareTrigger{" ccdbPathSoftwareTrigger" , " Users/m/mpuccio/EventFiltering/OTS/Chunked/" , " ccdb path for ZORRO objects" };
156159 o2::framework::ConfigurableAxis th2ConfigAxisCent{" th2ConfigAxisCent" , {100 , 0 ., 100 .}, " " };
157160 o2::framework::ConfigurableAxis th2ConfigAxisOccupancy{" th2ConfigAxisOccupancy" , {14 , 0 , 14000 }, " " };
161+ o2::framework::Configurable<bool > requireGoodRct{" requireGoodRct" , false , " Flag to require good RCT" };
162+ o2::framework::Configurable<std::string> rctLabel{" rctLabel" , " CBT_hadronPID" , " RCT selection flag (CBT, CBT_hadronPID, CBT_electronPID, CCBT_calo, CBT_muon, CBT_muon_glo)" };
163+ o2::framework::Configurable<bool > rctCheckZDC{" rctCheckZDC" , false , " RCT flag to check whether the ZDC is present or not" };
164+ o2::framework::Configurable<bool > rctTreatLimitedAcceptanceAsBad{" rctTreatLimitedAcceptanceAsBad" , false , " RCT flag to reject events with limited acceptance for selected detectors" };
158165
159166 // histogram names
160167 static constexpr char NameHistCollisions[] = " hCollisions" ;
@@ -169,6 +176,9 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
169176 std::shared_ptr<TH1> hCollisions, hSelCollisionsCent, hPosZBeforeEvSel, hPosZAfterEvSel, hPosXAfterEvSel, hPosYAfterEvSel, hNumPvContributorsAfterSel;
170177 std::shared_ptr<TH2> hCollisionsCentOcc;
171178
179+ // util to retrieve the RCT info from CCDB
180+ o2::aod::rctsel::RCTFlagsChecker rctChecker;
181+
172182 // util to retrieve trigger mask in case of software triggers
173183 Zorro zorro;
174184 o2::framework::OutputObj<ZorroSummary> zorroSummary{" zorroSummary" };
@@ -197,6 +207,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
197207 }
198208 }
199209
210+ void initRctChecker () {
211+ rctChecker.init (rctLabel.value , rctCheckZDC.value , rctTreatLimitedAcceptanceAsBad.value );
212+ }
213+
200214 // / \brief Applies event selection.
201215 // / \tparam useEvSel use information from the EvSel table
202216 // / \tparam centEstimator centrality estimator
@@ -218,6 +232,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
218232 }
219233
220234 if constexpr (useEvSel) {
235+ // / RCT condition
236+ if (requireGoodRct && !rctChecker.checkTable (collision)) {
237+ SETBIT (rejectionMask, EventRejection::Rct);
238+ }
221239 // / trigger condition
222240 if ((useSel8Trigger && !collision.sel8 ()) || (!useSel8Trigger && triggerClass > -1 && !collision.alias_bit (triggerClass))) {
223241 SETBIT (rejectionMask, EventRejection::Trigger);
@@ -333,14 +351,21 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
333351
334352struct HfEventSelectionMc {
335353 // event selection parameters (in chronological order of application)
336- bool useSel8Trigger{false }; // Apply the Sel8 selection
337- bool useTvxTrigger{false }; // Apply the TVX trigger
338- bool useTimeFrameBorderCut{true }; // Apply TF border cut
339- bool useItsRofBorderCut{false }; // Apply the ITS RO frame border cut
340- float zPvPosMin{-1000 .f }; // Minimum PV posZ (cm)
341- float zPvPosMax{1000 .f }; // Maximum PV posZ (cm)
342- float centralityMin{0 .f }; // Minimum centrality
343- float centralityMax{100 .f }; // Maximum centrality
354+ bool useSel8Trigger{false }; // Apply the Sel8 selection
355+ bool useTvxTrigger{false }; // Apply the TVX trigger
356+ bool useTimeFrameBorderCut{true }; // Apply TF border cut
357+ bool useItsRofBorderCut{false }; // Apply the ITS RO frame border cut
358+ float zPvPosMin{-1000 .f }; // Minimum PV posZ (cm)
359+ float zPvPosMax{1000 .f }; // Maximum PV posZ (cm)
360+ float centralityMin{0 .f }; // Minimum centrality
361+ float centralityMax{100 .f }; // Maximum centrality
362+ bool requireGoodRct{false }; // Apply RCT selection
363+ std::string rctLabel{" " }; // RCT selection flag
364+ bool rctCheckZDC; // require ZDC from RCT
365+ bool rctTreatLimitedAcceptanceAsBad; // RCT flag to reject events with limited acceptance for selected detectors
366+
367+ // util to retrieve the RCT info from CCDB
368+ o2::aod::rctsel::RCTFlagsChecker rctChecker;
344369
345370 // histogram names
346371 static constexpr char NameHistGenCollisionsCent[] = " hGenCollisionsCent" ;
@@ -383,8 +408,17 @@ struct HfEventSelectionMc {
383408 centralityMin = option.defaultValue .get <float >();
384409 } else if (option.name .compare (" hfEvSel.centralityMax" ) == 0 ) {
385410 centralityMax = option.defaultValue .get <float >();
411+ } else if (option.name .compare (" hfEvSel.requireGoodRct" ) == 0 ) {
412+ requireGoodRct = option.defaultValue .get <bool >();
413+ } else if (option.name .compare (" hfEvSel.rctLabel" ) == 0 ) {
414+ rctLabel = option.defaultValue .get <std::string>();
415+ } else if (option.name .compare (" hfEvSel.rctCheckZDC" ) == 0 ) {
416+ rctCheckZDC = option.defaultValue .get <bool >();
417+ } else if (option.name .compare (" hfEvSel.rctTreatLimitedAcceptanceAsBad" ) == 0 ) {
418+ rctTreatLimitedAcceptanceAsBad = option.defaultValue .get <bool >();
386419 }
387420 }
421+ rctChecker.init (rctLabel, rctCheckZDC, rctTreatLimitedAcceptanceAsBad);
388422 }
389423
390424 // / \brief Function to apply event selections to generated MC collisions
@@ -406,6 +440,16 @@ struct HfEventSelectionMc {
406440 SETBIT (rejectionMask, EventRejection::Centrality);
407441 }
408442 }
443+
444+ // / RCT condition
445+ if (requireGoodRct) {
446+ for (auto const & collision : collSlice) {
447+ if (!rctChecker.checkTable (collision)) {
448+ SETBIT (rejectionMask, EventRejection::Rct);
449+ break ;
450+ }
451+ }
452+ }
409453 // / Sel8 trigger selection
410454 if (useSel8Trigger && (!bc.selection_bit (o2::aod::evsel::kIsTriggerTVX ) || !bc.selection_bit (o2::aod::evsel::kNoTimeFrameBorder ) || !bc.selection_bit (o2::aod::evsel::kNoITSROFrameBorder ))) {
411455 SETBIT (rejectionMask, EventRejection::Trigger);
0 commit comments