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},
36  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
37  // set the rescale to true by default
38  m_autorescale = true;
39 
40  // store the file in path for the corners (BPIX)
41  for (unsigned int i = 1; i <= 4; i++) {
42  m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
43  }
44 
45  // store the file in path for the corners (BPIX)
46  for (int j : {-3, -2, -1, 1, 2, 3}) {
47  m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
48  }
49  }
50 
51  ~Phase1PixelMaps() = default;
52 
53  // set of no rescale
54  inline void setNoRescale() { m_autorescale = false; }
55 
56  // set option, but only if not already set
57  void resetOption(const char* option);
58 
59  // booking methods
60  void bookBarrelHistograms(const std::string& currentHistoName, const char* what, const char* zaxis);
61  void bookForwardHistograms(const std::string& currentHistoName, const char* what, const char* zaxis);
62  void bookBarrelBins(const std::string& currentHistoName);
63  void bookForwardBins(const std::string& currentHistoName);
64 
65  // filling methods
66  void fillBarrelBin(const std::string& currentHistoName, unsigned int id, double value);
67  void fillForwardBin(const std::string& currentHistoName, unsigned int id, double value);
68 
69  // beautification methods
70  void beautifyAllHistograms();
71  void setBarrelScale(const std::string& currentHistoName, std::pair<float, float> extrema);
72  void setForwardScale(const std::string& currentHistoName, std::pair<float, float> extrema);
73 
74  // drawing methos
75  void drawBarrelMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr);
76  void drawForwardMaps(const std::string& currentHistoName, TCanvas& canvas, const char* drawOption = nullptr);
77  void drawSummaryMaps(const std::string& currentHistoName, TCanvas& canvas);
78 
79 private:
80  Option_t* m_option;
83 
84  std::map<uint32_t, std::shared_ptr<TGraph>> bins, binsSummary;
85  std::map<std::string, std::vector<std::shared_ptr<TH2Poly>>> pxbTh2PolyBarrel;
86  std::map<std::string, std::shared_ptr<TH2Poly>> pxbTh2PolyBarrelSummary;
87  std::map<std::string, std::vector<std::shared_ptr<TH2Poly>>> pxfTh2PolyForward;
88  std::map<std::string, std::shared_ptr<TH2Poly>> pxfTh2PolyForwardSummary;
89 
90  std::vector<edm::FileInPath> m_cornersBPIX;
91  std::vector<edm::FileInPath> m_cornersFPIX;
92 
93  const indexedCorners retrieveCorners(const std::vector<edm::FileInPath>& cornerFiles, const unsigned int reads);
94 
95  // graphics
96  void makeNicePlotStyle(TH1* hist);
97  void adjustCanvasMargins(TVirtualPad* pad, float top, float bottom, float left, float right);
98  void rescaleAllBarrel(const std::string& currentHistoName);
99  void rescaleAllForward(const std::string& currentHistoName);
100 };
101 
102 #endif
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:84
Phase1PixelMaps::m_cornersFPIX
std::vector< edm::FileInPath > m_cornersFPIX
Definition: Phase1PixelMaps.h:91
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
Phase1PixelMaps::makeNicePlotStyle
void makeNicePlotStyle(TH1 *hist)
Definition: Phase1PixelMaps.cc:388
Phase1PixelMaps::setBarrelScale
void setBarrelScale(const std::string &currentHistoName, std::pair< float, float > extrema)
Definition: Phase1PixelMaps.cc:245
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:87
Phase1PixelMaps::beautifyAllHistograms
void beautifyAllHistograms()
Definition: Phase1PixelMaps.cc:222
Phase1PixelMaps::bookBarrelBins
void bookBarrelBins(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:102
Phase1PixelMaps::rescaleAllBarrel
void rescaleAllBarrel(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:425
Phase1PixelMaps::Phase1PixelMaps
Phase1PixelMaps(const char *option)
Definition: Phase1PixelMaps.h:33
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
FileInPath.h
Phase1PixelMaps::pxbTh2PolyBarrel
std::map< std::string, std::vector< std::shared_ptr< TH2Poly > > > pxbTh2PolyBarrel
Definition: Phase1PixelMaps.h:85
Phase1PixelMaps::fillForwardBin
void fillForwardBin(const std::string &currentHistoName, unsigned int id, double value)
Definition: Phase1PixelMaps.cc:207
edm::FileInPath
Definition: FileInPath.h:64
Phase1PixelMaps::bookForwardBins
void bookForwardBins(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:147
StandaloneTrackerTopology.h
Phase1PixelMaps::fillBarrelBin
void fillBarrelBin(const std::string &currentHistoName, unsigned int id, double value)
Definition: Phase1PixelMaps.cc:194
Phase1PixelMaps
Definition: Phase1PixelMaps.h:31
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Phase1PixelMaps::pxbTh2PolyBarrelSummary
std::map< std::string, std::shared_ptr< TH2Poly > > pxbTh2PolyBarrelSummary
Definition: Phase1PixelMaps.h:86
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:64
Phase1PixelMaps::binsSummary
std::map< uint32_t, std::shared_ptr< TGraph > > binsSummary
Definition: Phase1PixelMaps.h:84
value
Definition: value.py:1
Phase1PixelMaps::pxfTh2PolyForwardSummary
std::map< std::string, std::shared_ptr< TH2Poly > > pxfTh2PolyForwardSummary
Definition: Phase1PixelMaps.h:88
Phase1PixelMaps::setForwardScale
void setForwardScale(const std::string &currentHistoName, std::pair< float, float > extrema)
Definition: Phase1PixelMaps.cc:252
Phase1PixelMaps::rescaleAllForward
void rescaleAllForward(const std::string &currentHistoName)
Definition: Phase1PixelMaps.cc:446
Phase1PixelMaps::retrieveCorners
const indexedCorners retrieveCorners(const std::vector< edm::FileInPath > &cornerFiles, const unsigned int reads)
Definition: Phase1PixelMaps.cc:328
Phase1PixelMaps::~Phase1PixelMaps
~Phase1PixelMaps()=default
Phase1PixelMaps::adjustCanvasMargins
void adjustCanvasMargins(TVirtualPad *pad, float top, float bottom, float left, float right)
Definition: Phase1PixelMaps.cc:413
Phase1PixelMaps::drawForwardMaps
void drawForwardMaps(const std::string &currentHistoName, TCanvas &canvas, const char *drawOption=nullptr)
Definition: Phase1PixelMaps.cc:282
Phase1PixelMaps::m_cornersBPIX
std::vector< edm::FileInPath > m_cornersBPIX
Definition: Phase1PixelMaps.h:90
Phase1PixelMaps::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: Phase1PixelMaps.h:82
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Phase1PixelMaps::drawBarrelMaps
void drawBarrelMaps(const std::string &currentHistoName, TCanvas &canvas, const char *drawOption=nullptr)
Definition: Phase1PixelMaps.cc:259
Phase1PixelMaps::resetOption
void resetOption(const char *option)
Definition: Phase1PixelMaps.cc:20
Phase1PixelMaps::drawSummaryMaps
void drawSummaryMaps(const std::string &currentHistoName, TCanvas &canvas)
Definition: Phase1PixelMaps.cc:305
Phase1PixelMaps::m_option
Option_t * m_option
Definition: Phase1PixelMaps.h:80
Phase1PixelMaps::setNoRescale
void setNoRescale()
Definition: Phase1PixelMaps.h:54
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
Phase1PixelMaps::m_autorescale
bool m_autorescale
Definition: Phase1PixelMaps.h:81
histoStyle.drawOption
drawOption
Definition: histoStyle.py:56