CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DD4hep_ListGroups Class Reference
Inheritance diagram for DD4hep_ListGroups:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DD4hep_ListGroups (const edm::ParameterSet &iConfig)
 
 ~DD4hep_ListGroups () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void fillColor ()
 
void fillGradient ()
 
void fillMaterialDifferences ()
 
std::vector< std::pair< std::shared_ptr< TLine >, std::shared_ptr< TText > > > overlayEtaReferences ()
 
void produceAndSaveSummaryPlot (const cms::DDCompactView &cpv)
 

Private Attributes

const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecordddToken_
 
std::vector< unsigned int > m_color
 
std::map< std::string, std::pair< float, float > > m_diff
 
std::vector< int > m_gradient
 
std::set< std::string_view > m_group_names
 
std::vector< DD4hep_MaterialAccountingGroup * > m_groups
 
std::vector< TH2F * > m_plots
 
const bool m_saveSummaryPlot
 
const edm::ESInputTag m_tag
 
std::map< std::string, std::pair< float, float > > m_values
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 36 of file DD4hep_ListGroups.cc.

Constructor & Destructor Documentation

◆ DD4hep_ListGroups()

DD4hep_ListGroups::DD4hep_ListGroups ( const edm::ParameterSet iConfig)

Definition at line 66 of file DD4hep_ListGroups.cc.

References fillColor(), fillGradient(), fillMaterialDifferences(), m_groups, and m_plots.

67  : m_tag(iConfig.getParameter<edm::ESInputTag>("DDDetector")),
68  m_saveSummaryPlot(iConfig.getUntrackedParameter<bool>("SaveSummaryPlot")),
69  ddToken_(esConsumes<cms::DDCompactView, IdealGeometryRecord>(m_tag)) {
70  m_plots.clear();
71  m_groups.clear();
72  TColor::InitializeColors();
73  fillColor();
75  fillGradient();
76 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
std::vector< TH2F * > m_plots
const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > ddToken_
const bool m_saveSummaryPlot
std::vector< DD4hep_MaterialAccountingGroup * > m_groups
const edm::ESInputTag m_tag

◆ ~DD4hep_ListGroups()

DD4hep_ListGroups::~DD4hep_ListGroups ( )
override

Definition at line 78 of file DD4hep_ListGroups.cc.

78 {}

Member Function Documentation

◆ analyze()

void DD4hep_ListGroups::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 366 of file DD4hep_ListGroups.cc.

References class-composition::children, ddToken_, ALCARECOTkAlBeamHalo_cff::filter, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, m_group_names, m_saveSummaryPlot, castor_dqm_sourceclient_file_cfg::path, produceAndSaveSummaryPlot(), singleTopDQM_cfi::setup, cms::DDFilteredView::specpars(), and submitPVValidationJobs::t.

366  {
368  cms::DDFilter filter("TrackingMaterialGroup", "");
369  cms::DDFilteredView fv(*cpv, filter);
370 
371  for (const auto &t : fv.specpars()) {
372  m_group_names.insert(t.second->strValue("TrackingMaterialGroup"));
373  }
374 
375  for (const auto &i : m_group_names) {
376  cms::DDFilter filter1("TrackingMaterialGroup", {i.data(), i.size()});
377  cms::DDFilteredView fv1(*cpv, filter1);
378  bool firstChild = fv1.firstChild();
379 
380  for (const auto &j : fv1.specpars()) {
381  for (const auto &k : j.second->paths) {
382  if (firstChild) {
383  std::vector<std::vector<cms::Node *>> children = fv1.children(k);
384  for (auto const &path : children) {
385  for (auto const &node : path) {
386  edm::LogVerbatim("TrackingMaterialGroup") << node->GetName() << "/";
387  }
388  cms::Translation trans = fv1.translation(path);
389  edm::LogVerbatim("TrackingMaterialGroup")
390  << "(" << trans.x() << ", " << trans.y() << ", " << trans.z() << ")\n";
391  }
392  }
393  }
394  }
395  }
396 
397  if (m_saveSummaryPlot)
399 }
Log< level::Info, true > LogVerbatim
void produceAndSaveSummaryPlot(const cms::DDCompactView &cpv)
const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > ddToken_
const bool m_saveSummaryPlot
std::set< std::string_view > m_group_names
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > Translation

◆ beginJob()

void DD4hep_ListGroups::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 43 of file DD4hep_ListGroups.cc.

43 {}

◆ endJob()

void DD4hep_ListGroups::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 401 of file DD4hep_ListGroups.cc.

401 {}

◆ fillColor()

void DD4hep_ListGroups::fillColor ( void  )
private

Definition at line 196 of file DD4hep_ListGroups.cc.

References m_color.

Referenced by DD4hep_ListGroups().

196  {
197  // With the introduction of the support for PhaseI and PhaseII detectors it
198  // became quite difficult to maintain a list of colors that is in sync with
199  // the real number of grouping used in the different scenarios. We therefore
200  // define some reasonable set and loop over it in case the number of grouping
201  // is larger than the number of colors.
202 
203  m_color.emplace_back(kBlack); // unassigned
204 
205  m_color.emplace_back(kAzure); // PixelBarrelLayer0_Z0
206  m_color.emplace_back(kAzure - 1); // PixelBarrelLayer0_Z20
207  m_color.emplace_back(kAzure + 1); // Layer1_Z0
208  m_color.emplace_back(kAzure + 2); // Layer1_Z20
209 
210  m_color.emplace_back(kGreen); // EndCapDisk1_R0
211  m_color.emplace_back(kGreen + 2); // EndcapDisk1_R11
212  m_color.emplace_back(kGreen + 4); // EndcapDisk1_R7
213  m_color.emplace_back(kSpring + 9); // EndcapDisk2_R0
214  m_color.emplace_back(kSpring + 4); // EndcapDisk2_R7
215  m_color.emplace_back(kSpring); // EndcapDisk2_R7
216 
217  m_color.emplace_back(kRed); // TECDisk0_R20
218  m_color.emplace_back(kRed + 2); // TECDisk0_R40
219  m_color.emplace_back(kRed - 7); // TECDisk0_R50
220  m_color.emplace_back(kRed - 5); // TECDisk0_R60
221  m_color.emplace_back(kRed - 10); // TECDisk0_R90
222  m_color.emplace_back(kRed - 1); // TECDisk1_Inner
223  m_color.emplace_back(kRed - 2); // TECDisk1_Outer
224  m_color.emplace_back(kRed - 3); // TECDisk1_R20
225  m_color.emplace_back(kPink - 2); // TECDisk2_Inner
226  m_color.emplace_back(kPink - 3); // TECDisk2_Outer
227  m_color.emplace_back(kPink - 4); // TECDisk2_R20
228  m_color.emplace_back(kPink + 9); // TECDisk3_Inner
229  m_color.emplace_back(kPink + 8); // TECDisk3_Outer
230  m_color.emplace_back(kPink + 7); // TECDisk3
231  m_color.emplace_back(kMagenta - 2); // TECDisk4_Inner
232  m_color.emplace_back(kMagenta - 3); // TECDisk4_Outer
233  m_color.emplace_back(kMagenta - 4); // TECDisk4_R33
234  m_color.emplace_back(kMagenta - 5); // TECDisk5_Inner
235  m_color.emplace_back(kMagenta - 6); // TECDisk5_Outer
236  m_color.emplace_back(kMagenta - 7); // TECDisk5_R33
237  m_color.emplace_back(kRed); // TECDisk6
238  m_color.emplace_back(kMagenta - 9); // TECDisk7_R40
239  m_color.emplace_back(kViolet); // TECDisk8
240 
241  m_color.emplace_back(kOrange + 9); // TIBLayer0_Z0
242  m_color.emplace_back(kOrange + 7); // TIBLayer0_Z20
243  m_color.emplace_back(kOrange + 5); // TIBLayer0_Z40
244  m_color.emplace_back(kOrange - 2); // TIBLayer1_Z0
245  m_color.emplace_back(kOrange - 3); // TIBLayer1_Z30
246  m_color.emplace_back(kOrange - 6); // TIBLayer1_Z60
247  m_color.emplace_back(kOrange + 4); // TIBLayer2_Z0
248  m_color.emplace_back(kOrange - 7); // TIBLayer2_Z40
249  m_color.emplace_back(kOrange); // TIBLayer3_Z0
250  m_color.emplace_back(kOrange + 10); // TIBLayer3_Z50
251 
252  m_color.emplace_back(kViolet + 10); // TIDDisk1_R0
253  m_color.emplace_back(kViolet + 6); // TIDDisk1_R30
254  m_color.emplace_back(kViolet + 3); // TIDDisk1_R40
255  m_color.emplace_back(kViolet - 7); // TIDDisk2_R25
256  m_color.emplace_back(kViolet - 1); // TIDDisk2_R30
257  m_color.emplace_back(kViolet + 9); // TIDDisk2_R40
258  m_color.emplace_back(kViolet - 5); // TIDDisk3_R24
259  m_color.emplace_back(kViolet - 3); // TIDDisk3_R30
260  m_color.emplace_back(kViolet); // TIDDisk3_R40
261 
262  m_color.emplace_back(kAzure); // TOBLayer0_Z0
263  m_color.emplace_back(kAzure + 8); // TOBLayer0_Z20
264  m_color.emplace_back(kAzure + 2); // TOBLayer0_Z70
265  m_color.emplace_back(kAzure + 4); // TOBLayer0_Z80
266  m_color.emplace_back(kCyan + 1); // TOBLayer1_Z0
267  m_color.emplace_back(kCyan - 9); // TOBLayer1_Z20
268  m_color.emplace_back(kCyan + 3); // TOBLayer1_Z80
269  m_color.emplace_back(kCyan + 4); // TOBLayer1_Z90
270  m_color.emplace_back(kAzure); // TOBLayer2_Z0
271  m_color.emplace_back(kAzure + 8); // TOBLayer2_Z25
272  m_color.emplace_back(kAzure + 2); // TOBLayer2_Z80
273  m_color.emplace_back(kAzure + 5); // TOBLayer2_Z90
274  m_color.emplace_back(kCyan + 1); // TOBLayer3_Z0
275  m_color.emplace_back(kCyan - 9); // TOBLayer3_Z25
276  m_color.emplace_back(kCyan + 3); // TOBLayer3_Z80
277  m_color.emplace_back(kCyan + 4); // TOBLayer3_Z90
278  m_color.emplace_back(kAzure); // TOBLayer4_Z0
279  m_color.emplace_back(kAzure + 8); // TOBLayer4_Z25
280  m_color.emplace_back(kAzure + 2); // TOBLayer4_Z80
281  m_color.emplace_back(kAzure + 5); // TOBLayer4_Z90
282  m_color.emplace_back(kCyan + 1); // TOBLayer5_Z0
283  m_color.emplace_back(kCyan - 9); // TOBLayer5_Z25
284  m_color.emplace_back(kCyan + 3); // TOBLayer5_Z80
285  m_color.emplace_back(kCyan + 4); // TOBLayer5_Z90
286 }
std::vector< unsigned int > m_color

◆ fillGradient()

void DD4hep_ListGroups::fillGradient ( )
private

Definition at line 288 of file DD4hep_ListGroups.cc.

References b1, b2, hitfit::delta_r(), diffTwoXMLs::g1, diffTwoXMLs::g2, mps_fire::i, cuy::ii, m_gradient, diffTwoXMLs::r1, diffTwoXMLs::r2, and customisers::steps.

Referenced by DD4hep_ListGroups().

288  {
289  m_gradient.reserve(200);
290  unsigned int steps = 100;
291  // if no index was given, find the highest used one and start from that plus one
292  unsigned int index = ((TObjArray *)gROOT->GetListOfColors())->GetLast() + 1;
293 
294  float r1, g1, b1, r2, g2, b2;
295  static_cast<TColor *>(gROOT->GetListOfColors()->At(kBlue + 1))->GetRGB(r1, g1, b1);
296  static_cast<TColor *>(gROOT->GetListOfColors()->At(kAzure + 10))->GetRGB(r2, g2, b2);
297  float delta_r = (r2 - r1) / (steps - 1);
298  float delta_g = (g2 - g1) / (steps - 1);
299  float delta_b = (b2 - b1) / (steps - 1);
300 
301  m_gradient.emplace_back(kBlue + 4); // Underflow lowest bin
302  unsigned int ii = 0;
303  for (unsigned int i = 0; i < steps; ++i, ++ii) {
304  new TColor(static_cast<Int_t>(index + ii), r1 + delta_r * i, g1 + delta_g * i, b1 + delta_b * i);
305  m_gradient.emplace_back(index + ii);
306  }
307 
308  m_gradient.emplace_back(kWhite); // 0 level perfectly white
309 
310  static_cast<TColor *>(gROOT->GetListOfColors()->At(kOrange))->GetRGB(r1, g1, b1);
311  static_cast<TColor *>(gROOT->GetListOfColors()->At(kOrange + 7))->GetRGB(r2, g2, b2);
312  delta_r = (r2 - r1) / (steps - 1);
313  delta_g = (g2 - g1) / (steps - 1);
314  delta_b = (b2 - b1) / (steps - 1);
315  for (unsigned int i = 0; i < steps; ++i, ++ii) {
316  new TColor(static_cast<Int_t>(index + ii), r1 + delta_r * i, g1 + delta_g * i, b1 + delta_b * i);
317  m_gradient.emplace_back(index + ii);
318  }
319  m_gradient.emplace_back(kRed); // Overflow highest bin
320 }
std::vector< int > m_gradient
double delta_r(const Fourvec &a, const Fourvec &b)
Find the distance between two four-vectors in the two-dimensional space .
Definition: fourvec.cc:238
ii
Definition: cuy.py:589
bias2_t b2[25]
Definition: b2.h:9
static constexpr float b1

◆ fillMaterialDifferences()

void DD4hep_ListGroups::fillMaterialDifferences ( )
inlineprivate

Definition at line 6 of file DD4hep_ListGroupsMaterialDifference.h.

Referenced by DD4hep_ListGroups().

6 {}

◆ overlayEtaReferences()

std::vector< std::pair< std::shared_ptr< TLine >, std::shared_ptr< TText > > > DD4hep_ListGroups::overlayEtaReferences ( )
private

Definition at line 322 of file DD4hep_ListGroups.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, l1tTrackerHTMiss_cfi::deltaZ, PVValHelper::eta, JetChargeProducer_cfi::exp, groupFilesInBlocks::lines, funct::tan(), and theta().

Referenced by produceAndSaveSummaryPlot().

322  {
323  std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText>>> lines;
324 
325  lines.reserve(40);
326  std::pair<float, float> deltaZ(293, 298);
327  std::pair<float, float> deltaR(115, 118);
328  float text_size = 0.033;
329 
330  for (float eta = 0.; eta <= 3.8; eta += 0.2) {
331  float theta = 2. * atan(exp(-eta));
332  if (eta >= 1.8) {
333  lines.emplace_back(
334  std::make_shared<TLine>(deltaZ.first, deltaZ.first * tan(theta), deltaZ.second, deltaZ.second * tan(theta)),
335  std::make_shared<TText>(deltaZ.first, deltaZ.first * tan(theta), fmt::sprintf("%2.1f", eta).c_str()));
336  lines.back().second->SetTextFont(42);
337  lines.back().second->SetTextSize(text_size);
338  lines.back().second->SetTextAlign(33);
339  lines.emplace_back(
340  std::make_shared<TLine>(-deltaZ.first, deltaZ.first * tan(theta), -deltaZ.second, deltaZ.second * tan(theta)),
341  std::make_shared<TText>(-deltaZ.first, deltaZ.first * tan(theta), fmt::sprintf("-%2.1f", eta).c_str()));
342  lines.back().second->SetTextFont(42);
343  lines.back().second->SetTextSize(text_size);
344  lines.back().second->SetTextAlign(13);
345  } else {
346  lines.emplace_back(
347  std::make_shared<TLine>(deltaR.first / tan(theta), deltaR.first, deltaR.second / tan(theta), deltaR.second),
348  std::make_shared<TText>(deltaR.first / tan(theta), deltaR.first, fmt::sprintf("%2.1f", eta).c_str()));
349  lines.back().second->SetTextFont(42);
350  lines.back().second->SetTextSize(text_size);
351  lines.back().second->SetTextAlign(23);
352  if (eta != 0) {
353  lines.emplace_back(
354  std::make_shared<TLine>(
355  -deltaR.first / tan(theta), deltaR.first, -deltaR.second / tan(theta), deltaR.second),
356  std::make_shared<TText>(-deltaR.first / tan(theta), deltaR.first, fmt::sprintf("-%2.1f", eta).c_str()));
357  lines.back().second->SetTextFont(42);
358  lines.back().second->SetTextSize(text_size);
359  lines.back().second->SetTextAlign(23);
360  }
361  }
362  }
363  return lines;
364 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Geom::Theta< T > theta() const

◆ produceAndSaveSummaryPlot()

void DD4hep_ListGroups::produceAndSaveSummaryPlot ( const cms::DDCompactView cpv)
private

Definition at line 80 of file DD4hep_ListGroups.cc.

References svgfig::canvas(), g, createfilelist::int, mps_splice::line, groupFilesInBlocks::lines, m_color, m_diff, m_gradient, m_group_names, m_groups, m_plots, m_values, dqmiodumpmetadata::n, overlayEtaReferences(), and pfClustersFromCombinedCaloHF_cfi::scale.

Referenced by analyze().

80  {
81  const double scale = 10.;
82 
83  static int markerStyles[10] = {kFullCircle,
84  kFullSquare,
85  kFullTriangleUp,
86  kFullTriangleDown,
87  kOpenCircle,
88  kOpenSquare,
89  kOpenTriangleUp,
90  kOpenDiamond,
91  kOpenCross,
92  kFullStar};
93 
94  for (auto n : m_group_names) {
95  m_groups.emplace_back(new DD4hep_MaterialAccountingGroup(n.data(), cpv));
96  }
97 
98  auto canvas = std::make_unique<TCanvas>(
99  "Grouping_rz", "Grouping - RZ view", (int)(600 * scale * 1.25), (int)(120 * scale * 1.50));
100  canvas->GetFrame()->SetFillColor(kWhite);
101  gStyle->SetOptStat(0);
102 
103  unsigned int color_index = 1;
104 
105  auto leg = std::make_unique<TLegend>(0.1, 0.1, 0.23, 0.34);
106  leg->SetHeader("Tracker Material Grouping");
107  leg->SetTextFont(42);
108  leg->SetTextSize(0.008);
109  leg->SetNColumns(3);
110  auto radlen = std::make_unique<TProfile2D>("OverallRadLen", "OverallRadLen", 600., -300., 300, 120., 0., 120.);
111  auto eneloss =
112  std::make_unique<TProfile2D>("OverallEnergyLoss", "OverallEnergyLoss", 600., -300., 300, 120., 0., 120.);
113  auto radlen_diff = std::make_unique<TProfile2D>(
114  "OverallDifferencesRadLen", "OverallDifferencesRadLen", 600., -300., 300, 120., 0., 120.);
115  auto eneloss_diff = std::make_unique<TProfile2D>(
116  "OverallDifferencesEnergyLoss", "OverallDifferencesEnergyLoss", 600., -300., 300, 120., 0., 120.);
117 
118  for (auto g : m_groups) {
119  m_plots.push_back(
120  new TH2F(g->name().c_str(), g->name().c_str(), 6000., -300., 300, 1200., 0., 120.)); // 10x10 points per cm2
121  TH2F &current = *m_plots.back();
122  current.SetMarkerColor(m_color[color_index]);
123  current.SetMarkerStyle(markerStyles[color_index % 10]);
124  current.SetMarkerSize(0.8);
125  current.SetLineWidth(1);
126  for (const auto &element : g->elements()) {
127  current.Fill(element.z(), element.perp());
128  radlen->Fill(element.z(), element.perp(), m_values[g->name()].first);
129  eneloss->Fill(element.z(), element.perp(), m_values[g->name()].second);
130  radlen_diff->Fill(element.z(), element.perp(), m_diff[g->name()].first);
131  eneloss_diff->Fill(element.z(), element.perp(), m_diff[g->name()].second);
132  }
133 
134  if (color_index == 1)
135  current.Draw();
136  else
137  current.Draw("SAME");
138 
139  leg->AddEntry(&current, g->name().c_str(), "lp")->SetTextColor(m_color[color_index]);
140  color_index++;
141 
142  color_index = color_index % m_color.size();
143  }
144  leg->Draw();
145  canvas->SaveAs("Grouping.png");
146 
147  std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText>>> lines = overlayEtaReferences();
148 
149  canvas->Clear();
150  radlen->SetMinimum(0);
151  radlen->SetMaximum(0.25);
152  radlen->Draw("COLZ");
153  for (const auto &line : lines) {
154  line.first->SetLineWidth(5);
155  line.first->Draw();
156  line.second->Draw();
157  }
158  canvas->SaveAs("RadLenValues.png");
159 
160  canvas->Clear();
161  eneloss->SetMinimum(0.00001);
162  eneloss->SetMaximum(0.0005);
163  eneloss->Draw("COLZ");
164  for (const auto &line : lines) {
165  line.first->SetLineWidth(5);
166  line.first->Draw();
167  line.second->Draw();
168  }
169  canvas->SaveAs("EnergyLossValues.png");
170 
171  canvas->Clear();
172  gStyle->SetPalette(m_gradient.size(), &m_gradient.front());
173  gStyle->SetNumberContours(m_gradient.size());
174  radlen_diff->SetMinimum(-100);
175  radlen_diff->SetMaximum(100);
176  radlen_diff->Draw("COLZ");
177  for (const auto &line : lines) {
178  line.first->SetLineWidth(5);
179  line.first->Draw();
180  line.second->Draw();
181  }
182  canvas->SaveAs("RadLenChanges.png");
183 
184  canvas->Clear();
185  eneloss_diff->SetMinimum(-100);
186  eneloss_diff->SetMaximum(100);
187  eneloss_diff->Draw("COLZ");
188  for (const auto &line : lines) {
189  line.first->SetLineWidth(5);
190  line.first->Draw();
191  line.second->Draw();
192  }
193  canvas->SaveAs("EnergyLossChanges.png");
194 }
std::vector< unsigned int > m_color
std::vector< int > m_gradient
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
Definition: Activities.doc:4
std::map< std::string, std::pair< float, float > > m_diff
std::vector< TH2F * > m_plots
std::map< std::string, std::pair< float, float > > m_values
std::set< std::string_view > m_group_names
std::vector< DD4hep_MaterialAccountingGroup * > m_groups
def canvas(sub, attr)
Definition: svgfig.py:482
std::vector< std::pair< std::shared_ptr< TLine >, std::shared_ptr< TText > > > overlayEtaReferences()

Member Data Documentation

◆ ddToken_

const edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> DD4hep_ListGroups::ddToken_
private

Definition at line 48 of file DD4hep_ListGroups.cc.

Referenced by analyze().

◆ m_color

std::vector<unsigned int> DD4hep_ListGroups::m_color
private

Definition at line 52 of file DD4hep_ListGroups.cc.

Referenced by fillColor(), and produceAndSaveSummaryPlot().

◆ m_diff

std::map<std::string, std::pair<float, float> > DD4hep_ListGroups::m_diff
private

Definition at line 60 of file DD4hep_ListGroups.cc.

Referenced by produceAndSaveSummaryPlot().

◆ m_gradient

std::vector<int> DD4hep_ListGroups::m_gradient
private

Definition at line 53 of file DD4hep_ListGroups.cc.

Referenced by fillGradient(), and produceAndSaveSummaryPlot().

◆ m_group_names

std::set<std::string_view> DD4hep_ListGroups::m_group_names
private

Definition at line 51 of file DD4hep_ListGroups.cc.

Referenced by analyze(), and produceAndSaveSummaryPlot().

◆ m_groups

std::vector<DD4hep_MaterialAccountingGroup *> DD4hep_ListGroups::m_groups
private

Definition at line 54 of file DD4hep_ListGroups.cc.

Referenced by DD4hep_ListGroups(), and produceAndSaveSummaryPlot().

◆ m_plots

std::vector<TH2F *> DD4hep_ListGroups::m_plots
private

Definition at line 50 of file DD4hep_ListGroups.cc.

Referenced by DD4hep_ListGroups(), and produceAndSaveSummaryPlot().

◆ m_saveSummaryPlot

const bool DD4hep_ListGroups::m_saveSummaryPlot
private

Definition at line 47 of file DD4hep_ListGroups.cc.

Referenced by analyze().

◆ m_tag

const edm::ESInputTag DD4hep_ListGroups::m_tag
private

Definition at line 46 of file DD4hep_ListGroups.cc.

◆ m_values

std::map<std::string, std::pair<float, float> > DD4hep_ListGroups::m_values
private

Definition at line 61 of file DD4hep_ListGroups.cc.

Referenced by produceAndSaveSummaryPlot().