49 TVectorT<float> *tVector =
nullptr;
50 f->GetObject(name, tVector);
51 if(!tVector)
return false;
52 for(
int i = 0;
i < tVector->GetNoElements(); ++
i) vector.push_back((*tVector)[
i]);
59 QGLikelihoodObject::Histogram histogram(th1->GetNbinsX(), th1->GetXaxis()->GetBinLowEdge(1), th1->GetXaxis()->GetBinUpEdge(th1->GetNbinsX()));
60 for(
int ibin = 0; ibin <= th1->GetNbinsX() + 1; ++ibin) histogram.
setBinContent(ibin, th1->GetBinContent(ibin));
67 if(!pdfs[binNumbers])
return;
68 std::vector<int> neighbour = binNumbers;
70 if(--(neighbour[index]) < 0)
return;
71 }
while (!pdfs[neighbour]);
72 if(TString(pdfs[binNumbers]->GetTitle()) != TString(pdfs[neighbour]->GetTitle()))
return;
83 pdfs.erase(binNumbers);
91 payload->
data.clear();
97 std::map<TString, std::vector<float>> gridOfBins;
98 for(TString binVariable : {
"eta",
"pt",
"rho"}){
100 edm::LogError(
"NoBins") <<
"Missing bin information for " << binVariable <<
" in input file" << std::endl;
108 std::map<std::vector<int>, TH1*> pdfs;
110 for(TString
type : {
"gluon",
"quark"}){
111 int qgIndex = (
type ==
"gluon");
112 for(TString likelihoodVar : {
"mult",
"ptD",
"axis2"}){
113 int varIndex = (likelihoodVar ==
"mult" ? 0 : (likelihoodVar ==
"ptD" ? 1 : 2));
114 for(
int i = 0;
i < (int)gridOfBins[
"eta"].
size() - 1; ++
i){
115 for(
int j = 0;
j < (int)gridOfBins[
"pt"].
size() - 1; ++
j){
116 for(
int k = 0;
k < (int)gridOfBins[
"rho"].
size() - 1; ++
k){
119 category.
EtaMin = gridOfBins[
"eta"][
i];
120 category.
EtaMax = gridOfBins[
"eta"][
i+1];
121 category.
PtMin = gridOfBins[
"pt"][
j];
122 category.
PtMax = gridOfBins[
"pt"][
j+1];
123 category.
RhoMin = gridOfBins[
"rho"][
k];
124 category.
RhoMax = gridOfBins[
"rho"][
k+1];
128 TString
key = TString::Format(likelihoodVar +
"/" + likelihoodVar +
"_" +
type +
"_eta%d_pt%d_rho%d",
i,
j,
k);
129 TH1* pdf = (TH1*) f->Get(key);
131 edm::LogError(
"NoPDF") <<
"Could not found pdf with key " << key <<
" in input file" << std::endl;
135 std::vector<int> binNumbers = {qgIndex, varIndex,
i,
j,
k};
136 pdfs[binNumbers] = pdf;
141 for(
int k = 0;
k < (int)gridOfBins[
"rho"].
size() - 1; ++
k){
142 std::vector<int> binNumbers = {qgIndex, varIndex,
i,
j,
k};
146 for(
int j = 0;
j < (int)gridOfBins[
"pt"].
size() - 1; ++
j){
147 for(
int k = 0;
k < (int)gridOfBins[
"rho"].
size() - 1; ++
k){
148 std::vector<int> binNumbers = {qgIndex, varIndex,
i,
j,
k};
164 payload->
data.push_back(entry);
167 sprintf(buff,
"%6d) var=%1d\t\tqg=%1d\t\teta={%5.2f,%5.2f}\t\tpt={%8.2f,%8.2f}\t\trho={%6.2f,%8.2f}", i++,
184 edm::LogInfo(
"UserOutput") <<
"Opening PoolDBOutputService" << std::endl;
188 edm::LogInfo(
"UserOutput") <<
"Setting up payload with " << payload->
data.size() <<
" entries and tag " <<
payloadTag << std::endl;
T getParameter(std::string const &) const
QGLikelihoodCategory category
#define DEFINE_FWK_MODULE(type)
QGLikelihoodCategory qgValidRange
const double EtaMax[kNumberCalorimeter]
void tryToMerge(std::map< std::vector< int >, QGLikelihoodCategory > &, std::map< std::vector< int >, TH1 * > &, std::vector< int > &, int)
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
QGLikelihoodDBWriter(const edm::ParameterSet &)
QGLikelihoodObject containing valid range and entries with category and histogram (mean is not used a...
bool isNewTagRequest(const std::string &recordName)
std::string inputRootFile
cond::Time_t beginOfTime() const
QGLikelihoodObject::Histogram transformToHistogramObject(TH1 *)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
const double EtaMin[kNumberCalorimeter]
Category structure: ranges associated with QGLikelihood histograms.
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
cond::Time_t endOfTime() const
std::vector< Entry > data
bool getVectorFromFile(TFile *, std::vector< float > &, const TString &)
virtual void beginJob() override
virtual void endJob() override
tuple size
Write out results.