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  TkHistoMap(const TkDetMap* tkDetMap,
26  const std::string& path,
27  const std::string& MapName,
28  float baseline = 0,
29  bool mechanicalView = false);
30  TkHistoMap(const TkDetMap* tkDetMap,
31  const std::string& path,
32  const std::string& MapName,
33  float baseline,
34  bool mechanicalView,
35  bool isTH2F);
36  TkHistoMap(const TkDetMap* tkDetMap);
38 
39  void loadServices();
40 
41  void loadTkHistoMap(const std::string& path, const std::string& MapName, bool mechanicalView = false);
42 
43  MonitorElement* getMap(short layerNumber) { return tkHistoMap_[layerNumber]; };
44  const std::vector<MonitorElement*>& getAllMaps() const { return tkHistoMap_; };
45  std::vector<MonitorElement*>& getAllMaps() { return tkHistoMap_; };
46 
47  float getValue(DetId detid);
48  float getEntries(DetId detid);
49  DetId getDetId(const std::string& title, int ix, int iy) {
50  return getDetId(getLayerNum(getLayerName(title)), ix, iy);
51  }
52  DetId getDetId(int layer, int ix, int iy) { return tkdetmap_->getDetFromBin(layer, ix, iy); }
53  DetId getDetId(const MonitorElement* ME, int ix, int iy) { return getDetId(ME->getTitle(), ix, iy); }
54  std::string getLayerName(std::string title) { return title.erase(0, MapName_.size() + 1); }
55  uint16_t getLayerNum(const std::string& layerName) { return tkdetmap_->getLayerNum(layerName); }
56 
57  void fillFromAscii(const std::string& filename);
58  void fill(DetId detid, float value);
59  void setBinContent(DetId detid, float value);
60  void add(DetId detid, float value);
61 
62  void dumpInTkMap(TrackerMap* tkmap,
63  bool dumpEntries = false); //dumpEntries==true? (dump entries) : (dump mean values)
64  void save(const std::string& filename);
65  void saveAsCanvas(const std::string& filename, const std::string& options = "", const std::string& mode = "RECREATE");
66 
67 private:
68  void load(const TkDetMap* tkDetMap,
69  const std::string& path,
70  float baseline,
71  bool mechanicalView,
72  bool isTH2F,
73  bool createTkMap = true);
74 
75  void createTkHistoMap(DQMStore::IBooker& ibooker,
76  const std::string& path,
77  const std::string& MapName,
78  float baseline,
79  bool mechanicalView);
80 
83  const std::string& MapName,
84  int layer,
85  bool mechanicalView,
87 
88  DQMStore* dqmStore_{nullptr};
89 
92  int16_t cached_layer;
94  std::vector<MonitorElement*> tkHistoMap_;
97  bool isTH2F_;
98 };
99 
100 #endif
void loadServices()
Definition: TkHistoMap.cc:60
virtual std::string getTitle() const
get MonitorElement title
DetId cached_detid
Definition: TkHistoMap.h:91
void setBinContent(DetId detid, float value)
Definition: TkHistoMap.cc:204
std::vector< MonitorElement * > & getAllMaps()
Definition: TkHistoMap.h:45
DetId getDetId(const MonitorElement *ME, int ix, int iy)
Definition: TkHistoMap.h:53
void fillFromAscii(const std::string &filename)
Definition: TkHistoMap.cc:164
void load(const TkDetMap *tkDetMap, const std::string &path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap=true)
Definition: TkHistoMap.cc:47
int16_t cached_layer
Definition: TkHistoMap.h:92
int HistoNumber
Definition: TkHistoMap.h:95
std::vector< MonitorElement * > tkHistoMapVect
Definition: TkHistoMap.h:16
const std::vector< MonitorElement * > & getAllMaps() const
Definition: TkHistoMap.h:44
DQMStore * dqmStore_
Definition: TkHistoMap.h:88
std::vector< MonitorElement * > tkHistoMap_
Definition: TkHistoMap.h:94
std::string getLayerName(std::string title)
Definition: TkHistoMap.h:54
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:52
void save(const std::string &filename)
Definition: TkHistoMap.cc:71
std::string MapName_
Definition: TkHistoMap.h:96
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:100
TkLayerMap::XYbin cached_XYbin
Definition: TkHistoMap.h:93
TkHistoMap(const TkDetMap *tkDetMap, DQMStore::IBooker &ibooker, const std::string &path, const std::string &MapName, float baseline=0, bool mechanicalView=false)
Definition: TkHistoMap.cc:35
dqm::legacy::DQMStore DQMStore
Definition: TkHistoMap.h:14
Definition: value.py:1
void dumpInTkMap(TrackerMap *tkmap, bool dumpEntries=false)
Definition: TkHistoMap.cc:270
Definition: DetId.h:17
MonitorElement * getMap(short layerNumber)
Definition: TkHistoMap.h:43
bool isTH2F_
Definition: TkHistoMap.h:97
DetId getDetId(const std::string &title, int ix, int iy)
Definition: TkHistoMap.h:49
void fill(DetId detid, float value)
Definition: TkHistoMap.cc:176
uint16_t getLayerNum(const std::string &layerName)
Definition: TkHistoMap.h:55
const TkDetMap * tkdetmap_
Definition: TkHistoMap.h:90
void saveAsCanvas(const std::string &filename, const std::string &options="", const std::string &mode="RECREATE")
Definition: TkHistoMap.cc:287
void loadTkHistoMap(const std::string &path, const std::string &MapName, bool mechanicalView=false)
Definition: TkHistoMap.cc:76
DetId getDetFromBin(int layer, int ix, int iy) const
Definition: TkDetMap.h:191
void add(DetId detid, float value)
Definition: TkHistoMap.cc:232
float getEntries(DetId detid)
Definition: TkHistoMap.cc:260
float getValue(DetId detid)
Definition: TkHistoMap.cc:250
std::string folderDefinition(DQMStore::IBooker &ibooker, std::string folder, const std::string &MapName, int layer, bool mechanicalView, std::string &fullName)
Definition: TkHistoMap.cc:138