CMS 3D CMS Logo

SiStripTkMaps.h
Go to the documentation of this file.
1 #ifndef DQM_TRACKERREMAPPER_SISTRIPTKMAPS_H
2 #define DQM_TRACKERREMAPPER_SISTRIPTKMAPS_H
3 
4 // CMSSW includes
12 
13 // ROOT includes
14 #include "TArrow.h"
15 #include "TPaletteAxis.h"
16 #include "TGaxis.h"
17 #include "TCanvas.h"
18 #include "TColor.h"
19 #include "TGraph.h"
20 #include "TLatex.h"
21 #include "TH2Poly.h"
22 #include "TStyle.h"
23 
24 // STL includes
25 #include <fstream>
26 #include <iostream>
27 #include <map>
28 #include <string>
29 #include <vector>
30 
31 // boost includes
32 #include <boost/tokenizer.hpp>
33 #include <boost/range/adaptor/indexed.hpp>
34 
35 #define MYOUT LogDebug("SiStripTkMaps")
36 
37 /*--------------------------------------------------------------------
38 / Ancillary class to build SiStrip Tracker maps
39 /--------------------------------------------------------------------*/
41 public:
42  SiStripTkMaps(const char* option)
43  : m_option{option},
45  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {}
46 
47  ~SiStripTkMaps() = default;
48 
49  void bookMap(const std::string mapTitle, const std::string zAxisTitle);
50  void fill(long rawid, double val);
51  void drawMap(TCanvas& canvas, std::string option = "");
52 
53  //============================================================================
54  inline const TH2Poly* getTheMap() { return m_trackerMap; }
55 
56  //============================================================================
57  inline const std::string& getTheMapTitle() { return m_mapTitle; }
58 
59  //============================================================================
60  inline const std::string& getTheZAxisTitle() { return m_zAxisTitle; }
61 
62  //============================================================================
63  inline const std::vector<unsigned int>& getTheFilledIds() { return m_detIdVector; }
64 
65  //============================================================================
66  inline const std::vector<double>& getTheFilledValues() { return m_values; }
67 
68  //============================================================================
69  inline void setZAxisRange(double xmin, double xmax) { m_trackerMap->GetZaxis()->SetRangeUser(xmin, xmax); }
70 
71 private:
72  // private members
73  Option_t* m_option;
76  double m_axmin, m_axmax;
77  std::map<long, std::shared_ptr<TGraph>> m_bins;
78  std::vector<unsigned int> m_detIdVector;
79  std::vector<double> m_values;
81  TH2Poly* m_trackerMap{nullptr};
82 
83  // private methods
84  //============================================================================
85  void dressMap(TCanvas& canv);
86  void drawArrows(
87  const float x_X1, const float x_X2, const float x_Y1, const float y_Y2, const char* x_label, const char* y_label);
88  void adjustCanvasMargins(TVirtualPad* pad, const float top, const float bottom, const float left, const float right);
89  void readVertices(double& minx, double& maxx, double& miny, double& maxy);
90 };
91 
92 #endif
void readVertices(double &minx, double &maxx, double &miny, double &maxy)
Option_t * m_option
Definition: SiStripTkMaps.h:73
const std::vector< double > & getTheFilledValues()
Definition: SiStripTkMaps.h:66
void bookMap(const std::string mapTitle, const std::string zAxisTitle)
void dressMap(TCanvas &canv)
void drawArrows(const float x_X1, const float x_X2, const float x_Y1, const float y_Y2, const char *x_label, const char *y_label)
const std::vector< unsigned int > & getTheFilledIds()
Definition: SiStripTkMaps.h:63
std::string m_zAxisTitle
Definition: SiStripTkMaps.h:75
void adjustCanvasMargins(TVirtualPad *pad, const float top, const float bottom, const float left, const float right)
std::string m_mapTitle
Definition: SiStripTkMaps.h:74
SiStripTkMaps(const char *option)
Definition: SiStripTkMaps.h:42
const std::string & getTheMapTitle()
Definition: SiStripTkMaps.h:57
std::vector< unsigned int > m_detIdVector
Definition: SiStripTkMaps.h:78
void fill(long rawid, double val)
void setZAxisRange(double xmin, double xmax)
Definition: SiStripTkMaps.h:69
~SiStripTkMaps()=default
const TH2Poly * getTheMap()
Definition: SiStripTkMaps.h:54
std::vector< double > m_values
Definition: SiStripTkMaps.h:79
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
def canvas(sub, attr)
Definition: svgfig.py:482
void drawMap(TCanvas &canvas, std::string option="")
TH2Poly * m_trackerMap
Definition: SiStripTkMaps.h:81
const std::string & getTheZAxisTitle()
Definition: SiStripTkMaps.h:60
TrackerTopology m_trackerTopo
Definition: SiStripTkMaps.h:80
std::map< long, std::shared_ptr< TGraph > > m_bins
Definition: SiStripTkMaps.h:77