CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HDQMInspector.h
Go to the documentation of this file.
1 #ifndef HDQMInspector_h
2 #define HDQMInspector_h
3 
4 //---------------------------------------------------------//
5 //
6 //-- extract summary informations from historic DB --
7 //-- plot summary informations vs run number or vs detID --
8 //
9 //---------------------------------------------------------//
10 //---------------------------------------------------------//
11 //
12 // 12-08-2008 - domenico.giordano@cern.ch
13 // 12-06-2008 - anne-catherine.le.bihan@cern.ch
14 //
15 //---------------------------------------------------------//
16 
17 #include <vector>
18 #include <string>
19 #include <iostream>
20 #include <fstream>
21 #include <cmath>
25 #include "TFile.h"
26 #include "TGraphErrors.h"
27 
29 {
30  public:
32  DBName_(""),
33  DBTag_(""),
34  DBauth_(""),
35  Iterator(0),
36  iDebug(0),
37  iDoStat(0),
38  fSkip99s(false),
39  fSkip0s(false),
41  fSep("@")
42  {
43  };
44 
46  DBName_(""),
47  DBTag_(""),
48  DBauth_(""),
49  Iterator(0),
50  iDebug(0),
51  iDoStat(0),
52  fSkip99s(false),
53  fSkip0s(false),
54  fHDQMInspectorConfig(InConfig),
55  fSep("@")
56  {
57  };
58 
59  virtual ~HDQMInspector() {
60  delete Iterator;
61  };
62  struct DetIdItemList {
63  unsigned int detid;
64  std::vector<std::string> items;
65  std::vector<float> values;
66  };
67 
68  void setDB(const std::string & DBName, const std::string & DBTag, const std::string & DBauth = "");
69  void createTrend(const std::string ListItems, const std::string CanvasName="", const int logy=0, const std::string Conditions="",
70  std::string const& Labels="", const unsigned int firstRun=1, const unsigned int lastRun=0xFFFFFFFE, int const UseYRange = 0, double const& YMin = 999999, double const& YMax = -999999);
71  void createTrendLastRuns(const std::string ListItems, const std::string CanvasName="",
72  const int logy=0, const std::string Conditions="", std::string const& Labels="", const unsigned int nRuns=10, int const UseYRange = 0, double const& YMin = 999999, double const& YMax = -999999);
73  void setDebug(int i){iDebug=i;}
74  void setDoStat(int i){iDoStat=i;}
75  void setBlackList(std::string const& ListItems);
76  void setWhiteList(std::string const& ListItems);
77  std::string readListFromFile(const std::string & listFileName);
78  void setSkip99s (bool const in) {
79  fSkip99s = in;
80  return;
81  }
82  void setSkip0s (bool const in) {
83  fSkip0s = in;
84  return;
85  }
86  void closeFile ()
87  {
88  if( fOutFile ) {
89  fOutFile->Close();
90  }
91  }
92  double findGraphMax(TGraphErrors*);
93  double findGraphMin(TGraphErrors*);
94  void setSeparator(std::string const in) {
95  fSep = in;
96  return;
97  }
98 
99 
100  inline std::vector<unsigned int> getRuns() { return vRun_;}
101  inline std::vector<float> getSummary() { return vSummary_;}
102 
103  inline std::vector<std::string> getListItems() { return vlistItems_;}
104  inline std::vector<unsigned int> getvDetId() { return vdetId_;}
105 
106 private:
107 
108  void style();
109  void plot(size_t& nPads, std::string CanvasName, int logy=0, std::string const& Labels = "", int const UseYRange = 0, double const XMin = 999999, double const YMin = -999999);
110  void accessDB();
111  void InitializeIOVList();
112  bool setRange(unsigned int& firstRun, unsigned int& lastRun);
113  void setItems(std::string);
114  size_t unpackItems(std::string& );
115  void unpackConditions(std::string&, std::vector<DetIdItemList>&);
116  bool ApplyConditions(std::string&, std::vector<DetIdItemList>&);
117  bool isListed(unsigned int run, std::vector<unsigned int>& vList);
118 
119 
121 
123 
124  std::vector<unsigned int> iovList;
125  std::vector<unsigned int> blackList;
126  std::vector<unsigned int> whiteList;
127 
128  std::vector<unsigned int> vRun_;
129  std::vector<float> vSummary_;
130  std::vector<DetIdItemList> vDetIdItemList_;
131  std::vector<std::string> vlistItems_;
132  std::vector<unsigned int> vdetId_;
133 
134  int iDebug;
135  int iDoStat;
136  bool fSkip99s;
137  bool fSkip0s;
138 
140 
142 
143 public:
144  TFile *fOutFile;
145 
146 };
147 
148 #endif
double findGraphMin(TGraphErrors *)
void createTrendLastRuns(const std::string ListItems, const std::string CanvasName="", const int logy=0, const std::string Conditions="", std::string const &Labels="", const unsigned int nRuns=10, int const UseYRange=0, double const &YMin=999999, double const &YMax=-999999)
int i
Definition: DBlmapReader.cc:9
double findGraphMax(TGraphErrors *)
std::vector< std::string > vlistItems_
std::string DBauth_
HDQMInspector(const HDQMInspectorConfigBase *InConfig)
Definition: HDQMInspector.h:45
void closeFile()
Definition: HDQMInspector.h:86
std::vector< std::string > items
Definition: HDQMInspector.h:64
std::vector< unsigned int > iovList
std::vector< float > getSummary()
string firstRun
Definition: dataset.py:789
std::vector< unsigned int > whiteList
void setSkip99s(bool const in)
Definition: HDQMInspector.h:78
void setItems(std::string)
void setSeparator(std::string const in)
Definition: HDQMInspector.h:94
void setBlackList(std::string const &ListItems)
bool isListed(unsigned int run, std::vector< unsigned int > &vList)
std::string fSep
TFile * fOutFile
void createTrend(const std::string ListItems, const std::string CanvasName="", const int logy=0, const std::string Conditions="", std::string const &Labels="", const unsigned int firstRun=1, const unsigned int lastRun=0xFFFFFFFE, int const UseYRange=0, double const &YMin=999999, double const &YMax=-999999)
void setWhiteList(std::string const &ListItems)
void unpackConditions(std::string &, std::vector< DetIdItemList > &)
std::vector< unsigned int > getvDetId()
std::vector< float > values
Definition: HDQMInspector.h:65
std::vector< unsigned int > blackList
void setDebug(int i)
Definition: HDQMInspector.h:73
virtual ~HDQMInspector()
Definition: HDQMInspector.h:59
std::string readListFromFile(const std::string &listFileName)
bool ApplyConditions(std::string &, std::vector< DetIdItemList > &)
const HDQMInspectorConfigBase * fHDQMInspectorConfig
bool setRange(unsigned int &firstRun, unsigned int &lastRun)
std::string DBTag_
std::vector< std::string > getListItems()
std::vector< unsigned int > getRuns()
std::vector< float > vSummary_
std::vector< unsigned int > vdetId_
size_t unpackItems(std::string &)
void setDB(const std::string &DBName, const std::string &DBTag, const std::string &DBauth="")
void setSkip0s(bool const in)
Definition: HDQMInspector.h:82
std::string DBName_
std::vector< DetIdItemList > vDetIdItemList_
CondCachedIter< HDQMSummary > * Iterator
volatile std::atomic< bool > shutdown_flag false
void plot(size_t &nPads, std::string CanvasName, int logy=0, std::string const &Labels="", int const UseYRange=0, double const XMin=999999, double const YMin=-999999)
void InitializeIOVList()
void setDoStat(int i)
Definition: HDQMInspector.h:74
std::vector< unsigned int > vRun_