ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/interface/CutFlow.h
Revision: 1.2
Committed: Fri Sep 7 19:43:16 2012 UTC (12 years, 7 months ago) by ahart
Content type: text/plain
Branch: MAIN
Changes since 1.1: +8 -2 lines
Log Message:
Add the "safe bool" idiom for getting a bool from the class directly which is the logical AND of all the cut decisions.

File Contents

# User Rev Content
1 ahart 1.1 #ifndef CUT_FLOW
2    
3     #define CUT_FLOW
4    
5     #include <iostream>
6     #include <iomanip>
7     #include <map>
8     #include <string>
9     #include <vector>
10    
11     #include "FWCore/ServiceRegistry/interface/Service.h"
12     #include "CommonTools/UtilAlgos/interface/TFileService.h"
13    
14     #include "TH1D.h"
15     #include "TStopwatch.h"
16    
17     using namespace std;
18    
19     class CutFlow
20     {
21 ahart 1.2 typedef void (CutFlow::*boolType) () const;
22    
23 ahart 1.1 public:
24     CutFlow () {};
25 ahart 1.2 CutFlow (const edm::Service<TFileService> &, const string &prefix = "");
26 ahart 1.1 ~CutFlow ();
27     bool &operator[] (const string &);
28     bool &at (const string &cutName) { return (*this)[cutName]; };
29 ahart 1.2 bool pass () const;
30     operator boolType () const { return pass () ? &CutFlow::thisTypeDoesNotSupportComparisons : 0; };
31 ahart 1.1
32     void fillCutFlow ();
33     void outputTime ();
34     void outputCutFlow ();
35    
36     private:
37     TH1D *cutFlow_;
38     TH1D *selection_;
39 ahart 1.2 TH1D *rejection_;
40 ahart 1.1
41     TStopwatch sw_;
42     string prefix_;
43     vector<string> cutNames_;
44     map<string, bool> cuts_;
45 ahart 1.2
46     void thisTypeDoesNotSupportComparisons () const {};
47 ahart 1.1 };
48    
49     #endif