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";
63 return double(::atof(value.c_str()));
79 out << std::fixed << std::setprecision(3);
80 return out <<
"(" << v.rho() <<
", " << v.z() <<
", " << v.phi() <<
")";
114 std::map<std::string, std::pair<float, float> >
m_diff;
115 std::map<std::string, std::pair<float, float> >
m_values;
122 TColor::InitializeColors();
142 unsigned int steps = 100;
144 unsigned int index = ((TObjArray*) gROOT->GetListOfColors())->GetLast() + 1;
147 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kBlue + 1))->GetRGB(r1, g1, b1);
148 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kAzure + 10))->GetRGB(r2, g2, b2);
150 float delta_g = (g2 -
g1) / (steps - 1);
151 float delta_b = (b2 - b1) / (steps - 1);
155 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
156 new TColor(index + ii, r1 + delta_r *
i, g1 + delta_g * i, b1 + delta_b * i);
162 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kOrange))->GetRGB(r1, g1, b1);
163 static_cast<TColor *
>(gROOT->GetListOfColors()->At(kOrange + 7))->GetRGB(r2, g2, b2);
164 delta_r = (r2 -
r1) / (steps - 1);
165 delta_g = (g2 -
g1) / (steps - 1);
166 delta_b = (b2 - b1) / (steps - 1);
167 for (
unsigned int i = 0;
i <
steps; ++
i, ++
ii) {
168 new TColor(index + ii, r1 + delta_r *
i, g1 + delta_g * i, b1 + delta_b * i);
179 m_color.push_back(kAzure + 1) ;
180 m_color.push_back(kAzure + 2) ;
181 m_color.push_back(kAzure + 3) ;
182 m_color.push_back(kAzure + 10);
187 m_color.push_back(kSpring + 9);
188 m_color.push_back(kSpring + 4);
198 m_color.push_back(kMagenta - 2);
199 m_color.push_back(kMagenta - 4);
201 m_color.push_back(kMagenta - 9);
204 m_color.push_back(kOrange + 9);
205 m_color.push_back(kOrange + 7);
206 m_color.push_back(kOrange - 2);
207 m_color.push_back(kOrange - 3);
208 m_color.push_back(kOrange + 4);
209 m_color.push_back(kOrange - 7);
211 m_color.push_back(kOrange + 10);
213 m_color.push_back(kViolet + 10);
214 m_color.push_back(kViolet + 6);
215 m_color.push_back(kViolet - 7);
216 m_color.push_back(kViolet - 1);
217 m_color.push_back(kViolet + 9);
240 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
242 std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > >
lines;
245 std::pair<float, float> deltaZ(293, 298);
246 std::pair<float, float>
deltaR(115, 118);
247 float text_size = 0.033;
249 for (
float eta = 0.;
eta <= 3.8;
eta += 0.2) {
253 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
254 std::make_shared<TLine>(
255 deltaZ.first, deltaZ.first *
tan(theta), deltaZ.second, deltaZ.second *
tan(theta)),
256 std::make_shared<TText>(
258 lines.back().second->SetTextFont(42);
259 lines.back().second->SetTextSize(text_size);
260 lines.back().second->SetTextAlign(33);
262 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
263 std::make_shared<TLine>(
264 -deltaZ.first, deltaZ.first *
tan(theta), -deltaZ.second, deltaZ.second *
tan(theta)),
265 std::make_shared<TText>(
267 lines.back().second->SetTextFont(42);
268 lines.back().second->SetTextSize(text_size);
269 lines.back().second->SetTextAlign(13);
272 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
273 std::make_shared<TLine>(
274 deltaR.first /
tan(theta), deltaR.first, deltaR.second /
tan(theta), deltaR.second),
275 std::make_shared<TText>(
277 lines.back().second->SetTextFont(42);
278 lines.back().second->SetTextSize(text_size);
279 lines.back().second->SetTextAlign(23);
282 std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > (
283 std::make_shared<TLine>(
284 - deltaR.first /
tan(theta), deltaR.first, - deltaR.second /
tan(theta), deltaR.second),
285 std::make_shared<TText>(
287 lines.back().second->SetTextFont(42);
288 lines.back().second->SetTextSize(text_size);
289 lines.back().second->SetTextAlign(23);
298 const double scale = 10.;
299 std::vector<TText *> nukem_text;
308 std::unique_ptr<TCanvas>
canvas(
309 new TCanvas(
"Grouping_rz",
"Grouping - RZ view",
310 (
int) (600 * scale * 1.25), (
int) (120 * scale * 1.50)));
311 canvas->GetFrame()->SetFillColor(kWhite);
312 gStyle->SetOptStat(0);
314 unsigned int color_index = 1;
316 std::unique_ptr<TLegend>
leg(
new TLegend(0.1,0.1,0.23,0.34));
317 leg->SetHeader(
"Tracker Material Grouping");
318 leg->SetTextFont(42);
319 leg->SetTextSize(0.008);
321 std::unique_ptr<TProfile2D> radlen(
322 new TProfile2D(
"OverallRadLen",
"OverallRadLen",
323 600., -300., 300, 120., 0., 120.));
324 std::unique_ptr<TProfile2D> eneloss(
325 new TProfile2D(
"OverallEnergyLoss",
"OverallEnergyLoss",
326 600., -300., 300, 120., 0., 120.));
327 std::unique_ptr<TProfile2D> radlen_diff(
328 new TProfile2D(
"OverallDifferencesRadLen",
"OverallDifferencesRadLen",
329 600., -300., 300, 120., 0., 120.));
330 std::unique_ptr<TProfile2D> eneloss_diff(
331 new TProfile2D(
"OverallDifferencesEnergyLoss",
"OverallDifferencesEnergyLoss",
332 600., -300., 300, 120., 0., 120.));
336 new TH2F(
g->name().c_str(),
g->name().c_str(),
337 6000., -300., 300, 1200., 0., 120.));
339 current.SetMarkerColor(
m_color[color_index]);
340 current.SetMarkerStyle( color_index%2 == 0 ? kFullCircle : kOpenCircle);
341 current.SetMarkerSize(0.8);
342 for (
auto element :
g->elements()) {
343 current.Fill(element.z(), element.perp());
344 radlen->Fill(element.z(), element.perp(),
m_values[
g->name()].first);
345 eneloss->Fill(element.z(), element.perp(),
m_values[
g->name()].second);
346 radlen_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].first);
347 eneloss_diff->Fill(element.z(), element.perp(),
m_diff[
g->name()].second);
350 if (color_index == 1)
353 current.Draw(
"SAME");
355 leg->AddEntry(¤t ,
g->name().c_str(),
"lp")->SetTextColor(
m_color[color_index]);
360 color_index = color_index%
m_color.size();
363 canvas->SaveAs(
"Grouping.png");
368 radlen->SetMinimum(0);
369 radlen->SetMaximum(0.25);
370 radlen->Draw(
"COLZ");
371 for (
auto line : lines) {
372 line.first->SetLineWidth(5);
376 canvas->SaveAs(
"RadLenValues.png");
379 eneloss->SetMinimum(0.00001);
380 eneloss->SetMaximum(0.0005);
381 eneloss->Draw(
"COLZ");
382 for (
auto line : lines) {
383 line.first->SetLineWidth(5);
387 canvas->SaveAs(
"EnergyLossValues.png");
391 gStyle->SetNumberContours(
m_gradient.size() );
392 radlen_diff->SetMinimum(-100);
393 radlen_diff->SetMaximum(100);
394 radlen_diff->Draw(
"COLZ");
395 for (
auto line : lines) {
396 line.first->SetLineWidth(5);
400 canvas->SaveAs(
"RadLenChanges.png");
403 eneloss_diff->SetMinimum(-100);
404 eneloss_diff->SetMaximum(100);
405 eneloss_diff->Draw(
"COLZ");
406 for (
auto line : lines) {
407 line.first->SetLineWidth(5);
411 canvas->SaveAs(
"EnergyLossChanges.png");
413 for (
auto g : nukem_text)
437 for (
unsigned int h = 2;
h < history.size(); ++
h)
438 std::cout <<
'/' << history[
h].logicalPart().name().name() <<
'[' << history[
h].copyno() <<
']';
442 std::cout <<
"\t" << position << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &, const edm::EventSetup &) override
Geom::Theta< T > theta() const
string format
Some error handling for the usage.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
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)
static double dddGetDouble(const std::string &s, DDFilteredView const &view)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
std::map< std::string, std::pair< float, float > > m_values
static std::string dddGetString(const std::string &s, DDFilteredView const &view)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.