CMS 3D CMS Logo

Phase1PixelMaps.h
Go to the documentation of this file.
1 #ifndef DQM_TRACKERREMAPPER_PHASE1PIXELMAPS_H
2 #define DQM_TRACKERREMAPPER_PHASE1PIXELMAPS_H
3 
4 #include "TH2Poly.h"
5 #include "TGraph.h"
6 #include "TH1.h"
7 #include "TH2.h"
8 #include "TStyle.h"
9 #include "TCanvas.h"
10 
11 #include <fmt/printf.h>
12 #include <fstream>
13 #include <boost/tokenizer.hpp>
14 #include <boost/range/adaptor/indexed.hpp>
15 
19 
20 #ifndef PHASE1PIXELMAP_STANDALONE
21 #define LOGDEBUG(x) LogDebug(x)
22 #else
23 #define LOGDEBUG(x) std::cout << x << ": "
24 #endif
25 
26 using indexedCorners = std::map<unsigned int, std::pair<std::vector<float>, std::vector<float>>>;
27 
28 /*--------------------------------------------------------------------
29 / Ancillary class to build pixel phase-1 tracker maps
30 /--------------------------------------------------------------------*/
32 public:
33  Phase1PixelMaps(const char* option)
34  : m_option{option},
35  m_isBooked{std::make_pair(false, false)},
36  m_knownNames{{}},
38  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
39  // set the rescale to true by default
40  m_autorescale = true;
41 
42  // store the file in path for the corners (BPIX)
43  for (unsigned int i = 1; i <= 4; i++) {
44  m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
45  }
46 
47  // store the file in path for the corners (BPIX)
48  for (int j : {-3, -2, -1, 1, 2, 3}) {
49  m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
50  }
51  }
52 
53  ~Phase1PixelMaps() = default;
54 
55  // set of no rescale
56  inline void setNoRescale() { m_autorescale = false; }
57 
58  // set option, but only if not already set
59  void resetOption(const char* option);
60 
61  // book them all
62  void book(const std::string& currentHistoName, const char* what, const char* zaxis);
63 
64  // booking methods
65  void bookBarrelHistograms(const std::string& currentHistoName, const char* what, const char* zaxis);
66  void bookForwardHistograms(const std::string& currentHistoName, const char* what, const char* zaxis);
67 
68  // fill them all
69  void fill(const std::string& currentHistoName, unsigned int id, double value);
70 
71  // filling methods
72  void fillBarrelBin(const std::string& currentHistoName, unsigned int id, double value);
73  void fillForwardBin(const std::string& currentHistoName, unsigned int id, double value);
74 
75  // beautification methods
76  void beautifyAllHistograms();
77  void setBarrelScale(const std::string& currentHistoName, std::pair<float, float> extrema);
78  void setForwardScale(const std::string& currentHistoName, std::pair<float, float> extrema);
79 
80  // drawing methos
81  void drawBarrelMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr);
82  void drawForwardMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr);
83  void drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas);
84 
85 private:
86  Option_t* m_option;
88  std::pair<bool, bool> m_isBooked;
89  std::vector<std::string> m_knownNames;
90 
92 
93  std::map<uint32_t, std::shared_ptr<TGraph>> bins, binsSummary;
94  std::map<std::string, std::vector<std::shared_ptr<TH2Poly>>> pxbTh2PolyBarrel;
95  std::map<std::string, std::shared_ptr<TH2Poly>> pxbTh2PolyBarrelSummary;
96  std::map<std::string, std::vector<std::shared_ptr<TH2Poly>>> pxfTh2PolyForward;
97  std::map<std::string, std::shared_ptr<TH2Poly>> pxfTh2PolyForwardSummary;
98 
99  std::vector<edm::FileInPath> m_cornersBPIX;
100  std::vector<edm::FileInPath> m_cornersFPIX;
101 
102  const indexedCorners retrieveCorners(const std::vector<edm::FileInPath>& cornerFiles, const unsigned int reads);
103 
104  // called by book histograms
105  void bookBarrelBins(const std::string& currentHistoName);
106  void bookForwardBins(const std::string& currentHistoName);
107 
108  // graphics
109  void makeNicePlotStyle(TH1* hist);
110  void adjustCanvasMargins(TVirtualPad* pad, float top, float bottom, float left, float right);
111  void rescaleAllBarrel(const std::string& currentHistoName);
112  void rescaleAllForward(const std::string& currentHistoName);
113 };
114 
115 #endif
Phase1PixelMaps::m_knownNames
std::vector< std::string > m_knownNames
Definition: Phase1PixelMaps.h:89
indexedCorners
std::map< unsigned int, std::pair< std::vector< float >, std::vector< float > >> indexedCorners
Definition: Phase1PixelMaps.h:26
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
Phase1PixelMaps::bins
std::map< uint32_t, std::shared_ptr< TGraph > > bins
Definition: Phase1PixelMaps.h:93
Phase1PixelMaps::m_cornersFPIX
std::vector< edm::FileInPath > m_cornersFPIX
Definition: Phase1PixelMaps.h:100
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
Phase1PixelMaps::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: Phase1PixelMaps.cc:487
Phase1PixelMaps::setBarrelScale
void setBarrelScale(const std::string &currentHistoName, std::pair< float, float > extrema)
Definition: Phase1PixelMaps.cc:322
Phase1PixelMaps::bookBarrelHistograms
void bookBarrelHistograms(const std::string &currentHistoName, const char *what, const char *zaxis)
Definition: Phase1PixelMaps.cc:30
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
TrackerTopology
Definition: TrackerTopology.h:16
Phase1PixelMaps::pxfTh2PolyForward
std::map< std::string, std::vector< std::shared_ptr< TH2Poly > > > pxfTh2PolyForward
Definition: Phase1PixelMaps.h:96
Phase1PixelMaps::beautifyAllHistograms
void beautifyAllHistograms()
Definition: Phase1PixelMaps.cc:288
Phase1PixelMaps::bookBarrelBins
void bookBarrelBins(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:123
Phase1PixelMaps::rescaleAllBarrel
void rescaleAllBarrel(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:524
Phase1PixelMaps::Phase1PixelMaps
Phase1PixelMaps(const char *option)
Definition: Phase1PixelMaps.h:33
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:94
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
Phase1PixelMaps::pxbTh2PolyBarrel
std::map< std::string, std::vector< std::shared_ptr< TH2Poly > > > pxbTh2PolyBarrel
Definition: Phase1PixelMaps.h:94
Phase1PixelMaps::fillForwardBin
void fillForwardBin(const std::string &currentHistoName, unsigned int id, double value)
Definition: Phase1PixelMaps.cc:269
edm::FileInPath
Definition: FileInPath.h:61
Phase1PixelMaps::bookForwardBins
void bookForwardBins(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:168
StandaloneTrackerTopology.h
Phase1PixelMaps::fillBarrelBin
void fillBarrelBin(const std::string &currentHistoName, unsigned int id, double value)
Definition: Phase1PixelMaps.cc:252
Phase1PixelMaps
Definition: Phase1PixelMaps.h:31
FileInPath.h
Phase1PixelMaps::pxbTh2PolyBarrelSummary
std::map< std::string, std::shared_ptr< TH2Poly > > pxbTh2PolyBarrelSummary
Definition: Phase1PixelMaps.h:95
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
Phase1PixelMaps::bookForwardHistograms
void bookForwardHistograms(const std::string &currentHistoName, const char *what, const char *zaxis)
Definition: Phase1PixelMaps.cc:75
Phase1PixelMaps::binsSummary
std::map< uint32_t, std::shared_ptr< TGraph > > binsSummary
Definition: Phase1PixelMaps.h:93
Phase1PixelMaps::m_isBooked
std::pair< bool, bool > m_isBooked
Definition: Phase1PixelMaps.h:88
Phase1PixelMaps::fill
void fill(const std::string &currentHistoName, unsigned int id, double value)
Definition: Phase1PixelMaps.cc:222
value
Definition: value.py:1
Phase1PixelMaps::pxfTh2PolyForwardSummary
std::map< std::string, std::shared_ptr< TH2Poly > > pxfTh2PolyForwardSummary
Definition: Phase1PixelMaps.h:97
Phase1PixelMaps::setForwardScale
void setForwardScale(const std::string &currentHistoName, std::pair< float, float > extrema)
Definition: Phase1PixelMaps.cc:329
Phase1PixelMaps::rescaleAllForward
void rescaleAllForward(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:550
Phase1PixelMaps::retrieveCorners
const indexedCorners retrieveCorners(const std::vector< edm::FileInPath > &cornerFiles, const unsigned int reads)
Definition: Phase1PixelMaps.cc:427
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Phase1PixelMaps::book
void book(const std::string &currentHistoName, const char *what, const char *zaxis)
Definition: Phase1PixelMaps.cc:215
Phase1PixelMaps::~Phase1PixelMaps
~Phase1PixelMaps()=default
Phase1PixelMaps::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: Phase1PixelMaps.cc:512
Phase1PixelMaps::drawForwardMaps
void drawForwardMaps(const std::string &currentHistoName, TCanvas &canvas, const char *drawOption=nullptr)
Definition: Phase1PixelMaps.cc:366
Phase1PixelMaps::m_cornersBPIX
std::vector< edm::FileInPath > m_cornersBPIX
Definition: Phase1PixelMaps.h:99
Phase1PixelMaps::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: Phase1PixelMaps.h:91
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Phase1PixelMaps::drawBarrelMaps
void drawBarrelMaps(const std::string &currentHistoName, TCanvas &canvas, const char *drawOption=nullptr)
Definition: Phase1PixelMaps.cc:336
Phase1PixelMaps::resetOption
void resetOption(const char *option)
Definition: Phase1PixelMaps.cc:20
Phase1PixelMaps::drawSummaryMaps
void drawSummaryMaps(const std::string &currentHistoName, TCanvas &canvas)
Definition: Phase1PixelMaps.cc:396
Phase1PixelMaps::m_option
Option_t * m_option
Definition: Phase1PixelMaps.h:86
Phase1PixelMaps::setNoRescale
void setNoRescale()
Definition: Phase1PixelMaps.h:56
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
Phase1PixelMaps::m_autorescale
bool m_autorescale
Definition: Phase1PixelMaps.h:87
histoStyle.drawOption
drawOption
Definition: histoStyle.py:56