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

Annotation of /PamCut/Collections/SmartBlindCollection/SmartBlindCollection.cpp

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.23