Main Page
Namespaces
Classes
Package Documentation
Fireworks
Geometry
plugins
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
24
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
25
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
26
27
#include "
FWCore/Framework/interface/Event.h
"
28
#include "
FWCore/Framework/interface/MakerMacros.h
"
29
30
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
31
32
#include "
FWCore/Framework/interface/ESHandle.h
"
33
#include "
FWCore/Framework/interface/EventSetup.h
"
34
#include "
FWCore/Framework/interface/ESTransientHandle.h
"
35
36
#include "
Fireworks/Geometry/interface/DisplayGeomRecord.h
"
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
49
class
DumpSimGeometry
:
public
edm::EDAnalyzer
50
{
51
public
:
52
explicit
DumpSimGeometry
(
const
edm::ParameterSet
&);
53
~DumpSimGeometry
();
54
55
private
:
56
57
virtual
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
58
59
std::string
m_tag
;
60
std::string
m_outputFileName
;
61
};
62
63
64
//
65
// constructors and destructor
66
//
67
DumpSimGeometry::DumpSimGeometry
(
const
edm::ParameterSet
& ps)
68
{
69
m_tag
= ps.
getUntrackedParameter
<
std::string
>(
"tag"
,
"unknown"
);
70
m_outputFileName
= ps.
getUntrackedParameter
<
std::string
>(
"outputFileName"
,
"cmsSimGeom.root"
);
71
72
}
73
74
75
DumpSimGeometry::~DumpSimGeometry
()
76
{
77
// do anything here that needs to be done at desctruction time
78
// (e.g. close files, deallocate resources etc.)
79
}
80
81
82
// ------------ method called to for each event ------------
83
void
84
DumpSimGeometry::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
85
{
86
std::cout
<<
"In the DumpSimGeometry::analyze method..."
<< std::endl;
87
using namespace
edm
;
88
89
ESTransientHandle<TGeoManager>
geoh;
90
iSetup.
get
<
DisplayGeomRecord
>().
get
(geoh);
91
const
TGeoManager *
geom
= geoh.
product
();
// const_cast<TGeoManager*>(geoh.product());
92
93
int
level
= 1 + geom->GetTopVolume()->CountNodes(100, 3);
94
95
std::cout
<<
"In the DumpSimGeometry::analyze method...obtained main geometry, level="
96
<< level << std::endl;
97
98
// TFile f(TString::Format("cmsSimGeom-%d.root", level), "RECREATE");
99
TFile
f
(
m_outputFileName
.c_str(),
"RECREATE"
);
100
f
.WriteTObject(geom);
101
f
.WriteTObject(
new
TNamed(
"CMSSW_VERSION"
, gSystem->Getenv(
"CMSSW_VERSION"
)));
102
f
.WriteTObject(
new
TNamed(
"tag"
,
m_tag
.c_str()));
103
f
.Close();
104
}
105
106
//define this as a plug-in
107
DEFINE_FWK_MODULE
(
DumpSimGeometry
);
DumpSimGeometry::m_tag
std::string m_tag
Definition:
DumpSimGeometry.cc:59
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
hcalDigis_cfi.level
level
Definition:
hcalDigis_cfi.py:18
MakerMacros.h
EventSetup.h
DumpSimGeometry
Definition:
DumpSimGeometry.cc:49
Frameworkfwd.h
ParameterSet.h
DumpSimGeometry::~DumpSimGeometry
~DumpSimGeometry()
Definition:
DumpSimGeometry.cc:75
iEvent
int iEvent
Definition:
GenABIO.cc:230
ESHandle.h
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
edm::EventSetup
Definition:
EventSetup.h:45
relativeConstraints.geom
geom
Definition:
relativeConstraints.py:71
edm::EDAnalyzer
Definition:
EDAnalyzer.h:27
EDAnalyzer.h
DisplayGeomRecord
Definition:
DisplayGeomRecord.h:24
edm::EventSetup::get
const T & get() const
Definition:
EventSetup.h:56
edm::ESTransientHandle::product
T const * product() const
Definition:
ESTransientHandle.h:51
DumpSimGeometry::analyze
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
DumpSimGeometry.cc:84
edm
HLT enums.
Definition:
AlignableModifier.h:17
ESTransientHandle.h
DumpSimGeometry::m_outputFileName
std::string m_outputFileName
Definition:
DumpSimGeometry.cc:60
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
gather_cfg.cout
cout
Definition:
gather_cfg.py:145
DumpSimGeometry::DumpSimGeometry
DumpSimGeometry(const edm::ParameterSet &)
Definition:
DumpSimGeometry.cc:67
edm::Event
Definition:
Event.h:66
DisplayGeomRecord.h
Generated for CMSSW Reference Manual by
1.8.11