12 #include "TPaletteAxis.h" 30 #include <boost/tokenizer.hpp> 31 #include <boost/range/adaptor/indexed.hpp> 37 double minx = 0xFFFFFF, maxx = -0xFFFFFF, miny = 0xFFFFFF, maxy = -0xFFFFFFF;
44 TGaxis::SetMaxDigits(2);
60 for (
const auto& pair :
m_bins) {
65 for (
const auto& pair :
m_bins) {
89 static constexpr double emptyBinValue = -9999;
127 canvas.SetFrameLineColor(0);
129 TPaletteAxis*
palette = (TPaletteAxis*)
m_trackerMap->GetListOfFunctions()->FindObject(
"palette");
132 palette->SetX1NDC(1 - rmargin_);
133 palette->SetX2NDC(1 - rmargin_ + lmargin_);
137 if (
canvas.GetWindowHeight() != hH_ &&
canvas.GetWindowWidth() != wH_ &&
option.find(
"same") == std::string::npos) {
138 canvas.SetWindowSize(wH_, hH_);
147 std::array<std::string, 12> barrelNames = {
148 {
"TIB L2",
"TIB L1",
"TIB L4",
"TIB L3",
"TOB L2",
"TOB L1",
"TOB L4",
" TOB L3",
"TOB L6",
"TOB L5"}};
149 std::array<std::string, 4> endcapNames = {{
"TID",
"TEC",
"TID",
"TEC"}};
150 std::array<std::string, 24> disknumbering = {{
"+1",
"+2",
"+3",
"+1",
"+2",
"+3",
"+4",
"+5",
151 "+6",
"+7",
"+8",
"+9",
"-1",
"-2",
"-3",
"-1",
152 "-2",
"-3",
"-4",
"-5",
"-6",
"-7",
"-8",
"-9"}};
154 static constexpr std::array<float, 12> b_coordx = {
155 {0.1, 0.1, 0.26, 0.26, 0.41, 0.41, 0.56, 0.56, 0.725, 0.725, 0.05, 0.17}};
156 static constexpr std::array<float, 12> b_coordy = {
157 {0.70, 0.45, 0.70, 0.45, 0.70, 0.46, 0.70, 0.46, 0.70, 0.46, 0.85, 0.85}};
159 static constexpr std::array<float, 4> e_coordx = {{0.01, 0.21, 0.01, 0.21}};
160 static constexpr std::array<float, 4> e_coordy = {{0.89, 0.89, 0.17, 0.17}};
162 static constexpr std::array<float, 24> n_coordx = {{0.01, 0.087, 0.165, 0.227, 0.305, 0.383, 0.461, 0.539,
163 0.616, 0.694, 0.772, 0.850, 0.01, 0.087, 0.165, 0.227,
164 0.305, 0.383, 0.461, 0.539, 0.617, 0.695, 0.773, 0.851}};
166 static constexpr std::array<float, 24> n_coordy = {{0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85,
167 0.85, 0.85, 0.85, 0.85, 0.13, 0.13, 0.13, 0.13,
168 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13}};
171 for (
const auto&
name : barrelNames | boost::adaptors::indexed(0)) {
174 ltx.SetTextSize(0.035);
175 ltx.SetTextAlign(11);
176 ltx.DrawLatexNDC(b_coordx[
name.index()], b_coordy[
name.index()],
name.value().c_str());
179 for (
const auto&
name : endcapNames | boost::adaptors::indexed(0)) {
182 ltx.SetTextSize(0.05);
183 ltx.SetTextAlign(11);
184 ltx.DrawLatexNDC(e_coordx[
name.index()], e_coordy[
name.index()],
name.value().c_str());
187 for (
const auto&
name : disknumbering | boost::adaptors::indexed(0)) {
190 ltx.SetTextSize(0.035);
191 ltx.SetTextAlign(11);
192 ltx.DrawLatexNDC(n_coordx[
name.index()], n_coordy[
name.index()],
name.value().c_str());
197 ltx.SetTextSize(0.045);
198 ltx.SetTextAlign(11);
199 ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.03,
m_mapTitle.c_str());
202 drawArrows(0.09, 0.23, 0.24, 0.45,
"#phi",
"z");
212 const float x_X1,
const float x_X2,
const float x_Y1,
const float y_Y2,
const char* x_label,
const char* y_label) {
213 auto arrow_X = TArrow();
214 arrow_X.SetLineColor(kBlue);
215 arrow_X.SetLineWidth(2);
216 arrow_X.SetOption(
"|>");
217 arrow_X.SetArrowSize(10);
218 arrow_X.DrawLineNDC(x_X1, x_Y1, x_X2, x_Y1);
220 auto arrow_Y = TArrow();
221 arrow_Y.SetLineColor(kBlue);
222 arrow_Y.SetLineWidth(2);
223 arrow_Y.SetOption(
"|>");
224 arrow_Y.SetArrowSize(10);
225 arrow_Y.DrawLineNDC(x_X2, x_Y1, x_X2, y_Y2);
227 auto text_X = TLatex();
228 text_X.SetTextSize(0.04);
229 text_X.SetTextAlign(11);
230 text_X.SetTextColor(kBlue);
231 text_X.DrawLatexNDC(x_X1, x_Y1 - 0.03, x_label);
233 auto text_Y = TLatex();
234 text_Y.SetTextSize(0.04);
235 text_Y.SetTextAlign(11);
236 text_Y.SetTextColor(kBlue);
237 text_Y.DrawLatexNDC(x_X2 + 0.005, y_Y2 - 0.01, y_label);
242 TVirtualPad* pad,
const float top,
const float bottom,
const float left,
const float right) {
244 pad->SetTopMargin(top);
247 pad->SetBottomMargin(bottom);
250 pad->SetLeftMargin(left);
253 pad->SetRightMargin(right);
265 throw cms::Exception(
"FileError") <<
"SiStripTkMaps: problem opening vertices file!!" << std::endl;
275 typedef boost::tokenizer<boost::char_separator<char>> tokenizer;
276 boost::char_separator<char> sep{
" "};
277 tokenizer tok{
line, sep};
281 for (
const auto&
t : tok | boost::adaptors::indexed(0)) {
284 detid = atoll((
t.value()).c_str());
294 x[
ix] = atof((
t.value()).c_str());
303 y[
iy] = atof((
t.value()).c_str());
void readVertices(double &minx, double &maxx, double &miny, double &maxy)
void bookMap(const std::string mapTitle, const std::string zAxisTitle)
void dressMap(TCanvas &canv)
void drawArrows(const float x_X1, const float x_X2, const float x_Y1, const float y_Y2, const char *x_label, const char *y_label)
void adjustCanvasMargins(TVirtualPad *pad, const float top, const float bottom, const float left, const float right)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
std::vector< unsigned int > m_detIdVector
void fill(long rawid, double val)
std::vector< double > m_values
bool isPixel(HitType hitType)
void drawMap(TCanvas &canvas, std::string option="")
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
std::map< long, std::shared_ptr< TGraph > > m_bins