CMS 3D CMS Logo

DumpFWRecoGeometry.cc
Go to the documentation of this file.
8 
9 #include "TFile.h"
10 #include "TTree.h"
11 #include "TError.h"
12 #include "TSystem.h"
13 
15 {
16 public:
17  explicit DumpFWRecoGeometry( const edm::ParameterSet& config );
18  virtual ~DumpFWRecoGeometry( void ) {}
19 
20 private:
21  virtual void analyze( const edm::Event& event, const edm::EventSetup& eventSetup ) override;
22  virtual void beginJob( void ) override;
23  virtual void endJob( void ) override;
24 
25  int m_level;
28 };
29 
31  : m_level( config.getUntrackedParameter<int>( "level", 1 )),
32  m_tag( config.getUntrackedParameter<std::string>( "tagInfo", "unknown" )),
33  m_outputFileName( config.getUntrackedParameter<std::string>( "outputFileName", "cmsRecoGeo.root" ))
34 {}
35 
36 void
38 {
39  using namespace edm;
40 
42  eventSetup.get<FWRecoGeometryRecord>().get( geoh );
43  TFile file( m_outputFileName.c_str(), "RECREATE" );
44 
45  TTree *tree = new TTree("idToGeo", "raw detector id association with geometry ANT");
46 
47  UInt_t v_id;
48  Float_t v_vertex[24];
49  Float_t v_params[9];
50  Float_t v_shape[5];
51  Float_t v_translation[3];
52  Float_t v_matrix[9];
53 
54  tree->SetBranchStyle( 0 );
55  tree->Branch( "id", &v_id, "id/i" );
56  tree->Branch( "points", &v_vertex, "points[24]/F" );
57  tree->Branch( "topology", &v_params, "topology[9]/F" );
58  tree->Branch( "shape", &v_shape, "shape[5]/F" );
59  tree->Branch( "translation", &v_translation, "translation[3]/F" );
60  tree->Branch( "matrix", &v_matrix, "matrix[9]/F" );
61 
62  for( FWRecoGeom::InfoMapItr it = geoh.product()->idToName.begin(),
63  end = geoh.product()->idToName.end();
64  it != end; ++it )
65  {
66  v_id = it->id;
67  for( unsigned int i = 0; i < 24; ++i )
68  v_vertex[i] = it->points[i];
69  for( unsigned int i = 0; i < 9; ++i )
70  v_params[i] = it->topology[i];
71  for( unsigned int i = 0; i < 5; ++i )
72  v_shape[i] = it->shape[i];
73  for( unsigned int i = 0; i < 3; ++i )
74  v_translation[i] = it->translation[i];
75  for( unsigned int i = 0; i < 9; ++i )
76  v_matrix[i] = it->matrix[i];
77  tree->Fill();
78  }
79  file.WriteTObject( tree );
80 
81 
82  file.WriteTObject(new TNamed("CMSSW_VERSION", gSystem->Getenv( "CMSSW_VERSION" )));
83  file.WriteTObject(new TNamed("tag", m_tag.c_str()));
84  file.WriteTObject(&geoh.product()->extraDet, "ExtraDetectors");
85  file.WriteTObject(new TNamed("PRODUCER_VERSION", "1")); // version 2 changes pixel parameters
86 
87 
88 
89  file.Close();
90 }
91 
92 void
94 {}
95 
96 void
98 {}
99 
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:28
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Definition: config.py:1
FWRecoGeom::InfoMap idToName
std::string m_outputFileName
#define end
Definition: vmac.h:37
virtual ~DumpFWRecoGeometry(void)
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
virtual void beginJob(void) override
const T & get() const
Definition: EventSetup.h:55
T const * product() const
DumpFWRecoGeometry(const edm::ParameterSet &config)
virtual void endJob(void) override
TObjArray extraDet
HLT enums.
Definition: tree.py:1
Definition: event.py:1