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.12 by querten, Mon Mar 24 09:55:23 2008 UTC vs.
Revision 1.15 by querten, Sat Apr 5 07:40:33 2008 UTC

# Line 104 | Line 104 | class OpenGLDisplayer : public edm::EDAn
104        Geometry*    Geom_ECAL;
105        Geometry*    Geom_HCAL;
106  
107 +      std::string              OutputFile;
108 +
109 +      std::vector<InputTag> SimTrackProducers;
110 +      std::vector<InputTag> SimVertexProducers;
111 +      std::vector<InputTag> SimHitProducers;
112 +
113 +      std::vector<InputTag> TrackProducers;
114 +      std::vector<InputTag> EcalRecHitProducers;
115 +      std::vector<InputTag> HcalHBHERecHitProducers;
116 +      std::vector<InputTag> HcalHORecHitProducers;
117 +      std::vector<InputTag> HcalHFRecHitProducers;
118  
108      std::vector<std::string> SimHitSubdetectors;
119  
110      std::string              OutputFile;
120  
121  
122        // ----------member data ---------------------------
# Line 118 | Line 127 | class OpenGLDisplayer : public edm::EDAn
127   //
128   OpenGLDisplayer::OpenGLDisplayer(const edm::ParameterSet& iConfig)
129   {
130 <    SimHitSubdetectors  = iConfig.getParameter<std::vector<std::string> >("SimHitSubdetectors");
130 >    OutputFile              = iConfig.getParameter<std::string >("OutputFile");
131 >
132 >    SimTrackProducers       = iConfig.getParameter<std::vector<InputTag> >("SimTrackProducers");
133 >    SimVertexProducers      = iConfig.getParameter<std::vector<InputTag> >("SimVertexProducers");
134 >    SimHitProducers         = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
135 >
136 >    TrackProducers          = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
137 >    EcalRecHitProducers     = iConfig.getParameter<std::vector<InputTag> >("EcalRecHitProducers");
138 >    HcalHBHERecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHBHERecHitProducers");
139 >    HcalHORecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
140 >    HcalHFRecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers");
141  
123    OutputFile          = iConfig.getParameter<std::string >("OutputFile");
142   }
143  
144  
# Line 262 | Line 280 | OpenGLDisplayer::endJob() {
280   void
281   OpenGLDisplayer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
282   {
283 <
266 <        edm::Handle<std::vector< SimTrack > > h_SimTracks;
267 <        iEvent.getByLabel("g4SimHits", h_SimTracks);
268 <        std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
269 <
270 <        edm::Handle<std::vector< SimVertex > > h_Vertex;
271 <        iEvent.getByLabel("g4SimHits", h_Vertex);
272 <        std::vector< SimVertex > VertexColl = *h_Vertex.product();
283 >        MySimEvent* MyEvent = new MySimEvent;
284  
285  
286  
# Line 282 | Line 293 | OpenGLDisplayer::analyze(const edm::Even
293          TrackingGeometry::DetContainer theDetUnits = theTracker.dets();
294  
295  
296 +        // Save Data
297  
298 +        for(unsigned int i=0;i<SimTrackProducers.size();i++){
299 +           edm::Handle<std::vector< SimTrack > > h_SimTracks;
300 +           iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
301 +           std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
302  
303 <        // Save the data
288 <
289 <        MySimEvent* MyEvent = new MySimEvent;
303 >           MySimEvent* MyEvent = new MySimEvent;
304    
305 <        for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
305 >           for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
306                  MySimTrack  MysimTrack;
307                  SimTrack    simTrack    =SimTrackColl[a];
308  
# Line 302 | Line 316 | OpenGLDisplayer::analyze(const edm::Even
316                  MysimTrack.charge       =simTrack.charge();
317  
318                  MyEvent->MySimTrackCollection.push_back(MysimTrack);
319 <        }
319 >           }
320 >        }
321 >
322  
323 +        for(unsigned int i=0;i<SimVertexProducers.size();i++){
324 +           edm::Handle<std::vector< SimVertex > > h_Vertex;
325 +           iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
326 +           std::vector< SimVertex > VertexColl = *h_Vertex.product();
327  
328 <        for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
328 >           for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
329                  MySimVertex     MyVertex;
330                  SimVertex       Vertex  =  VertexColl[b];
331  
# Line 315 | Line 335 | OpenGLDisplayer::analyze(const edm::Even
335                  MyVertex.z              =Vertex.position().z();
336  
337                  MyEvent->MySimVertexCollection.push_back(MyVertex);
338 <        }
338 >           }
339 >        }
340  
341 <        for(unsigned int i=0; i<SimHitSubdetectors.size(); i++)
321 <        {
341 >        for(unsigned int i=0;i<SimHitProducers.size();i++){
342             edm::Handle<std::vector< PSimHit > > h_Hits;
343 <           iEvent.getByLabel("g4SimHits",SimHitSubdetectors[i].c_str(), h_Hits);
343 >           iEvent.getByLabel(SimHitProducers[i], h_Hits);
344             std::vector< PSimHit > Hits = *h_Hits.product();
345  
346             for(unsigned int h=0; h<Hits.size(); h++)
# Line 336 | Line 356 | OpenGLDisplayer::analyze(const edm::Even
356                  Hit.dEdX        = Hits[h].energyLoss();
357  
358                  MyEvent->MyPSimHitCollection.push_back(Hit);
339
359             }
360          }
361  
343        edm::Handle<std::vector< reco::Track > > h_Tracks;
344        iEvent.getByLabel("ctfWithMaterialTracks", h_Tracks);
345        std::vector< reco::Track > TrackColl = *h_Tracks.product();
362  
363 <        for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
363 >        for(unsigned int i=0;i<TrackProducers.size();i++){
364 >           edm::Handle<std::vector< reco::Track > > h_Tracks;
365 >           iEvent.getByLabel(TrackProducers[i], h_Tracks);
366 >           std::vector< reco::Track > TrackColl = *h_Tracks.product();
367 >
368 >           for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
369                  MyRecoTrack  MyrecoTrack;
370                  reco::Track  recoTrack  =TrackColl[t];
371  
351 //                MyrecoTrack.Hits = new MyRecoHit[MyrecoTrack.N];
352
372                  for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
373                        TrackingRecHitRef h_it     = recoTrack.recHit(h);
374                        if(!h_it->isValid() )continue;
# Line 364 | Line 383 | OpenGLDisplayer::analyze(const edm::Even
383                        hit.DetId  = detId.rawId();
384                        hit.Charge = -1;
385                        MyrecoTrack.Hits.push_back(hit);
367
368
369 //                    printf("%8.2f %8.2f %8.2f\n",theDet->surface().toGlobal(localPos).x(),theDet->surface().toGlobal(localPos).y(),theDet->surface().toGlobal(localPos).z());
386                  }
387                  MyEvent->MyRecoTrackCollection.push_back(MyrecoTrack);
388 +           }
389          }
390  
391  
392 <
393 <        edm::Handle<EcalRecHitCollection > h_EcalEB_RecHits;
394 <        iEvent.getByLabel("ecalRecHit","EcalRecHitsEB", h_EcalEB_RecHits);
395 <        EcalRecHitCollection EcalEB_RecHits = *h_EcalEB_RecHits.product();
396 <
397 <        for(unsigned int eh=0;eh<EcalEB_RecHits.size();eh++){
398 <                MyCaloHit temp_EcalEBHit;
399 <                temp_EcalEBHit.E     = EcalEB_RecHits[eh].energy();
400 <                temp_EcalEBHit.t     = EcalEB_RecHits[eh].time();
401 <                temp_EcalEBHit.DetId = (EcalEB_RecHits[eh].detid()).rawId();
402 <        
403 <                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalEBHit);
404 <        }
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);
392 >        for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
393 >           edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
394 >           iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
395 >           EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
396 >
397 >           for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
398 >                MyCaloHit temp_EcalHit;
399 >                temp_EcalHit.E     = Ecal_RecHits[eh].energy();
400 >                temp_EcalHit.t     = Ecal_RecHits[eh].time();
401 >                temp_EcalHit.DetId = (Ecal_RecHits[eh].detid()).rawId();
402 >        
403 >                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalHit);
404 >           }
405          }
406  
407  
408 +        for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
409 +           edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
410 +           iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
411 +           HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
412  
413 <        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++){
413 >           for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
414                  MyCaloHit temp_HcalHBHEHit;
415                  temp_HcalHBHEHit.E      = HcalHBHE_RecHits[hh].energy();
416                  temp_HcalHBHEHit.t      = HcalHBHE_RecHits[hh].time();
417                  temp_HcalHBHEHit.DetId = (HcalHBHE_RecHits[hh].detid()).rawId();
418  
419                  MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHBHEHit);
420 +           }
421          }
422  
423  
424 <        edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
425 <        iEvent.getByLabel("horeco", h_HcalHO_RecHits);
426 <        HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
424 >        for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
425 >           edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
426 >           iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
427 >           HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
428  
429 <        for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
429 >           for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
430                  MyCaloHit temp_HcalHOHit;
431                  temp_HcalHOHit.E      = HcalHO_RecHits[hh].energy();
432                  temp_HcalHOHit.t      = HcalHO_RecHits[hh].time();
433                  temp_HcalHOHit.DetId = (HcalHO_RecHits[hh].detid()).rawId();
434  
435                  MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHOHit);
436 +           }
437          }
438  
446        edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
447        iEvent.getByLabel("hfreco", h_HcalHF_RecHits);
448        HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
439  
440 <        for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
440 >        for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
441 >           edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
442 >           iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
443 >           HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
444 >
445 >           for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
446                  MyCaloHit temp_HcalHFHit;
447                  temp_HcalHFHit.E      = HcalHF_RecHits[hh].energy();
448                  temp_HcalHFHit.t      = HcalHF_RecHits[hh].time();
449                  temp_HcalHFHit.DetId = (HcalHF_RecHits[hh].detid()).rawId();
450  
451                  MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHFHit);
452 +           }
453          }
454  
459
460
461
462
463
464
465
466
467
468
455          MyEvents->Events.push_back(MyEvent);  
470
456   }
457  
458  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines