7 #include <fmt/printf.h>
14 #include <TLegendEntry.h>
16 #include <TProfile2D.h>
40 std::vector<const DDsvalues_type *>
result;
42 for (std::vector<const DDsvalues_type *>::iterator it =
result.begin(); it !=
result.end(); ++it) {
49 throw cms::Exception(
"Configuration") <<
" ERROR: multiple " <<
name <<
" tags encountered";
93 std::vector<MaterialAccountingGroup *>
m_groups;
106 std::map<std::string, std::pair<float, float> >
m_diff;
107 std::map<std::string, std::pair<float, float> >
m_values;
114 TColor::InitializeColors();
133 unsigned int steps = 100;
135 unsigned int index = ((TObjArray *)gROOT->GetListOfColors())->GetLast() + 1;
138 static_cast<TColor *>(gROOT->GetListOfColors()->At(kBlue + 1))->GetRGB(
r1,
g1,
b1);
139 static_cast<TColor *>(gROOT->GetListOfColors()->At(kAzure + 10))->GetRGB(
r2,
g2,
b2);
146 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
153 static_cast<TColor *>(gROOT->GetListOfColors()->At(kOrange))->GetRGB(
r1,
g1,
b1);
154 static_cast<TColor *>(gROOT->GetListOfColors()->At(kOrange + 7))->GetRGB(
r2,
g2,
b2);
158 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
182 m_color.push_back(kSpring + 9);
183 m_color.push_back(kSpring + 4);
200 m_color.push_back(kMagenta - 2);
201 m_color.push_back(kMagenta - 3);
202 m_color.push_back(kMagenta - 4);
203 m_color.push_back(kMagenta - 5);
204 m_color.push_back(kMagenta - 6);
205 m_color.push_back(kMagenta - 7);
207 m_color.push_back(kMagenta - 9);
210 m_color.push_back(kOrange + 9);
211 m_color.push_back(kOrange + 7);
212 m_color.push_back(kOrange + 5);
213 m_color.push_back(kOrange - 2);
214 m_color.push_back(kOrange - 3);
215 m_color.push_back(kOrange - 6);
216 m_color.push_back(kOrange + 4);
217 m_color.push_back(kOrange - 7);
219 m_color.push_back(kOrange + 10);
221 m_color.push_back(kViolet + 10);
222 m_color.push_back(kViolet + 6);
223 m_color.push_back(kViolet + 3);
224 m_color.push_back(kViolet - 7);
225 m_color.push_back(kViolet - 1);
226 m_color.push_back(kViolet + 9);
227 m_color.push_back(kViolet - 5);
228 m_color.push_back(kViolet - 3);
258 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
lines;
261 std::pair<float, float> deltaZ(293, 298);
262 std::pair<float, float>
deltaR(115, 118);
263 float text_size = 0.033;
265 for (
float eta = 0.;
eta <= 3.8;
eta += 0.2) {
268 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
269 std::make_shared<TLine>(deltaZ.first, deltaZ.first *
tan(
theta), deltaZ.second, deltaZ.second *
tan(
theta)),
270 std::make_shared<TText>(deltaZ.first, deltaZ.first *
tan(
theta), fmt::sprintf(
"%2.1f",
eta).c_str())));
271 lines.back().second->SetTextFont(42);
272 lines.back().second->SetTextSize(text_size);
273 lines.back().second->SetTextAlign(33);
274 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
275 std::make_shared<TLine>(-deltaZ.first, deltaZ.first *
tan(
theta), -deltaZ.second, deltaZ.second *
tan(
theta)),
276 std::make_shared<TText>(-deltaZ.first, deltaZ.first *
tan(
theta), fmt::sprintf(
"-%2.1f",
eta).c_str())));
277 lines.back().second->SetTextFont(42);
278 lines.back().second->SetTextSize(text_size);
279 lines.back().second->SetTextAlign(13);
281 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
284 lines.back().second->SetTextFont(42);
285 lines.back().second->SetTextSize(text_size);
286 lines.back().second->SetTextAlign(23);
288 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
289 std::make_shared<TLine>(
292 lines.back().second->SetTextFont(42);
293 lines.back().second->SetTextSize(text_size);
294 lines.back().second->SetTextAlign(23);
302 const double scale = 10.;
303 std::vector<TText *> nukem_text;
304 static int markerStyles[10] = {kFullCircle,
322 std::unique_ptr<TCanvas>
canvas(
323 new TCanvas(
"Grouping_rz",
"Grouping - RZ view", (
int)(600 *
scale * 1.25), (
int)(120 *
scale * 1.50)));
324 canvas->GetFrame()->SetFillColor(kWhite);
325 gStyle->SetOptStat(0);
327 unsigned int color_index = 1;
329 std::unique_ptr<TLegend> leg(
new TLegend(0.1, 0.1, 0.23, 0.34));
330 leg->SetHeader(
"Tracker Material Grouping");
331 leg->SetTextFont(42);
332 leg->SetTextSize(0.008);
334 std::unique_ptr<TProfile2D> radlen(
335 new TProfile2D(
"OverallRadLen",
"OverallRadLen", 600., -300., 300, 120., 0., 120.));
336 std::unique_ptr<TProfile2D> eneloss(
337 new TProfile2D(
"OverallEnergyLoss",
"OverallEnergyLoss", 600., -300., 300, 120., 0., 120.));
338 std::unique_ptr<TProfile2D> radlen_diff(
339 new TProfile2D(
"OverallDifferencesRadLen",
"OverallDifferencesRadLen", 600., -300., 300, 120., 0., 120.));
340 std::unique_ptr<TProfile2D> eneloss_diff(
341 new TProfile2D(
"OverallDifferencesEnergyLoss",
"OverallDifferencesEnergyLoss", 600., -300., 300, 120., 0., 120.));
345 new TH2F(
g->name().c_str(),
g->name().c_str(), 6000., -300., 300, 1200., 0., 120.));
346 TH2F ¤t = *
m_plots.back();
347 current.SetMarkerColor(
m_color[color_index]);
348 current.SetMarkerStyle(markerStyles[color_index % 10]);
349 current.SetMarkerSize(0.8);
350 current.SetLineWidth(1);
351 for (
const auto &element :
g->elements()) {
352 current.Fill(element.z(), element.perp());
353 radlen->Fill(element.z(), element.perp(),
m_values[
g->name()].first);
354 eneloss->Fill(element.z(), element.perp(),
m_values[
g->name()].second);
355 radlen_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].first);
356 eneloss_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].second);
359 if (color_index == 1)
362 current.Draw(
"SAME");
364 leg->AddEntry(¤t,
g->name().c_str(),
"lp")->SetTextColor(
m_color[color_index]);
369 color_index = color_index %
m_color.size();
372 canvas->SaveAs(
"Grouping.png");
377 radlen->SetMinimum(0);
378 radlen->SetMaximum(0.25);
379 radlen->Draw(
"COLZ");
381 line.first->SetLineWidth(5);
385 canvas->SaveAs(
"RadLenValues.png");
388 eneloss->SetMinimum(0.00001);
389 eneloss->SetMaximum(0.0005);
390 eneloss->Draw(
"COLZ");
392 line.first->SetLineWidth(5);
396 canvas->SaveAs(
"EnergyLossValues.png");
401 radlen_diff->SetMinimum(-100);
402 radlen_diff->SetMaximum(100);
403 radlen_diff->Draw(
"COLZ");
405 line.first->SetLineWidth(5);
409 canvas->SaveAs(
"RadLenChanges.png");
412 eneloss_diff->SetMinimum(-100);
413 eneloss_diff->SetMaximum(100);
414 eneloss_diff->Draw(
"COLZ");
416 line.first->SetLineWidth(5);
420 canvas->SaveAs(
"EnergyLossChanges.png");
422 for (
auto g : nukem_text)
441 for (
unsigned int h = 2;
h < history.size(); ++
h)
442 std::cout <<
'/' << history[
h].logicalPart().name().name() <<
'[' << history[
h].copyno() <<
']';
447 <<
"[rho] " <<
position.Rho() << std::endl;