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