File indexing completed on 2024-04-06 12:09:03
0001 #ifndef DQM_TRACKERREMAPPER_PHASE1PIXELSUMMARYMAP_H
0002 #define DQM_TRACKERREMAPPER_PHASE1PIXELSUMMARYMAP_H
0003
0004 #include "TArrow.h"
0005 #include "TCanvas.h"
0006 #include "TGraph.h"
0007 #include "TH1.h"
0008 #include "TH2.h"
0009 #include "TH2Poly.h"
0010 #include "TLatex.h"
0011 #include "TStyle.h"
0012
0013 #include <array>
0014 #include <fmt/printf.h>
0015 #include <fstream>
0016 #include <memory>
0017 #include <boost/tokenizer.hpp>
0018 #include <boost/range/adaptor/indexed.hpp>
0019
0020 #include "FWCore/ParameterSet/interface/FileInPath.h"
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 #include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h"
0023
0024 #ifndef PH1PSUMMARYMAP_STANDALONE
0025 #define LOGDEBUG(x) LogDebug(x)
0026 #define LOGINFO(x) edm::LogInfo(x)
0027 #define LOGPRINT(x) edm::LogPrint(x)
0028 #else
0029 #define LOGDEBUG(x) std::cout << x << " Debug : "
0030 #define LOGINFO(x) std::cout << x << " Info : "
0031 #define LOGPRINT(x) std::cout << x << " : "
0032 #endif
0033
0034 using indexedCorners = std::map<unsigned int, std::pair<std::vector<float>, std::vector<float>>>;
0035
0036 namespace Ph1PMapSummaryHelper {
0037
0038
0039
0040 inline std::vector<std::string> tokenize(std::string line, char delimiter) {
0041
0042 std::vector<std::string> tokens;
0043 std::stringstream check1(line);
0044 std::string intermediate;
0045
0046
0047 while (getline(check1, intermediate, delimiter)) {
0048 tokens.push_back(intermediate);
0049 }
0050 return tokens;
0051 }
0052 }
0053
0054
0055
0056
0057 class Phase1PixelSummaryMap {
0058 public:
0059 Phase1PixelSummaryMap(const char* option, std::string title, std::string zAxisTitle)
0060 : m_option{option},
0061 m_title{title},
0062 m_zAxisTitle{zAxisTitle},
0063 m_trackerTopo{StandaloneTrackerTopology::fromTrackerParametersXMLFile(
0064 edm::FileInPath("Geometry/TrackerCommonData/data/PhaseI/trackerParameters.xml").fullPath())} {
0065
0066 for (unsigned int i = 1; i <= 4; i++) {
0067 m_cornersBPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_barrel_%i", i)));
0068 }
0069
0070
0071 for (int j : {-3, -2, -1, 1, 2, 3}) {
0072 m_cornersFPIX.push_back(edm::FileInPath(Form("DQM/SiStripMonitorClient/data/Geometry/vertices_forward_%i", j)));
0073 }
0074 }
0075
0076 ~Phase1PixelSummaryMap() = default;
0077
0078 void resetOption(const char* option);
0079 void createTrackerBaseMap();
0080 void printTrackerMap(TCanvas& canvas, const float topMargin = 0.02, int index = 0);
0081 bool fillTrackerMap(unsigned int id, double value);
0082 void setZAxisRange(const double min, const double max);
0083 const std::pair<float, float> getZAxisRange() const;
0084
0085 protected:
0086 void addNamedBins(edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation = false);
0087
0088 private:
0089 Option_t* m_option;
0090 const std::string m_title;
0091 const std::string m_zAxisTitle;
0092
0093 TrackerTopology m_trackerTopo;
0094 std::shared_ptr<TH2Poly> m_BaseTrackerMap;
0095 std::map<uint32_t, std::shared_ptr<TGraph>> bins;
0096
0097 std::vector<edm::FileInPath> m_cornersBPIX;
0098 std::vector<edm::FileInPath> m_cornersFPIX;
0099
0100 static const unsigned int maxPxBarrel = 4;
0101 static const unsigned int maxPxForward = 3;
0102 const std::array<int, maxPxBarrel> barrelLadderShift = {{0, 14, 44, 90}};
0103 const std::array<int, maxPxForward> forwardDiskXShift = {{25, 75, 125}};
0104
0105 const int forwardDiskYShift = 45;
0106
0107 const int plotWidth = 3000;
0108 const int plotHeight = 2000;
0109
0110 TArrow arrow, phiArrow, xArrow, yArrow;
0111 };
0112
0113 #endif