Skip to content

Commit

Permalink
update to use alieventcuts on run2 selection
Browse files Browse the repository at this point in the history
  • Loading branch information
BongHwi committed Dec 5, 2024
1 parent af69988 commit 7c2febc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 21 deletions.
31 changes: 13 additions & 18 deletions PWGLF/TableProducer/Resonances/LFResonanceInitializer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ struct reso2initializer {
using ResoV0sMC = soa::Join<ResoV0s, aod::McV0Labels>;
using ResoCascades = aod::CascDatas;
using ResoCascadesMC = soa::Join<ResoCascades, aod::McCascLabels>;
using BCsWithRun2Info = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps>;

template <bool isMC, typename CollisionType, typename TrackType>
bool IsTrackSelected(CollisionType const&, TrackType const& track)
Expand Down Expand Up @@ -1057,10 +1058,9 @@ struct reso2initializer {

void processTrackDataRun2(ResoRun2Events::iterator const& collision,
soa::Filtered<ResoTracks> const& tracks,
aod::BCsWithTimestamps const&)
BCsWithRun2Info const&)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>(); /// adding timestamp to access magnetic field later
initCCDB(bc);
auto bc = collision.bc_as<BCsWithRun2Info>();
// Default event selection
if (!colCuts.isSelected(collision))
return;
Expand Down Expand Up @@ -1111,10 +1111,9 @@ struct reso2initializer {
void processTrackV0DataRun2(ResoRun2Events::iterator const& collision,
soa::Filtered<ResoTracks> const& tracks,
ResoV0s const& V0s,
aod::BCsWithTimestamps const&)
BCsWithRun2Info const&)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>(); /// adding timestamp to access magnetic field later
initCCDB(bc);
auto bc = collision.bc_as<BCsWithRun2Info>();
// Default event selection
if (!colCuts.isSelected(collision))
return;
Expand Down Expand Up @@ -1152,10 +1151,9 @@ struct reso2initializer {
soa::Filtered<ResoTracks> const& tracks,
ResoV0s const& V0s,
ResoCascades const& Cascades,
aod::BCsWithTimestamps const&)
BCsWithRun2Info const&)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>(); /// adding timestamp to access magnetic field later
initCCDB(bc);
auto bc = collision.bc_as<BCsWithRun2Info>();
// Default event selection
if (!colCuts.isSelected(collision))
return;
Expand Down Expand Up @@ -1215,10 +1213,9 @@ struct reso2initializer {
Preslice<aod::McParticles> perMcCollisionRun2 = aod::mcparticle::mcCollisionId;
void processTrackMCRun2(soa::Join<ResoRun2Events, aod::McCollisionLabels>::iterator const& collision,
aod::McCollisions const&, soa::Filtered<ResoTracksMC> const& tracks,
aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&)
aod::McParticles const& mcParticles, BCsWithRun2Info const&)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>(); /// adding timestamp to access magnetic field later
initCCDB(bc);
auto bc = collision.bc_as<BCsWithRun2Info>();
colCuts.fillQARun2(collision);

resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange());
Expand Down Expand Up @@ -1258,10 +1255,9 @@ struct reso2initializer {
void processTrackV0MCRun2(soa::Join<ResoRun2Events, aod::McCollisionLabels>::iterator const& collision,
aod::McCollisions const&, soa::Filtered<ResoTracksMC> const& tracks,
ResoV0sMC const& V0s,
aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&)
aod::McParticles const& mcParticles, BCsWithRun2Info const&)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>(); /// adding timestamp to access magnetic field later
initCCDB(bc);
auto bc = collision.bc_as<BCsWithRun2Info>();
colCuts.fillQARun2(collision);

resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange());
Expand Down Expand Up @@ -1306,10 +1302,9 @@ struct reso2initializer {
aod::McCollisions const&, soa::Filtered<ResoTracksMC> const& tracks,
ResoV0sMC const& V0s,
ResoCascadesMC const& Cascades,
aod::McParticles const& mcParticles, aod::BCsWithTimestamps const&)
aod::McParticles const& mcParticles, BCsWithRun2Info const&)
{
auto bc = collision.bc_as<aod::BCsWithTimestamps>(); /// adding timestamp to access magnetic field later
initCCDB(bc);
auto bc = collision.bc_as<BCsWithRun2Info>();
colCuts.fillQARun2(collision);

resoCollisions(0, collision.posX(), collision.posY(), collision.posZ(), collision.centRun2V0M(), ComputeSpherocity(tracks, trackSphMin, trackSphDef), 0., 0., 0., 0., d_bz, bc.timestamp(), collision.trackOccupancyInTimeRange());
Expand Down
30 changes: 27 additions & 3 deletions PWGLF/Utils/collisionCuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CollisonCuts
/// \param checkTrigger whether or not to check for the trigger alias
/// \param trig Requested trigger alias
/// \param checkOffline whether or not to check for offline selection criteria
void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3, bool triggerTVXsel = false, int trackOccupancyInTimeRangeMax = -1)
void setCuts(float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3, bool triggerTVXsel = false, int trackOccupancyInTimeRangeMax = -1, int trackOccupancyInTimeRangeMin = -1)
{
mCutsSet = true;
mZvtxMax = zvtxMax;
Expand All @@ -72,7 +72,9 @@ class CollisonCuts
mApplyZvertexTimedifference = false;
mApplyPileupRejection = false;
mApplyNoITSROBorderCut = false;
mApplyCollInTimeRangeStandard = false;
mtrackOccupancyInTimeRangeMax = trackOccupancyInTimeRangeMax;
mtrackOccupancyInTimeRangeMin = trackOccupancyInTimeRangeMin;
}

/// Initializes histograms for the task
Expand Down Expand Up @@ -113,8 +115,8 @@ class CollisonCuts
/// Print some debug information
void printCuts()
{
LOGF(info, "Debug information for Collison Cuts \n Max. z-vertex: %f \n Check trigger: %d \n Trigger: %d \n Check offline: %d \n Check Run3: %d \n Trigger TVX selection: %d \n Apply time frame border cut: %d \n Apply ITS-TPC vertex: %d \n Apply Z-vertex time difference: %d \n Apply Pileup rejection: %d \n Apply NoITSRO frame border cut: %d \n Track occupancy in time range max: %d",
mZvtxMax, mCheckTrigger, mTrigger, mCheckOffline, mCheckIsRun3, mTriggerTVXselection, mApplyTFBorderCut, mApplyITSTPCvertex, mApplyZvertexTimedifference, mApplyPileupRejection, mApplyNoITSROBorderCut, mtrackOccupancyInTimeRangeMax);
LOGF(info, "Debug information for Collison Cuts \n Max. z-vertex: %f \n Check trigger: %d \n Trigger: %d \n Check offline: %d \n Check Run3: %d \n Trigger TVX selection: %d \n Apply time frame border cut: %d \n Apply ITS-TPC vertex: %d \n Apply Z-vertex time difference: %d \n Apply Pileup rejection: %d \n Apply NoITSRO frame border cut: %d \n Track occupancy in time range max: %d \n Track occupancy in time range min: %d \n Apply NoCollInTimeRangeStandard: %d",
mZvtxMax, mCheckTrigger, mTrigger, mCheckOffline, mCheckIsRun3, mTriggerTVXselection, mApplyTFBorderCut, mApplyITSTPCvertex, mApplyZvertexTimedifference, mApplyPileupRejection, mApplyNoITSROBorderCut, mtrackOccupancyInTimeRangeMax, mtrackOccupancyInTimeRangeMin, mApplyCollInTimeRangeStandard);
}

/// Set MB selection
Expand All @@ -138,6 +140,12 @@ class CollisonCuts
/// Set the NoITSRO frame border cut
void setApplyNoITSROBorderCut(bool applyNoITSROBorderCut) { mApplyNoITSROBorderCut = applyNoITSROBorderCut; }

/// Set the track occupancy in time range cut
void setTrackOccupancyInTimeRange(int trackOccupancyInTimeRangeMax, int trackOccupancyInTimeRangeMin) { mtrackOccupancyInTimeRangeMax = trackOccupancyInTimeRangeMax; mtrackOccupancyInTimeRangeMin = trackOccupancyInTimeRangeMin; }

/// Set the NoCollInTimeRangeStandard cut
void setApplyCollInTimeRangeStandard(bool applyCollInTimeRangeStandard) { mApplyCollInTimeRangeStandard = applyCollInTimeRangeStandard; }

/// Check whether the collisions fulfills the specified selections
/// \tparam T type of the collision
/// \param col Collision
Expand Down Expand Up @@ -195,12 +203,25 @@ class CollisonCuts
LOGF(debug, "trackOccupancyInTimeRange selection failed");
return false;
}
if (mtrackOccupancyInTimeRangeMin > 0 && col.trackOccupancyInTimeRange() < mtrackOccupancyInTimeRangeMin) {
LOGF(debug, "trackOccupancyInTimeRange selection failed");
return false;
}
if ((!col.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) && mApplyCollInTimeRangeStandard) {
LOGF(debug, "NoCollInTimeRangeStandard selection failed");
return false;
}
mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagOccupancy);
} else { // Run2 case
if (mCheckOffline && !col.sel7()) {
LOGF(debug, "Offline selection failed (sel7)");
return false;
}
auto bc = col.template bc_as<BCsWithRun2Info>();
if (!(bc.eventCuts() & BIT(aod::Run2EventCuts::kAliEventCutsAccepted))){
LOGF(debug, "Offline selection failed (AliEventCuts)");
return false;
}
mHistogramRegistry->fill(HIST("CollCutCounts"), EvtSel::kFlagTrigerTVX);
}
if (mCheckTrigger && !col.alias_bit(mTrigger)) {
Expand Down Expand Up @@ -253,6 +274,7 @@ class CollisonCuts
}

private:
using BCsWithRun2Info = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps>;
HistogramRegistry* mHistogramRegistry = nullptr; ///< For QA output
bool mCutsSet = false; ///< Protection against running without cuts
bool mCheckTrigger = false; ///< Check for trigger
Expand All @@ -265,9 +287,11 @@ class CollisonCuts
bool mApplyZvertexTimedifference = false; ///< removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference.
bool mApplyPileupRejection = false; ///< Pileup rejection
bool mApplyNoITSROBorderCut = false; ///< Apply NoITSRO frame border cut
bool mApplyCollInTimeRangeStandard = false; ///< Apply NoCollInTimeRangeStandard selection
int mTrigger = kINT7; ///< Trigger to check for
float mZvtxMax = 999.f; ///< Maximal deviation from nominal z-vertex (cm)
int mtrackOccupancyInTimeRangeMax = -1; ///< Maximum trackOccupancyInTimeRange cut (-1 no cut)
int mtrackOccupancyInTimeRangeMin = -1; ///< Minimum trackOccupancyInTimeRange cut (-1 no cut)
};
} // namespace o2::analysis

Expand Down

0 comments on commit 7c2febc

Please sign in to comment.