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" |
24 |
|
class Parser { |
25 |
|
public: |
26 |
|
Parser() {} |
27 |
< |
reco::parser::ExpressionPtr makeExpression(const std::string &expr, const Reflex::Type &type) const ; |
28 |
< |
reco::parser::SelectorPtr makeSelector(const std::string &expr, const Reflex::Type &type) const ; |
29 |
< |
Reflex::Type elementType(const Reflex::Type &wrapperType) const ; |
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 |
< |
void addExpression(const char *expr) ; |
41 |
< |
void setCut(const char *cut) ; |
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) ; |
47 |
< |
void print(const void *obj) ; |
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) ; |
52 |
< |
void fill2D(const void *obj, TH2 *hist2d) ; |
53 |
< |
void fillProf(const void *obj, TProfile *prof) ; |
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: |
47 |
– |
Parser helpme; |
58 |
|
Reflex::Type objType_; |
59 |
|
std::vector<reco::parser::ExpressionPtr> exprs_; |
60 |
|
reco::parser::SelectorPtr cut_; |
62 |
|
}; |
63 |
|
} |
64 |
|
|
65 |
< |
|
65 |
> |
#endif |