CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ddstats.cc
Go to the documentation of this file.
7 void ddstats(std::ostream & os)
8 {
9 
10  os << "DDD in memory stats:" << std::endl
11  << "====================" << std::endl << std::endl;
12  DDCompactView cpv;
13 
14  // What we will count:
15  // ----------------------
16 
17  int noEdges(0); // number of graph-multi-edges
18  int noNodes(0); // number of graph-nodes
19  int noExpNodes(1); // number of expanded-nodes
20 
21  // number of Logical- and PosParts, Solids, Materials
22  int noLog(0), noPos(0), noSol(0), noMat(0), noRot(0);
23  noPos = noEdges;
24 
25  // accumulative number of name-characters (logparts,solids,rotation,materials)
26  int noCLog(0), noCSol(0), noCMat(0), noCRot(0);
27 
28  int noSolidP(0); // accumulative number of solid-parameters
29 
30  // fetch the acyclic multigraph
31  const DDCompactView::graph_type & g = cpv.graph();
32 
33  DDExpandedView exv(cpv);
34  while (exv.next()) ++noExpNodes;
35 
36  // iterate over the adjacency-list
38  for(; it != g.end(); ++it) {
39  ++noNodes;
40  noEdges += it->size();
41  }
42 
43  typedef DDLogicalPart::StoreT::value_type lpst_type;
44  lpst_type & lpst = DDLogicalPart::StoreT::instance();
45  lpst_type::iterator lpstit = lpst.begin();
46  for(; lpstit != lpst.end(); ++lpstit) {
47  noCLog += lpstit->first.name().size();
48  ++noLog;
49  }
50 
51  typedef DDMaterial::StoreT::value_type mast_type;
52  mast_type & mast = DDMaterial::StoreT::instance();
53  mast_type::iterator mastit = mast.begin();
54  for(; mastit != mast.end(); ++mastit) {
55  noCMat += mastit->first.name().size();
56  ++noMat;
57  }
58 
59  typedef DDSolid::StoreT::value_type sost_type;
60  sost_type & sost = DDSolid::StoreT::instance();
61  sost_type::iterator sostit = sost.begin();
62  for(; sostit != sost.end(); ++sostit) {
63  noCSol += sostit->first.name().size();
64  DDSolid s(sostit->first);
65  noSolidP += s.parameters().size();
66  ++noSol;
67  }
68 
69  typedef DDRotation::StoreT::value_type rost_type;
70  rost_type & rost = DDRotation::StoreT::instance();
71  rost_type::iterator rostit = rost.begin();
72  for(; rostit != rost.end(); ++rostit) {
73  noCRot += rostit->first.name().size();
74  ++noRot;
75  }
76 
77  // derived quantities
78  std::cout << "sizeof(void*)=" << sizeof(void*) << std::endl;
79  std::cout << "sizeof(DDLogicalPart)="<<sizeof(DDLogicalPart)<<std::endl;
80  std::cout << "sizeof(DDTranslation)="<< sizeof(DDTranslation)<<std::endl;
81  std::cout << "sizeof(DDRotationMatrix)=" << sizeof(DDRotationMatrix)<<std::endl;
82  int store = 4*sizeof(void*); // overhead for data-management (est.)
83  int byRot = noRot * (sizeof(DDRotationMatrix) + store); // bytes in rotations
84  int bySol = noSolidP * sizeof(double) + noSol*store; // bytes in solids
85  int byMat = noMat * (5*sizeof(double) + store); // bytes in materials
86  int byPos = noEdges * (sizeof(DDTranslation) + sizeof(DDRotation) + sizeof(int));
87  int byNam = noCLog + noCSol + noCMat + noCRot; // bytes in strings for names
88  int byLog = noLog * (sizeof(DDMaterial) + sizeof(DDSolid) + store); // LogicalPart
89  int byGra = (noEdges + noNodes)*store; // est. graph structure
90  int bytes = byRot + bySol + byMat + byPos + byNam + byLog + byGra;
91  bytes += noNodes*sizeof(DDLogicalPart) + noEdges*sizeof(DDPosData*);
92  double mb = 1024.*1024.;
93 
94  os << "noNodes=" << noNodes << std::endl
95  << "noEdges=" << noEdges << std::endl
96  << "noExNod=" << noExpNodes << std::endl << std::endl;
97  os << "noLog=" << noLog << std::endl
98  << "noSol=" << noSol << " noSolidP=" << noSolidP << std::endl
99  << "noMat=" << noMat << std::endl
100  << "noRot=" << noRot << std::endl << std::endl;
101  os << "noCLog=" << noCLog << std::endl
102  << "noCSol=" << noCSol << std::endl
103  << "noCMat=" << noCMat << std::endl
104  << "noCRot=" << noCRot << std::endl
105  << " --------" << std::endl
106  << " " << byNam
107  << " chars used for naming." << std::endl << std::endl;
108  os << "byLog = " << byLog/mb << " logicalparts " << std::endl
109  << "byNam = " << byNam/mb << " string for names " << std::endl
110  << "byRot = " << byRot/mb << " rotations " << std::endl
111  << "bySol = " << bySol/mb << " solids " << std::endl
112  << "byMat = " << byMat/mb << " materials " << std::endl
113  << "byPos = " << byPos/mb << " posparts " << std::endl
114  << "byGra = " << byGra/mb << " graph-struct " << std::endl
115  << "-----------------------" << std::endl
116  << "OVERALL: " << bytes / mb << " MByte" << std::endl;
117 
118 }
const std::vector< double > & parameters() const
Don&#39;t use (only meant to be used by DDbox(), DDtub(), ...)
Definition: DDSolid.cc:153
bool next()
set current node to the next node in the expanded tree
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:16
void ddstats(std::ostream &os)
Definition: ddstats.cc:7
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
type of data representation of DDCompactView
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:42
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
adj_list::const_iterator const_adj_iterator
Definition: adjgraph.h:126
tuple cout
Definition: gather_cfg.py:41
string s
Definition: asciidump.py:422
adj_iterator begin()
Definition: adjgraph.h:198
Provides an exploded view of the detector (tree-view)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
adj_iterator end()
Definition: adjgraph.h:200