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) {
45 if (parameter.
strings().size() == 1) {
46 value = parameter.
strings().front();
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);
141 float delta_g = (g2 -
g1) / (steps - 1);
142 float delta_b = (b2 -
b1) / (steps - 1);
146 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
147 new TColor(static_cast<Int_t>(index + ii), r1 + delta_r *
i, g1 + delta_g * i, b1 + delta_b * i);
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);
155 delta_r = (r2 -
r1) / (steps - 1);
156 delta_g = (g2 -
g1) / (steps - 1);
157 delta_b = (b2 -
b1) / (steps - 1);
158 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
159 new TColor(static_cast<Int_t>(index + ii), r1 + delta_r *
i, g1 + delta_g * i, b1 + delta_b * i);
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> >(
282 std::make_shared<TLine>(deltaR.first /
tan(theta), deltaR.first, deltaR.second /
tan(theta), deltaR.second),
283 std::make_shared<TText>(deltaR.first /
tan(theta), deltaR.first, fmt::sprintf(
"%2.1f",
eta).c_str())));
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>(
290 -deltaR.first /
tan(theta), deltaR.first, -deltaR.second /
tan(theta), deltaR.second),
291 std::make_shared<TText>(-deltaR.first /
tan(theta), deltaR.first, fmt::sprintf(
"-%2.1f",
eta).c_str())));
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");
380 for (
const auto &
line : lines) {
381 line.first->SetLineWidth(5);
385 canvas->SaveAs(
"RadLenValues.png");
388 eneloss->SetMinimum(0.00001);
389 eneloss->SetMaximum(0.0005);
390 eneloss->Draw(
"COLZ");
391 for (
const auto &
line : lines) {
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");
404 for (
const auto &
line : lines) {
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");
415 for (
const auto &
line : lines) {
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() <<
']';
446 std::cout <<
"\t(" << position.x() <<
", " << position.y() <<
", " << position.z() <<
") "
447 <<
"[rho] " << position.Rho() << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
Geom::Theta< T > theta() const
Exp< T >::type exp(const T &t)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
std::vector< TH2F * > m_plots
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
std::vector< unsigned int > m_color
std::vector< std::pair< std::shared_ptr< TLine >, std::shared_ptr< TText > > > overlayEtaReferences()
void produceAndSaveSummaryPlot(const edm::EventSetup &)
bool next()
set current node to the next node in the filtered tree
void fillMaterialDifferences()
double delta_r(const Fourvec &a, const Fourvec &b)
Find the distance between two four-vectors in the two-dimensional space .
Tan< T >::type tan(const T &t)
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
std::map< std::string, std::pair< float, float > > m_diff
std::vector< DDExpandedNode > DDGeoHistory
Geometrical 'path' of the current node up to the root-node.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::set< std::string > m_group_names
std::vector< MaterialAccountingGroup * > m_groups
static int position[264][3]
ListGroups(const edm::ParameterSet &)
std::vector< int > m_gradient
void specificsV(std::vector< const DDsvalues_type * > &result) const
User specific data attached to the current node.
static bool dddGetStringRaw(const DDFilteredView &view, const std::string &name, std::string &value)
const DDTranslation & translation() const
The absolute translation of the current node.
static constexpr float b2
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
static constexpr float b1
std::map< std::string, std::pair< float, float > > m_values
static std::string dddGetString(const std::string &s, DDFilteredView const &view)