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" |
72 |
|
#include "DataFormats/TrackReco/interface/Track.h" |
73 |
|
|
74 |
|
#include "DataFormats/Math/interface/Point3D.h" |
75 |
< |
|
75 |
> |
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h" |
76 |
> |
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h" |
77 |
|
|
78 |
|
#include "Visualisation/OpenGLDisplayer/interface/SimEvent.h" |
79 |
|
#include "Visualisation/OpenGLDisplayer/interface/Geometry.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]; |
132 |
< |
// StripGeomDetUnit* DetUnit = dynamic_cast<StripGeomDetUnit*> (Det[i]); |
145 |
> |
GeomDet* DetUnit = TrackerDets[i]; |
146 |
|
if(!DetUnit)continue; |
134 |
– |
|
147 |
|
const BoundPlane plane = DetUnit->surface(); |
148 |
< |
float width = DetUnit->surface().bounds().width(); |
149 |
< |
float length = DetUnit->surface().bounds().length(); |
150 |
< |
float thickness = DetUnit->surface().bounds().thickness(); |
148 |
> |
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds()))); |
149 |
> |
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds()))); |
150 |
> |
|
151 |
> |
float width = 0; |
152 |
> |
float length = 0; |
153 |
> |
float thickness = 0; |
154 |
> |
float TrapezoidalParam = 0; |
155 |
> |
|
156 |
> |
if(trapezoidalBounds) |
157 |
> |
{ |
158 |
> |
std::vector<float> const & parameters = (*trapezoidalBounds).parameters(); |
159 |
> |
width = parameters[0]*2; |
160 |
> |
length = parameters[3]*2; |
161 |
> |
thickness = (*trapezoidalBounds).thickness(); |
162 |
> |
TrapezoidalParam = parameters[1]/parameters[0]; |
163 |
> |
}else if(rectangularBounds){ |
164 |
> |
width = DetUnit->surface().bounds().width(); |
165 |
> |
length = DetUnit->surface().bounds().length(); |
166 |
> |
thickness = DetUnit->surface().bounds().thickness(); |
167 |
> |
TrapezoidalParam = 1; |
168 |
> |
} |
169 |
|
|
170 |
|
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) ); |
171 |
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) ); |
172 |
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) ); |
173 |
|
|
144 |
– |
|
174 |
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector()); |
175 |
|
|
176 |
< |
Geom->Add_TrackerDet(Detid.rawId(), |
177 |
< |
Pos.x(), Pos.y(), Pos.z(), |
178 |
< |
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(), |
179 |
< |
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(), |
180 |
< |
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z()); |
176 |
> |
Geom->Add_TrackerDet(Detid.rawId(), TrapezoidalParam, |
177 |
> |
Pos.x(), Pos.y(), Pos.z(), |
178 |
> |
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(), |
179 |
> |
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(), |
180 |
> |
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z()); |
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) 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 |
+ |
printf("Det = %i Subdet = %i --> %6.2f %6.2f %6.2f - %i\n", Detid.det(), SubDet, CellPos.x(), CellPos.y(), CellPos.z(), CellCorners.size()); |
208 |
+ |
} |
209 |
+ |
|
210 |
+ |
|
211 |
|
Geom->Save("Tracker.geom"); |
212 |
|
|
213 |
|
|