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";
95 std::vector<MaterialAccountingGroup *>
m_groups;
108 std::map<std::string, std::pair<float, float> >
m_diff;
109 std::map<std::string, std::pair<float, float> >
m_values;
113 : m_saveSummaryPlot(iPSet.getUntrackedParameter<
bool>(
"SaveSummaryPlot")),
117 TColor::InitializeColors();
136 unsigned int steps = 100;
138 unsigned int index = ((TObjArray *)gROOT->GetListOfColors())->GetLast() + 1;
141 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kBlue + 1))->GetRGB(
r1,
g1,
b1);
142 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kAzure + 10))->GetRGB(
r2,
g2,
b2);
149 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
156 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kOrange))->GetRGB(
r1,
g1,
b1);
157 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kOrange + 7))->GetRGB(
r2,
g2,
b2);
161 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
185 m_color.push_back(kSpring + 9);
186 m_color.push_back(kSpring + 4);
203 m_color.push_back(kMagenta - 2);
204 m_color.push_back(kMagenta - 3);
205 m_color.push_back(kMagenta - 4);
206 m_color.push_back(kMagenta - 5);
207 m_color.push_back(kMagenta - 6);
208 m_color.push_back(kMagenta - 7);
210 m_color.push_back(kMagenta - 9);
213 m_color.push_back(kOrange + 9);
214 m_color.push_back(kOrange + 7);
215 m_color.push_back(kOrange + 5);
216 m_color.push_back(kOrange - 2);
217 m_color.push_back(kOrange - 3);
218 m_color.push_back(kOrange - 6);
219 m_color.push_back(kOrange + 4);
220 m_color.push_back(kOrange - 7);
222 m_color.push_back(kOrange + 10);
224 m_color.push_back(kViolet + 10);
225 m_color.push_back(kViolet + 6);
226 m_color.push_back(kViolet + 3);
227 m_color.push_back(kViolet - 7);
228 m_color.push_back(kViolet - 1);
229 m_color.push_back(kViolet + 9);
230 m_color.push_back(kViolet - 5);
231 m_color.push_back(kViolet - 3);
261 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
lines;
264 std::pair<float, float>
deltaZ(293, 298);
265 std::pair<float, float>
deltaR(115, 118);
266 float text_size = 0.033;
268 for (
float eta = 0.;
eta <= 3.8;
eta += 0.2) {
271 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
274 lines.back().second->SetTextFont(42);
275 lines.back().second->SetTextSize(text_size);
276 lines.back().second->SetTextAlign(33);
277 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
280 lines.back().second->SetTextFont(42);
281 lines.back().second->SetTextSize(text_size);
282 lines.back().second->SetTextAlign(13);
284 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
287 lines.back().second->SetTextFont(42);
288 lines.back().second->SetTextSize(text_size);
289 lines.back().second->SetTextAlign(23);
291 lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
292 std::make_shared<TLine>(
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,
324 std::unique_ptr<TCanvas>
canvas(
325 new TCanvas(
"Grouping_rz",
"Grouping - RZ view", (
int)(600 *
scale * 1.25), (
int)(120 *
scale * 1.50)));
326 canvas->GetFrame()->SetFillColor(kWhite);
327 gStyle->SetOptStat(0);
329 unsigned int color_index = 1;
331 std::unique_ptr<TLegend> leg(
new TLegend(0.1, 0.1, 0.23, 0.34));
332 leg->SetHeader(
"Tracker Material Grouping");
333 leg->SetTextFont(42);
334 leg->SetTextSize(0.008);
336 std::unique_ptr<TProfile2D> radlen(
337 new TProfile2D(
"OverallRadLen",
"OverallRadLen", 600., -300., 300, 120., 0., 120.));
338 std::unique_ptr<TProfile2D> eneloss(
339 new TProfile2D(
"OverallEnergyLoss",
"OverallEnergyLoss", 600., -300., 300, 120., 0., 120.));
340 std::unique_ptr<TProfile2D> radlen_diff(
341 new TProfile2D(
"OverallDifferencesRadLen",
"OverallDifferencesRadLen", 600., -300., 300, 120., 0., 120.));
342 std::unique_ptr<TProfile2D> eneloss_diff(
343 new TProfile2D(
"OverallDifferencesEnergyLoss",
"OverallDifferencesEnergyLoss", 600., -300., 300, 120., 0., 120.));
347 new TH2F(
g->name().c_str(),
g->name().c_str(), 6000., -300., 300, 1200., 0., 120.));
348 TH2F ¤t = *
m_plots.back();
349 current.SetMarkerColor(
m_color[color_index]);
350 current.SetMarkerStyle(markerStyles[color_index % 10]);
351 current.SetMarkerSize(0.8);
352 current.SetLineWidth(1);
353 for (
const auto &element :
g->elements()) {
354 current.Fill(element.z(), element.perp());
355 radlen->Fill(element.z(), element.perp(),
m_values[
g->name()].first);
356 eneloss->Fill(element.z(), element.perp(),
m_values[
g->name()].second);
357 radlen_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].first);
358 eneloss_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].second);
361 if (color_index == 1)
364 current.Draw(
"SAME");
366 leg->AddEntry(¤t,
g->name().c_str(),
"lp")->SetTextColor(
m_color[color_index]);
371 color_index = color_index %
m_color.size();
374 canvas->SaveAs(
"Grouping.png");
379 radlen->SetMinimum(0);
380 radlen->SetMaximum(0.25);
381 radlen->Draw(
"COLZ");
383 line.first->SetLineWidth(5);
387 canvas->SaveAs(
"RadLenValues.png");
390 eneloss->SetMinimum(0.00001);
391 eneloss->SetMaximum(0.0005);
392 eneloss->Draw(
"COLZ");
394 line.first->SetLineWidth(5);
398 canvas->SaveAs(
"EnergyLossValues.png");
403 radlen_diff->SetMinimum(-100);
404 radlen_diff->SetMaximum(100);
405 radlen_diff->Draw(
"COLZ");
407 line.first->SetLineWidth(5);
411 canvas->SaveAs(
"RadLenChanges.png");
414 eneloss_diff->SetMinimum(-100);
415 eneloss_diff->SetMaximum(100);
416 eneloss_diff->Draw(
"COLZ");
418 line.first->SetLineWidth(5);
422 canvas->SaveAs(
"EnergyLossChanges.png");
424 for (
auto g : nukem_text)
442 for (
unsigned int h = 2;
h < history.size(); ++
h)
443 std::cout <<
'/' << history[
h].logicalPart().name().name() <<
'[' << history[
h].copyno() <<
']';
448 <<
"[rho] " <<
position.Rho() << std::endl;
void analyze(const edm::Event &, const edm::EventSetup &) override
Compact representation of the geometrical detector hierarchy.
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)
#define DEFINE_FWK_MODULE(type)
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.
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
const bool m_saveSummaryPlot
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
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
static bool dddGetStringRaw(const DDFilteredView &view, const std::string &name, std::string &value)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const DDTranslation & translation() const
The absolute translation of the current node.
Geom::Theta< T > theta() const
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)