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.10 by querten, Fri Mar 21 19:40:46 2008 UTC vs.
Revision 1.13 by querten, Tue Mar 25 13:12:31 2008 UTC

# Line 54 | Line 54
54   #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
55   #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
56  
57 <
57 > #include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
58 > #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
59 > #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
60  
61   #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
62   #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
# Line 98 | Line 100 | class OpenGLDisplayer : public edm::EDAn
100  
101  
102        MySimEvents* MyEvents;
103 <      Geometry*    Geom;
103 >      Geometry*    Geom_Tracker;
104 >      Geometry*    Geom_ECAL;
105 >      Geometry*    Geom_HCAL;
106  
107  
108        std::vector<std::string> SimHitSubdetectors;
# Line 131 | Line 135 | OpenGLDisplayer::beginJob(const edm::Eve
135     DetId  Detid;
136     int    SubDet;
137  
138 <   MyEvents = new MySimEvents();
139 <   Geom     = new Geometry();
138 >   MyEvents     = new MySimEvents();
139 >   Geom_Tracker = new Geometry();
140 >   Geom_ECAL    = new Geometry();
141 >   Geom_HCAL    = new Geometry();
142 >
143  
144     edm::ESHandle<TrackerGeometry> tkGeom;
145     iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
# Line 173 | Line 180 | OpenGLDisplayer::beginJob(const edm::Eve
180  
181        GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
182  
183 <      Geom->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
183 >      Geom_Tracker->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
184             Pos.x(),                  Pos.y(),                  Pos.z(),
185             WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
186             LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
# Line 193 | Line 200 | OpenGLDisplayer::beginJob(const edm::Eve
200     {
201        Detid  = CaloDets[i];
202        SubDet = Detid.subdetId();
196    
197      if(Detid.det()!=DetId::Ecal) continue;
203  
204 <      //EcalBarrel=1, EcalEndcap=2, EcalPreshower=3, EcalTriggerTower=4, EcalLaserPnDiode=5
205 <      if(SubDet!=EcalBarrel)continue;
204 >      Geometry* Geom_temp = NULL;
205 >      if(Detid.det()==DetId::Ecal){
206 >        Geom_temp = Geom_ECAL;
207 >
208 >        if(SubDet<1 || SubDet>3){
209 >                printf("Don't Save EcalTriggerTower or EcalLaserPnDiode\n");
210 >                continue;
211 >        }
212 >      }else if(Detid.det()==DetId::Hcal){
213 >        Geom_temp = Geom_HCAL;
214 >
215 >        if(SubDet<1 || SubDet>4){
216 >                printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n");
217 >                continue;
218 >        }
219 >      }else{
220 >        continue;
221 >      }
222  
223        const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
224        GlobalPoint CellPos =  CellGeom->getPosition();
204
225        const CaloCellGeometry::CornersVec CellCorners =  CellGeom->getCorners();
226 <                
227 <      printf("Det = %i Subdet = %i --> %6.2f %6.2f %6.2f - %i\n",  Detid.det(), SubDet, CellPos.x(), CellPos.y(), CellPos.z(), CellCorners.size());
226 >
227 >      Geom_temp->Add_CaloDet(Detid.rawId(),
228 >                        CellPos.x()         ,   CellPos.y()         ,   CellPos.z(),
229 >                        CellCorners[0].x()  ,   CellCorners[0].y()  ,   CellCorners[0].z()  ,
230 >                        CellCorners[1].x()  ,   CellCorners[1].y()  ,   CellCorners[1].z()  ,
231 >                        CellCorners[2].x()  ,   CellCorners[2].y()  ,   CellCorners[2].z()  ,
232 >                        CellCorners[3].x()  ,   CellCorners[3].y()  ,   CellCorners[3].z()  ,
233 >                        CellCorners[4].x()  ,   CellCorners[4].y()  ,   CellCorners[4].z()  ,
234 >                        CellCorners[5].x()  ,   CellCorners[5].y()  ,   CellCorners[5].z()  ,
235 >                        CellCorners[6].x()  ,   CellCorners[6].y()  ,   CellCorners[6].z()  ,
236 >                        CellCorners[7].x()  ,   CellCorners[7].y()  ,   CellCorners[7].z()  );
237     }
238  
239 +   Geom_Tracker->Save("Tracker.geom");    
240 +   Geom_ECAL->Save("ECAL.geom");
241 +   Geom_HCAL->Save("HCAL.geom");
242  
211   Geom->Save("Tracker.geom");    
243  
244  
245   }
# Line 218 | Line 249 | void
249   OpenGLDisplayer::endJob() {
250    
251     MyEvents->Save((char*) OutputFile.c_str());
252 <   MyEvents->Load((char*) OutputFile.c_str());
252 > //   MyEvents->Load((char*) OutputFile.c_str());
253   }
254  
255  
# Line 340 | Line 371 | OpenGLDisplayer::analyze(const edm::Even
371                  MyEvent->MyRecoTrackCollection.push_back(MyrecoTrack);
372          }
373  
374 +
375 +
376 +        edm::Handle<EcalRecHitCollection > h_EcalEB_RecHits;
377 +        iEvent.getByLabel("ecalRecHit","EcalRecHitsEB", h_EcalEB_RecHits);
378 +        EcalRecHitCollection EcalEB_RecHits = *h_EcalEB_RecHits.product();
379 +
380 +        for(unsigned int eh=0;eh<EcalEB_RecHits.size();eh++){
381 +                MyCaloHit temp_EcalEBHit;
382 +                temp_EcalEBHit.E     = EcalEB_RecHits[eh].energy();
383 +                temp_EcalEBHit.t     = EcalEB_RecHits[eh].time();
384 +                temp_EcalEBHit.DetId = (EcalEB_RecHits[eh].detid()).rawId();
385 +        
386 +                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalEBHit);
387 +        }
388 +
389 +
390 +        edm::Handle<EcalRecHitCollection > h_EcalEE_RecHits;
391 +        iEvent.getByLabel("ecalRecHit","EcalRecHitsEE", h_EcalEE_RecHits);
392 +        EcalRecHitCollection EcalEE_RecHits = *h_EcalEE_RecHits.product();
393 +
394 +        for(unsigned int eh=0;eh<EcalEE_RecHits.size();eh++){
395 +                MyCaloHit temp_EcalEEHit;
396 +                temp_EcalEEHit.E     = EcalEE_RecHits[eh].energy();
397 +                temp_EcalEEHit.t     = EcalEE_RecHits[eh].time();
398 +                temp_EcalEEHit.DetId = (EcalEE_RecHits[eh].detid()).rawId();
399 +
400 +                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalEEHit);
401 +        }
402 +
403 +
404 +        edm::Handle<EcalRecHitCollection > h_EcalES_RecHits;
405 +        iEvent.getByLabel("ecalPreshowerRecHit","EcalRecHitsES", h_EcalES_RecHits);
406 +        EcalRecHitCollection EcalES_RecHits = *h_EcalES_RecHits.product();
407 +
408 +        for(unsigned int eh=0;eh<EcalES_RecHits.size();eh++){
409 +                MyCaloHit temp_EcalESHit;
410 +                temp_EcalESHit.E     = EcalES_RecHits[eh].energy();
411 +                temp_EcalESHit.t     = EcalES_RecHits[eh].time();
412 +                temp_EcalESHit.DetId = (EcalES_RecHits[eh].detid()).rawId();
413 +
414 +                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalESHit);
415 +        }
416 +
417 +
418 +
419 +        edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
420 +        iEvent.getByLabel("hbhereco", h_HcalHBHE_RecHits);
421 +        HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
422 +
423 +        for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
424 +                MyCaloHit temp_HcalHBHEHit;
425 +                temp_HcalHBHEHit.E      = HcalHBHE_RecHits[hh].energy();
426 +                temp_HcalHBHEHit.t      = HcalHBHE_RecHits[hh].time();
427 +                temp_HcalHBHEHit.DetId = (HcalHBHE_RecHits[hh].detid()).rawId();
428 +
429 +                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHBHEHit);
430 +        }
431 +
432 +
433 +        edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
434 +        iEvent.getByLabel("horeco", h_HcalHO_RecHits);
435 +        HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
436 +
437 +        for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
438 +                MyCaloHit temp_HcalHOHit;
439 +                temp_HcalHOHit.E      = HcalHO_RecHits[hh].energy();
440 +                temp_HcalHOHit.t      = HcalHO_RecHits[hh].time();
441 +                temp_HcalHOHit.DetId = (HcalHO_RecHits[hh].detid()).rawId();
442 +
443 +                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHOHit);
444 +        }
445 +
446 +        edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
447 +        iEvent.getByLabel("hfreco", h_HcalHF_RecHits);
448 +        HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
449 +
450 +        for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
451 +                MyCaloHit temp_HcalHFHit;
452 +                temp_HcalHFHit.E      = HcalHF_RecHits[hh].energy();
453 +                temp_HcalHFHit.t      = HcalHF_RecHits[hh].time();
454 +                temp_HcalHFHit.DetId = (HcalHF_RecHits[hh].detid()).rawId();
455 +
456 +                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHFHit);
457 +        }
458 +
459 +
460 +
461 +
462 +
463 +
464 +
465 +
466 +
467 +
468 +
469          MyEvents->Events.push_back(MyEvent);  
470  
471   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines