7 #include "boost/format.hpp" 27 #include <TProfile2D.h> 34 #include <TLegendEntry.h> 42 std::vector<const DDsvalues_type *>
result;
44 for (std::vector<const DDsvalues_type *>::iterator it = result.begin(); it != result.end(); ++it) {
47 if (parameter.
strings().size() == 1) {
48 value = parameter.
strings().front();
51 throw cms::Exception(
"Configuration")<<
" ERROR: multiple " << name <<
" tags encountered";
82 return out <<
"(" << v.rho() <<
", " << v.z() <<
", " << v.phi() <<
")";
116 std::map<std::string, std::pair<float, float> >
m_diff;
117 std::map<std::string, std::pair<float, float> >
m_values;
124 TColor::InitializeColors();
144 unsigned int steps = 100;
146 unsigned int index = ((TObjArray*) gROOT->GetListOfColors())->GetLast() + 1;
149 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kBlue + 1))->GetRGB(r1, g1, b1);
150 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kAzure + 10))->GetRGB(r2, g2, b2);
152 float delta_g = (g2 -
g1) / (steps - 1);
153 float delta_b = (b2 - b1) / (steps - 1);
157 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
158 new TColor(static_cast<Int_t>(index + ii), r1 + delta_r *
i, g1 + delta_g * i, b1 + delta_b * i);
164 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kOrange))->GetRGB(r1, g1, b1);
165 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kOrange + 7))->GetRGB(r2, g2, b2);
166 delta_r = (r2 -
r1) / (steps - 1);
167 delta_g = (g2 -
g1) / (steps - 1);
168 delta_b = (b2 - b1) / (steps - 1);
169 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
170 new TColor(static_cast<Int_t>(index + ii), r1 + delta_r *
i, g1 + delta_g * i, b1 + delta_b * i);
187 m_color.push_back(kAzure + 1) ;
188 m_color.push_back(kAzure + 2) ;
193 m_color.push_back(kSpring + 9);
194 m_color.push_back(kSpring + 4);
211 m_color.push_back(kMagenta - 2);
212 m_color.push_back(kMagenta - 3);
213 m_color.push_back(kMagenta - 4);
214 m_color.push_back(kMagenta - 5);
215 m_color.push_back(kMagenta - 6);
216 m_color.push_back(kMagenta - 7);
218 m_color.push_back(kMagenta - 9);
221 m_color.push_back(kOrange + 9);
222 m_color.push_back(kOrange + 7);
223 m_color.push_back(kOrange + 5);
224 m_color.push_back(kOrange - 2);
225 m_color.push_back(kOrange - 3);
226 m_color.push_back(kOrange - 6);
227 m_color.push_back(kOrange + 4);
228 m_color.push_back(kOrange - 7);
230 m_color.push_back(kOrange + 10);
232 m_color.push_back(kViolet + 10);
233 m_color.push_back(kViolet + 6);
234 m_color.push_back(kViolet + 3);
235 m_color.push_back(kViolet - 7);
236 m_color.push_back(kViolet - 1);
237 m_color.push_back(kViolet + 9);
238 m_color.push_back(kViolet - 5);
239 m_color.push_back(kViolet - 3);
268 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
270 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
lines;
273 std::pair<float, float> deltaZ(293, 298);
274 std::pair<float, float>
deltaR(115, 118);
275 float text_size = 0.033;
277 for (
float eta = 0.;
eta <= 3.8;
eta += 0.2) {
281 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
282 std::make_shared<TLine>(
283 deltaZ.first, deltaZ.first *
tan(theta), deltaZ.second, deltaZ.second *
tan(theta)),
284 std::make_shared<TText>(
286 lines.back().second->SetTextFont(42);
287 lines.back().second->SetTextSize(text_size);
288 lines.back().second->SetTextAlign(33);
290 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
291 std::make_shared<TLine>(
292 -deltaZ.first, deltaZ.first *
tan(theta), -deltaZ.second, deltaZ.second *
tan(theta)),
293 std::make_shared<TText>(
295 lines.back().second->SetTextFont(42);
296 lines.back().second->SetTextSize(text_size);
297 lines.back().second->SetTextAlign(13);
300 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
301 std::make_shared<TLine>(
302 deltaR.first /
tan(theta), deltaR.first, deltaR.second /
tan(theta), deltaR.second),
303 std::make_shared<TText>(
305 lines.back().second->SetTextFont(42);
306 lines.back().second->SetTextSize(text_size);
307 lines.back().second->SetTextAlign(23);
310 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
311 std::make_shared<TLine>(
312 - deltaR.first /
tan(theta), deltaR.first, - deltaR.second /
tan(theta), deltaR.second),
313 std::make_shared<TText>(
315 lines.back().second->SetTextFont(42);
316 lines.back().second->SetTextSize(text_size);
317 lines.back().second->SetTextAlign(23);
326 const double scale = 10.;
327 std::vector<TText *> nukem_text;
328 static int markerStyles[10] = {kFullCircle, kFullSquare, kFullTriangleUp, kFullTriangleDown, kOpenCircle, kOpenSquare, kOpenTriangleUp, kOpenDiamond, kOpenCross, kFullStar};
337 std::unique_ptr<TCanvas>
canvas(
338 new TCanvas(
"Grouping_rz",
"Grouping - RZ view",
339 (
int) (600 * scale * 1.25), (
int) (120 * scale * 1.50)));
340 canvas->GetFrame()->SetFillColor(kWhite);
341 gStyle->SetOptStat(0);
343 unsigned int color_index = 1;
345 std::unique_ptr<TLegend>
leg(
new TLegend(0.1,0.1,0.23,0.34));
346 leg->SetHeader(
"Tracker Material Grouping");
347 leg->SetTextFont(42);
348 leg->SetTextSize(0.008);
350 std::unique_ptr<TProfile2D> radlen(
351 new TProfile2D(
"OverallRadLen",
"OverallRadLen",
352 600., -300., 300, 120., 0., 120.));
353 std::unique_ptr<TProfile2D> eneloss(
354 new TProfile2D(
"OverallEnergyLoss",
"OverallEnergyLoss",
355 600., -300., 300, 120., 0., 120.));
356 std::unique_ptr<TProfile2D> radlen_diff(
357 new TProfile2D(
"OverallDifferencesRadLen",
"OverallDifferencesRadLen",
358 600., -300., 300, 120., 0., 120.));
359 std::unique_ptr<TProfile2D> eneloss_diff(
360 new TProfile2D(
"OverallDifferencesEnergyLoss",
"OverallDifferencesEnergyLoss",
361 600., -300., 300, 120., 0., 120.));
365 new TH2F(
g->name().c_str(),
g->name().c_str(),
366 6000., -300., 300, 1200., 0., 120.));
367 TH2F ¤t = *
m_plots.back();
368 current.SetMarkerColor(
m_color[color_index]);
369 current.SetMarkerStyle(markerStyles[color_index%10]);
370 current.SetMarkerSize(0.8);
371 current.SetLineWidth(1);
372 for (
auto element :
g->elements()) {
373 current.Fill(element.z(), element.perp());
374 radlen->Fill(element.z(), element.perp(),
m_values[
g->name()].first);
375 eneloss->Fill(element.z(), element.perp(),
m_values[
g->name()].second);
376 radlen_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].first);
377 eneloss_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].second);
380 if (color_index == 1)
383 current.Draw(
"SAME");
385 leg->AddEntry(¤t ,
g->name().c_str(),
"lp")->SetTextColor(
m_color[color_index]);
390 color_index = color_index%
m_color.size();
393 canvas->SaveAs(
"Grouping.png");
398 radlen->SetMinimum(0);
399 radlen->SetMaximum(0.25);
400 radlen->Draw(
"COLZ");
401 for (
auto line : lines) {
402 line.first->SetLineWidth(5);
406 canvas->SaveAs(
"RadLenValues.png");
409 eneloss->SetMinimum(0.00001);
410 eneloss->SetMaximum(0.0005);
411 eneloss->Draw(
"COLZ");
412 for (
auto line : lines) {
413 line.first->SetLineWidth(5);
417 canvas->SaveAs(
"EnergyLossValues.png");
421 gStyle->SetNumberContours(
m_gradient.size() );
422 radlen_diff->SetMinimum(-100);
423 radlen_diff->SetMaximum(100);
424 radlen_diff->Draw(
"COLZ");
425 for (
auto line : lines) {
426 line.first->SetLineWidth(5);
430 canvas->SaveAs(
"RadLenChanges.png");
433 eneloss_diff->SetMinimum(-100);
434 eneloss_diff->SetMaximum(100);
435 eneloss_diff->Draw(
"COLZ");
436 for (
auto line : lines) {
437 line.first->SetLineWidth(5);
441 canvas->SaveAs(
"EnergyLossChanges.png");
443 for (
auto g : nukem_text)
465 for (
unsigned int h = 2;
h < history.size(); ++
h)
466 std::cout <<
'/' << history[
h].logicalPart().name().name() <<
'[' << history[
h].copyno() <<
']';
471 <<
", " << position.y()
472 <<
", " << position.z() <<
") " 473 <<
"[rho] " << position.Rho() << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
Geom::Theta< T > theta() const
def setup(process, global_tag, zero_tesla=False)
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 &)
static std::ostream & operator<<(std::ostream &out, const math::XYZVector &v)
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)
format
Some error handling for the usage.
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.
double deltaR(double eta1, double eta2, double phi1, double phi2)
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.
std::map< std::string, std::pair< float, float > > m_values
static std::string dddGetString(const std::string &s, DDFilteredView const &view)