44 size_t subStringPos = myString.find(mySubstring);
45 if(subStringPos != std::string::npos){
46 myString = myString.substr(subStringPos + mySubstring.length(), std::string::npos);
55 payload->
data.clear();
59 TList *
keys = f->GetListOfKeys();
61 edm::LogError(
"NoKeys") <<
"There are no keys in the input file." << std::endl;
68 while((keydir = (TKey*)nextdir())){
69 TDirectory *
dir = (TDirectory*)keydir->ReadObj() ;
70 TIter nexthist(dir->GetListOfKeys());
72 while((keyhist = (TKey*)nexthist())){
74 float ptMin, ptMax, rhoMin, rhoMax, etaMin, etaMax;
75 int varIndex, qgIndex;
81 if(
extractString(
"nPFCand_QC_ptCutJet0", histname)) varIndex = 0;
83 else if(
extractString(
"axis2_QCJet0", histname)) varIndex = 2;
87 if(
extractString(
"_F", histname)){ etaMin = 2.5; etaMax = 4.7;}
88 else { etaMin = 0.;etaMax = 2.5;}
97 ptMin = std::atof(histname.substr(0, histname.find(
"_")).c_str());
99 ptMax = std::atof(histname.substr(0, histname.find(
"rho")).c_str());
101 if(etaMin == 2.5 && ptMin > 128)
continue;
102 if(etaMin == 2.5 && ptMin == 127) ptMax = 4000;
106 rhoMin = std::atof(histname.c_str());
107 rhoMax = rhoMin + 1.;
111 sprintf(buff,
"%50s : var=%1d, qg=%1d, etaMin=%6.2f, etaMax=%6.2f, ptMin=%8.2f, ptMax=%8.2f, rhoMin=%6.2f, rhoMax=%6.2f", histname_.c_str(), varIndex, qgIndex, etaMin, etaMax,
ptMin, ptMax, rhoMin, rhoMax );
119 category.
PtMax = ptMax;
126 TH1* th1hist = (TH1*) keyhist->ReadObj();
129 if(th1hist->GetEntries()<50 ) th1hist->Rebin(5);
130 else if(th1hist->GetEntries()<500 ) th1hist->Rebin(2);
131 th1hist->Scale(1./th1hist->Integral(
"width"));
134 QGLikelihoodObject::Histogram histogram(th1hist->GetNbinsX(), th1hist->GetXaxis()->GetBinLowEdge(1), th1hist->GetXaxis()->GetBinUpEdge(th1hist->GetNbinsX()));
135 for(
int ibin = 0; ibin <= th1hist->GetNbinsX() + 1; ++ibin){
143 entry.
mean = th1hist->GetMean();
144 payload->
data.push_back(entry);
159 edm::LogInfo(
"UserOutput") <<
"Opening PoolDBOutputService" << std::endl;
163 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
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, histogram and mean...
bool isNewTagRequest(const std::string &recordName)
std::string inputRootFile
cond::Time_t beginOfTime() const
bool extractString(std::string, std::string &)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
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
virtual void beginJob() override
virtual void endJob() override