64 |
|
|
65 |
|
|
66 |
|
#include "Visualisation/OpenGLDisplayer/interface/SimEvent.h" |
67 |
< |
//#include "Visualisation/OpenGLDisplayer/interface/SimEvent.cpp" |
68 |
< |
|
69 |
< |
|
67 |
> |
#include "Visualisation/OpenGLDisplayer/interface/Geometry.h" |
68 |
|
|
69 |
|
using namespace edm; |
70 |
|
using namespace std; |
80 |
|
|
81 |
|
|
82 |
|
private: |
83 |
< |
virtual void beginJob(const edm::EventSetup&) ; |
84 |
< |
virtual void analyze(const edm::Event&, const edm::EventSetup&); |
85 |
< |
virtual void endJob() ; |
83 |
> |
virtual void beginJob(const edm::EventSetup& iSetup); |
84 |
> |
virtual void analyze (const edm::Event&, const edm::EventSetup&); |
85 |
> |
virtual void endJob (); |
86 |
|
|
87 |
|
|
88 |
|
MySimEvents* MyEvents; |
89 |
+ |
Geometry* Geom; |
90 |
|
|
91 |
|
|
92 |
|
std::vector<std::string> SimHitSubdetectors; |
114 |
|
|
115 |
|
// ------------ method called once each job just before starting event loop ------------ |
116 |
|
void |
117 |
< |
OpenGLDisplayer::beginJob(const edm::EventSetup&) |
117 |
> |
OpenGLDisplayer::beginJob(const edm::EventSetup& iSetup) |
118 |
|
{ |
119 |
|
|
121 |
– |
|
120 |
|
MyEvents = new MySimEvents(); |
121 |
+ |
Geom = new Geometry(); |
122 |
+ |
|
123 |
+ |
edm::ESHandle<TrackerGeometry> tkGeom; |
124 |
+ |
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom ); |
125 |
+ |
vector<GeomDet*> Det = tkGeom->dets(); |
126 |
+ |
|
127 |
+ |
for(unsigned int i=0;i<Det.size();i++){ |
128 |
+ |
DetId Detid = Det[i]->geographicalId(); |
129 |
+ |
// int SubDet = Detid.subdetId(); |
130 |
+ |
|
131 |
+ |
GeomDet* DetUnit = Det[i]; |
132 |
+ |
// StripGeomDetUnit* DetUnit = dynamic_cast<StripGeomDetUnit*> (Det[i]); |
133 |
+ |
if(!DetUnit)continue; |
134 |
+ |
|
135 |
+ |
const BoundPlane plane = DetUnit->surface(); |
136 |
+ |
float width = DetUnit->surface().bounds().width(); |
137 |
+ |
float length = DetUnit->surface().bounds().length(); |
138 |
+ |
float thickness = DetUnit->surface().bounds().thickness(); |
139 |
+ |
|
140 |
+ |
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) ); |
141 |
+ |
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) ); |
142 |
+ |
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) ); |
143 |
+ |
|
144 |
+ |
|
145 |
+ |
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector()); |
146 |
+ |
|
147 |
+ |
Geom->Add_TrackerDet(Detid.rawId(), |
148 |
+ |
Pos.x(), Pos.y(), Pos.z(), |
149 |
+ |
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(), |
150 |
+ |
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(), |
151 |
+ |
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z()); |
152 |
+ |
} |
153 |
+ |
Geom->Save("Tracker.geom"); |
154 |
+ |
|
155 |
|
|
156 |
|
} |
157 |
|
|