Skip to content

Commit 24cbcde

Browse files
committed
Added ZDC time cut
1 parent b39849c commit 24cbcde

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

PWGHF/Utils/utilsEvSelHf.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,41 @@ enum EventRejection {
114114
NoCollInTimeRangeStandard,
115115
NoCollInRofStandard,
116116
UpcEventCut,
117+
UpcZdcNeutronClass,
117118
Chi2,
118119
PositionZ,
119120
NEventRejection
120121
};
121122

122123
using HfCollisionRejectionMask = uint32_t; // 32 bits, in case new ev. selections will be added
123124

125+
enum UpcZdcNeutronClassSelection {
126+
kXn0n = 0,
127+
k0nXn,
128+
kInvalid
129+
};
130+
124131
const o2::framework::AxisSpec axisEvents = {EventRejection::NEventRejection, -0.5f, +EventRejection::NEventRejection - 0.5f, ""};
125132
const o2::framework::AxisSpec axisUpcEvents = {o2::aod::sgselector::DoubleGap + 1, -0.5f, +o2::aod::sgselector::DoubleGap + 0.5f, ""};
126133

134+
template <typename TBc>
135+
int getUpcZdcNeutronClass(TBc const& bc, const float zdcTimeMin, const float zdcTimeMax)
136+
{
137+
if (!bc.has_zdc()) {
138+
return UpcZdcNeutronClassSelection::kInvalid;
139+
}
140+
const auto zdc = bc.zdc();
141+
const bool isZNAinTime = zdc.timeZNA() >= zdcTimeMin && zdc.timeZNA() <= zdcTimeMax;
142+
const bool isZNCinTime = zdc.timeZNC() >= zdcTimeMin && zdc.timeZNC() <= zdcTimeMax;
143+
if (isZNAinTime && !isZNCinTime) {
144+
return UpcZdcNeutronClassSelection::kXn0n;
145+
}
146+
if (!isZNAinTime && isZNCinTime) {
147+
return UpcZdcNeutronClassSelection::k0nXn;
148+
}
149+
return UpcZdcNeutronClassSelection::kInvalid;
150+
}
151+
127152
/// \brief Function to put labels on monitoring histogram
128153
/// \param hRejection monitoring histogram
129154
/// \param softwareTriggerLabel bin label for software trigger rejection
@@ -140,6 +165,7 @@ void setEventRejectionLabels(Histo& hRejection, std::string const& softwareTrigg
140165
hRejection->GetXaxis()->SetBinLabel(EventRejection::TimeFrameBorderCut + 1, "TF border");
141166
hRejection->GetXaxis()->SetBinLabel(EventRejection::ItsRofBorderCut + 1, "ITS ROF border");
142167
hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcEventCut + 1, "UPC event");
168+
hRejection->GetXaxis()->SetBinLabel(EventRejection::UpcZdcNeutronClass + 1, "UPC ZDC 0nXn/Xn0n");
143169
hRejection->GetXaxis()->SetBinLabel(EventRejection::IsGoodZvtxFT0vsPV + 1, "PV #it{z} consistency FT0 timing");
144170
hRejection->GetXaxis()->SetBinLabel(EventRejection::NoSameBunchPileup + 1, "No same-bunch pile-up"); // POTENTIALLY BAD FOR BEAUTY ANALYSES
145171
hRejection->GetXaxis()->SetBinLabel(EventRejection::Occupancy + 1, "Occupancy");
@@ -185,6 +211,8 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
185211
o2::framework::Configurable<bool> rctCheckZDC{"rctCheckZDC", false, "RCT flag to check whether the ZDC is present or not"};
186212
o2::framework::Configurable<bool> rctTreatLimitedAcceptanceAsBad{"rctTreatLimitedAcceptanceAsBad", false, "RCT flag to reject events with limited acceptance for selected detectors"};
187213
o2::framework::Configurable<std::string> irSource{"irSource", "", "Estimator of the interaction rate (Empty: automatically set. Otherwise recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"};
214+
o2::framework::Configurable<float> upcZdcTimeMin{"upcZdcTimeMin", -2.f, "Minimum ZDC time for UPC neutron class selection (ns)"};
215+
o2::framework::Configurable<float> upcZdcTimeMax{"upcZdcTimeMax", 2.f, "Maximum ZDC time for UPC neutron class selection (ns)"};
188216

189217
// SG selector
190218
SGSelector sgSelector;
@@ -435,6 +463,10 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
435463
if (upcEventType > o2::aod::sgselector::DoubleGap) {
436464
SETBIT(rejectionMaskWithUpc, EventRejection::UpcEventCut);
437465
} else {
466+
const auto upcZdcNeutronClass = getUpcZdcNeutronClass(*sgSelectionResult.bc, upcZdcTimeMin, upcZdcTimeMax);
467+
if (upcZdcNeutronClass != UpcZdcNeutronClassSelection::kXn0n && upcZdcNeutronClass != UpcZdcNeutronClassSelection::k0nXn) {
468+
SETBIT(rejectionMaskWithUpc, EventRejection::UpcZdcNeutronClass);
469+
}
438470
hUpCollisions->Fill(upcEventType);
439471
}
440472
}

0 commit comments

Comments
 (0)