10 #include <fmt/printf.h>
13 #include <boost/tokenizer.hpp>
14 #include <boost/range/adaptor/indexed.hpp>
28 <<
"Option has already been set to " <<
m_option <<
". It's not possible to reset it.";
34 m_BaseTrackerMap = std::make_shared<TH2Poly>(
"Summary",
"", -10, 160, -70, 70);
46 LOGINFO(
"Phase1PixelSummaryMap") <<
"barrel, shift: " <<
i <<
" corner: " <<
i << std::endl;
47 LOGINFO(
"Phase1PixelSummaryMap") <<
"translate x: " << 0 << std::endl;
50 int currBarrelTranslateX = 0;
56 for (
int j : {-3, -2, -1}) {
57 LOGINFO(
"Phase1PixelSummaryMap") <<
"negative fwd, shift: " << -
j - 1 <<
" corner: " <<
maxPxForward +
j
68 for (
int k : {1, 2, 3}) {
69 LOGINFO(
"Phase1PixelSummaryMap") <<
"positive fwd, shift: " <<
k <<
" corner: " <<
maxPxForward +
k - 1
79 edm::LogPrint(
"Phase1PixelSummaryMap") <<
"Base Tracker Map: constructed" << std::endl;
88 canvas.SetBottomMargin(0.02);
89 canvas.SetLeftMargin(0.02);
90 canvas.SetRightMargin(0.14);
94 arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02,
"|>");
95 arrow.SetLineWidth(4);
99 phiArrow = TArrow(0.0, 27.0, 30.0, 27.0, 0.02,
"|>");
104 xArrow = TArrow(25.0, 44.5, 50.0, 44.5, 0.02,
"|>");
109 yArrow = TArrow(25.0, 44.5, 25.0, 69.5, 0.02,
"|>");
120 txt.SetTextAlign(22);
124 txt.SetTextSize(0.05);
125 txt.DrawLatex(0.5, 0.95, (fmt::sprintf(
"Pixel Tracker Map: %s",
m_title)).c_str());
126 txt.SetTextSize(0.03);
128 txt.DrawLatex(0.55, 0.125,
"-DISK");
129 txt.DrawLatex(0.55, 0.875,
"+DISK");
131 txt.DrawLatex(0.08, 0.28,
"+z");
132 txt.DrawLatex(0.25, 0.70,
"+phi");
133 txt.DrawLatex(0.31, 0.78,
"+x");
134 txt.DrawLatex(0.21, 0.96,
"+y");
136 txt.SetTextAngle(90);
137 txt.DrawLatex(0.04, 0.5,
"BARREL");
139 edm::LogPrint(
"Phase1PixelSummaryMap") <<
"Base Tracker Map: printed" << std::endl;
144 auto detid =
DetId(
id);
147 << __func__ <<
" The following detid " <<
id <<
" is not Pixel!" << std::endl;
157 edm::FileInPath geoFile,
int tX,
int tY,
int sX,
int sY,
bool applyModuleRotation) {
158 auto cornerFileName = geoFile.
fullPath();
159 std::ifstream cornerFile(cornerFileName.c_str());
160 if (!cornerFile.good()) {
161 throw cms::Exception(
"FileError") <<
"Problem opening corner file: " << cornerFileName;
164 while (std::getline(cornerFile,
line)) {
166 std::istringstream iss(
line);
170 for (
unsigned int i = 0;
i < tokens.size();
i++)
171 LOGDEBUG(
"Phase1PixelSummaryMap") << tokens[
i] <<
'\n';
174 unsigned int detId = stoi(detInfo[0]);
177 unsigned int verNum = 1;
178 std::vector<float> xP, yP;
179 for (
const auto& coord :
xy) {
181 if (applyModuleRotation) {
182 xP.push_back(-(std::stof(coordSpl[0]) * sX + tX));
183 yP.push_back(((std::stof(coordSpl[1]) * sY + tY)));
185 xP.push_back(std::stof(coordSpl[0]) * sX + tX);
186 yP.push_back(std::stof(coordSpl[1]) * sY + tY);
194 LOGDEBUG(
"Phase1PixelSummaryMap") << detId <<
"[";
195 for (
const auto&
p : xP) {
196 LOGDEBUG(
"Phase1PixelSummaryMap") <<
p <<
",";
198 LOGDEBUG(
"Phase1PixelSummaryMap") <<
"] [ ";
199 for (
const auto&
q : yP) {
200 LOGDEBUG(
"Phase1PixelSummaryMap") <<
q <<
",";
202 LOGDEBUG(
"Phase1PixelSummaryMap") <<
"]" << std::endl;
204 const unsigned int N = verNum;
205 if (applyModuleRotation) {
206 bins[detId] = std::make_shared<TGraph>(
N, &yP[0], &xP[0]);
208 bins[detId] = std::make_shared<TGraph>(
N, &xP[0], &yP[0]);
212 bins[detId]->SetName(detInfo[0].c_str());