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 public:
17  ~DumpFWRecoGeometry(void) override {}
18 
19 private:
20  void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;
21  void beginJob(void) override;
22  void endJob(void) override;
23 
24  int m_level;
27 };
28 
30  : m_level(config.getUntrackedParameter<int>("level", 1)),
31  m_tag(config.getUntrackedParameter<std::string>("tagInfo", "unknown")),
32 
33  m_outputFileName(config.getUntrackedParameter<std::string>("outputFileName", "cmsRecoGeo.root")) {}
34 
36  using namespace edm;
37 
39  eventSetup.get<FWRecoGeometryRecord>().get(geoh);
40  TFile file(m_outputFileName.c_str(), "RECREATE");
41 
42  TTree* tree = new TTree("idToGeo", "raw detector id association with geometry ANT");
43 
44  UInt_t v_id;
45  Float_t v_vertex[24];
46  Float_t v_params[9];
47  Float_t v_shape[5];
48  Float_t v_translation[3];
49  Float_t v_matrix[9];
50 
51  tree->SetBranchStyle(0);
52  tree->Branch("id", &v_id, "id/i");
53  tree->Branch("points", &v_vertex, "points[24]/F");
54  tree->Branch("topology", &v_params, "topology[9]/F");
55  tree->Branch("shape", &v_shape, "shape[5]/F");
56  tree->Branch("translation", &v_translation, "translation[3]/F");
57  tree->Branch("matrix", &v_matrix, "matrix[9]/F");
58 
59  for (FWRecoGeom::InfoMapItr it = geoh.product()->idToName.begin(), end = geoh.product()->idToName.end(); it != end;
60  ++it) {
61  v_id = it->id;
62  for (unsigned int i = 0; i < 24; ++i)
63  v_vertex[i] = it->points[i];
64  for (unsigned int i = 0; i < 9; ++i)
65  v_params[i] = it->topology[i];
66  for (unsigned int i = 0; i < 5; ++i)
67  v_shape[i] = it->shape[i];
68  for (unsigned int i = 0; i < 3; ++i)
69  v_translation[i] = it->translation[i];
70  for (unsigned int i = 0; i < 9; ++i)
71  v_matrix[i] = it->matrix[i];
72  tree->Fill();
73  }
74  file.WriteTObject(tree);
75 
76  file.WriteTObject(new TNamed("CMSSW_VERSION", gSystem->Getenv("CMSSW_VERSION")));
77  file.WriteTObject(new TNamed("tag", m_tag.c_str()));
78  file.WriteTObject(&geoh.product()->extraDet, "ExtraDetectors");
79  file.WriteTObject(new TNamed("PRODUCER_VERSION", "1")); // version 2 changes pixel parameters
80 
81  file.WriteTObject(new TNamed("TrackerTopology", geoh.product()->trackerTopologyXML));
82 
83  file.Close();
84 }
85 
87 
89 
mps_fire.i
i
Definition: mps_fire.py:428
ESTransientHandle.h
DumpFWRecoGeometry
Definition: DumpFWRecoGeometry.cc:14
edm::ESTransientHandle::product
T const * product() const
Definition: ESTransientHandle.h:51
FWRecoGeometryRecord
Definition: FWRecoGeometryRecord.h:9
ESHandle.h
FWRecoGeometry::idToName
FWRecoGeom::InfoMap idToName
Definition: FWRecoGeometry.h:14
edm
HLT enums.
Definition: AlignableModifier.h:19
FWRecoGeometry::trackerTopologyXML
std::string trackerTopologyXML
Definition: FWRecoGeometry.h:16
tree
Definition: tree.py:1
DumpFWRecoGeometry::beginJob
void beginJob(void) override
Definition: DumpFWRecoGeometry.cc:86
EDAnalyzer.h
DumpFWRecoGeometry::~DumpFWRecoGeometry
~DumpFWRecoGeometry(void) override
Definition: DumpFWRecoGeometry.cc:17
DumpFWRecoGeometry::m_level
int m_level
Definition: DumpFWRecoGeometry.cc:24
edm::EDAnalyzer
Definition: EDAnalyzer.h:28
config
Definition: config.py:1
MakerMacros.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
mps_fire.end
end
Definition: mps_fire.py:242
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
DumpFWRecoGeometry::analyze
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
Definition: DumpFWRecoGeometry.cc:35
createfilelist.int
int
Definition: createfilelist.py:10
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
DumpFWRecoGeometry::DumpFWRecoGeometry
DumpFWRecoGeometry(const edm::ParameterSet &config)
Definition: DumpFWRecoGeometry.cc:29
DumpFWRecoGeometry::endJob
void endJob(void) override
Definition: DumpFWRecoGeometry.cc:88
edm::EventSetup
Definition: EventSetup.h:58
FWRecoGeom::InfoMapItr
std::vector< FWRecoGeom::Info >::const_iterator InfoMapItr
Definition: FWRecoGeom.h:24
get
#define get
cms::cuda::for
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
Definition: HistoContainer.h:27
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
FWRecoGeometryRecord.h
std
Definition: JetResolutionObject.h:76
DumpFWRecoGeometry::m_outputFileName
std::string m_outputFileName
Definition: DumpFWRecoGeometry.cc:26
DumpFWRecoGeometry::m_tag
std::string m_tag
Definition: DumpFWRecoGeometry.cc:25
EventSetup.h
FWRecoGeometry::extraDet
TObjArray extraDet
Definition: FWRecoGeometry.h:15
FWRecoGeometry.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73