CMS 3D CMS Logo

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

Public Member Functions

 ListGroups (const edm::ParameterSet &)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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 edm::EventSetup &)
 

Private Attributes

const edm::ESGetToken< 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 > m_group_names
 
std::vector< MaterialAccountingGroup * > m_groups
 
std::vector< TH2F * > m_plots
 
const bool m_saveSummaryPlot
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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 76 of file ListGroups.cc.

Constructor & Destructor Documentation

◆ ListGroups()

ListGroups::ListGroups ( const edm::ParameterSet iPSet)

Definition at line 112 of file ListGroups.cc.

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

113  : m_saveSummaryPlot(iPSet.getUntrackedParameter<bool>("SaveSummaryPlot")),
114  ddToken_(esConsumes<DDCompactView, IdealGeometryRecord>()) {
115  m_plots.clear();
116  m_groups.clear();
117  TColor::InitializeColors();
118  fillColor();
120  fillGradient();
121 }
void fillColor()
Definition: ListGroups.cc:168
std::vector< TH2F * > m_plots
Definition: ListGroups.cc:93
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
Definition: ListGroups.cc:92
const bool m_saveSummaryPlot
Definition: ListGroups.cc:91
void fillGradient()
Definition: ListGroups.cc:134
std::vector< MaterialAccountingGroup * > m_groups
Definition: ListGroups.cc:95

◆ ~ListGroups()

ListGroups::~ListGroups ( )
override

Definition at line 123 of file ListGroups.cc.

References g, m_groups, m_plots, and plotFactory::plot.

123  {
124  for (auto plot : m_plots)
125  delete plot;
126 
127  if (!m_groups.empty())
128  for (auto g : m_groups)
129  delete g;
130 }
std::vector< TH2F * > m_plots
Definition: ListGroups.cc:93
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::vector< MaterialAccountingGroup * > m_groups
Definition: ListGroups.cc:95

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 428 of file ListGroups.cc.

References gather_cfg::cout, dddGetString(), ddToken_, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::geoHistory(), h, m_group_names, m_saveSummaryPlot, DDFilteredView::next(), position, produceAndSaveSummaryPlot(), singleTopDQM_cfi::setup, and DDFilteredView::translation().

428  {
429  edm::ESTransientHandle<DDCompactView> hDdd = setup.getTransientHandle(ddToken_);
430 
431  DDSpecificsHasNamedValueFilter filter{"TrackingMaterialGroup"};
432  DDFilteredView fv(*hDdd, filter);
433 
434  while (fv.next()) {
435  // print the group name and full hierarchy of all items
436  std::cout << dddGetString("TrackingMaterialGroup", fv) << '\t';
437  m_group_names.insert(dddGetString("TrackingMaterialGroup", fv));
438 
439  // start from 2 to skip the leading /OCMS[0]/CMSE[1] part
440  const DDGeoHistory &history = fv.geoHistory();
441  std::cout << '/';
442  for (unsigned int h = 2; h < history.size(); ++h)
443  std::cout << '/' << history[h].logicalPart().name().name() << '[' << history[h].copyno() << ']';
444 
445  // DD3Vector and DDTranslation are the same type as math::XYZVector
446  math::XYZVector position = fv.translation() / 10.; // mm -> cm
447  std::cout << "\t(" << position.x() << ", " << position.y() << ", " << position.z() << ") "
448  << "[rho] " << position.Rho() << std::endl;
449  };
450  std::cout << std::endl;
451 
452  if (m_saveSummaryPlot)
454 }
void produceAndSaveSummaryPlot(const edm::EventSetup &)
Definition: ListGroups.cc:304
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
Definition: ListGroups.cc:92
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const bool m_saveSummaryPlot
Definition: ListGroups.cc:91
std::set< std::string > m_group_names
Definition: ListGroups.cc:94
static int position[264][3]
Definition: ReadPGInfo.cc:289
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static std::string dddGetString(const std::string &s, DDFilteredView const &view)
Definition: ListGroups.cc:68

◆ beginJob()

void ListGroups::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 83 of file ListGroups.cc.

83 {}

◆ endJob()

void ListGroups::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 456 of file ListGroups.cc.

456 {}

◆ fillColor()

void ListGroups::fillColor ( void  )
private

Definition at line 168 of file ListGroups.cc.

References m_color.

Referenced by ListGroups().

168  {
169  // With the introduction of the support for PhaseI and PhaseII detectors it
170  // became quite difficult to maintain a list of colors that is in sync with
171  // the real number of grouping used in the different scenarios. We therefore
172  // define some reasonable set and loop over it in case the number of grouping
173  // is larger than the number of colors.
174 
175  m_color.push_back(kBlack); // unassigned
176 
177  m_color.push_back(kAzure); // PixelBarrelLayer0_Z0
178  m_color.push_back(kAzure - 1); // PixelBarrelLayer0_Z20
179  m_color.push_back(kAzure + 1); // Layer1_Z0
180  m_color.push_back(kAzure + 2); // Layer1_Z20
181 
182  m_color.push_back(kGreen); // EndCapDisk1_R0
183  m_color.push_back(kGreen + 2); // EndcapDisk1_R11
184  m_color.push_back(kGreen + 4); // EndcapDisk1_R7
185  m_color.push_back(kSpring + 9); // EndcapDisk2_R0
186  m_color.push_back(kSpring + 4); // EndcapDisk2_R7
187  m_color.push_back(kSpring); // EndcapDisk2_R7
188 
189  m_color.push_back(kRed); // TECDisk0_R20
190  m_color.push_back(kRed + 2); // TECDisk0_R40
191  m_color.push_back(kRed - 7); // TECDisk0_R50
192  m_color.push_back(kRed - 5); // TECDisk0_R60
193  m_color.push_back(kRed - 10); // TECDisk0_R90
194  m_color.push_back(kRed - 1); // TECDisk1_Inner
195  m_color.push_back(kRed - 2); // TECDisk1_Outer
196  m_color.push_back(kRed - 3); // TECDisk1_R20
197  m_color.push_back(kPink - 2); // TECDisk2_Inner
198  m_color.push_back(kPink - 3); // TECDisk2_Outer
199  m_color.push_back(kPink - 4); // TECDisk2_R20
200  m_color.push_back(kPink + 9); // TECDisk3_Inner
201  m_color.push_back(kPink + 8); // TECDisk3_Outer
202  m_color.push_back(kPink + 7); // TECDisk3
203  m_color.push_back(kMagenta - 2); // TECDisk4_Inner
204  m_color.push_back(kMagenta - 3); // TECDisk4_Outer
205  m_color.push_back(kMagenta - 4); // TECDisk4_R33
206  m_color.push_back(kMagenta - 5); // TECDisk5_Inner
207  m_color.push_back(kMagenta - 6); // TECDisk5_Outer
208  m_color.push_back(kMagenta - 7); // TECDisk5_R33
209  m_color.push_back(kRed); // TECDisk6
210  m_color.push_back(kMagenta - 9); // TECDisk7_R40
211  m_color.push_back(kViolet); // TECDisk8
212 
213  m_color.push_back(kOrange + 9); // TIBLayer0_Z0
214  m_color.push_back(kOrange + 7); // TIBLayer0_Z20
215  m_color.push_back(kOrange + 5); // TIBLayer0_Z40
216  m_color.push_back(kOrange - 2); // TIBLayer1_Z0
217  m_color.push_back(kOrange - 3); // TIBLayer1_Z30
218  m_color.push_back(kOrange - 6); // TIBLayer1_Z60
219  m_color.push_back(kOrange + 4); // TIBLayer2_Z0
220  m_color.push_back(kOrange - 7); // TIBLayer2_Z40
221  m_color.push_back(kOrange); // TIBLayer3_Z0
222  m_color.push_back(kOrange + 10); // TIBLayer3_Z50
223 
224  m_color.push_back(kViolet + 10); // TIDDisk1_R0
225  m_color.push_back(kViolet + 6); // TIDDisk1_R30
226  m_color.push_back(kViolet + 3); // TIDDisk1_R40
227  m_color.push_back(kViolet - 7); // TIDDisk2_R25
228  m_color.push_back(kViolet - 1); // TIDDisk2_R30
229  m_color.push_back(kViolet + 9); // TIDDisk2_R40
230  m_color.push_back(kViolet - 5); // TIDDisk3_R24
231  m_color.push_back(kViolet - 3); // TIDDisk3_R30
232  m_color.push_back(kViolet); // TIDDisk3_R40
233 
234  m_color.push_back(kAzure); // TOBLayer0_Z0
235  m_color.push_back(kAzure + 8); // TOBLayer0_Z20
236  m_color.push_back(kAzure + 2); // TOBLayer0_Z70
237  m_color.push_back(kAzure + 4); // TOBLayer0_Z80
238  m_color.push_back(kCyan + 1); // TOBLayer1_Z0
239  m_color.push_back(kCyan - 9); // TOBLayer1_Z20
240  m_color.push_back(kCyan + 3); // TOBLayer1_Z80
241  m_color.push_back(kCyan + 4); // TOBLayer1_Z90
242  m_color.push_back(kAzure); // TOBLayer2_Z0
243  m_color.push_back(kAzure + 8); // TOBLayer2_Z25
244  m_color.push_back(kAzure + 2); // TOBLayer2_Z80
245  m_color.push_back(kAzure + 5); // TOBLayer2_Z90
246  m_color.push_back(kCyan + 1); // TOBLayer3_Z0
247  m_color.push_back(kCyan - 9); // TOBLayer3_Z25
248  m_color.push_back(kCyan + 3); // TOBLayer3_Z80
249  m_color.push_back(kCyan + 4); // TOBLayer3_Z90
250  m_color.push_back(kAzure); // TOBLayer4_Z0
251  m_color.push_back(kAzure + 8); // TOBLayer4_Z25
252  m_color.push_back(kAzure + 2); // TOBLayer4_Z80
253  m_color.push_back(kAzure + 5); // TOBLayer4_Z90
254  m_color.push_back(kCyan + 1); // TOBLayer5_Z0
255  m_color.push_back(kCyan - 9); // TOBLayer5_Z25
256  m_color.push_back(kCyan + 3); // TOBLayer5_Z80
257  m_color.push_back(kCyan + 4); // TOBLayer5_Z90
258 }
std::vector< unsigned int > m_color
Definition: ListGroups.cc:96

◆ fillGradient()

void ListGroups::fillGradient ( void  )
private

Definition at line 134 of file 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 ListGroups().

134  {
135  m_gradient.reserve(200);
136  unsigned int steps = 100;
137  // if no index was given, find the highest used one and start from that plus one
138  unsigned int index = ((TObjArray *)gROOT->GetListOfColors())->GetLast() + 1;
139 
140  float r1, g1, b1, r2, g2, b2;
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);
143  float delta_r = (r2 - r1) / (steps - 1);
144  float delta_g = (g2 - g1) / (steps - 1);
145  float delta_b = (b2 - b1) / (steps - 1);
146 
147  m_gradient.push_back(kBlue + 4); // Underflow lowest bin
148  unsigned int ii = 0;
149  for (unsigned int i = 0; i < steps; ++i, ++ii) {
150  new TColor(static_cast<Int_t>(index + ii), r1 + delta_r * i, g1 + delta_g * i, b1 + delta_b * i);
151  m_gradient.push_back(index + ii);
152  }
153 
154  m_gradient.push_back(kWhite); // 0 level perfectly white
155 
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);
158  delta_r = (r2 - r1) / (steps - 1);
159  delta_g = (g2 - g1) / (steps - 1);
160  delta_b = (b2 - b1) / (steps - 1);
161  for (unsigned int i = 0; i < steps; ++i, ++ii) {
162  new TColor(static_cast<Int_t>(index + ii), r1 + delta_r * i, g1 + delta_g * i, b1 + delta_b * i);
163  m_gradient.push_back(index + ii);
164  }
165  m_gradient.push_back(kRed); // Overflow highest bin
166 }
weight_default_t b1[25]
Definition: b1.h:9
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
weight_default_t b2[10]
Definition: b2.h:9
ii
Definition: cuy.py:589
std::vector< int > m_gradient
Definition: ListGroups.cc:97

◆ fillMaterialDifferences()

void ListGroups::fillMaterialDifferences ( )
inlineprivate

Definition at line 6 of file ListGroupsMaterialDifference.h.

Referenced by ListGroups().

6 {}

◆ overlayEtaReferences()

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

Definition at line 260 of file ListGroups.cc.

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

Referenced by produceAndSaveSummaryPlot().

260  {
261  std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > > lines;
262 
263  lines.reserve(40);
264  std::pair<float, float> deltaZ(293, 298);
265  std::pair<float, float> deltaR(115, 118);
266  float text_size = 0.033;
267 
268  for (float eta = 0.; eta <= 3.8; eta += 0.2) {
269  float theta = 2. * atan(exp(-eta));
270  if (eta >= 1.8) {
271  lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
272  std::make_shared<TLine>(deltaZ.first, deltaZ.first * tan(theta), deltaZ.second, deltaZ.second * tan(theta)),
273  std::make_shared<TText>(deltaZ.first, deltaZ.first * tan(theta), fmt::sprintf("%2.1f", eta).c_str())));
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> >(
278  std::make_shared<TLine>(-deltaZ.first, deltaZ.first * tan(theta), -deltaZ.second, deltaZ.second * tan(theta)),
279  std::make_shared<TText>(-deltaZ.first, deltaZ.first * tan(theta), fmt::sprintf("-%2.1f", eta).c_str())));
280  lines.back().second->SetTextFont(42);
281  lines.back().second->SetTextSize(text_size);
282  lines.back().second->SetTextAlign(13);
283  } else {
284  lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
285  std::make_shared<TLine>(deltaR.first / tan(theta), deltaR.first, deltaR.second / tan(theta), deltaR.second),
286  std::make_shared<TText>(deltaR.first / tan(theta), deltaR.first, fmt::sprintf("%2.1f", eta).c_str())));
287  lines.back().second->SetTextFont(42);
288  lines.back().second->SetTextSize(text_size);
289  lines.back().second->SetTextAlign(23);
290  if (eta != 0) {
291  lines.push_back(std::make_pair<std::shared_ptr<TLine>, std::shared_ptr<TText> >(
292  std::make_shared<TLine>(
293  -deltaR.first / tan(theta), deltaR.first, -deltaR.second / tan(theta), deltaR.second),
294  std::make_shared<TText>(-deltaR.first / tan(theta), deltaR.first, fmt::sprintf("-%2.1f", eta).c_str())));
295  lines.back().second->SetTextFont(42);
296  lines.back().second->SetTextSize(text_size);
297  lines.back().second->SetTextAlign(23);
298  }
299  }
300  }
301  return lines;
302 }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Geom::Theta< T > theta() const

◆ produceAndSaveSummaryPlot()

void ListGroups::produceAndSaveSummaryPlot ( const edm::EventSetup setup)
private

Definition at line 304 of file ListGroups.cc.

References svgfig::canvas(), ddToken_, g, mps_splice::line, groupFilesInBlocks::lines, m_color, m_diff, m_gradient, m_group_names, m_groups, m_plots, m_values, dqmiodumpmetadata::n, overlayEtaReferences(), L1EGammaClusterEmuProducer_cfi::scale, and singleTopDQM_cfi::setup.

Referenced by analyze().

304  {
305  const double scale = 10.;
306  std::vector<TText *> nukem_text;
307  static int markerStyles[10] = {kFullCircle,
308  kFullSquare,
309  kFullTriangleUp,
310  kFullTriangleDown,
311  kOpenCircle,
312  kOpenSquare,
313  kOpenTriangleUp,
314  kOpenDiamond,
315  kOpenCross,
316  kFullStar};
317 
318  edm::ESTransientHandle<DDCompactView> hDdd = setup.getTransientHandle(ddToken_);
319 
320  for (const auto &n : m_group_names) {
321  m_groups.push_back(new MaterialAccountingGroup(n, *hDdd));
322  };
323 
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);
328 
329  unsigned int color_index = 1;
330  // Setup the legend
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);
335  leg->SetNColumns(3);
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.));
344 
345  for (auto g : m_groups) {
346  m_plots.push_back(
347  new TH2F(g->name().c_str(), g->name().c_str(), 6000., -300., 300, 1200., 0., 120.)); // 10x10 points per cm2
348  TH2F &current = *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);
359  }
360 
361  if (color_index == 1)
362  current.Draw();
363  else
364  current.Draw("SAME");
365 
366  leg->AddEntry(&current, g->name().c_str(), "lp")->SetTextColor(m_color[color_index]);
367  color_index++;
368 
369  // Loop over the same chromatic scale in case the number of
370  // allocated colors is not big enough.
371  color_index = color_index % m_color.size();
372  }
373  leg->Draw();
374  canvas->SaveAs("Grouping.png");
375 
376  std::vector<std::pair<std::shared_ptr<TLine>, std::shared_ptr<TText> > > lines = overlayEtaReferences();
377 
378  canvas->Clear();
379  radlen->SetMinimum(0);
380  radlen->SetMaximum(0.25);
381  radlen->Draw("COLZ");
382  for (const auto &line : lines) {
383  line.first->SetLineWidth(5);
384  line.first->Draw();
385  line.second->Draw();
386  }
387  canvas->SaveAs("RadLenValues.png");
388 
389  canvas->Clear();
390  eneloss->SetMinimum(0.00001);
391  eneloss->SetMaximum(0.0005);
392  eneloss->Draw("COLZ");
393  for (const auto &line : lines) {
394  line.first->SetLineWidth(5);
395  line.first->Draw();
396  line.second->Draw();
397  }
398  canvas->SaveAs("EnergyLossValues.png");
399 
400  canvas->Clear();
401  gStyle->SetPalette(m_gradient.size(), &m_gradient.front());
402  gStyle->SetNumberContours(m_gradient.size());
403  radlen_diff->SetMinimum(-100);
404  radlen_diff->SetMaximum(100);
405  radlen_diff->Draw("COLZ");
406  for (const auto &line : lines) {
407  line.first->SetLineWidth(5);
408  line.first->Draw();
409  line.second->Draw();
410  }
411  canvas->SaveAs("RadLenChanges.png");
412 
413  canvas->Clear();
414  eneloss_diff->SetMinimum(-100);
415  eneloss_diff->SetMaximum(100);
416  eneloss_diff->Draw("COLZ");
417  for (const auto &line : lines) {
418  line.first->SetLineWidth(5);
419  line.first->Draw();
420  line.second->Draw();
421  }
422  canvas->SaveAs("EnergyLossChanges.png");
423 
424  for (auto g : nukem_text)
425  delete g;
426 }
std::vector< TH2F * > m_plots
Definition: ListGroups.cc:93
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::vector< std::pair< std::shared_ptr< TLine >, std::shared_ptr< TText > > > overlayEtaReferences()
Definition: ListGroups.cc:260
std::vector< unsigned int > m_color
Definition: ListGroups.cc:96
std::map< std::string, std::pair< float, float > > m_diff
Definition: ListGroups.cc:108
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
Definition: ListGroups.cc:92
std::set< std::string > m_group_names
Definition: ListGroups.cc:94
std::vector< MaterialAccountingGroup * > m_groups
Definition: ListGroups.cc:95
def canvas(sub, attr)
Definition: svgfig.py:482
std::vector< int > m_gradient
Definition: ListGroups.cc:97
std::map< std::string, std::pair< float, float > > m_values
Definition: ListGroups.cc:109

Member Data Documentation

◆ ddToken_

const edm::ESGetToken<DDCompactView, IdealGeometryRecord> ListGroups::ddToken_
private

Definition at line 92 of file ListGroups.cc.

Referenced by analyze(), and produceAndSaveSummaryPlot().

◆ m_color

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

Definition at line 96 of file ListGroups.cc.

Referenced by fillColor(), and produceAndSaveSummaryPlot().

◆ m_diff

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

Definition at line 108 of file ListGroups.cc.

Referenced by produceAndSaveSummaryPlot().

◆ m_gradient

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

Definition at line 97 of file ListGroups.cc.

Referenced by fillGradient(), and produceAndSaveSummaryPlot().

◆ m_group_names

std::set<std::string> ListGroups::m_group_names
private

Definition at line 94 of file ListGroups.cc.

Referenced by analyze(), and produceAndSaveSummaryPlot().

◆ m_groups

std::vector<MaterialAccountingGroup *> ListGroups::m_groups
private

Definition at line 95 of file ListGroups.cc.

Referenced by ListGroups(), produceAndSaveSummaryPlot(), and ~ListGroups().

◆ m_plots

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

Definition at line 93 of file ListGroups.cc.

Referenced by ListGroups(), produceAndSaveSummaryPlot(), and ~ListGroups().

◆ m_saveSummaryPlot

const bool ListGroups::m_saveSummaryPlot
private

Definition at line 91 of file ListGroups.cc.

Referenced by analyze().

◆ m_values

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

Definition at line 109 of file ListGroups.cc.

Referenced by produceAndSaveSummaryPlot().