| 18 |
return CUTOK; |
return CUTOK; |
| 19 |
} |
} |
| 20 |
|
|
| 21 |
unsigned int bunchEnd = -1; |
unsigned int firstFailed = _cuts.size(); |
|
unsigned int nActions = 0; |
|
|
unsigned int firstActionOfBunch = -1; |
|
|
if (_actions.size() > 0) { |
|
|
// Set the bunch end to the position of the first action |
|
|
bunchEnd = _actionsPositions[0]; |
|
|
// Set the position of the first action at the end of the bunch |
|
|
firstActionOfBunch = 0; |
|
|
// Set the number of actions at the end of this bunch of cuts |
|
|
nActions = 1; |
|
|
while (_actionsPositions[nActions] == bunchEnd) |
|
|
nActions++; |
|
|
} |
|
|
|
|
|
int firstFailed = CUTOK; |
|
| 22 |
for (unsigned int icut = 0; icut < _cuts.size(); icut++) { |
for (unsigned int icut = 0; icut < _cuts.size(); icut++) { |
| 23 |
if (_cuts[icut]->ApplyCut(event) != CUTOK && firstFailed == CUTOK) { |
if (_cuts[icut]->ApplyCut(event) != CUTOK && firstFailed == _cuts.size()) { |
| 24 |
firstFailed = icut; |
firstFailed = icut; |
| 25 |
} |
} |
| 26 |
if (bunchEnd == icut) { |
} |
|
if (firstFailed == CUTOK) { |
|
|
for (unsigned int i = 0; i < nActions; i++) { |
|
|
_actions[firstActionOfBunch + i]->OnGood(event); |
|
|
} |
|
|
} |
|
|
else { |
|
|
for (unsigned int i = 0; i < nActions; i++) { |
|
|
_actions[firstActionOfBunch + i]->OnBad(event, icut); |
|
|
} |
|
|
} |
|
| 27 |
|
|
| 28 |
if (firstActionOfBunch + nActions < _actions.size()) { |
//Do actions |
| 29 |
// Current bunch is done, but actions are not finished yet. Set up the next bunch. |
if (_actions.size() > 0) { |
| 30 |
// Set the end of the new bunch and the number of actions at this end |
for (unsigned int i = 0; i < _actions.size(); i++) { |
| 31 |
firstActionOfBunch += nActions; |
if (_actionsPositions[i] < firstFailed) |
| 32 |
bunchEnd = _actionsPositions[firstActionOfBunch]; |
_actions[i]->OnGood(event); |
| 33 |
nActions = 1; |
else |
| 34 |
while (_actionsPositions[firstActionOfBunch + nActions] == bunchEnd) |
_actions[i]->OnBad(event, firstFailed); |
|
nActions++; |
|
|
} |
|
| 35 |
} |
} |
| 36 |
} |
} |
| 37 |
|
|
| 38 |
if (firstFailed == CUTOK) { |
if (firstFailed == _cuts.size()) { |
| 39 |
_nGood++; |
_nGood++; |
| 40 |
OnGood(event); |
OnGood(event); |
| 41 |
|
return CUTOK; |
| 42 |
} |
} |
| 43 |
else { |
else { |
| 44 |
OnBad(event, firstFailed); |
OnBad(event, firstFailed); |
| 45 |
|
return firstFailed; |
| 46 |
} |
} |
|
return firstFailed; |
|
| 47 |
|
|
| 48 |
} |
} |