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;
87 canvas.SetTopMargin(topMargin);
88 canvas.SetBottomMargin(0.02);
89 canvas.SetLeftMargin(0.02);
90 canvas.SetRightMargin(0.14);
95 arrow = TArrow(0.05, 27.0, 0.05, -30.0, 0.02,
"|>");
96 arrow.SetLineWidth(4);
100 phiArrow = TArrow(0.0, 27.0, 30.0, 27.0, 0.02,
"|>");
105 xArrow = TArrow(25.0, 44.5, 50.0, 44.5, 0.02,
"|>");
110 yArrow = TArrow(25.0, 44.5, 25.0, 69.5, 0.02,
"|>");
121 txt.SetTextAlign(22);
125 txt.SetTextSize((topMargin == 0.02) ? 0.05 : 0.03);
126 txt.DrawLatex(0.5, 0.95, (fmt::sprintf(
"Pixel Tracker Map: %s",
m_title)).c_str());
127 txt.SetTextSize(0.03);
129 txt.DrawLatex(0.55, 0.125,
"-DISK");
130 txt.DrawLatex(0.55, 0.875,
"+DISK");
132 txt.DrawLatex(0.08, 0.28,
"+z");
133 txt.DrawLatex(0.25, 0.70,
"+phi");
134 txt.DrawLatex(0.31, 0.78,
"+x");
135 txt.DrawLatex(0.21, 0.96,
"+y");
137 txt.SetTextAngle(90);
138 txt.DrawLatex(0.04, 0.5,
"BARREL");
140 edm::LogPrint(
"Phase1PixelSummaryMap") <<
"Base Tracker Map: printed" << std::endl;
145 auto detid =
DetId(
id);
148 << __func__ <<
" The following detid " <<
id <<
" is not Pixel!" << std::endl;
158 edm::FileInPath geoFile,
int tX,
int tY,
int sX,
int sY,
bool applyModuleRotation) {
159 auto cornerFileName = geoFile.
fullPath();
160 std::ifstream cornerFile(cornerFileName.c_str());
161 if (!cornerFile.good()) {
162 throw cms::Exception(
"FileError") <<
"Problem opening corner file: " << cornerFileName;
165 while (std::getline(cornerFile,
line)) {
167 std::istringstream iss(
line);
171 for (
unsigned int i = 0;
i < tokens.size();
i++)
172 LOGDEBUG(
"Phase1PixelSummaryMap") << tokens[
i] <<
'\n';
175 unsigned int detId = stoi(detInfo[0]);
178 unsigned int verNum = 1;
179 std::vector<float> xP, yP;
180 for (
const auto& coord :
xy) {
182 if (applyModuleRotation) {
183 xP.push_back(-(std::stof(coordSpl[0]) * sX + tX));
184 yP.push_back(((std::stof(coordSpl[1]) * sY + tY)));
186 xP.push_back(std::stof(coordSpl[0]) * sX + tX);
187 yP.push_back(std::stof(coordSpl[1]) * sY + tY);
195 LOGDEBUG(
"Phase1PixelSummaryMap") << detId <<
"[";
196 for (
const auto&
p : xP) {
197 LOGDEBUG(
"Phase1PixelSummaryMap") <<
p <<
",";
199 LOGDEBUG(
"Phase1PixelSummaryMap") <<
"] [ ";
200 for (
const auto&
q : yP) {
201 LOGDEBUG(
"Phase1PixelSummaryMap") <<
q <<
",";
203 LOGDEBUG(
"Phase1PixelSummaryMap") <<
"]" << std::endl;
205 const unsigned int N = verNum;
206 if (applyModuleRotation) {
207 bins[detId] = std::make_shared<TGraph>(
N, &yP[0], &xP[0]);
209 bins[detId] = std::make_shared<TGraph>(
N, &xP[0], &yP[0]);
213 bins[detId]->SetName(detInfo[0].c_str());
const std::string m_zAxisTitle
void resetOption(const char *option)
static const unsigned int maxPxBarrel
const std::array< int, maxPxBarrel > barrelLadderShift
std::map< uint32_t, std::shared_ptr< TGraph > > bins
const std::array< int, maxPxForward > forwardDiskXShift
std::string fullPath() const
void createTrackerBaseMap()
std::vector< std::string > tokenize(std::string line, char delimiter)
static const unsigned int maxPxForward
void printTrackerMap(TCanvas &canvas, const float topMargin=0.02)
Log< level::Error, false > LogError
const std::string m_title
std::shared_ptr< TH2Poly > m_BaseTrackerMap
std::vector< edm::FileInPath > m_cornersBPIX
Log< level::Warning, true > LogPrint
void addNamedBins(edm::FileInPath geoFile, int tX, int tY, int sX, int sY, bool applyModuleRotation=false)
std::vector< edm::FileInPath > m_cornersFPIX
bool fillTrackerMap(unsigned int id, double value)
const int forwardDiskYShift