test
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), noSol(0), noMat(0), noRot(0);
23 
24  // accumulative number of name-characters (logparts,solids,rotation,materials)
25  int noCLog(0), noCSol(0), noCMat(0), noCRot(0);
26 
27  int noSolidP(0); // accumulative number of solid-parameters
28 
29  // fetch the acyclic multigraph
30  const DDCompactView::graph_type & g = cpv.graph();
31 
32  DDExpandedView exv(cpv);
33  while (exv.next()) ++noExpNodes;
34 
35  // iterate over the adjacency-list
37  for(; it != g.end(); ++it) {
38  ++noNodes;
39  noEdges += it->size();
40  }
41 
42  typedef DDLogicalPart::StoreT::value_type lpst_type;
43  lpst_type & lpst = DDLogicalPart::StoreT::instance();
44  lpst_type::iterator lpstit = lpst.begin();
45  for(; lpstit != lpst.end(); ++lpstit) {
46  noCLog += lpstit->first.name().size();
47  ++noLog;
48  }
49 
50  typedef DDMaterial::StoreT::value_type mast_type;
51  mast_type & mast = DDMaterial::StoreT::instance();
52  mast_type::iterator mastit = mast.begin();
53  for(; mastit != mast.end(); ++mastit) {
54  noCMat += mastit->first.name().size();
55  ++noMat;
56  }
57 
58  typedef DDSolid::StoreT::value_type sost_type;
59  sost_type & sost = DDSolid::StoreT::instance();
60  sost_type::iterator sostit = sost.begin();
61  for(; sostit != sost.end(); ++sostit) {
62  noCSol += sostit->first.name().size();
63  DDSolid s(sostit->first);
64  noSolidP += s.parameters().size();
65  ++noSol;
66  }
67 
68  typedef DDRotation::StoreT::value_type rost_type;
69  rost_type & rost = DDRotation::StoreT::instance();
70  rost_type::iterator rostit = rost.begin();
71  for(; rostit != rost.end(); ++rostit) {
72  noCRot += rostit->first.name().size();
73  ++noRot;
74  }
75 
76  // derived quantities
77  std::cout << "sizeof(void*)=" << sizeof(void*) << std::endl;
78  std::cout << "sizeof(DDLogicalPart)="<<sizeof(DDLogicalPart)<<std::endl;
79  std::cout << "sizeof(DDTranslation)="<< sizeof(DDTranslation)<<std::endl;
80  std::cout << "sizeof(DDRotationMatrix)=" << sizeof(DDRotationMatrix)<<std::endl;
81  int store = 4*sizeof(void*); // overhead for data-management (est.)
82  int byRot = noRot * (sizeof(DDRotationMatrix) + store); // bytes in rotations
83  int bySol = noSolidP * sizeof(double) + noSol*store; // bytes in solids
84  int byMat = noMat * (5*sizeof(double) + store); // bytes in materials
85  int byPos = noEdges * (sizeof(DDTranslation) + sizeof(DDRotation) + sizeof(int));
86  int byNam = noCLog + noCSol + noCMat + noCRot; // bytes in strings for names
87  int byLog = noLog * (sizeof(DDMaterial) + sizeof(DDSolid) + store); // LogicalPart
88  int byGra = (noEdges + noNodes)*store; // est. graph structure
89  int bytes = byRot + bySol + byMat + byPos + byNam + byLog + byGra;
90  bytes += noNodes*sizeof(DDLogicalPart) + noEdges*sizeof(DDPosData*);
91  double mb = 1024.*1024.;
92 
93  os << "noNodes=" << noNodes << std::endl
94  << "noEdges=" << noEdges << std::endl
95  << "noExNod=" << noExpNodes << std::endl << std::endl;
96  os << "noLog=" << noLog << std::endl
97  << "noSol=" << noSol << " noSolidP=" << noSolidP << std::endl
98  << "noMat=" << noMat << std::endl
99  << "noRot=" << noRot << std::endl << std::endl;
100  os << "noCLog=" << noCLog << std::endl
101  << "noCSol=" << noCSol << std::endl
102  << "noCMat=" << noCMat << std::endl
103  << "noCRot=" << noCRot << std::endl
104  << " --------" << std::endl
105  << " " << byNam
106  << " chars used for naming." << std::endl << std::endl;
107  os << "byLog = " << byLog/mb << " logicalparts " << std::endl
108  << "byNam = " << byNam/mb << " string for names " << std::endl
109  << "byRot = " << byRot/mb << " rotations " << std::endl
110  << "bySol = " << bySol/mb << " solids " << std::endl
111  << "byMat = " << byMat/mb << " materials " << std::endl
112  << "byPos = " << byPos/mb << " posparts " << std::endl
113  << "byGra = " << byGra/mb << " graph-struct " << std::endl
114  << "-----------------------" << std::endl
115  << "OVERALL: " << bytes / mb << " MByte" << std::endl;
116 
117 }
bool next()
set current node to the next node in the expanded tree
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
void ddstats(std::ostream &os)
Definition: ddstats.cc:7
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
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:77
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:35
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:88
adj_list::const_iterator const_adj_iterator
Definition: adjgraph.h:125
tuple cout
Definition: gather_cfg.py:145
adj_iterator begin()
Definition: adjgraph.h:197
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:199