CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DumpFWTGeoRecoGeometry.cc
Go to the documentation of this file.
8 
9 #include "TGeoManager.h"
10 #include "TFile.h"
11 #include "TTree.h"
12 #include "TError.h"
13 
15 {
16 public:
18  virtual ~DumpFWTGeoRecoGeometry( void ) {}
19 
20 private:
21  virtual void analyze( const edm::Event& event, const edm::EventSetup& eventSetup );
22  virtual void beginJob( void );
23  virtual void endJob( void );
24 
25  int m_level;
26 };
27 
29  : m_level( config.getUntrackedParameter<int>( "level", 1 ))
30 {}
31 
32 void
34 {
35  using namespace edm;
36 
38  eventSetup.get<FWTGeoRecoGeometryRecord>().get( geoh );
39  TGeoManager *geom = geoh.product()->manager();//const_cast<TGeoManager*>( geoh.product()->manager());
40 
41  std::stringstream s;
42  s << "cmsTGeoRecoGeom" << m_level << ".root";
43  TFile file( s.str().c_str(), "RECREATE" );
44 
45  TTree *tree = new TTree( "idToGeo", "Raw detector id association with geometry" );
46  UInt_t v_id;
47  TString *v_path( new TString );
48  char v_name[1000];
49  Float_t v_vertex[24];
50  Float_t v_params[9];
51 
52  tree->SetBranchStyle( 0 );
53  tree->Branch( "id", &v_id, "id/i" );
54  tree->Branch( "path", &v_name, "path/C" );
55  tree->Branch( "points", &v_vertex, "points[24]/F" );
56  tree->Branch( "topology", &v_params, "topology[9]/F" );
57 
58  for( std::map<unsigned int, FWTGeoRecoGeometry::Info>::const_iterator it = geoh.product()->idToName.begin(),
59  end = geoh.product()->idToName.end();
60  it != end; ++it )
61  {
62  v_id = it->first;
63  *v_path = it->second.name.c_str();
64  for( unsigned int i = 0; i < 24; ++i )
65  v_vertex[i] = it->second.points[i];
66  for( unsigned int i = 0; i < 9; ++i )
67  v_params[i] = it->second.topology[i];
68  assert( it->second.name.size() < 1000 );
69  strncpy( v_name, it->second.name.c_str(), 1000 );
70  tree->Fill();
71  }
72  file.WriteTObject( &*geom );
73  file.WriteTObject( tree );
74  file.Close();
75 }
76 
77 void
79 {}
80 
81 void
83 {}
84 
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
DumpFWTGeoRecoGeometry(const edm::ParameterSet &config)
#define end
Definition: vmac.h:38
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned int UInt_t
Definition: FUTypes.h:12
const T & get() const
Definition: EventSetup.h:55
virtual void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)