54 |
|
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" |
55 |
|
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" |
56 |
|
|
57 |
+ |
#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" |
58 |
+ |
#include "Geometry/Records/interface/MuonGeometryRecord.h" |
59 |
+ |
#include "Geometry/DTGeometry/interface/DTGeometry.h" |
60 |
+ |
|
61 |
+ |
|
62 |
|
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" |
63 |
|
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" |
64 |
|
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" |
108 |
|
Geometry* Geom_Tracker; |
109 |
|
Geometry* Geom_ECAL; |
110 |
|
Geometry* Geom_HCAL; |
111 |
+ |
Geometry* Geom_Muon; |
112 |
+ |
|
113 |
|
|
114 |
|
std::string OutputFile; |
115 |
|
|
164 |
|
Geom_Tracker = new Geometry(); |
165 |
|
Geom_ECAL = new Geometry(); |
166 |
|
Geom_HCAL = new Geometry(); |
167 |
+ |
Geom_Muon = new Geometry(); |
168 |
|
|
169 |
|
|
170 |
+ |
// ### TRACKER GEOMETRY ### |
171 |
+ |
|
172 |
|
edm::ESHandle<TrackerGeometry> tkGeom; |
173 |
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom ); |
174 |
|
vector<GeomDet*> TrackerDets = tkGeom->dets(); |
264 |
|
CellCorners[7].x() , CellCorners[7].y() , CellCorners[7].z() ); |
265 |
|
} |
266 |
|
|
267 |
< |
Geom_Tracker->Save("Tracker.geom"); |
268 |
< |
Geom_ECAL->Save("ECAL.geom"); |
269 |
< |
Geom_HCAL->Save("HCAL.geom"); |
267 |
> |
// ### MUON GEOMETRY ### |
268 |
> |
|
269 |
> |
edm::ESHandle<DTGeometry> DtGeom; |
270 |
> |
// iSetup.get<IdealGeometryRecord>().get( DtGeom ); |
271 |
> |
iSetup.get<MuonGeometryRecord>().get( DtGeom ); |
272 |
> |
const vector<GeomDet*> DtDets = DtGeom->dets(); |
273 |
> |
|
274 |
> |
|
275 |
> |
for(unsigned int i=0;i<DtDets.size();i++) |
276 |
> |
{ |
277 |
> |
Detid = DetId(DtDets[i]->geographicalId()); |
278 |
> |
SubDet = Detid.subdetId(); |
279 |
> |
|
280 |
> |
GeomDet* DetUnit = DtDets[i]; |
281 |
> |
if(!DetUnit)continue; |
282 |
> |
const BoundPlane plane = DetUnit->surface(); |
283 |
> |
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds()))); |
284 |
> |
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds()))); |
285 |
|
|
286 |
+ |
float width = 0; |
287 |
+ |
float length = 0; |
288 |
+ |
float thickness = 0; |
289 |
+ |
float TrapezoidalParam = 0; |
290 |
|
|
291 |
+ |
if(trapezoidalBounds) |
292 |
+ |
{ |
293 |
+ |
std::vector<float> const & parameters = (*trapezoidalBounds).parameters(); |
294 |
+ |
width = parameters[0]*2; |
295 |
+ |
length = parameters[3]*2; |
296 |
+ |
thickness = (*trapezoidalBounds).thickness(); |
297 |
+ |
TrapezoidalParam = parameters[1]/parameters[0]; |
298 |
+ |
}else if(rectangularBounds){ |
299 |
+ |
width = DetUnit->surface().bounds().width(); |
300 |
+ |
length = DetUnit->surface().bounds().length(); |
301 |
+ |
thickness = DetUnit->surface().bounds().thickness(); |
302 |
+ |
TrapezoidalParam = 1; |
303 |
+ |
} |
304 |
+ |
|
305 |
+ |
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) ); |
306 |
+ |
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) ); |
307 |
+ |
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) ); |
308 |
+ |
|
309 |
+ |
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector()); |
310 |
+ |
|
311 |
+ |
printf("Det = %i\n",Detid.det()); |
312 |
+ |
Geom_Muon->Add_TrackerDet(Detid.rawId(), TrapezoidalParam, |
313 |
+ |
Pos.x(), Pos.y(), Pos.z(), |
314 |
+ |
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(), |
315 |
+ |
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(), |
316 |
+ |
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z()); |
317 |
+ |
} |
318 |
+ |
|
319 |
+ |
|
320 |
+ |
// ### Save .geom ### |
321 |
+ |
|
322 |
+ |
Geom_Tracker->Save("Tracker.geom"); |
323 |
+ |
Geom_ECAL ->Save("Ecal.geom"); |
324 |
+ |
Geom_HCAL ->Save("Hcal.geom"); |
325 |
+ |
Geom_Muon ->Save("Muon.geom"); |
326 |
|
|
327 |
|
} |
328 |
|
|
358 |
|
|
359 |
|
|
360 |
|
// Save Data |
297 |
– |
|
361 |
|
for(unsigned int i=0;i<SimTrackProducers.size();i++){ |
362 |
|
edm::Handle<std::vector< SimTrack > > h_SimTracks; |
363 |
|
iEvent.getByLabel(SimTrackProducers[i], h_SimTracks); |
364 |
|
std::vector< SimTrack > SimTrackColl = *h_SimTracks.product(); |
365 |
|
|
303 |
– |
MySimEvent* MyEvent = new MySimEvent; |
304 |
– |
|
366 |
|
for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) { |
367 |
|
MySimTrack MysimTrack; |
368 |
|
SimTrack simTrack =SimTrackColl[a]; |
377 |
|
MysimTrack.charge =simTrack.charge(); |
378 |
|
|
379 |
|
MyEvent->MySimTrackCollection.push_back(MysimTrack); |
380 |
< |
} |
380 |
> |
} |
381 |
|
} |
382 |
|
|
383 |
|
|