Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <memory>
00022 #include <iostream>
00023
00024
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032
00033 #include "FWCore/Framework/interface/ESHandle.h"
00034 #include "FWCore/Framework/interface/EventSetup.h"
00035 #include "FWCore/Framework/interface/ESTransientHandle.h"
00036
00037 #include "Fireworks/Geometry/interface/DisplayGeomRecord.h"
00038
00039 #include "TGeoManager.h"
00040 #include "TGeoMatrix.h"
00041
00042 #include "TFile.h"
00043 #include "TError.h"
00044
00045
00046
00047
00048
00049 class DumpSimGeometry : public edm::EDAnalyzer
00050 {
00051 public:
00052 explicit DumpSimGeometry(const edm::ParameterSet&);
00053 ~DumpSimGeometry();
00054
00055 private:
00056
00057
00058
00059 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00060 };
00061
00062
00063
00064
00065
00066 DumpSimGeometry::DumpSimGeometry(const edm::ParameterSet&)
00067 {
00068
00069 }
00070
00071
00072 DumpSimGeometry::~DumpSimGeometry()
00073 {
00074
00075
00076 }
00077
00078
00079
00080 void
00081 DumpSimGeometry::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00082 {
00083 std::cout << "In the DumpSimGeometry::analyze method..." << std::endl;
00084 using namespace edm;
00085
00086 ESTransientHandle<TGeoManager> geoh;
00087 iSetup.get<DisplayGeomRecord>().get(geoh);
00088 const TGeoManager *geom = geoh.product();
00089
00090 int level = 1 + geom->GetTopVolume()->CountNodes(100, 3);
00091
00092 std::cout << "In the DumpSimGeometry::analyze method...obtained main geometry, level="
00093 << level << std::endl;
00094
00095 TFile f(TString::Format("cmsSimGeom-%d.root", level), "RECREATE");
00096 f.WriteTObject(geom);
00097 f.Close();
00098 }
00099
00100
00101 DEFINE_FWK_MODULE(DumpSimGeometry);