ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/GPetrucc/interface/fwliteHelpers.h
Revision: 1.4
Committed: Tue Feb 2 18:11:54 2010 UTC (15 years, 3 months ago) by gpetrucc
Content type: text/plain
Branch: MAIN
Changes since 1.3: +12 -10 lines
Log Message:
- cleanup parser helper (make methods static)
- allow event selectors to be used with the scanner
  (e.g. req a number of objects passing a selection, or run/lumi)

File Contents

# Content
1 #ifndef UserCode_GPetrucc_fwliteHelpers_h
2 #define UserCode_GPetrucc_fwliteHelpers_h
3 //#include "DataFormats/Candidate/interface/Candidate.h"
4 //#include "DataFormats/TrackReco/interface/Track.h"
5 //#include "DataFormats/VertexReco/interface/Vertex.h"
6 //#include "CommonTools/Utils/interface/StringObjectFunction.h"
7 //#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
8
9 #include <string>
10 #include <Reflex/Type.h>
11 #include <TH1.h>
12 #include <TH2.h>
13 #include <TProfile.h>
14 #include <TGraph.h>
15
16 #if !defined(__CINT__) && !defined(__MAKECINT__)
17 #include "CommonTools/Utils/src/ExpressionPtr.h"
18 #include "CommonTools/Utils/src/SelectorPtr.h"
19 #include "CommonTools/Utils/src/ExpressionBase.h"
20 #include "CommonTools/Utils/src/SelectorBase.h"
21 #endif
22
23 namespace helper {
24 class Parser {
25 public:
26 Parser() {}
27 static reco::parser::ExpressionPtr makeExpression(const std::string &expr, const Reflex::Type &type) ;
28 static reco::parser::SelectorPtr makeSelector(const std::string &expr, const Reflex::Type &type) ;
29 static Reflex::Type elementType(const Reflex::Type &wrapperType) ;
30 };
31 class ScannerBase {
32 public:
33 ScannerBase() {}
34 ScannerBase(const Reflex::Type &objType) : objType_(objType), ignoreExceptions_(false) {}
35 void clearExpressions() { exprs_.clear(); }
36 void addExpression(const char *expr) ;
37 void setCut(const char *cut) ;
38 void clearCut() { cut_.reset(); }
39
40 /// obj must point to an object of the correct type!
41 bool test(const void *obj) const ;
42 void print(const void *obj) const ;
43
44 void fill1D(const void *obj, TH1 *hist) const ;
45 void fill2D(const void *obj, TH2 *hist2d) const ;
46 void fillProf(const void *obj, TProfile *prof) const ;
47
48 void setIgnoreExceptions(bool ignoreThem) { ignoreExceptions_ = ignoreThem; }
49 private:
50 Reflex::Type objType_;
51 std::vector<reco::parser::ExpressionPtr> exprs_;
52 reco::parser::SelectorPtr cut_;
53 bool ignoreExceptions_;
54 };
55 }
56
57 #endif