ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/GPetrucc/interface/fwliteHelpers.h
Revision: 1.6
Committed: Wed Mar 3 09:29:52 2010 UTC (15 years, 2 months ago) by gpetrucc
Content type: text/plain
Branch: MAIN
CVS Tags: V03-00-00, HEAD
Changes since 1.5: +4 -0 lines
Error occurred while calculating annotation data.
Log Message:
slight improvements in draw

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 // define also dictionaries for these two trivial functions
31 // because otherwise sometimes CINT crashes on them
32 static bool test(const reco::parser::SelectorPtr &sel, const Reflex::Type type, const void * obj);
33 static double eval(const reco::parser::ExpressionPtr &sel, const Reflex::Type type, const void * obj);
34 };
35 class ScannerBase {
36 public:
37 ScannerBase() {}
38 ScannerBase(const Reflex::Type &objType) : objType_(objType), ignoreExceptions_(false) {}
39 void clearExpressions() { exprs_.clear(); }
40 size_t numberOfExpressions() const { return exprs_.size(); }
41 bool addExpression(const char *expr) ;
42 bool setCut(const char *cut) ;
43 void clearCut() { cut_.reset(); }
44
45 // obj must point to an object of the correct type!
46 bool test(const void *obj) const ;
47 double eval(const void *obj, size_t iexpr = 0) const;
48 void print(const void *obj) const ;
49
50
51 void fill1D(const void *obj, TH1 *hist) const ;
52 void fill2D(const void *obj, TH2 *hist2d) const ;
53 void fillGraph(const void *obj, TGraph *graph) const ;
54 void fillProf(const void *obj, TProfile *prof) const ;
55
56 void setIgnoreExceptions(bool ignoreThem) { ignoreExceptions_ = ignoreThem; }
57 private:
58 Reflex::Type objType_;
59 std::vector<reco::parser::ExpressionPtr> exprs_;
60 reco::parser::SelectorPtr cut_;
61 bool ignoreExceptions_;
62 };
63 }
64
65 #endif