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" |
98 |
|
|
99 |
|
|
100 |
|
MySimEvents* MyEvents; |
101 |
< |
Geometry* Geom; |
101 |
> |
Geometry* Geom_Tracker; |
102 |
> |
Geometry* Geom_ECAL; |
103 |
> |
Geometry* Geom_HCAL; |
104 |
|
|
105 |
|
|
106 |
|
std::vector<std::string> SimHitSubdetectors; |
130 |
|
void |
131 |
|
OpenGLDisplayer::beginJob(const edm::EventSetup& iSetup) |
132 |
|
{ |
133 |
+ |
DetId Detid; |
134 |
+ |
int SubDet; |
135 |
+ |
|
136 |
+ |
MyEvents = new MySimEvents(); |
137 |
+ |
Geom_Tracker = new Geometry(); |
138 |
+ |
Geom_ECAL = new Geometry(); |
139 |
+ |
Geom_HCAL = new Geometry(); |
140 |
|
|
121 |
– |
MyEvents = new MySimEvents(); |
122 |
– |
Geom = new Geometry(); |
141 |
|
|
142 |
|
edm::ESHandle<TrackerGeometry> tkGeom; |
143 |
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom ); |
144 |
< |
vector<GeomDet*> Det = tkGeom->dets(); |
144 |
> |
vector<GeomDet*> TrackerDets = tkGeom->dets(); |
145 |
|
|
146 |
< |
for(unsigned int i=0;i<Det.size();i++){ |
147 |
< |
DetId Detid = Det[i]->geographicalId(); |
148 |
< |
// int SubDet = Detid.subdetId(); |
146 |
> |
for(unsigned int i=0;i<TrackerDets.size();i++){ |
147 |
> |
Detid = TrackerDets[i]->geographicalId(); |
148 |
> |
// SubDet = Detid.subdetId(); |
149 |
|
|
150 |
< |
GeomDet* DetUnit = Det[i]; |
150 |
> |
GeomDet* DetUnit = TrackerDets[i]; |
151 |
|
if(!DetUnit)continue; |
152 |
|
const BoundPlane plane = DetUnit->surface(); |
153 |
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds()))); |
154 |
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds()))); |
155 |
|
|
156 |
< |
float width; |
157 |
< |
float length; |
158 |
< |
float thickness; |
159 |
< |
float TrapezoidalParam; |
156 |
> |
float width = 0; |
157 |
> |
float length = 0; |
158 |
> |
float thickness = 0; |
159 |
> |
float TrapezoidalParam = 0; |
160 |
|
|
161 |
|
if(trapezoidalBounds) |
162 |
|
{ |
163 |
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters(); |
164 |
< |
width = parameters[0]; |
165 |
< |
length = parameters[3]; |
164 |
> |
width = parameters[0]*2; |
165 |
> |
length = parameters[3]*2; |
166 |
|
thickness = (*trapezoidalBounds).thickness(); |
167 |
|
TrapezoidalParam = parameters[1]/parameters[0]; |
150 |
– |
|
168 |
|
}else if(rectangularBounds){ |
169 |
|
width = DetUnit->surface().bounds().width(); |
170 |
|
length = DetUnit->surface().bounds().length(); |
178 |
|
|
179 |
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector()); |
180 |
|
|
181 |
< |
Geom->Add_TrackerDet(Detid.rawId(), TrapezoidalParam, |
181 |
> |
Geom_Tracker->Add_TrackerDet(Detid.rawId(), TrapezoidalParam, |
182 |
|
Pos.x(), Pos.y(), Pos.z(), |
183 |
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(), |
184 |
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(), |
186 |
|
|
187 |
|
|
188 |
|
} |
189 |
< |
Geom->Save("Tracker.geom"); |
189 |
> |
|
190 |
> |
|
191 |
> |
// ### CALO GEOMETRY ### |
192 |
> |
|
193 |
> |
edm::ESHandle<CaloGeometry> CaloGeom; |
194 |
> |
iSetup.get<IdealGeometryRecord>().get( CaloGeom ); |
195 |
> |
const vector<DetId> CaloDets = CaloGeom->getValidDetIds(); |
196 |
> |
|
197 |
> |
for(unsigned int i=0;i<CaloDets.size();i++) |
198 |
> |
{ |
199 |
> |
Detid = CaloDets[i]; |
200 |
> |
SubDet = Detid.subdetId(); |
201 |
> |
|
202 |
> |
Geometry* Geom_temp = NULL; |
203 |
> |
if(Detid.det()==DetId::Ecal){ |
204 |
> |
Geom_temp = Geom_ECAL; |
205 |
> |
|
206 |
> |
if(SubDet<1 || SubDet>3){ |
207 |
> |
printf("Don't Save EcalTriggerTower or EcalLaserPnDiode\n"); |
208 |
> |
continue; |
209 |
> |
} |
210 |
> |
}else if(Detid.det()==DetId::Hcal){ |
211 |
> |
Geom_temp = Geom_HCAL; |
212 |
> |
|
213 |
> |
if(SubDet<1 || SubDet>4){ |
214 |
> |
printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n"); |
215 |
> |
continue; |
216 |
> |
} |
217 |
> |
}else{ |
218 |
> |
continue; |
219 |
> |
} |
220 |
> |
|
221 |
> |
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid); |
222 |
> |
GlobalPoint CellPos = CellGeom->getPosition(); |
223 |
> |
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners(); |
224 |
> |
|
225 |
> |
Geom_temp->Add_CaloDet(Detid.rawId(), |
226 |
> |
CellPos.x() , CellPos.y() , CellPos.z(), |
227 |
> |
CellCorners[0].x() , CellCorners[0].y() , CellCorners[0].z() , |
228 |
> |
CellCorners[1].x() , CellCorners[1].y() , CellCorners[1].z() , |
229 |
> |
CellCorners[2].x() , CellCorners[2].y() , CellCorners[2].z() , |
230 |
> |
CellCorners[3].x() , CellCorners[3].y() , CellCorners[3].z() , |
231 |
> |
CellCorners[4].x() , CellCorners[4].y() , CellCorners[4].z() , |
232 |
> |
CellCorners[5].x() , CellCorners[5].y() , CellCorners[5].z() , |
233 |
> |
CellCorners[6].x() , CellCorners[6].y() , CellCorners[6].z() , |
234 |
> |
CellCorners[7].x() , CellCorners[7].y() , CellCorners[7].z() ); |
235 |
> |
} |
236 |
> |
|
237 |
> |
Geom_Tracker->Save("Tracker.geom"); |
238 |
> |
Geom_ECAL->Save("ECAL.geom"); |
239 |
> |
Geom_HCAL->Save("HCAL.geom"); |
240 |
> |
|
241 |
|
|
242 |
|
|
243 |
|
} |