CMS 3D CMS Logo

Phase1PixelSummaryMap.h
Go to the documentation of this file.
1 #ifndef DQM_TRACKERREMAPPER_PHASE1PIXELSUMMARYMAP_H
2 #define DQM_TRACKERREMAPPER_PHASE1PIXELSUMMARYMAP_H
3 
4 #include "TArrow.h"
5 #include "TCanvas.h"
6 #include "TGraph.h"
7 #include "TH1.h"
8 #include "TH2.h"
9 #include "TH2Poly.h"
10 #include "TLatex.h"
11 #include "TStyle.h"
12 
13 #include <fmt/printf.h>
14 #include <fstream>
15 #include <memory>
16 #include <boost/tokenizer.hpp>
17 #include <boost/range/adaptor/indexed.hpp>
18 
22 
23 #ifndef PH1PSUMMARYMAP_STANDALONE
24 #define LOGDEBUG(x) LogDebug(x)
25 #define LOGINFO(x) edm::LogInfo(x)
26 #define LOGPRINT(x) edm::LogPrint(x)
27 #else
28 #define LOGDEBUG(x) std::cout << x << " Debug : "
29 #define LOGINFO(x) std::cout << x << " Info : "
30 #define LOGPRINT(x) std::cout << x << " : "
31 #endif
32 
33 using indexedCorners = std::map<unsigned int, std::pair<std::vector<float>, std::vector<float>>>;
34 
36  //============================================================================
37  // utility to tokenize std::string
38  //============================================================================
39  std::vector<std::string> tokenize(std::string line, char delimiter) {
40  // Vector of string to save tokens
41  std::vector<std::string> tokens;
42  std::stringstream check1(line);
43  std::string intermediate;
44 
45  // Tokenizing w.r.t. delimiter
46  while (getline(check1, intermediate, delimiter)) {
47  tokens.push_back(intermediate);
48  }
49  return tokens;
50  }
51 } // namespace Ph1PMapSummaryHelper
52 
53 /*--------------------------------------------------------------------
54 / Ancillary class to build pixel phase-1 tracker maps
55 /--------------------------------------------------------------------*/
57 public:
59  : m_option{option},
60  m_title{title},
61  m_zAxisTitle{zAxisTitle},
63  edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
64  // store the file in path for the corners (BPIX)
65  for (unsigned int i = 1; i <= 4; i++) {
66  m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
67  }
68 
69  // store the file in path for the corners (BPIX)
70  for (int j : {-3, -2, -1, 1, 2, 3}) {
71  m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
72  }
73  }
74 
75  ~Phase1PixelSummaryMap() = default;
76 
77  void resetOption(const char* option);
78  void createTrackerBaseMap();
79  void printTrackerMap(TCanvas& canvas);
80  bool fillTrackerMap(unsigned int id, double value);
81 
82 protected:
83  void addNamedBins(edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation = false);
84 
85 private:
86  Option_t* m_option;
89 
91  std::shared_ptr<TH2Poly> m_BaseTrackerMap;
92  std::map<uint32_t, std::shared_ptr<TGraph>> bins;
93 
94  std::vector<edm::FileInPath> m_cornersBPIX;
95  std::vector<edm::FileInPath> m_cornersFPIX;
96 
97  static const unsigned int maxPxBarrel = 4;
98  static const unsigned int maxPxForward = 3;
99  const std::array<int, maxPxBarrel> barrelLadderShift = {{0, 14, 44, 90}};
100  const std::array<int, maxPxForward> forwardDiskXShift = {{25, 75, 125}};
101 
102  const int forwardDiskYShift = 45; //# to make +DISK on top in the 'strip-like' layout
103 
104  const int plotWidth = 3000;
105  const int plotHeight = 2000;
106 
108 };
109 
110 #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
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
Ph1PMapSummaryHelper
Definition: Phase1PixelSummaryMap.h:35
makeHLTPrescaleTable.delimiter
delimiter
Definition: makeHLTPrescaleTable.py:181
Phase1PixelSummaryMap::addNamedBins
void addNamedBins(edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation=false)
Definition: Phase1PixelSummaryMap.cc:156
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
TrackerTopology
Definition: TrackerTopology.h:16
Phase1PixelSummaryMap::arrow
TArrow arrow
Definition: Phase1PixelSummaryMap.h:107
Phase1PixelSummaryMap::bins
std::map< uint32_t, std::shared_ptr< TGraph > > bins
Definition: Phase1PixelSummaryMap.h:92
Phase1PixelSummaryMap::xArrow
TArrow xArrow
Definition: Phase1PixelSummaryMap.h:107
Phase1PixelSummaryMap::m_trackerTopo
TrackerTopology m_trackerTopo
Definition: Phase1PixelSummaryMap.h:90
Phase1PixelSummaryMap::maxPxBarrel
static const unsigned int maxPxBarrel
Definition: Phase1PixelSummaryMap.h:97
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
Phase1PixelSummaryMap::plotWidth
const int plotWidth
Definition: Phase1PixelSummaryMap.h:104
FileInPath.h
Phase1PixelSummaryMap::m_title
const std::string m_title
Definition: Phase1PixelSummaryMap.h:87
Phase1PixelSummaryMap::m_cornersBPIX
std::vector< edm::FileInPath > m_cornersBPIX
Definition: Phase1PixelSummaryMap.h:94
Phase1PixelSummaryMap::plotHeight
const int plotHeight
Definition: Phase1PixelSummaryMap.h:105
edm::FileInPath
Definition: FileInPath.h:64
Phase1PixelSummaryMap::Phase1PixelSummaryMap
Phase1PixelSummaryMap(const char *option, std::string title, std::string zAxisTitle)
Definition: Phase1PixelSummaryMap.h:58
Phase1PixelSummaryMap::m_zAxisTitle
const std::string m_zAxisTitle
Definition: Phase1PixelSummaryMap.h:88
StandaloneTrackerTopology.h
Phase1PixelSummaryMap::barrelLadderShift
const std::array< int, maxPxBarrel > barrelLadderShift
Definition: Phase1PixelSummaryMap.h:99
Phase1PixelSummaryMap::resetOption
void resetOption(const char *option)
Definition: Phase1PixelSummaryMap.cc:23
Phase1PixelSummaryMap::forwardDiskYShift
const int forwardDiskYShift
Definition: Phase1PixelSummaryMap.h:102
Phase1PixelSummaryMap::m_cornersFPIX
std::vector< edm::FileInPath > m_cornersFPIX
Definition: Phase1PixelSummaryMap.h:95
Phase1PixelSummaryMap::m_BaseTrackerMap
std::shared_ptr< TH2Poly > m_BaseTrackerMap
Definition: Phase1PixelSummaryMap.h:91
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Phase1PixelSummaryMap::forwardDiskXShift
const std::array< int, maxPxForward > forwardDiskXShift
Definition: Phase1PixelSummaryMap.h:100
Phase1PixelSummaryMap::m_option
Option_t * m_option
Definition: Phase1PixelSummaryMap.h:86
Phase1PixelSummaryMap
Definition: Phase1PixelSummaryMap.h:56
Phase1PixelSummaryMap::maxPxForward
static const unsigned int maxPxForward
Definition: Phase1PixelSummaryMap.h:98
value
Definition: value.py:1
Phase1PixelSummaryMap::phiArrow
TArrow phiArrow
Definition: Phase1PixelSummaryMap.h:107
Phase1PixelSummaryMap::yArrow
TArrow yArrow
Definition: Phase1PixelSummaryMap.h:107
Ph1PMapSummaryHelper::tokenize
std::vector< std::string > tokenize(std::string line, char delimiter)
Definition: Phase1PixelSummaryMap.h:39
Phase1PixelSummaryMap::fillTrackerMap
bool fillTrackerMap(unsigned int id, double value)
Definition: Phase1PixelSummaryMap.cc:143
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Phase1PixelSummaryMap::printTrackerMap
void printTrackerMap(TCanvas &canvas)
Definition: Phase1PixelSummaryMap.cc:84
mps_splice.line
line
Definition: mps_splice.py:76
StandaloneTrackerTopology::fromTrackerParametersXMLFile
TrackerTopology fromTrackerParametersXMLFile(const std::string &xmlFileName)
Definition: StandaloneTrackerTopology.cc:168
Phase1PixelSummaryMap::~Phase1PixelSummaryMap
~Phase1PixelSummaryMap()=default
Phase1PixelSummaryMap::createTrackerBaseMap
void createTrackerBaseMap()
Definition: Phase1PixelSummaryMap.cc:33