/[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.5 - (hide annotations) (download)
Thu Jul 8 14:00:30 2010 UTC (14 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: MergedFromV8_1, V9, HEAD
Changes since 1.4: +36 -11 lines
Merged from branch V8 (tag MergedToHEAD_1). Tag before the merge: BeforeMergingFromV8_1.

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 pam-fi 1.5
16     // Execute the actions placed before the cuts
17     unsigned int iBeforeCuts = 0;
18     //cout << GetName() << endl;
19     if (_actions.size() > 0) {
20     while (_actionsPositions[iBeforeCuts] == -1) {
21     _actions[iBeforeCuts]->OnGood(event);
22     iBeforeCuts++;
23     if (iBeforeCuts == _actions.size())
24     break;
25     }
26     }
27    
28     // Apply the cuts
29 pam-fi 1.2 if (_cuts.size() == 0) {
30     _nGood++;
31     OnGood(event);
32     return CUTOK;
33     }
34 pam-fi 1.1
35 pam-fi 1.3 unsigned int firstFailed = _cuts.size();
36 pam-fi 1.5 unsigned int iAction = iBeforeCuts;
37     for (unsigned int iCut = 0; iCut < _cuts.size(); iCut++) {
38     if (_cuts[iCut]->ApplyCut(event) != CUTOK && firstFailed == _cuts.size()) {
39     firstFailed = iCut;
40 pam-fi 1.2 }
41    
42 pam-fi 1.5 if (iAction < _actions.size()) {
43     if (firstFailed == _cuts.size()) { // No cut has failed yet
44     while (_actionsPositions[iAction] == (int) iCut) {
45     _actions[iAction]->OnGood(event);
46     iAction++;
47     if (iAction == _actions.size())
48     break;
49     }
50     }
51     else {
52     while (_actionsPositions[iAction] == (int) iCut) {
53     _actions[iAction]->OnBad(event, (int) firstFailed);
54     iAction++;
55     if (iAction == _actions.size())
56     break;
57     }
58     }
59    
60 pam-fi 1.2 }
61 pam-fi 1.1 }
62    
63 pam-fi 1.3 if (firstFailed == _cuts.size()) {
64 pam-fi 1.2 _nGood++;
65     OnGood(event);
66 pam-fi 1.3 return CUTOK;
67 pam-fi 1.1 }
68 pam-fi 1.2 else {
69     OnBad(event, firstFailed);
70 pam-fi 1.3 return firstFailed;
71 pam-fi 1.1 }
72    
73     }

  ViewVC Help
Powered by ViewVC 1.1.23