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
Log Message:
slight improvements in draw

File Contents

# User Rev Content
1 gpetrucc 1.4 #ifndef UserCode_GPetrucc_fwliteHelpers_h
2     #define UserCode_GPetrucc_fwliteHelpers_h
3 gpetrucc 1.1 //#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 gpetrucc 1.2 #include <TH1.h>
12     #include <TH2.h>
13     #include <TProfile.h>
14     #include <TGraph.h>
15 gpetrucc 1.1
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 gpetrucc 1.4 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 gpetrucc 1.6 // 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 gpetrucc 1.1 };
35     class ScannerBase {
36     public:
37 gpetrucc 1.4 ScannerBase() {}
38 gpetrucc 1.3 ScannerBase(const Reflex::Type &objType) : objType_(objType), ignoreExceptions_(false) {}
39 gpetrucc 1.1 void clearExpressions() { exprs_.clear(); }
40 gpetrucc 1.5 size_t numberOfExpressions() const { return exprs_.size(); }
41     bool addExpression(const char *expr) ;
42     bool setCut(const char *cut) ;
43 gpetrucc 1.1 void clearCut() { cut_.reset(); }
44    
45 gpetrucc 1.5 // 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 gpetrucc 1.2
51 gpetrucc 1.4 void fill1D(const void *obj, TH1 *hist) const ;
52     void fill2D(const void *obj, TH2 *hist2d) const ;
53 gpetrucc 1.5 void fillGraph(const void *obj, TGraph *graph) const ;
54 gpetrucc 1.4 void fillProf(const void *obj, TProfile *prof) const ;
55 gpetrucc 1.3
56     void setIgnoreExceptions(bool ignoreThem) { ignoreExceptions_ = ignoreThem; }
57 gpetrucc 1.1 private:
58     Reflex::Type objType_;
59     std::vector<reco::parser::ExpressionPtr> exprs_;
60     reco::parser::SelectorPtr cut_;
61 gpetrucc 1.3 bool ignoreExceptions_;
62 gpetrucc 1.1 };
63     }
64    
65 gpetrucc 1.4 #endif