CMS 3D CMS Logo

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 #include "TSystem.h"
44 
45 //
46 // class declaration
47 //
48 
50 public:
51  explicit DumpSimGeometry(const edm::ParameterSet&);
52  ~DumpSimGeometry() override;
53 
54 private:
55  void analyze(const edm::Event&, const edm::EventSetup&) override;
56 
59 };
60 
61 //
62 // constructors and destructor
63 //
65  m_tag = ps.getUntrackedParameter<std::string>("tag", "unknown");
66  m_outputFileName = ps.getUntrackedParameter<std::string>("outputFileName", "cmsSimGeom.root");
67 }
68 
70  // do anything here that needs to be done at desctruction time
71  // (e.g. close files, deallocate resources etc.)
72 }
73 
74 // ------------ method called to for each event ------------
76  std::cout << "In the DumpSimGeometry::analyze method..." << std::endl;
77  using namespace edm;
78 
80  iSetup.get<DisplayGeomRecord>().get(geoh);
81  const TGeoManager* geom = geoh.product(); // const_cast<TGeoManager*>(geoh.product());
82 
83  int level = 1 + geom->GetTopVolume()->CountNodes(100, 3);
84 
85  std::cout << "In the DumpSimGeometry::analyze method...obtained main geometry, level=" << level << std::endl;
86 
87  // TFile f(TString::Format("cmsSimGeom-%d.root", level), "RECREATE");
88  TFile f(m_outputFileName.c_str(), "RECREATE");
89  f.WriteTObject(geom);
90  f.WriteTObject(new TNamed("CMSSW_VERSION", gSystem->Getenv("CMSSW_VERSION")));
91  f.WriteTObject(new TNamed("tag", m_tag.c_str()));
92  f.Close();
93 }
94 
95 //define this as a plug-in
personalPlayback.level
level
Definition: personalPlayback.py:22
DumpSimGeometry
Definition: DumpSimGeometry.cc:49
ESTransientHandle.h
edm::ESTransientHandle::product
T const * product() const
Definition: ESTransientHandle.h:51
ESHandle.h
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DumpSimGeometry::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DumpSimGeometry.cc:75
DumpSimGeometry::~DumpSimGeometry
~DumpSimGeometry() override
Definition: DumpSimGeometry.cc:69
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
DumpSimGeometry::m_tag
std::string m_tag
Definition: DumpSimGeometry.cc:57
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
DisplayGeomRecord.h
Frameworkfwd.h
EventSetup.h
DumpSimGeometry::m_outputFileName
std::string m_outputFileName
Definition: DumpSimGeometry.cc:58
ParameterSet.h
edm::Event
Definition: Event.h:73
DumpSimGeometry::DumpSimGeometry
DumpSimGeometry(const edm::ParameterSet &)
Definition: DumpSimGeometry.cc:64
DisplayGeomRecord
Definition: DisplayGeomRecord.h:24