ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FastOpenGlDisplayer/src/OpenGLDisplayer.cc
(Generate patch)

Comparing UserCode/FastOpenGlDisplayer/src/OpenGLDisplayer.cc (file contents):
Revision 1.16 by querten, Wed Apr 16 05:58:28 2008 UTC vs.
Revision 1.19 by querten, Fri Apr 18 13:08:34 2008 UTC

# Line 54 | Line 54
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 + #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
61 + #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
62 +
63 +
64 +
65   #include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
66   #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
67   #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
# Line 103 | Line 111 | class OpenGLDisplayer : public edm::EDAn
111        Geometry*    Geom_Tracker;
112        Geometry*    Geom_ECAL;
113        Geometry*    Geom_HCAL;
114 +      Geometry*    Geom_Muon;
115 +
116  
117        std::string              OutputFile;
118  
# Line 157 | Line 167 | OpenGLDisplayer::beginJob(const edm::Eve
167     Geom_Tracker = new Geometry();
168     Geom_ECAL    = new Geometry();
169     Geom_HCAL    = new Geometry();
170 +   Geom_Muon    = new Geometry();
171 +
172  
173 +   // ### TRACKER GEOMETRY ###
174  
175     edm::ESHandle<TrackerGeometry> tkGeom;
176     iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
# Line 254 | Line 267 | OpenGLDisplayer::beginJob(const edm::Eve
267                          CellCorners[7].x()  ,   CellCorners[7].y()  ,   CellCorners[7].z()  );
268     }
269  
270 +   // ### MUON GEOMETRY ###
271 +
272 +   edm::ESHandle<DTGeometry> DtGeom;
273 +   iSetup.get<MuonGeometryRecord>().get( DtGeom );
274 +   const vector<GeomDet*> DtDets = DtGeom->dets();
275 +
276 +   edm::ESHandle<CSCGeometry> CscGeom;
277 +   iSetup.get<MuonGeometryRecord>().get( CscGeom );
278 +   const vector<GeomDet*> CscDets = CscGeom->dets();
279 +
280 +   edm::ESHandle<RPCGeometry> RpcGeom;
281 +   iSetup.get<MuonGeometryRecord>().get( RpcGeom );
282 +   const vector<GeomDet*> RpcDets = RpcGeom->dets();
283 +
284 +   vector<GeomDet*> MuonDets;
285 +   for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
286 +   for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
287 +   for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
288 +
289 +
290 +   for(unsigned int i=0;i<MuonDets.size();i++)
291 +   {
292 +      Detid  = DetId(MuonDets[i]->geographicalId());
293 +      SubDet = Detid.subdetId();
294 +
295 +      GeomDet* DetUnit = MuonDets[i];
296 +      if(!DetUnit)continue;
297 +      const BoundPlane plane = DetUnit->surface();
298 +      const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
299 +      const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
300 +
301 +      float width            = 0;
302 +      float length           = 0;
303 +      float thickness        = 0;
304 +      float TrapezoidalParam = 0;
305 +
306 +      if(trapezoidalBounds)
307 +      {
308 +         std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
309 +         width            = parameters[0]*2;
310 +         length           = parameters[3]*2;
311 +         thickness        =  (*trapezoidalBounds).thickness();
312 +         TrapezoidalParam = parameters[1]/parameters[0];
313 +      }else if(rectangularBounds){
314 +         width            = DetUnit->surface().bounds().width();
315 +         length           = DetUnit->surface().bounds().length();
316 +         thickness        = DetUnit->surface().bounds().thickness();
317 +         TrapezoidalParam = 1;
318 +      }
319 +
320 +      Surface::GlobalPoint WidthVector  = plane.toGlobal( LocalPoint(width/2, 0, 0) );
321 +      Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
322 +      Surface::GlobalPoint ThickVector  = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
323 +
324 +      GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
325 +
326 +      Geom_Muon->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
327 +           Pos.x(),                  Pos.y(),                  Pos.z(),
328 +           WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
329 +           LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
330 +           ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
331 +   }
332 +
333 +
334 +   // ### Save .geom ###
335 +
336     Geom_Tracker->Save("Tracker.geom");    
337 <   Geom_ECAL->Save("Ecal.geom");
338 <   Geom_HCAL->Save("Hcal.geom");
337 >   Geom_ECAL   ->Save("Ecal.geom");
338 >   Geom_HCAL   ->Save("Hcal.geom");
339  
340 +   printf("RPC = %i\n",Geom_Muon   ->Det_Muon_RPC.size());
341  
342 +   Geom_Muon   ->Save("Muon.geom");
343  
344   }
345  
# Line 294 | Line 375 | OpenGLDisplayer::analyze(const edm::Even
375  
376  
377          // Save Data
297
378          for(unsigned int i=0;i<SimTrackProducers.size();i++){
379             edm::Handle<std::vector< SimTrack > > h_SimTracks;
380             iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
381             std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
382  
303           MySimEvent* MyEvent = new MySimEvent;
304  
383             for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
384                  MySimTrack  MysimTrack;
385                  SimTrack    simTrack    =SimTrackColl[a];
# Line 316 | Line 394 | OpenGLDisplayer::analyze(const edm::Even
394                  MysimTrack.charge       =simTrack.charge();
395  
396                  MyEvent->MySimTrackCollection.push_back(MysimTrack);
397 <           }
397 >           }      
398          }
399  
400  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines