File indexing completed on 2024-04-06 12:09:03
0001 #ifndef DQM_TRACKERREMAPPER_SISTRIPTKMAPS_H
0002 #define DQM_TRACKERREMAPPER_SISTRIPTKMAPS_H
0003
0004
0005 #include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h"
0006 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
0007 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
0008 #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h"
0009 #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "FWCore/ParameterSet/interface/FileInPath.h"
0012
0013
0014 #include "TArrow.h"
0015 #include "TPaletteAxis.h"
0016 #include "TGaxis.h"
0017 #include "TCanvas.h"
0018 #include "TColor.h"
0019 #include "TGraph.h"
0020 #include "TLatex.h"
0021 #include "TH2Poly.h"
0022 #include "TStyle.h"
0023
0024
0025 #include <fstream>
0026 #include <iostream>
0027 #include <map>
0028 #include <string>
0029 #include <vector>
0030
0031
0032 #include <boost/tokenizer.hpp>
0033 #include <boost/range/adaptor/indexed.hpp>
0034
0035 #define MYOUT LogDebug("SiStripTkMaps")
0036
0037
0038
0039
0040 class SiStripTkMaps {
0041 public:
0042 SiStripTkMaps(const char* option)
0043 : m_option{option},
0044 m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile(
0045 edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {}
0046
0047 ~SiStripTkMaps() = default;
0048
0049 void bookMap(const std::string mapTitle, const std::string zAxisTitle);
0050 void fill(long rawid, double val);
0051 void drawMap(TCanvas& canvas, std::string option = "");
0052
0053
0054 inline const TH2Poly* getTheMap() { return m_trackerMap; }
0055
0056
0057 inline const std::string& getTheMapTitle() { return m_mapTitle; }
0058
0059
0060 inline const std::string& getTheZAxisTitle() { return m_zAxisTitle; }
0061
0062
0063 inline const std::vector<unsigned int>& getTheFilledIds() { return m_detIdVector; }
0064
0065
0066 inline const std::vector<double>& getTheFilledValues() { return m_values; }
0067
0068
0069 inline void setZAxisRange(double xmin, double xmax) { m_trackerMap->GetZaxis()->SetRangeUser(xmin, xmax); }
0070
0071 private:
0072
0073 Option_t* m_option;
0074 std::string m_mapTitle = "";
0075 std::string m_zAxisTitle = "";
0076 double m_axmin, m_axmax;
0077 std::map<long, std::shared_ptr<TGraph>> m_bins;
0078 std::vector<unsigned int> m_detIdVector;
0079 std::vector<double> m_values;
0080 TrackerTopology m_trackerTopo;
0081 TH2Poly* m_trackerMap{nullptr};
0082
0083
0084
0085 void dressMap(TCanvas& canv);
0086 void drawArrows(
0087 const float x_X1, const float x_X2, const float x_Y1, const float y_Y2, const char* x_label, const char* y_label);
0088 void adjustCanvasMargins(TVirtualPad* pad, const float top, const float bottom, const float left, const float right);
0089 void readVertices(double& minx, double& maxx, double& miny, double& maxy);
0090 };
0091
0092 #endif