CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DumpSimGeometry.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DumpSimGeometry
4 // Class: DumpSimGeometry
5 //
13 //
14 // Original Author: Chris D Jones
15 // Created: Wed Sep 26 08:27:23 EDT 2007
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <iostream>
22 
23 // user include files
26 
29 
31 
35 
37 
38 #include "TGeoManager.h"
39 #include "TGeoMatrix.h"
40 
41 #include "TFile.h"
42 #include "TError.h"
43 
44 //
45 // class declaration
46 //
47 
49 {
50 public:
51  explicit DumpSimGeometry(const edm::ParameterSet&);
53 
54 private:
55  // virtual void beginJob();
56  // virtual void endJob();
57 
58  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
59 };
60 
61 
62 //
63 // constructors and destructor
64 //
66 {
67  // now do what ever initialization is needed
68 }
69 
70 
72 {
73  // do anything here that needs to be done at desctruction time
74  // (e.g. close files, deallocate resources etc.)
75 }
76 
77 
78 // ------------ method called to for each event ------------
79 void
81 {
82  std::cout << "In the DumpSimGeometry::analyze method..." << std::endl;
83  using namespace edm;
84 
86  iSetup.get<DisplayGeomRecord>().get(geoh);
87  const TGeoManager *geom = geoh.product(); // const_cast<TGeoManager*>(geoh.product());
88 
89  int level = 1 + geom->GetTopVolume()->CountNodes(100, 3);
90 
91  std::cout << "In the DumpSimGeometry::analyze method...obtained main geometry, level="
92  << level << std::endl;
93 
94  TFile f(TString::Format("cmsSimGeom-%d.root", level), "RECREATE");
95  f.WriteTObject(geom);
96  f.Close();
97 }
98 
99 //define this as a plug-in
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:243
double f[11][100]
const T & get() const
Definition: EventSetup.h:55
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
tuple cout
Definition: gather_cfg.py:121
tuple level
Definition: testEve_cfg.py:34
DumpSimGeometry(const edm::ParameterSet &)