1 |
dhidas |
1.1 |
/*
|
2 |
|
|
* HistogramManager.h
|
3 |
|
|
*
|
4 |
|
|
* Created on: 4 Jul 2010
|
5 |
|
|
* Author: kreczko
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
#ifndef HISTOGRAMMANAGER_H_
|
9 |
|
|
#define HISTOGRAMMANAGER_H_
|
10 |
|
|
#include "THCollection.h"
|
11 |
|
|
#include "TH1D.h"
|
12 |
|
|
#include "TH2D.h"
|
13 |
|
|
#include "../../interface/DataTypes.h"
|
14 |
|
|
#include <boost/shared_ptr.hpp>
|
15 |
|
|
#include <boost/array.hpp>
|
16 |
|
|
#include <boost/multi_array.hpp>
|
17 |
|
|
#include "TFile.h"
|
18 |
|
|
#include <string>
|
19 |
|
|
|
20 |
|
|
namespace BAT {
|
21 |
|
|
|
22 |
|
|
namespace JetBin {
|
23 |
|
|
enum value {
|
24 |
|
|
NoJet,
|
25 |
|
|
OneJet,
|
26 |
|
|
TwoJets,
|
27 |
|
|
ThreeJets,
|
28 |
|
|
FourOrMoreJets,
|
29 |
|
|
NUMBER_OF_JET_BINS
|
30 |
|
|
};
|
31 |
|
|
|
32 |
|
|
const boost::array<std::string, JetBin::NUMBER_OF_JET_BINS> names = {
|
33 |
|
|
{ "0jet", "1jet", "2jets", "3jets", "4orMoreJets"
|
34 |
|
|
} };
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
namespace JetBinSummed {
|
38 |
|
|
enum value {
|
39 |
|
|
allJet,
|
40 |
|
|
OneOrMoreJets,
|
41 |
|
|
TwoOrMoreJets,
|
42 |
|
|
ThreeOrMoreJets,
|
43 |
|
|
NUMBER_OF_SUMMED_JET_BINS
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
const boost::array<std::string, JetBinSummed::NUMBER_OF_SUMMED_JET_BINS> names = { {
|
47 |
|
|
"0orMoreJets",
|
48 |
|
|
"1orMoreJets",
|
49 |
|
|
"2orMoreJets",
|
50 |
|
|
"3orMoreJets" } };
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
namespace BJetBin {
|
54 |
|
|
enum value {
|
55 |
|
|
NoBtag,
|
56 |
|
|
OneBTag,
|
57 |
|
|
TwoBtags,
|
58 |
|
|
ThreeBtags,
|
59 |
|
|
FourOrMoreBTags,
|
60 |
|
|
NUMBER_OF_BJET_BINS
|
61 |
|
|
};
|
62 |
|
|
|
63 |
|
|
const boost::array<std::string, BJetBin::NUMBER_OF_BJET_BINS> names = { {
|
64 |
|
|
"0btag",
|
65 |
|
|
"1btag",
|
66 |
|
|
"2btags",
|
67 |
|
|
"3btags",
|
68 |
|
|
"4orMoreBtags" } };
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
namespace BJetBinSummed {
|
72 |
|
|
enum value {
|
73 |
|
|
allBtags,
|
74 |
|
|
OneOrMoreBTags,
|
75 |
|
|
TwoOrMoreBTags,
|
76 |
|
|
ThreeOrMoreBTags,
|
77 |
|
|
NUMBER_OF_SUMMED_BJET_BINS
|
78 |
|
|
};
|
79 |
|
|
|
80 |
|
|
const boost::array<std::string, BJetBinSummed::NUMBER_OF_SUMMED_BJET_BINS> names = { {
|
81 |
|
|
"0orMoreBtag",
|
82 |
|
|
"1orMoreBtag",
|
83 |
|
|
"2orMoreBtags",
|
84 |
|
|
"3orMoreBtags" } };
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
namespace LeptonBin {
|
88 |
|
|
enum value {
|
89 |
|
|
Electron,
|
90 |
|
|
Muon,
|
91 |
|
|
NUMBER_OF_LEPTON_BINS
|
92 |
|
|
};
|
93 |
|
|
|
94 |
|
|
const boost::array<std::string, LeptonBin::NUMBER_OF_LEPTON_BINS> names = { {
|
95 |
|
|
"elec",
|
96 |
|
|
"mu" } };
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
namespace LepBinSummed {
|
100 |
|
|
enum value {
|
101 |
|
|
lepton,
|
102 |
|
|
NUMBER_OF_SUMMED_LEPTON_BINS
|
103 |
|
|
};
|
104 |
|
|
|
105 |
|
|
const boost::array<std::string, LepBinSummed::NUMBER_OF_SUMMED_LEPTON_BINS> names = { {
|
106 |
|
|
"lepton" } };
|
107 |
|
|
}
|
108 |
|
|
|
109 |
|
|
typedef unsigned short ushort;
|
110 |
|
|
class HistogramManager {
|
111 |
|
|
public:
|
112 |
|
|
HistogramManager();
|
113 |
|
|
virtual ~HistogramManager();
|
114 |
|
|
void createAllHistograms();
|
115 |
|
|
void addH1D(std::string name, std::string title, unsigned int nBins, float xmin, float xmax);
|
116 |
|
|
void addH1D_JetBinned(std::string name, std::string title, unsigned int nBins, float xmin, float xmax);
|
117 |
|
|
void addH1D_BJetBinned(std::string name, std::string title, unsigned int nBins, float xmin, float xmax);
|
118 |
|
|
void addH2D_BJetBinned(std::string name, std::string title, unsigned int nXBins, float xmin, float xmax,
|
119 |
|
|
unsigned int nYBins, float ymin, float ymax);
|
120 |
|
|
|
121 |
|
|
void addH1D_LepBinned(std::string name, std::string title, unsigned int nBins, float xmin, float xmax);
|
122 |
|
|
|
123 |
|
|
void addH2D(std::string name, std::string title, unsigned int nXBins, float xmin, float xmax, unsigned int nYBins,
|
124 |
|
|
float ymin, float ymax);
|
125 |
|
|
|
126 |
|
|
void setCurrentDataType(DataType::value type);
|
127 |
|
|
void setCurrentJetBin(unsigned int jetbin);
|
128 |
|
|
void setCurrentBJetBin(unsigned int jetbin);
|
129 |
|
|
void setCurrentLepBin(unsigned int jetbin);
|
130 |
|
|
void setCurrentLumi(float lumi);
|
131 |
|
|
void prepareForSeenDataTypes(const boost::array<bool, DataType::NUMBER_OF_DATA_TYPES>& seenDataTypes);
|
132 |
|
|
|
133 |
|
|
boost::shared_ptr<TH1> operator[](std::string);
|
134 |
|
|
boost::shared_ptr<TH1> H1D(std::string);
|
135 |
|
|
boost::shared_ptr<TH1> H1D_JetBinned(std::string);
|
136 |
|
|
boost::shared_ptr<TH1> H1D_BJetBinned(std::string);
|
137 |
|
|
boost::shared_ptr<TH1> H1D_LepBinned(std::string);
|
138 |
|
|
boost::shared_ptr<TH2> operator()(std::string);
|
139 |
|
|
boost::shared_ptr<TH2> H2D(std::string);
|
140 |
|
|
boost::shared_ptr<TH2> H2D_JetBinned(std::string);
|
141 |
|
|
boost::shared_ptr<TH2> H2D_BJetBinned(std::string);
|
142 |
|
|
|
143 |
|
|
int Section;
|
144 |
|
|
|
145 |
|
|
void writeToDisk();
|
146 |
|
|
private:
|
147 |
|
|
boost::multi_array<TH1CollectionRef, 2> jetBinned1DHists;
|
148 |
|
|
std::vector<std::string> jetBinned1DHistNames;
|
149 |
|
|
boost::multi_array<TH2CollectionRef, 2> jetBinned2DHists;
|
150 |
|
|
std::vector<std::string> jetBinned2DHistNames;
|
151 |
|
|
boost::multi_array<TH1CollectionRef, 2> bJetBinned1DHists;
|
152 |
|
|
boost::multi_array<TH1CollectionRef, 2> lepBinned1DHists;
|
153 |
|
|
std::vector<std::string> bJetBinned1DHistNames;
|
154 |
|
|
std::vector<std::string> lepBinned1DHistNames;
|
155 |
|
|
boost::multi_array<TH2CollectionRef, 2> bJetBinned2DHists;
|
156 |
|
|
std::vector<std::string> bJetBinned2DHistNames;
|
157 |
|
|
boost::array<bool, DataType::NUMBER_OF_DATA_TYPES> seenDataTypes;
|
158 |
|
|
boost::array<boost::shared_ptr<TFile>, DataType::NUMBER_OF_DATA_TYPES> histFiles;
|
159 |
|
|
boost::array<TH1CollectionRef, DataType::NUMBER_OF_DATA_TYPES> collection;// move to array of DataTypes
|
160 |
|
|
std::vector<std::string> collection1DHistNames;
|
161 |
|
|
boost::array<TH2CollectionRef, DataType::NUMBER_OF_DATA_TYPES> collection2D;
|
162 |
|
|
std::vector<std::string> collection2DHistNames;
|
163 |
|
|
DataType::value currentDataType;
|
164 |
|
|
unsigned int currentJetbin;
|
165 |
|
|
unsigned int currentBJetbin;
|
166 |
|
|
unsigned int currentLepbin;
|
167 |
|
|
float currentIntegratedLumi;
|
168 |
|
|
|
169 |
|
|
const std::string assembleFilename(DataType::value) const;
|
170 |
|
|
void createSummedHistograms(DataType::value);
|
171 |
|
|
void createJetSummedHistograms(DataType::value);
|
172 |
|
|
void createBJetSummedHistograms(DataType::value);
|
173 |
|
|
void createLepSummedHistograms(DataType::value);
|
174 |
|
|
};
|
175 |
|
|
|
176 |
|
|
}
|
177 |
|
|
|
178 |
|
|
#endif /* HISTOGRAMMANAGER_H_ */
|