CMS 3D CMS Logo

Functions
ddstats.cc File Reference
#include "DetectorDescription/Core/interface/DDRotationMatrix.h"
#include "DetectorDescription/Core/interface/DDTranslation.h"
#include "DetectorDescription/Core/interface/Store.h"
#include "DetectorDescription/Core/interface/DDBase.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/Core/interface/DDExpandedView.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDName.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDTransform.h"
#include "DetectorDescription/RegressionTest/src/ddstats.h"
#include "DataFormats/Math/interface/Graph.h"
#include <map>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

void ddstats (std::ostream &os)
 

Function Documentation

◆ ddstats()

void ddstats ( std::ostream &  os)

Definition at line 22 of file ddstats.cc.

References gather_cfg::cout, g, DDCompactView::graph(), DDI::Singleton< I >::instance(), createfilelist::int, DDExpandedView::next(), and alignCSCRings::s.

22  {
23  os << "DDD in memory stats:" << std::endl << "====================" << std::endl << std::endl;
24  DDCompactView cpv;
25 
26  // What we will count:
27  // ----------------------
28 
29  int noEdges(0); // number of graph-multi-edges
30  int noNodes(0); // number of graph-nodes
31  int noExpNodes(1); // number of expanded-nodes
32 
33  // number of Logical- and PosParts, Solids, Materials
34  int noLog(0), noSol(0), noMat(0), noRot(0);
35 
36  // accumulative number of name-characters (logparts,solids,rotation,materials)
37  int noCLog(0), noCSol(0), noCMat(0), noCRot(0);
38 
39  int noSolidP(0); // accumulative number of solid-parameters
40 
41  // fetch the acyclic multigraph
42  const auto& g = cpv.graph();
43 
44  DDExpandedView exv(cpv);
45  while (exv.next())
46  ++noExpNodes;
47 
48  // iterate over the adjacency-list
49  auto it = g.begin();
50  for (; it != g.end(); ++it) {
51  ++noNodes;
52  noEdges += it->size();
53  }
54 
55  typedef DDLogicalPart::StoreT::value_type lpst_type;
56  lpst_type& lpst = DDLogicalPart::StoreT::instance();
57  lpst_type::iterator lpstit = lpst.begin();
58  for (; lpstit != lpst.end(); ++lpstit) {
59  noCLog += lpstit->first.name().size();
60  ++noLog;
61  }
62 
63  typedef DDMaterial::StoreT::value_type mast_type;
64  mast_type& mast = DDMaterial::StoreT::instance();
65  mast_type::iterator mastit = mast.begin();
66  for (; mastit != mast.end(); ++mastit) {
67  noCMat += mastit->first.name().size();
68  ++noMat;
69  }
70 
71  typedef DDSolid::StoreT::value_type sost_type;
72  sost_type& sost = DDSolid::StoreT::instance();
73  sost_type::iterator sostit = sost.begin();
74  for (; sostit != sost.end(); ++sostit) {
75  noCSol += sostit->first.name().size();
76  DDSolid s(sostit->first);
77  noSolidP += s.parameters().size();
78  ++noSol;
79  }
80 
81  typedef DDRotation::StoreT::value_type rost_type;
82  rost_type& rost = DDRotation::StoreT::instance();
83  rost_type::iterator rostit = rost.begin();
84  for (; rostit != rost.end(); ++rostit) {
85  noCRot += rostit->first.name().size();
86  ++noRot;
87  }
88 
89  // derived quantities
90  std::cout << "sizeof(void*)=" << sizeof(void*) << std::endl;
91  std::cout << "sizeof(DDLogicalPart)=" << sizeof(DDLogicalPart) << std::endl;
92  std::cout << "sizeof(DDTranslation)=" << sizeof(DDTranslation) << std::endl;
93  std::cout << "sizeof(DDRotationMatrix)=" << sizeof(DDRotationMatrix) << std::endl;
94  int store = 4 * sizeof(void*); // overhead for data-management (est.)
95  int byRot = noRot * (sizeof(DDRotationMatrix) + store); // bytes in rotations
96  int bySol = noSolidP * sizeof(double) + noSol * store; // bytes in solids
97  int byMat = noMat * (5 * sizeof(double) + store); // bytes in materials
98  int byPos = noEdges * (sizeof(DDTranslation) + sizeof(DDRotation) + sizeof(int));
99  int byNam = noCLog + noCSol + noCMat + noCRot; // bytes in strings for names
100  int byLog = noLog * (sizeof(DDMaterial) + sizeof(DDSolid) + store); // LogicalPart
101  int byGra = (noEdges + noNodes) * store; // est. graph structure
102  int bytes = byRot + bySol + byMat + byPos + byNam + byLog + byGra;
103  bytes += noNodes * sizeof(DDLogicalPart) + noEdges * sizeof(DDPosData*);
104  double mb = 1024. * 1024.;
105 
106  os << "noNodes=" << noNodes << std::endl
107  << "noEdges=" << noEdges << std::endl
108  << "noExNod=" << noExpNodes << std::endl
109  << std::endl;
110  os << "noLog=" << noLog << std::endl
111  << "noSol=" << noSol << " noSolidP=" << noSolidP << std::endl
112  << "noMat=" << noMat << std::endl
113  << "noRot=" << noRot << std::endl
114  << std::endl;
115  os << "noCLog=" << noCLog << std::endl
116  << "noCSol=" << noCSol << std::endl
117  << "noCMat=" << noCMat << std::endl
118  << "noCRot=" << noCRot << std::endl
119  << " --------" << std::endl
120  << " " << byNam << " chars used for naming." << std::endl
121  << std::endl;
122  os << "byLog = " << byLog / mb << " logicalparts " << std::endl
123  << "byNam = " << byNam / mb << " string for names " << std::endl
124  << "byRot = " << byRot / mb << " rotations " << std::endl
125  << "bySol = " << bySol / mb << " solids " << std::endl
126  << "byMat = " << byMat / mb << " materials " << std::endl
127  << "byPos = " << byPos / mb << " posparts " << std::endl
128  << "byGra = " << byGra / mb << " graph-struct " << std::endl
129  << "-----------------------" << std::endl
130  << "OVERALL: " << bytes / mb << " MByte" << std::endl;
131 }
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
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
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
static value_type & instance()
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.
Provides an exploded view of the detector (tree-view)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7