Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions PWGJE/Core/JetDerivedDataUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,31 @@ bool selectCollision(T const& collision, const std::vector<int>& eventSelectionM
if (eventSelectionMaskBits.size() == 0) {
return true;
}
bool isOrCondition = false;
for (auto eventSelectionMaskBit : eventSelectionMaskBits) {
if (!(collision.eventSel() & (1 << eventSelectionMaskBit))) {
return false;
if (eventSelectionMaskBit == -1) {
isOrCondition = true;
continue;
}
if (!isOrCondition) {
if (!(collision.eventSel() & (1ULL << eventSelectionMaskBit))) {
return false;
}
} else {
if (collision.eventSel() & (1ULL << eventSelectionMaskBit)) {
return true;
}
}
}
return true;
return !isOrCondition;
}

bool eventSelectionMasksContainSelection(const std::string& eventSelectionMasks, std::string selection)
{
size_t position = 0;
while ((position = eventSelectionMasks.find(selection, position)) != std::string::npos) {
bool validStart = (position == 0 || eventSelectionMasks[position - 1] == '+');
bool validEnd = (position + selection.length() == eventSelectionMasks.length() || eventSelectionMasks[position + selection.length()] == '+');
bool validStart = (position == 0 || eventSelectionMasks[position - 1] == '+' || eventSelectionMasks[position - 1] == '|');
bool validEnd = (position + selection.length() == eventSelectionMasks.length() || eventSelectionMasks[position + selection.length()] == '+' || eventSelectionMasks[position + selection.length()] == '|');
if (validStart && validEnd) {
return true;
}
Expand All @@ -116,6 +127,9 @@ bool eventSelectionMasksContainSelection(const std::string& eventSelectionMasks,
std::vector<int> initialiseEventSelectionBits(const std::string& eventSelectionMasks)
{
std::vector<int> eventSelectionMaskBits;
if (eventSelectionMasks.find('|') != std::string::npos) { // needs to be first if statement evaluated
eventSelectionMaskBits.push_back(-1);
}
if (eventSelectionMasksContainSelection(eventSelectionMasks, "sel8")) {
eventSelectionMaskBits.push_back(JCollisionSel::sel8);
}
Expand Down Expand Up @@ -286,7 +300,7 @@ bool selectTrigger(T const& collision, const std::vector<int>& triggerMaskBits)
return true;
}
for (auto triggerMaskBit : triggerMaskBits) {
if (collision.triggerSel() & (1 << triggerMaskBit)) {
if (collision.triggerSel() & (1ULL << triggerMaskBit)) {
return true;
}
}
Expand All @@ -299,7 +313,7 @@ bool selectTrigger(T const& collision, int triggerMaskBit)
if (triggerMaskBit == -1) {
return true;
}
return collision.triggerSel() & (1 << triggerMaskBit);
return collision.triggerSel() & (1ULL << triggerMaskBit);
}

bool triggerMasksContainTrigger(const std::string& triggerMasks, std::string trigger)
Expand Down Expand Up @@ -410,7 +424,7 @@ bool selectChargedTrigger(T const& collision, int triggerSelection)
if (triggerSelection == -1) {
return true;
}
return (collision.chargedTriggerSel() & (1 << triggerSelection));
return (collision.chargedTriggerSel() & (1ULL << triggerSelection));
}

int initialiseChargedTriggerSelection(const std::string& triggerSelection)
Expand Down Expand Up @@ -475,7 +489,7 @@ bool selectFullTrigger(T const& collision, int triggerSelection)
if (triggerSelection == -1) {
return true;
}
return (collision.fullTriggerSel() & (1 << triggerSelection));
return (collision.fullTriggerSel() & (1ULL << triggerSelection));
}

int initialiseFullTriggerSelection(const std::string& triggerSelection)
Expand Down Expand Up @@ -570,7 +584,7 @@ bool selectChargedHFTrigger(T const& collision, int triggerSelection)
if (triggerSelection == -1) {
return true;
}
return (collision.chargedHFTriggerSel() & (1 << triggerSelection));
return (collision.chargedHFTriggerSel() & (1ULL << triggerSelection));
}

int initialiseChargedHFTriggerSelection(const std::string& triggerSelection)
Expand Down Expand Up @@ -632,16 +646,16 @@ bool applyTrackKinematics(T const& track, float pTMin = 0.15, float pTMax = 100.
template <typename T>
bool selectTrack(T const& track, int trackSelection, bool isEmbedded = false)
{
if (!(track.trackSel() & (1 << JTrackSel::notBadMcTrack))) {
if (!(track.trackSel() & (1ULL << JTrackSel::notBadMcTrack))) {
return false;
}
if (isEmbedded && !(track.trackSel() & (1 << JTrackSel::embeddedTrack))) { // will get rid of non embedded tracks
if (isEmbedded && !(track.trackSel() & (1ULL << JTrackSel::embeddedTrack))) { // will get rid of non embedded tracks
return false;
}
if (trackSelection == -1) {
return true;
}
return (track.trackSel() & (1 << trackSelection));
return (track.trackSel() & (1ULL << trackSelection));
}

int initialiseTrackSelection(const std::string& trackSelection)
Expand Down
Loading