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.1 |
};
|
31 |
|
|
class ScannerBase {
|
32 |
|
|
public:
|
33 |
gpetrucc |
1.4 |
ScannerBase() {}
|
34 |
gpetrucc |
1.3 |
ScannerBase(const Reflex::Type &objType) : objType_(objType), ignoreExceptions_(false) {}
|
35 |
gpetrucc |
1.1 |
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 |
gpetrucc |
1.4 |
bool test(const void *obj) const ;
|
42 |
|
|
void print(const void *obj) const ;
|
43 |
gpetrucc |
1.2 |
|
44 |
gpetrucc |
1.4 |
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 |
gpetrucc |
1.3 |
|
48 |
|
|
void setIgnoreExceptions(bool ignoreThem) { ignoreExceptions_ = ignoreThem; }
|
49 |
gpetrucc |
1.1 |
private:
|
50 |
|
|
Reflex::Type objType_;
|
51 |
|
|
std::vector<reco::parser::ExpressionPtr> exprs_;
|
52 |
|
|
reco::parser::SelectorPtr cut_;
|
53 |
gpetrucc |
1.3 |
bool ignoreExceptions_;
|
54 |
gpetrucc |
1.1 |
};
|
55 |
|
|
}
|
56 |
|
|
|
57 |
gpetrucc |
1.4 |
#endif
|