36 std::map<std::vector<int>, TH1*>&,
51 TVectorT<float>* tVector =
nullptr;
52 f->GetObject(name, tVector);
55 for (
int i = 0;
i < tVector->GetNoElements(); ++
i)
56 vector.push_back((*tVector)[
i]);
63 th1->GetNbinsX(), th1->GetXaxis()->GetBinLowEdge(1), th1->GetXaxis()->GetBinUpEdge(th1->GetNbinsX()));
64 for (
int ibin = 0; ibin <= th1->GetNbinsX() + 1; ++ibin)
71 std::map<std::vector<int>, TH1*>& pdfs,
72 std::vector<int>& binNumbers,
74 if (!pdfs[binNumbers])
76 std::vector<int> neighbour = binNumbers;
78 if (--(neighbour[index]) < 0)
80 }
while (!pdfs[neighbour]);
81 if (TString(pdfs[binNumbers]->GetTitle()) != TString(pdfs[neighbour]->GetTitle()))
102 pdfs.erase(binNumbers);
109 payload.
data.clear();
115 std::map<TString, std::vector<float>> gridOfBins;
116 for (
auto&& binVariable : {
"eta",
"pt",
"rho"}) {
117 if (!
getVectorFromFile(f, gridOfBins[binVariable], TString(binVariable) +
"Bins")) {
118 edm::LogError(
"NoBins") <<
"Missing bin information for " << binVariable <<
" in input file" << std::endl;
126 std::map<std::vector<int>, TH1*> pdfs;
128 for (
auto&&
type : {
"gluon",
"quark"}) {
130 int qgIndex = strcmp(
type,
"gluon") == 0 ? 1 : 0;
131 for (
auto&& likelihoodVar : {
"mult",
"ptD",
"axis2"}) {
133 int varIndex = (strcmp(likelihoodVar,
"mult") == 0 ? 0 : (strcmp(likelihoodVar,
"ptD") == 0 ? 1 : 2));
134 for (
int i = 0;
i < (int)gridOfBins[
"eta"].
size() - 1; ++
i) {
135 for (
int j = 0;
j < (int)gridOfBins[
"pt"].
size() - 1; ++
j) {
136 for (
int k = 0;
k < (int)gridOfBins[
"rho"].
size() - 1; ++
k) {
138 category.
EtaMin = gridOfBins[
"eta"][
i];
139 category.
EtaMax = gridOfBins[
"eta"][
i + 1];
140 category.
PtMin = gridOfBins[
"pt"][
j];
141 category.
PtMax = gridOfBins[
"pt"][
j + 1];
142 category.
RhoMin = gridOfBins[
"rho"][
k];
143 category.
RhoMax = gridOfBins[
"rho"][
k + 1];
147 TString
key = TString::Format(
"%s/%s_%s_eta%d_pt%d_rho%d", likelihoodVar, likelihoodVar,
type,
i,
j,
k);
148 TH1* pdf = (TH1*)f->Get(key);
150 edm::LogError(
"NoPDF") <<
"Could not found pdf with key " << key <<
" in input file" << std::endl;
154 std::vector<int> binNumbers = {qgIndex, varIndex,
i,
j,
k};
155 pdfs[binNumbers] = pdf;
160 for (
int k = 0;
k < (int)gridOfBins[
"rho"].
size() - 1; ++
k) {
161 std::vector<int> binNumbers = {qgIndex, varIndex,
i,
j,
k};
165 for (
int j = 0;
j < (int)gridOfBins[
"pt"].
size() - 1; ++
j) {
166 for (
int k = 0;
k < (int)gridOfBins[
"rho"].
size() - 1; ++
k) {
167 std::vector<int> binNumbers = {qgIndex, varIndex,
i,
j,
k};
177 for (
const auto&
category : categories) {
183 payload.
data.push_back(entry);
187 "%6d) var=%1d\t\tqg=%1d\t\teta={%5.2f,%5.2f}\t\tpt={%8.2f,%8.2f}\t\trho={%6.2f,%8.2f}",
211 edm::LogInfo(
"UserOutput") <<
"Opening PoolDBOutputService" << std::endl;
Log< level::Info, true > LogVerbatim
QGLikelihoodCategory category
static const char category[]
#define DEFINE_FWK_MODULE(type)
QGLikelihoodCategory qgValidRange
Log< level::Error, false > LogError
void tryToMerge(std::map< std::vector< int >, QGLikelihoodCategory > &, std::map< std::vector< int >, TH1 * > &, std::vector< int > &, int)
QGLikelihoodDBWriter(const edm::ParameterSet &)
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
std::string inputRootFile
cond::Time_t beginOfTime() const
tuple key
prepare the HTCondor submission files and eventually submit them
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
QGLikelihoodObject::Histogram transformToHistogramObject(TH1 *)
const double EtaMin[kNumberCalorimeter]
Category structure: ranges associated with QGLikelihood histograms.
Log< level::Info, false > LogInfo
void analyze(const edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
std::vector< Entry > data
bool getVectorFromFile(TFile *, std::vector< float > &, const TString &)
tuple size
Write out results.
~QGLikelihoodDBWriter() override