45 |
|
#include "DataFormats/GeometrySurface/interface/BoundSurface.h" |
46 |
|
#include "DataFormats/DetId/interface/DetId.h" |
47 |
|
|
48 |
+ |
#include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h" |
49 |
+ |
#include "Geometry/Records/interface/IdealGeometryRecord.h" |
50 |
+ |
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" |
51 |
+ |
#include "Geometry/CaloGeometry/interface/CaloGeometry.h" |
52 |
+ |
#include "Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h" |
53 |
+ |
#include "Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h" |
54 |
+ |
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" |
55 |
+ |
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" |
56 |
+ |
|
57 |
+ |
|
58 |
+ |
|
59 |
|
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" |
60 |
|
#include "SimDataFormats/TrackingHit/interface/PSimHit.h" |
61 |
|
#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" |
128 |
|
void |
129 |
|
OpenGLDisplayer::beginJob(const edm::EventSetup& iSetup) |
130 |
|
{ |
131 |
+ |
DetId Detid; |
132 |
+ |
int SubDet; |
133 |
|
|
134 |
|
MyEvents = new MySimEvents(); |
135 |
|
Geom = new Geometry(); |
136 |
|
|
137 |
|
edm::ESHandle<TrackerGeometry> tkGeom; |
138 |
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom ); |
139 |
< |
vector<GeomDet*> Det = tkGeom->dets(); |
139 |
> |
vector<GeomDet*> TrackerDets = tkGeom->dets(); |
140 |
|
|
141 |
< |
for(unsigned int i=0;i<Det.size();i++){ |
142 |
< |
DetId Detid = Det[i]->geographicalId(); |
143 |
< |
// int SubDet = Detid.subdetId(); |
141 |
> |
for(unsigned int i=0;i<TrackerDets.size();i++){ |
142 |
> |
Detid = TrackerDets[i]->geographicalId(); |
143 |
> |
// SubDet = Detid.subdetId(); |
144 |
|
|
145 |
< |
GeomDet* DetUnit = Det[i]; |
145 |
> |
GeomDet* DetUnit = TrackerDets[i]; |
146 |
|
if(!DetUnit)continue; |
147 |
|
const BoundPlane plane = DetUnit->surface(); |
148 |
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds()))); |
149 |
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds()))); |
150 |
|
|
151 |
< |
float width; |
152 |
< |
float length; |
153 |
< |
float thickness; |
154 |
< |
float TrapezoidalParam; |
151 |
> |
float width = 0; |
152 |
> |
float length = 0; |
153 |
> |
float thickness = 0; |
154 |
> |
float TrapezoidalParam = 0; |
155 |
|
|
156 |
|
if(trapezoidalBounds) |
157 |
|
{ |
181 |
|
|
182 |
|
|
183 |
|
} |
184 |
+ |
|
185 |
+ |
|
186 |
+ |
// ### CALO GEOMETRY ### |
187 |
+ |
|
188 |
+ |
edm::ESHandle<CaloGeometry> CaloGeom; |
189 |
+ |
iSetup.get<IdealGeometryRecord>().get( CaloGeom ); |
190 |
+ |
const vector<DetId> CaloDets = CaloGeom->getValidDetIds(); |
191 |
+ |
|
192 |
+ |
for(unsigned int i=0;i<CaloDets.size();i++) |
193 |
+ |
{ |
194 |
+ |
Detid = CaloDets[i]; |
195 |
+ |
SubDet = Detid.subdetId(); |
196 |
+ |
|
197 |
+ |
if(! (Detid.det()==DetId::Ecal||Detid.det()==DetId::Hcal)) continue; |
198 |
+ |
|
199 |
+ |
//EcalBarrel=1, EcalEndcap=2, EcalPreshower=3, EcalTriggerTower=4, EcalLaserPnDiode=5 |
200 |
+ |
// if(SubDet!=EcalBarrel)continue; |
201 |
+ |
|
202 |
+ |
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid); |
203 |
+ |
GlobalPoint CellPos = CellGeom->getPosition(); |
204 |
+ |
|
205 |
+ |
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners(); |
206 |
+ |
|
207 |
+ |
float Coord[24]; |
208 |
+ |
for(unsigned int i=0;i<8;i++){ |
209 |
+ |
Coord[i*3+0] = CellCorners[i].x(); |
210 |
+ |
Coord[i*3+1] = CellCorners[i].y(); |
211 |
+ |
Coord[i*3+2] = CellCorners[i].z(); |
212 |
+ |
} |
213 |
+ |
|
214 |
+ |
Geom->Add_CaloDet(Detid.rawId(), |
215 |
+ |
CellPos.x(), CellPos.y(), CellPos.z(), |
216 |
+ |
Coord[0 ] , Coord[1 ] , Coord[2 ] , |
217 |
+ |
Coord[3 ] , Coord[4 ] , Coord[5 ] , |
218 |
+ |
Coord[6 ] , Coord[7 ] , Coord[8 ] , |
219 |
+ |
Coord[9 ] , Coord[10] , Coord[11] , |
220 |
+ |
Coord[12] , Coord[13] , Coord[14] , |
221 |
+ |
Coord[15] , Coord[16] , Coord[17] , |
222 |
+ |
Coord[18] , Coord[19] , Coord[20] , |
223 |
+ |
Coord[21] , Coord[22] , Coord[23] ); |
224 |
+ |
|
225 |
+ |
printf("Det = %i Subdet = %i --> %6.2f %6.2f %6.2f - %i\n", Detid.det(), SubDet, CellPos.x(), CellPos.y(), CellPos.z(), CellCorners.size()); |
226 |
+ |
} |
227 |
+ |
|
228 |
+ |
|
229 |
|
Geom->Save("Tracker.geom"); |
230 |
|
|
231 |
|
|