7 #include "boost/format.hpp"
27 #include <TProfile2D.h>
34 #include <TLegendEntry.h>
41 std::vector<const DDsvalues_type *>
result;
43 for (std::vector<const DDsvalues_type *>::iterator it =
result.begin(); it !=
result.end(); ++it) {
50 throw cms::Exception(
"Configuration") <<
" ERROR: multiple " <<
name <<
" tags encountered";
94 std::vector<MaterialAccountingGroup *>
m_groups;
107 std::map<std::string, std::pair<float, float> >
m_diff;
108 std::map<std::string, std::pair<float, float> >
m_values;
115 TColor::InitializeColors();
134 unsigned int steps = 100;
136 unsigned int index = ((TObjArray *)gROOT->GetListOfColors())->GetLast() + 1;
139 static_cast<TColor *>(gROOT->GetListOfColors()->At(kBlue + 1))->GetRGB(
r1,
g1,
b1);
140 static_cast<TColor *>(gROOT->GetListOfColors()->At(kAzure + 10))->GetRGB(
r2,
g2,
b2);
147 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
154 static_cast<TColor *>(gROOT->GetListOfColors()->At(kOrange))->GetRGB(
r1,
g1,
b1);
155 static_cast<TColor *>(gROOT->GetListOfColors()->At(kOrange + 7))->GetRGB(
r2,
g2,
b2);
159 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
183 m_color.push_back(kSpring + 9);
184 m_color.push_back(kSpring + 4);
201 m_color.push_back(kMagenta - 2);
202 m_color.push_back(kMagenta - 3);
203 m_color.push_back(kMagenta - 4);
204 m_color.push_back(kMagenta - 5);
205 m_color.push_back(kMagenta - 6);
206 m_color.push_back(kMagenta - 7);
208 m_color.push_back(kMagenta - 9);
211 m_color.push_back(kOrange + 9);
212 m_color.push_back(kOrange + 7);
213 m_color.push_back(kOrange + 5);
214 m_color.push_back(kOrange - 2);
215 m_color.push_back(kOrange - 3);
216 m_color.push_back(kOrange - 6);
217 m_color.push_back(kOrange + 4);
218 m_color.push_back(kOrange - 7);
220 m_color.push_back(kOrange + 10);
222 m_color.push_back(kViolet + 10);
223 m_color.push_back(kViolet + 6);
224 m_color.push_back(kViolet + 3);
225 m_color.push_back(kViolet - 7);
226 m_color.push_back(kViolet - 1);
227 m_color.push_back(kViolet + 9);
228 m_color.push_back(kViolet - 5);
229 m_color.push_back(kViolet - 3);
259 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
lines;
262 std::pair<float, float> deltaZ(293, 298);
263 std::pair<float, float>
deltaR(115, 118);
264 float text_size = 0.033;
266 for (
float eta = 0.;
eta <= 3.8;
eta += 0.2) {
269 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
270 std::make_shared<TLine>(deltaZ.first, deltaZ.first *
tan(
theta), deltaZ.second, deltaZ.second *
tan(
theta)),
272 lines.back().second->SetTextFont(42);
273 lines.back().second->SetTextSize(text_size);
274 lines.back().second->SetTextAlign(33);
275 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
276 std::make_shared<TLine>(-deltaZ.first, deltaZ.first *
tan(
theta), -deltaZ.second, deltaZ.second *
tan(
theta)),
277 std::make_shared<TText>(
279 lines.back().second->SetTextFont(42);
280 lines.back().second->SetTextSize(text_size);
281 lines.back().second->SetTextAlign(13);
283 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
286 lines.back().second->SetTextFont(42);
287 lines.back().second->SetTextSize(text_size);
288 lines.back().second->SetTextAlign(23);
290 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
291 std::make_shared<TLine>(
293 std::make_shared<TText>(
295 lines.back().second->SetTextFont(42);
296 lines.back().second->SetTextSize(text_size);
297 lines.back().second->SetTextAlign(23);
305 const double scale = 10.;
306 std::vector<TText *> nukem_text;
307 static int markerStyles[10] = {kFullCircle,
325 std::unique_ptr<TCanvas>
canvas(
326 new TCanvas(
"Grouping_rz",
"Grouping - RZ view", (
int)(600 *
scale * 1.25), (
int)(120 *
scale * 1.50)));
327 canvas->GetFrame()->SetFillColor(kWhite);
328 gStyle->SetOptStat(0);
330 unsigned int color_index = 1;
332 std::unique_ptr<TLegend> leg(
new TLegend(0.1, 0.1, 0.23, 0.34));
333 leg->SetHeader(
"Tracker Material Grouping");
334 leg->SetTextFont(42);
335 leg->SetTextSize(0.008);
337 std::unique_ptr<TProfile2D> radlen(
338 new TProfile2D(
"OverallRadLen",
"OverallRadLen", 600., -300., 300, 120., 0., 120.));
339 std::unique_ptr<TProfile2D> eneloss(
340 new TProfile2D(
"OverallEnergyLoss",
"OverallEnergyLoss", 600., -300., 300, 120., 0., 120.));
341 std::unique_ptr<TProfile2D> radlen_diff(
342 new TProfile2D(
"OverallDifferencesRadLen",
"OverallDifferencesRadLen", 600., -300., 300, 120., 0., 120.));
343 std::unique_ptr<TProfile2D> eneloss_diff(
344 new TProfile2D(
"OverallDifferencesEnergyLoss",
"OverallDifferencesEnergyLoss", 600., -300., 300, 120., 0., 120.));
348 new TH2F(
g->name().c_str(),
g->name().c_str(), 6000., -300., 300, 1200., 0., 120.));
349 TH2F ¤t = *
m_plots.back();
350 current.SetMarkerColor(
m_color[color_index]);
351 current.SetMarkerStyle(markerStyles[color_index % 10]);
352 current.SetMarkerSize(0.8);
353 current.SetLineWidth(1);
354 for (
auto element :
g->elements()) {
355 current.Fill(element.z(), element.perp());
356 radlen->Fill(element.z(), element.perp(),
m_values[
g->name()].first);
357 eneloss->Fill(element.z(), element.perp(),
m_values[
g->name()].second);
358 radlen_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].first);
359 eneloss_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].second);
362 if (color_index == 1)
365 current.Draw(
"SAME");
367 leg->AddEntry(¤t,
g->name().c_str(),
"lp")->SetTextColor(
m_color[color_index]);
372 color_index = color_index %
m_color.size();
375 canvas->SaveAs(
"Grouping.png");
380 radlen->SetMinimum(0);
381 radlen->SetMaximum(0.25);
382 radlen->Draw(
"COLZ");
384 line.first->SetLineWidth(5);
388 canvas->SaveAs(
"RadLenValues.png");
391 eneloss->SetMinimum(0.00001);
392 eneloss->SetMaximum(0.0005);
393 eneloss->Draw(
"COLZ");
395 line.first->SetLineWidth(5);
399 canvas->SaveAs(
"EnergyLossValues.png");
404 radlen_diff->SetMinimum(-100);
405 radlen_diff->SetMaximum(100);
406 radlen_diff->Draw(
"COLZ");
408 line.first->SetLineWidth(5);
412 canvas->SaveAs(
"RadLenChanges.png");
415 eneloss_diff->SetMinimum(-100);
416 eneloss_diff->SetMaximum(100);
417 eneloss_diff->Draw(
"COLZ");
419 line.first->SetLineWidth(5);
423 canvas->SaveAs(
"EnergyLossChanges.png");
425 for (
auto g : nukem_text)
444 for (
unsigned int h = 2;
h < history.size(); ++
h)
445 std::cout <<
'/' << history[
h].logicalPart().name().name() <<
'[' << history[
h].copyno() <<
']';
450 <<
"[rho] " <<
position.Rho() << std::endl;