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.2 by querten, Sat Mar 15 17:02:20 2008 UTC vs.
Revision 1.8 by querten, Fri Mar 21 08:41:36 2008 UTC

# Line 61 | Line 61
61   #include "DataFormats/TrackReco/interface/Track.h"
62  
63   #include "DataFormats/Math/interface/Point3D.h"
64 <
64 > #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
65 > #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
66  
67   #include "Visualisation/OpenGLDisplayer/interface/SimEvent.h"
68 < //#include "Visualisation/OpenGLDisplayer/interface/SimEvent.cpp"
68 <
69 <
68 > #include "Visualisation/OpenGLDisplayer/interface/Geometry.h"
69  
70   using namespace edm;
71   using namespace std;
# Line 82 | Line 81 | class OpenGLDisplayer : public edm::EDAn
81  
82  
83     private:
84 <      virtual void beginJob(const edm::EventSetup&) ;
85 <      virtual void analyze(const edm::Event&, const edm::EventSetup&);
86 <      virtual void endJob() ;
84 >      virtual void beginJob(const edm::EventSetup& iSetup);
85 >      virtual void analyze (const edm::Event&, const edm::EventSetup&);
86 >      virtual void endJob  ();
87  
88  
89        MySimEvents* MyEvents;
90 +      Geometry*    Geom;
91  
92  
93        std::vector<std::string> SimHitSubdetectors;
# Line 115 | Line 115 | OpenGLDisplayer::~OpenGLDisplayer()
115  
116   // ------------ method called once each job just before starting event loop  ------------
117   void
118 < OpenGLDisplayer::beginJob(const edm::EventSetup&)
118 > OpenGLDisplayer::beginJob(const edm::EventSetup& iSetup)
119   {
120  
121
121     MyEvents = new MySimEvents();
122 +   Geom     = new Geometry();
123 +
124 +   edm::ESHandle<TrackerGeometry> tkGeom;
125 +   iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
126 +   vector<GeomDet*> Det = tkGeom->dets();
127 +
128 +   for(unsigned int i=0;i<Det.size();i++){
129 +      DetId  Detid  = Det[i]->geographicalId();
130 + //      int    SubDet = Detid.subdetId();
131 +  
132 +      GeomDet* DetUnit = Det[i];
133 +      if(!DetUnit)continue;
134 +      const BoundPlane plane = DetUnit->surface();
135 +      const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
136 +      const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));  
137 +
138 +      float width;
139 +      float length;
140 +      float thickness;
141 +      float TrapezoidalParam;
142 +
143 +      if(trapezoidalBounds)
144 +      {
145 +         std::vector<float> const & parameters = (*trapezoidalBounds).parameters();      
146 +         width            = parameters[0]*2;
147 +         length           = parameters[3]*2;  
148 +         thickness        =  (*trapezoidalBounds).thickness();
149 +         TrapezoidalParam = parameters[1]/parameters[0];
150 +      }else if(rectangularBounds){
151 +         width            = DetUnit->surface().bounds().width();
152 +         length           = DetUnit->surface().bounds().length();
153 +         thickness        = DetUnit->surface().bounds().thickness();
154 +         TrapezoidalParam = 1;
155 +      }
156 +
157 +      Surface::GlobalPoint WidthVector  = plane.toGlobal( LocalPoint(width/2, 0, 0) );
158 +      Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
159 +      Surface::GlobalPoint ThickVector  = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
160 +
161 +      GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
162 +
163 +      Geom->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
164 +           Pos.x(),                  Pos.y(),                  Pos.z(),
165 +           WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
166 +           LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
167 +           ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
168 +      
169 +
170 +   }
171 +   Geom->Save("Tracker.geom");    
172 +
173  
174   }
175  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines