CMS 3D CMS Logo

TkHistoMap.h
Go to the documentation of this file.
1 #ifndef DQM_SiStripCommon_TKHistoMap_h
2 #define DQM_SiStripCommon_TKHistoMap_h
3 
7 
10 #include <string>
11 
12 class TkHistoMap {
13 protected:
16  typedef std::vector<MonitorElement*> tkHistoMapVect;
17 
18 public:
19  TkHistoMap(const TkDetMap* tkDetMap,
20  DQMStore::IBooker& ibooker,
21  const std::string& path,
22  const std::string& MapName,
23  float baseline = 0,
24  bool mechanicalView = false,
25  bool isTH2F = false);
26  TkHistoMap(const TkDetMap* tkDetMap,
27  const std::string& path,
28  const std::string& MapName,
29  float baseline = 0,
30  bool mechanicalView = false);
31  TkHistoMap(const TkDetMap* tkDetMap,
32  const std::string& path,
33  const std::string& MapName,
34  float baseline,
35  bool mechanicalView,
36  bool isTH2F);
37  TkHistoMap(const TkDetMap* tkDetMap);
38  ~TkHistoMap() = default;
39 
40  void loadServices();
41 
42  void loadTkHistoMap(const std::string& path, const std::string& MapName, bool mechanicalView = false);
43 
44  MonitorElement* getMap(short layerNumber) { return tkHistoMap_[layerNumber]; };
45  const std::vector<MonitorElement*>& getAllMaps() const { return tkHistoMap_; };
46  std::vector<MonitorElement*>& getAllMaps() { return tkHistoMap_; };
47 
48  float getValue(DetId detid);
49  float getEntries(DetId detid);
50  DetId getDetId(const std::string& title, int ix, int iy) {
51  return getDetId(getLayerNum(getLayerName(title)), ix, iy);
52  }
53  DetId getDetId(int layer, int ix, int iy) { return tkdetmap_->getDetFromBin(layer, ix, iy); }
54  DetId getDetId(const MonitorElement* ME, int ix, int iy) { return getDetId(ME->getTitle(), ix, iy); }
55  std::string getLayerName(std::string title) { return title.erase(0, MapName_.size() + 1); }
57 
58  void fillFromAscii(const std::string& filename);
59  void fill(DetId detid, float value);
60  void setBinContent(DetId detid, float value);
61  void add(DetId detid, float value);
62 
63  void dumpInTkMap(TrackerMap* tkmap,
64  bool dumpEntries = false); //dumpEntries==true? (dump entries) : (dump mean values)
65  void save(const std::string& filename);
66  void saveAsCanvas(const std::string& filename, const std::string& options = "", const std::string& mode = "RECREATE");
67 
68 private:
69  void load(const TkDetMap* tkDetMap,
70  const std::string& path,
71  float baseline,
72  bool mechanicalView,
73  bool isTH2F,
74  bool createTkMap = true);
75 
76  void createTkHistoMap(DQMStore::IBooker& ibooker,
77  const std::string& path,
78  const std::string& MapName,
79  float baseline,
80  bool mechanicalView);
81 
84  const std::string& MapName,
85  int layer,
86  bool mechanicalView,
88 
89  DQMStore* dqmStore_{nullptr};
90 
93  int16_t cached_layer;
95  std::vector<MonitorElement*> tkHistoMap_;
98  bool isTH2F_;
99 };
100 
101 #endif
void loadServices()
Definition: TkHistoMap.cc:66
~TkHistoMap()=default
constexpr char const * layerName[numberOfLayers]
DetId cached_detid
Definition: TkHistoMap.h:92
void setBinContent(DetId detid, float value)
Definition: TkHistoMap.cc:219
std::vector< MonitorElement * > & getAllMaps()
Definition: TkHistoMap.h:46
DetId getDetId(const MonitorElement *ME, int ix, int iy)
Definition: TkHistoMap.h:54
void fillFromAscii(const std::string &filename)
Definition: TkHistoMap.cc:170
const std::vector< MonitorElement * > & getAllMaps() const
Definition: TkHistoMap.h:45
void load(const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
Definition: TkHistoMap.cc:48
int16_t cached_layer
Definition: TkHistoMap.h:93
int HistoNumber
Definition: TkHistoMap.h:96
std::vector< MonitorElement * > tkHistoMapVect
Definition: TkHistoMap.h:16
DQMStore * dqmStore_
Definition: TkHistoMap.h:89
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:95
std::string getLayerName(std::string title)
Definition: TkHistoMap.h:55
Definition: ME.h:11
static int getLayerNum(const std::string &in)
Definition: TkDetMap.cc:311
DetId getDetId(int layer, int ix, int iy)
Definition: TkHistoMap.h:53
void save(const std::string &filename)
Definition: TkHistoMap.cc:77
std::string MapName_
Definition: TkHistoMap.h:97
dqm::legacy::MonitorElement MonitorElement
Definition: TkHistoMap.h:15
void createTkHistoMap(DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline, bool mechanicalView)
Definition: TkHistoMap.cc:106
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:94
DetId getDetFromBin(int layer, int ix, int iy) const
Definition: TkDetMap.h:191
dqm::legacy::DQMStore DQMStore
Definition: TkHistoMap.h:14
Definition: value.py:1
void dumpInTkMap(TrackerMap *tkmap, bool dumpEntries=false)
Definition: TkHistoMap.cc:306
Definition: DetId.h:17
MonitorElement * getMap(short layerNumber)
Definition: TkHistoMap.h:44
bool isTH2F_
Definition: TkHistoMap.h:98
DetId getDetId(const std::string &title, int ix, int iy)
Definition: TkHistoMap.h:50
void fill(DetId detid, float value)
Definition: TkHistoMap.cc:187
uint16_t getLayerNum(const std::string &layerName)
Definition: TkHistoMap.h:56
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:91
void saveAsCanvas(const std::string &filename, const std::string &options="", const std::string &mode="RECREATE")
Definition: TkHistoMap.cc:323
TkHistoMap(const TkDetMap *tkDetMap, DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline=0, bool mechanicalView=false, bool isTH2F=false)
Definition: TkHistoMap.cc:35
void loadTkHistoMap(const std::string &path, const std::string &MapName, bool mechanicalView=false)
Definition: TkHistoMap.cc:82
void add(DetId detid, float value)
Definition: TkHistoMap.cc:253
float getEntries(DetId detid)
Definition: TkHistoMap.cc:290
float getValue(DetId detid)
Definition: TkHistoMap.cc:275
std::string folderDefinition(DQMStore::IBooker &ibooker, std::string folder, const std::string &MapName, int layer, bool mechanicalView, std::string &fullName)
Definition: TkHistoMap.cc:144