1 |
bortigno |
1.1 |
#ifndef CUTANDHISTOS_H
|
2 |
|
|
#define CUTANDHISTOS_H
|
3 |
|
|
#include "../interface/VHbbEvent.h"
|
4 |
|
|
#include <string>
|
5 |
|
|
#include <sstream>
|
6 |
|
|
#include <vector>
|
7 |
|
|
#include <TROOT.h>
|
8 |
|
|
#include <TFile.h>
|
9 |
|
|
|
10 |
|
|
class VHbbEvent;
|
11 |
|
|
//class TFolder;
|
12 |
|
|
|
13 |
|
|
/*class VHbbEventWithHypothesis : public VHbbEvent
|
14 |
|
|
{
|
15 |
|
|
TLorentzVector H;
|
16 |
|
|
TLorentzVector V;
|
17 |
|
|
};
|
18 |
|
|
*/
|
19 |
|
|
|
20 |
|
|
class Histos {
|
21 |
|
|
public:
|
22 |
|
|
virtual void book(TFile &f, std::string suffix) = 0;
|
23 |
|
|
virtual void fill(const VHbbEvent &, float w) = 0;
|
24 |
|
|
};
|
25 |
|
|
|
26 |
|
|
class Cut {
|
27 |
|
|
public:
|
28 |
|
|
virtual bool pass(const VHbbEvent &) = 0;
|
29 |
|
|
virtual std::string name() = 0;
|
30 |
|
|
virtual bool operator()(const VHbbEvent &e) {return pass(e); }
|
31 |
|
|
};
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
class CutSet : public Cut {
|
35 |
|
|
public:
|
36 |
|
|
void add(Cut *c) {cuts.push_back(c);}
|
37 |
|
|
bool pass(const VHbbEvent &e) {
|
38 |
|
|
bool result=true;
|
39 |
|
|
for(size_t i=0; i< cuts.size(); i++)
|
40 |
|
|
if( ! (cuts.at(i)->pass(e)) )
|
41 |
|
|
result=false;
|
42 |
|
|
return result;
|
43 |
|
|
}
|
44 |
|
|
std::string name() {
|
45 |
|
|
std::stringstream s;
|
46 |
|
|
for(size_t i=0; i< cuts.size(); i++) {
|
47 |
|
|
s << "_" << cuts.at(i)->name();
|
48 |
|
|
}
|
49 |
|
|
return s.str();
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
private:
|
53 |
|
|
std::vector<Cut *> cuts;
|
54 |
|
|
|
55 |
|
|
};
|
56 |
|
|
|
57 |
|
|
class CutsAndHistos {
|
58 |
|
|
public:
|
59 |
|
|
CutsAndHistos() {}
|
60 |
|
|
CutsAndHistos(CutSet & c, std::vector<Histos *> & h):
|
61 |
|
|
cutset(c),
|
62 |
|
|
histos(h) {}
|
63 |
|
|
|
64 |
|
|
void book(TFile &f) {
|
65 |
|
|
std::string suffix=cutset.name();
|
66 |
|
|
for(size_t i=0; i< histos.size(); i++)
|
67 |
|
|
histos.at(i)->book(f,suffix);
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
void process(const VHbbEvent & e,float w)
|
71 |
|
|
{
|
72 |
|
|
if(cutset.pass(e))
|
73 |
|
|
for(size_t i=0; i< histos.size(); i++)
|
74 |
|
|
histos.at(i)->fill(e,w);
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
CutSet cutset;
|
79 |
|
|
std::vector<Histos *> histos;
|
80 |
|
|
|
81 |
|
|
};
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
#endif
|