15 #include "RelationalAccess/ICursor.h" 16 #include "RelationalAccess/IQuery.h" 17 #include "RelationalAccess/ISchema.h" 18 #include "RelationalAccess/ITransaction.h" 20 #include "CoralBase/Attribute.h" 21 #include "CoralBase/AttributeList.h" 45 }
catch (std::runtime_error
const &
e) {
48 std::cerr <<
"Error loading parser: " << e.what() << std::endl;
54 for (
unsigned int i = 0;
i <
MEinfo_.size();
i++) {
59 }
else if (strcmp(
MEinfo_[
i].
type.c_str(),
"th2d") == 0) {
68 }
else if (strcmp(
MEinfo_[
i].
type.c_str(),
"tprofile") == 0) {
77 }
else if (strcmp(
MEinfo_[
i].
type.c_str(),
"tprofile2d") == 0) {
108 atLeastAQuery =
false;
110 std::vector<std::string>
vars;
113 for (
unsigned int i = 0;
i <
MEinfo_.size();
i++) {
122 atLeastAQuery =
true;
124 session->transaction().start(
true);
126 coral::ISchema &schema = session->nominalSchema();
128 coral::IQuery *
query = schema.newQuery();
130 for (
unsigned int j = 0;
j <
MEinfo_[
i].queries.size();
j++) {
131 if (strcmp(
MEinfo_[
i].queries[
j].query.c_str(),
"addToTableList") == 0) {
133 }
else if (strcmp(
MEinfo_[
i].queries[
j].query.c_str(),
"addToOutputList") == 0) {
135 vars.push_back(
MEinfo_[
i].queries[
j].alias);
136 }
else if (strcmp(
MEinfo_[
i].queries[
j].query.c_str(),
"setCondition") == 0) {
137 query->setCondition(
MEinfo_[
i].queries[
j].
arg, coral::AttributeList());
138 }
else if (strcmp(
MEinfo_[
i].queries[
j].query.c_str(),
"addToOrderList") == 0) {
143 coral::ICursor &cursor = query->execute();
147 while (cursor.next() && k <
MEinfo_[
i].loop) {
150 const coral::AttributeList &row = cursor.currentRow();
152 std::vector<float> vvars;
154 for (
unsigned int l = 0;
l < vars.size();
l++) {
156 vvars.push_back(row[vars[
l]].data<float>());
159 if (vvars.size() == 2) {
162 MEs_[
i]->Fill(vvars[0], vvars[1]);
163 }
else if (vvars.size() == 3) {
166 MEs_[
i]->Fill(vvars[0], vvars[1], vvars[2]);
167 }
else if (vvars.size() == 4) {
170 MEs_[
i]->Fill(vvars[0], vvars[1], vvars[2], vvars[3]);
172 std::cerr <<
"Too many variables to plot..." << std::endl;
182 std::cerr <<
"CORAL Exception : " << e.what() << std::endl;
184 std::cerr <<
"Standard C++ exception : " << e.what() << std::endl;
190 session->transaction().commit();
195 gStyle->SetOptStat(0);
197 gStyle->SetPalette(1,
nullptr);
199 for (
unsigned int i = 0;
i <
MEinfo_.size();
i++) {
205 c1 =
new TCanvas(
"c1",
"dummy", 400 * n, 400);
207 c1 =
new TCanvas(
"c1",
"dummy", 400, 400 * n);
212 const double histMax = 1.e15;
216 if (dynamic_cast<TH1F *>(ob)) {
217 TH1F *
h =
dynamic_cast<TH1F *
>(ob);
219 }
else if (dynamic_cast<TH2F *>(ob)) {
220 TH2F *
h =
dynamic_cast<TH2F *
>(ob);
221 if (h->GetMaximum(histMax) > 1.e4) {
227 }
else if (dynamic_cast<TProfile *>(ob)) {
228 TProfile *
h =
dynamic_cast<TProfile *
>(ob);
229 if (h->GetMaximum(histMax) > 1.e4) {
240 c1->SaveAs(name.c_str());
T getUntrackedParameter(std::string const &, T const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
MonitorElementsDb(const edm::ParameterSet &ps, std::string &xmlFile)
Constructors.
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
const std::vector< DB_ME > & getDB_ME(void) const
MonitorElement * bookProfile2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s")
Generate a Monitor Element from DB data.
MonitorElement * bookProfile(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
void analyze(const edm::Event &e, const edm::EventSetup &c, coral::ISessionProxy *s)
Analyze.
void load() noexcept(false)
std::vector< MonitorElement * > MEs_
std::vector< DB_ME > MEinfo_
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
virtual ~MonitorElementsDb()
Destructor.
void htmlOutput(std::string &htmlDir)
MonitorXMLParser * parser_