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 // $Id: DumpSimGeometry.cc,v 1.1 2010/08/24 13:20:15 matevz Exp $
17 //
18 //
19 
20 // system include files
21 #include <memory>
22 #include <iostream>
23 
24 // user include files
27 
30 
32 
36 
38 
39 #include "TGeoManager.h"
40 #include "TGeoMatrix.h"
41 
42 #include "TFile.h"
43 #include "TError.h"
44 
45 //
46 // class declaration
47 //
48 
50 {
51 public:
52  explicit DumpSimGeometry(const edm::ParameterSet&);
54 
55 private:
56  // virtual void beginJob();
57  // virtual void endJob();
58 
59  virtual void analyze(const edm::Event&, const edm::EventSetup&);
60 };
61 
62 
63 //
64 // constructors and destructor
65 //
67 {
68  // now do what ever initialization is needed
69 }
70 
71 
73 {
74  // do anything here that needs to be done at desctruction time
75  // (e.g. close files, deallocate resources etc.)
76 }
77 
78 
79 // ------------ method called to for each event ------------
80 void
82 {
83  std::cout << "In the DumpSimGeometry::analyze method..." << std::endl;
84  using namespace edm;
85 
87  iSetup.get<DisplayGeomRecord>().get(geoh);
88  TGeoManager *geom = const_cast<TGeoManager*>(geoh.product());
89 
90  int level = 1 + geom->GetTopVolume()->CountNodes(100, 3);
91 
92  std::cout << "In the DumpSimGeometry::analyze method...obtained main geometry, level="
93  << level << std::endl;
94 
95  TFile f(TString::Format("cmsSimGeom-%d.root", level), "RECREATE");
96  f.WriteTObject(geom);
97  f.Close();
98 }
99 
100 //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]
virtual void analyze(const edm::Event &, const edm::EventSetup &)
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:41
tuple level
Definition: testEve_cfg.py:34
DumpSimGeometry(const edm::ParameterSet &)