/[PAMELA software]/PamCut/Collections/SmartBlindCollection/SmartBlindCollection.cpp
ViewVC logotype

Contents of /PamCut/Collections/SmartBlindCollection/SmartBlindCollection.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Jun 16 16:44:59 2009 UTC (15 years, 5 months ago) by pam-fi
Branch: MAIN
Changes since 1.2: +13 -38 lines
Bug in actions handling fixed.

1 /*
2 * SmartBlindCollection.cpp
3 *
4 * Created on: 16-mag-2009
5 * Author: Nicola Mori
6 */
7
8 /*! @file SmartCollection.cpp The SmartBlindCollection class implementation file */
9
10 #include "SmartBlindCollection.h"
11
12 int SmartBlindCollection::ApplyCut(PamLevel2 *event) {
13
14 _nEv++;
15 if (_cuts.size() == 0) {
16 _nGood++;
17 OnGood(event);
18 return CUTOK;
19 }
20
21 unsigned int firstFailed = _cuts.size();
22 for (unsigned int icut = 0; icut < _cuts.size(); icut++) {
23 if (_cuts[icut]->ApplyCut(event) != CUTOK && firstFailed == _cuts.size()) {
24 firstFailed = icut;
25 }
26 }
27
28 //Do actions
29 if (_actions.size() > 0) {
30 for (unsigned int i = 0; i < _actions.size(); i++) {
31 if (_actionsPositions[i] < firstFailed)
32 _actions[i]->OnGood(event);
33 else
34 _actions[i]->OnBad(event, firstFailed);
35 }
36 }
37
38 if (firstFailed == _cuts.size()) {
39 _nGood++;
40 OnGood(event);
41 return CUTOK;
42 }
43 else {
44 OnBad(event, firstFailed);
45 return firstFailed;
46 }
47
48 }

  ViewVC Help
Powered by ViewVC 1.1.23