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

Comparing UserCode/FastOpenGlDisplayer/src/Frog_Analyzer.cc (file contents):
Revision 1.3 by querten, Sat Apr 19 14:46:02 2008 UTC vs.
Revision 1.19 by querten, Tue Jul 1 12:51:37 2008 UTC

# Line 79 | Line 79
79   #include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
80   #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
81   #include "DataFormats/TrackReco/interface/Track.h"
82 + #include "TrackingTools/PatternTools/interface/Trajectory.h"
83 + #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
84 +
85  
86   #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
87   #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
# Line 91 | Line 94
94   #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
95   #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
96  
97 < #include "Visualisation/Frog/interface/SimEvent.h"
98 < #include "Visualisation/Frog/interface/Geometry.h"
97 > #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
98 > #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
99 > #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
100 > #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
101 > #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
102 > #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
103 > #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
104 > #include "DataFormats/SiStripDetId/interface/TECDetId.h"
105 >
106 > #include "DataFormats/MuonDetId/interface/DTChamberId.h"
107 > #include "DataFormats/MuonDetId/interface/CSCDetId.h"
108 > #include "DataFormats/MuonDetId/interface/RPCDetId.h"
109 >
110 > #include "DataFormats/EcalDetId/interface/EBDetId.h"
111 > #include "DataFormats/EcalDetId/interface/EEDetId.h"
112 > #include "DataFormats/EcalDetId/interface/ESDetId.h"
113 > #include "DataFormats/HcalDetId/interface/HcalDetId.h"
114 >
115 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Base_With_DetId.h"
116 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.h"
117 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.cpp"
118 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_Track.h"
119 >
120 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.h"
121 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.cpp"
122 >
123 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.h"
124 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.cpp"
125 >
126 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_DetId.h"
127 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_ReadCards.cpp"
128 >
129  
130   using namespace edm;
131   using namespace std;
# Line 112 | Line 145 | class Frog_Analyzer : public edm::EDAnal
145        virtual void analyze (const edm::Event&, const edm::EventSetup&);
146        virtual void endJob  ();
147  
148 +      FROG_Element_Base*    events_prim;
149  
150 <      MySimEvents* MyEvents;
117 <      Geometry*    Geom_Tracker;
118 <      Geometry*    Geom_ECAL;
119 <      Geometry*    Geom_HCAL;
120 <      Geometry*    Geom_Muon;
121 <
122 <
123 <      std::string              OutputFile;
150 >      std::string           OutputFile;
151  
152        std::vector<InputTag> SimTrackProducers;
153        std::vector<InputTag> SimVertexProducers;
154        std::vector<InputTag> SimHitProducers;
155  
156        std::vector<InputTag> TrackProducers;
157 +      std::vector<InputTag> TrajectoryProducers;
158        std::vector<InputTag> EcalRecHitProducers;
159        std::vector<InputTag> HcalHBHERecHitProducers;
160        std::vector<InputTag> HcalHORecHitProducers;
# Line 137 | Line 165 | class Frog_Analyzer : public edm::EDAnal
165        std::vector<InputTag> RPCHitsProducers;
166  
167  
140
141
168        // ----------member data ---------------------------
169   };
170  
# Line 154 | Line 180 | Frog_Analyzer::Frog_Analyzer(const edm::
180      SimHitProducers         = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
181  
182      TrackProducers          = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
183 +    TrajectoryProducers     = iConfig.getParameter<std::vector<InputTag> >("TrajectoryProducers");
184      EcalRecHitProducers     = iConfig.getParameter<std::vector<InputTag> >("EcalRecHitProducers");
185      HcalHBHERecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHBHERecHitProducers");
186      HcalHORecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
# Line 176 | Line 203 | void
203   Frog_Analyzer::beginJob(const edm::EventSetup& iSetup)
204   {
205     DetId  Detid;
206 <   int    SubDet;
206 >   unsigned int    SubDet;
207  
208 <   MyEvents     = new MySimEvents();
209 <   Geom_Tracker = new Geometry();
210 <   Geom_ECAL    = new Geometry();
211 <   Geom_HCAL    = new Geometry();
212 <   Geom_Muon    = new Geometry();
208 >   unsigned int Frog_DetId;
209 >   FROG_Element_Base*            FEB      = NULL;
210 >   FROG_Element_Base_With_DetId* FEB_Temp = NULL;
211 >
212 >   FROG_Element_Base* prim               = new FROG_Element_Base(C_PRIMARY);
213 >   FROG_Element_Base* geom               = new FROG_Element_Base(C_GEOMETRY);                          prim->addDaughter(geom);
214 >   FROG_Element_Base_With_DetId* tracker = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_TRK);   geom->addDaughter(tracker);
215 >   FROG_Element_Base_With_DetId* muon    = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_MUON);  geom->addDaughter(muon);
216 >   FROG_Element_Base_With_DetId* ecal    = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_ECAL);  geom->addDaughter(ecal);
217 >   FROG_Element_Base_With_DetId* hcal    = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_HCAL);  geom->addDaughter(hcal);
218  
219  
220     // ### TRACKER GEOMETRY ###
# Line 193 | Line 225 | Frog_Analyzer::beginJob(const edm::Event
225  
226     for(unsigned int i=0;i<TrackerDets.size();i++){
227        Detid  = TrackerDets[i]->geographicalId();
228 < //    SubDet = Detid.subdetId();
228 >      SubDet = Detid.subdetId();
229 >      if(SubDet<1 || SubDet>6) continue;
230 >
231    
232        GeomDet* DetUnit = TrackerDets[i];
233        if(!DetUnit)continue;
# Line 206 | Line 240 | Frog_Analyzer::beginJob(const edm::Event
240        float thickness        = 0;
241        float TrapezoidalParam = 0;
242  
243 <      if(trapezoidalBounds)
210 <      {
243 >      if(trapezoidalBounds){
244           std::vector<float> const & parameters = (*trapezoidalBounds).parameters();      
245           width            = parameters[0]*2;
246           length           = parameters[3]*2;  
247 <         thickness        =  (*trapezoidalBounds).thickness();
247 >         thickness        = (*trapezoidalBounds).thickness();
248           TrapezoidalParam = parameters[1]/parameters[0];
249        }else if(rectangularBounds){
250           width            = DetUnit->surface().bounds().width();
# Line 226 | Line 259 | Frog_Analyzer::beginJob(const edm::Event
259  
260        GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
261  
262 <      Geom_Tracker->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
263 <           Pos.x(),                  Pos.y(),                  Pos.z(),
264 <           WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
262 >      FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
263 >           Detid.rawId(),           TrapezoidalParam,
264 >           Pos.x(),                  Pos.y(),                  Pos.z(),
265 >           WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
266             LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
267             ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
234      
268  
236   }
237
238
239   // ### CALO GEOMETRY ###
240
241   edm::ESHandle<CaloGeometry> CaloGeom;
242   iSetup.get<IdealGeometryRecord>().get( CaloGeom );
243   const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
269  
270 <   for(unsigned int i=0;i<CaloDets.size();i++)
271 <   {
272 <      Detid  = CaloDets[i];
273 <      SubDet = Detid.subdetId();
274 <
275 <      Geometry* Geom_temp = NULL;
276 <      if(Detid.det()==DetId::Ecal){
277 <        Geom_temp = Geom_ECAL;
278 <
279 <        if(SubDet<1 || SubDet>3){
280 <                printf("Don't Save EcalTriggerTower or EcalLaserPnDiode\n");
281 <                continue;
282 <        }
283 <      }else if(Detid.det()==DetId::Hcal){
284 <        Geom_temp = Geom_HCAL;
285 <
286 <        if(SubDet<1 || SubDet>4){
287 <                printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n");
288 <                continue;
289 <        }
270 >      Frog_DetId = DETID_TRK;
271 >      FEB        = tracker;
272 >
273 >      Frog_DetId += SubDet*100000;
274 >      FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
275 >      FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
276 >      if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
277 >
278 >      if(SubDet==PixelSubdetector::PixelBarrel){
279 >         PXBDetId detid = PXBDetId(Detid);
280 >
281 >         Frog_DetId += detid.layer()*10000;
282 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
283 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
284 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
285 >
286 >         Frog_DetId += detid.ladder()*100;
287 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
288 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
289 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
290 >      }else if(SubDet==PixelSubdetector::PixelEndcap){
291 >         PXFDetId detid = PXFDetId(Detid);
292 >
293 >         Frog_DetId += detid.side()*10000;
294 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
295 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
296 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
297 >
298 >         Frog_DetId += detid.disk()*1000;
299 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
300 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
301 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
302 >
303 >         Frog_DetId += detid.blade()*10;
304 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
305 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
306 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
307 >
308 >         Frog_DetId += detid.panel()*1;
309 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
310 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
311 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
312 >      }else if(SubDet==StripSubdetector::TIB){
313 >         TIBDetId detid = TIBDetId(Detid);
314 >
315 >         Frog_DetId += detid.layer()*10000;
316 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
317 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
318 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
319 >
320 >         Frog_DetId += detid.stringNumber()*100;
321 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
322 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
323 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
324 >      }else if(SubDet==StripSubdetector::TID){
325 >         TIDDetId detid = TIDDetId(Detid);
326 >
327 >         Frog_DetId += detid.side()*10000;
328 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
329 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
330 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
331 >
332 >         Frog_DetId += detid.wheel()*1000;
333 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
334 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
335 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
336 >
337 >         Frog_DetId += detid.ring()*10;
338 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
339 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
340 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
341 >      }else if(SubDet==StripSubdetector::TOB){
342 >         TOBDetId detid = TOBDetId(Detid);
343 >
344 >         Frog_DetId += detid.layer()*10000;
345 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
346 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
347 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
348 >
349 >         Frog_DetId += detid.rodNumber()*100;
350 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
351 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
352 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
353 >      }else if(SubDet==StripSubdetector::TEC){
354 >         TECDetId detid = TECDetId(Detid);
355 >
356 >         Frog_DetId += detid.side()*10000;
357 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
358 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
359 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
360 >
361 >         Frog_DetId += detid.wheel()*1000;
362 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
363 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
364 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
365 >
366 >         Frog_DetId += detid.ring()*10;
367 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
368 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
369 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
370 >
371 >         Frog_DetId += detid.petalNumber();
372 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
373 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
374 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
375        }else{
376 <        continue;
376 >         if(mod)delete mod;
377 >         continue;
378        }
379 <
269 <      const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
270 <      GlobalPoint CellPos =  CellGeom->getPosition();
271 <      const CaloCellGeometry::CornersVec CellCorners =  CellGeom->getCorners();
272 <
273 <      Geom_temp->Add_CaloDet(Detid.rawId(),
274 <                        CellPos.x()         ,   CellPos.y()         ,   CellPos.z(),
275 <                        CellCorners[0].x()  ,   CellCorners[0].y()  ,   CellCorners[0].z()  ,
276 <                        CellCorners[1].x()  ,   CellCorners[1].y()  ,   CellCorners[1].z()  ,
277 <                        CellCorners[2].x()  ,   CellCorners[2].y()  ,   CellCorners[2].z()  ,
278 <                        CellCorners[3].x()  ,   CellCorners[3].y()  ,   CellCorners[3].z()  ,
279 <                        CellCorners[4].x()  ,   CellCorners[4].y()  ,   CellCorners[4].z()  ,
280 <                        CellCorners[5].x()  ,   CellCorners[5].y()  ,   CellCorners[5].z()  ,
281 <                        CellCorners[6].x()  ,   CellCorners[6].y()  ,   CellCorners[6].z()  ,
282 <                        CellCorners[7].x()  ,   CellCorners[7].y()  ,   CellCorners[7].z()  );
379 >      FEB->addDaughter(mod);
380     }
381  
382 +
383     // ### MUON GEOMETRY ###
384  
385     edm::ESHandle<DTGeometry> DtGeom;
# Line 338 | Line 436 | Frog_Analyzer::beginJob(const edm::Event
436  
437        GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
438  
439 <      Geom_Muon->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
439 >      FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
440 >           Detid.rawId(),           TrapezoidalParam,
441             Pos.x(),                  Pos.y(),                  Pos.z(),
442             WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
443             LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
444             ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
445 +
446 +      Frog_DetId = DETID_MUON;
447 +      FEB        = muon;
448 +
449 +      Frog_DetId += SubDet*100000;
450 +      FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
451 +      FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
452 +      if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
453 +
454 +      if(SubDet==1){
455 +         DTChamberId detid = DTChamberId(Detid);
456 +
457 +         Frog_DetId += (detid.wheel()+3)*10000;
458 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
459 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
460 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
461 +
462 +         Frog_DetId += detid.station()*100;
463 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
464 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
465 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
466 +
467 +         Frog_DetId += detid.sector()*1;
468 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
469 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
470 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
471 +      }else if(SubDet==2){
472 +         CSCDetId detid = CSCDetId(Detid);
473 +  
474 +         Frog_DetId += detid.endcap()*10000;
475 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
476 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
477 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
478 +  
479 +         Frog_DetId += detid.station()*1000;
480 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
481 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
482 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
483 +  
484 +         Frog_DetId += detid.ring()*100;
485 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
486 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
487 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
488 +
489 +         Frog_DetId += detid.chamber()*1;
490 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
491 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
492 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
493 +      }else if(SubDet==3){
494 +         RPCDetId detid = RPCDetId(Detid);
495 +
496 +         Frog_DetId += (detid.region()+2)*10000;
497 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
498 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
499 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
500 +
501 +         // Barrel
502 +         if(detid.region()==0){
503 +            Frog_DetId += (detid.ring()+3)*1000;
504 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
505 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
506 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
507 +         // Endcap
508 +         }else{
509 +            Frog_DetId += detid.ring()*1000;
510 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
511 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
512 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
513 +         }
514 +
515 +         Frog_DetId += detid.station()*100;
516 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
517 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
518 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
519 +
520 +         Frog_DetId += detid.sector()*1;
521 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
522 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
523 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
524 +      }
525 +
526 +      FEB->addDaughter(mod);
527     }
528  
529  
530 <   // ### Save .geom ###
530 >      
531 >   // ### CALO GEOMETRY ###
532 >
533 >   edm::ESHandle<CaloGeometry> CaloGeom;
534 >   iSetup.get<IdealGeometryRecord>().get( CaloGeom );
535 >   const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
536 >
537 >   for(unsigned int i=0;i<CaloDets.size();i++)
538 >   {
539 >      Detid  = CaloDets[i];
540 >      SubDet = Detid.subdetId();
541  
542 <   Geom_Tracker->Save("Tracker.geom");    
543 <   Geom_ECAL   ->Save("Ecal.geom");
544 <   Geom_HCAL   ->Save("Hcal.geom");
545 <   Geom_Muon   ->Save("Muon.geom");
542 >      if(Detid.det()==DetId::Ecal){
543 >        if(SubDet<1 || SubDet>3) continue;
544 >
545 >         Frog_DetId = DETID_ECAL;
546 >         FEB        = ecal;
547 >
548 >         Frog_DetId += SubDet*100000;
549 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
550 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
551 >         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
552 >
553 >         if(SubDet==1){
554 >            EBDetId detid = EBDetId(Detid);
555 >
556 >            Frog_DetId += ((detid.zside()==1)+1)*10000;
557 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
558 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
559 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
560 >
561 >            Frog_DetId += (detid.tower_ieta()*detid.zside())*100;
562 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
563 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
564 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
565 >
566 >            Frog_DetId += detid.tower_iphi()*1;
567 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
568 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
569 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
570 >         }else if(SubDet==2){
571 >            EEDetId detid = EEDetId(Detid);
572 >
573 >            Frog_DetId += ((detid.zside()==1)+1)*10000;
574 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
575 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
576 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
577 >
578 >            Frog_DetId += detid.iquadrant()*1000;
579 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
580 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
581 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
582 >
583 >            Frog_DetId += detid.isc();
584 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
585 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
586 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
587 >         }else if(SubDet==3){
588 >            ESDetId detid = ESDetId(Detid);
589  
590 +            Frog_DetId += ((detid.zside()==1)+1)*10000;
591 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
592 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
593 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
594 +
595 +            Frog_DetId += detid.plane()*1000;
596 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
597 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
598 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
599 +
600 +            Frog_DetId += detid.six()*50;
601 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
602 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
603 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
604 +
605 +            Frog_DetId += detid.siy();
606 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
607 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
608 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
609 +         }
610 +      }else if(Detid.det()==DetId::Hcal){
611 +        if(SubDet<1 || SubDet>4) continue;
612 +
613 +         Frog_DetId = DETID_HCAL;
614 +         FEB        = hcal;
615 +
616 +         Frog_DetId += SubDet*100000;
617 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
618 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
619 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
620 +
621 +         if(true){
622 +            HcalDetId detid = HcalDetId(Detid);
623 +
624 +            Frog_DetId += ((detid.zside()==1)+1)*10000;
625 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
626 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
627 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
628 +
629 +            Frog_DetId += detid.ietaAbs()*100;
630 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
631 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
632 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
633 +
634 +            Frog_DetId += detid.iphi()*1;
635 +            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
636 +            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
637 +            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
638 +         }
639 +
640 +
641 +
642 +      }else if(Detid.det() == DetId::Calo){
643 +      continue;
644 +      /*
645 +         Frog_DetId = DETID_CALO + 1000000;
646 +         FEB        = hcal;
647 +
648 +         Frog_DetId += SubDet*100000;
649 +         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
650 +         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
651 +         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
652 +      */
653 +      }
654 +
655 +      const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
656 +      GlobalPoint CellPos =  CellGeom->getPosition();
657 +      const CaloCellGeometry::CornersVec CellCorners =  CellGeom->getCorners();
658 +
659 +      float cX = (CellCorners[0].x() + CellCorners[2].x())/2;
660 +      float cY = (CellCorners[0].y() + CellCorners[2].y())/2;
661 +      float cZ = (CellCorners[0].z() + CellCorners[2].z())/2;
662 +
663 +      float wX = (CellCorners[1].x() - CellCorners[0].x())/2;
664 +      float wY = (CellCorners[1].y() - CellCorners[0].y())/2;
665 +      float wZ = (CellCorners[1].z() - CellCorners[0].z())/2;
666 +        
667 +      float hX = (CellCorners[3].x() - CellCorners[0].x())/2;
668 +      float hY = (CellCorners[3].y() - CellCorners[0].y())/2;
669 +      float hZ = (CellCorners[3].z() - CellCorners[0].z())/2;
670 +
671 +      float F  = sqrt( pow(CellCorners[4].x()+CellCorners[6].x(),2) + pow(CellCorners[4].y()+CellCorners[6].y(),2) + pow(CellCorners[4].z()+CellCorners[6].z(),2) );
672 +            F /= sqrt( pow(CellCorners[0].x()+CellCorners[2].x(),2) + pow(CellCorners[0].y()+CellCorners[2].y(),2) + pow(CellCorners[0].z()+CellCorners[2].z(),2) );
673 +
674 +      FROG_Element_Geom_CaloMod* mod = new FROG_Element_Geom_CaloMod(
675 +                        Detid.rawId(), F,
676 +                        cX  ,   cY  , cZ ,
677 +                        wX  ,   wY  , wZ ,
678 +                        hX  ,   hY  , hZ );
679 +
680 +      FEB->addDaughter(mod);
681 +   }
682 +
683 +
684 +
685 +   // ### Save .geom ###
686 +
687 +   FROG_Geometry* CMS_Geom = new FROG_Geometry(prim);
688 +   CMS_Geom->Save("CMS.geom");  
689 +
690 +   events_prim = new FROG_Element_Base(C_PRIMARY);  
691   }
692  
693   // ------------ method called once each job just after ending the event loop  ------------
694   void
695 < Frog_Analyzer::endJob() {
696 <  
697 <   MyEvents->Save((char*) OutputFile.c_str());
698 < //   MyEvents->Load((char*) OutputFile.c_str());
695 > Frog_Analyzer::endJob()
696 > {
697 >   FROG_Events* events = new FROG_Events(events_prim);
698 >   events->Save((char*) OutputFile.c_str());
699   }
700  
701  
# Line 373 | Line 708 | Frog_Analyzer::endJob() {
708   void
709   Frog_Analyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
710   {
711 <        MySimEvent* MyEvent = new MySimEvent;
711 >        FROG_Element_Event* event =  new FROG_Element_Event();
712 >        events_prim->addDaughter(event);
713  
714          // access the tracker
715          edm::ESHandle<TrackerGeometry> tkGeom;
# Line 389 | Line 725 | Frog_Analyzer::analyze(const edm::Event&
725          iSetup.get<MuonGeometryRecord>().get( RpcGeom );
726  
727  
728 +
729 +           edm::Handle<std::vector< SimVertex > > h_Vertex2;
730 +           iEvent.getByLabel(SimVertexProducers[0], h_Vertex2);
731 +           std::vector< SimVertex > VertexColl2 = *h_Vertex2.product();
732 +
733 +
734          // Save Data
735          // ### SIMTRACK ###
736          for(unsigned int i=0;i<SimTrackProducers.size();i++){
# Line 396 | Line 738 | Frog_Analyzer::analyze(const edm::Event&
738             iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
739             std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
740  
741 +           FROG_Element_Base_With_DetId* frogSimTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMTRK + i);
742 +           event->addDaughter(frogSimTrkColl);
743 +
744             for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
400                MySimTrack  MysimTrack;
745                  SimTrack    simTrack    =SimTrackColl[a];
746  
747 <                MysimTrack.track_id     =simTrack.trackId();
748 <                MysimTrack.Type         =simTrack.type();
749 <                MysimTrack.parent_vertex=simTrack.vertIndex();
750 <                MysimTrack.Px           =simTrack.momentum().x();
751 <                MysimTrack.Py           =simTrack.momentum().y();
752 <                MysimTrack.Pz           =simTrack.momentum().z();
753 <                MysimTrack.E            =simTrack.momentum().e();
754 <                MysimTrack.charge       =simTrack.charge();
747 >                FROG_Element_Event_Sim_Track* frogSimTrk =  new FROG_Element_Event_Sim_Track(simTrack.trackId(),
748 >                        simTrack.momentum().x(),     simTrack.momentum().y(),     simTrack.momentum().z(),
749 >                        simTrack.momentum().e(),     simTrack.type(),             simTrack.vertIndex(),
750 >                        simTrack.charge() );
751 >                frogSimTrkColl->addDaughter(frogSimTrk);
752 >
753 >                printf("Track %+05i --> Pt=%6.2f\n",simTrack.trackId(),simTrack.momentum().perp());
754 >                printf("Track %+05i --> Vertex1 = %6.2f %6.2f %6.2f\n",simTrack.trackId(),VertexColl2[simTrack.vertIndex()].position().x(),VertexColl2[simTrack.vertIndex()].position().y(),VertexColl2[simTrack.vertIndex()].position().z());
755 > //                for(unsigned int v=0;v<VertexColl2.size();v++){
756 > //                 if()
757 > //                }
758 >
759  
412                MyEvent->MySimTrackCollection.push_back(MysimTrack);
760             }      
761          }
762  
# Line 419 | Line 766 | Frog_Analyzer::analyze(const edm::Event&
766             iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
767             std::vector< SimVertex > VertexColl = *h_Vertex.product();
768  
769 +           FROG_Element_Base_With_DetId* frogSimVtxColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMVTX + i);
770 +           event->addDaughter(frogSimVtxColl);
771 +
772             for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
423                MySimVertex     MyVertex;
773                  SimVertex       Vertex  =  VertexColl[b];
774  
775 <                MyVertex.parentTrack_id =Vertex.parentIndex ();
776 <                MyVertex.x              =Vertex.position().x();
777 <                MyVertex.y              =Vertex.position().y();
429 <                MyVertex.z              =Vertex.position().z();
775 >                FROG_Element_Event_Sim_Vertex* frogSimVtx = new FROG_Element_Event_Sim_Vertex(
776 >                        Vertex.position().x(),  Vertex.position().y(),  Vertex.position().z(),
777 >                        Vertex.parentIndex());
778  
779 <                MyEvent->MySimVertexCollection.push_back(MyVertex);
779 >                frogSimVtxColl->addDaughter(frogSimVtx);
780             }
781          }
782  
783 +
784          // ### SIMHIT ###
785 +
786          for(unsigned int i=0;i<SimHitProducers.size();i++){
787             edm::Handle<std::vector< PSimHit > > h_Hits;
788             iEvent.getByLabel(SimHitProducers[i], h_Hits);
789             std::vector< PSimHit > Hits = *h_Hits.product();
790  
791 +           FROG_Element_Base_With_DetId* frogSimHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT + i);
792 +           event->addDaughter(frogSimHitColl);
793 +
794             for(unsigned int h=0; h<Hits.size(); h++)
795             {
796                  DetId theDetUnitId(Hits[h].detUnitId());
797                  const GeomDet* theDet = tkGeom->idToDet(theDetUnitId);
798  
799 <                MyPSimHit Hit;
800 <                Hit.x           = theDet->surface().toGlobal(Hits[h].localPosition()).x();
801 <                Hit.y           = theDet->surface().toGlobal(Hits[h].localPosition()).y();
802 <                Hit.z           = theDet->surface().toGlobal(Hits[h].localPosition()).z();
803 <                Hit.ProcessType = Hits[h].processType();
451 <                Hit.dEdX        = Hits[h].energyLoss();
452 <
453 <                MyEvent->MyPSimHitCollection.push_back(Hit);
799 >                
800 >                FROG_Element_Event_Sim_Hit* frogSimHit = new FROG_Element_Event_Sim_Hit(
801 >                        theDet->surface().toGlobal(Hits[h].localPosition()).x(),theDet->surface().toGlobal(Hits[h].localPosition()).y(),theDet->surface().toGlobal(Hits[h].localPosition()).z(),
802 >                        Hits[h].energyLoss(), Hits[h].processType() );
803 >                frogSimHitColl->addDaughter(frogSimHit);
804             }
805          }
806  
807  
808 <        // ### TRACKS ###
808 >
809 >        // ### TRAJECTORY ###
810 >        for(unsigned int i=0;i<TrajectoryProducers.size();i++){
811 >             Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
812 >             iEvent.getByLabel(TrajectoryProducers[i], trajTrackAssociationHandle);
813 >             const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
814 >
815 >             FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + i);
816 >             event->addDaughter(frogTrkColl);
817 >
818 >             for(TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it!=TrajToTrackMap.end(); ++it) {
819 >                Trajectory  recoTraj     = *it->key;
820 >                FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(i,it->val->p(),it->val->pt(),it->key->chiSquared());
821 >                frogTrkColl->addDaughter(frogTrk);
822 >
823 >                std::vector<TrajectoryMeasurement> measurements = recoTraj.measurements();
824 >                for(unsigned int h=0;h<measurements.size();h++){
825 >
826 >                      TrajectoryMeasurement::ConstRecHitPointer h_it = measurements[h].recHit();
827 >                      if(!h_it->isValid() )continue;
828 >                      DetId detId                = h_it->geographicalId();
829 >                      GlobalPoint globalPos      = measurements[h].updatedState().globalPosition();
830 >
831 >                      FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(detId.rawId(), globalPos.x(),globalPos.y(),  globalPos.z(), -1);
832 >                      frogTrk->addDaughter(frogHit);
833 >                }
834 >           }
835 >        }
836 >
837 >        // ### TRACK ###
838 >
839          for(unsigned int i=0;i<TrackProducers.size();i++){
840             edm::Handle<std::vector< reco::Track > > h_Tracks;
841             iEvent.getByLabel(TrackProducers[i], h_Tracks);
842             std::vector< reco::Track > TrackColl = *h_Tracks.product();
843  
844 +           FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + TrajectoryProducers.size()+i);
845 +           event->addDaughter(frogTrkColl);
846 +
847 +           //printf("Size of the TrackCOllection : %i = %i\n",i,TrackColl.size());
848             for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
849 <                MyRecoTrack  MyrecoTrack;
466 <                reco::Track  recoTrack  =TrackColl[t];
849 >              reco::Track  recoTrack  =TrackColl[t];
850  
851 <                for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
852 <                      TrackingRecHitRef h_it     = recoTrack.recHit(h);
470 <                      if(!h_it->isValid() )continue;
471 <                      DetId detId                = h_it->geographicalId();
472 <                      const GeomDet * theDet     = tkGeom->idToDet(detId);
473 <                      LocalPoint localPos        = h_it->localPosition();
851 >              FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(TrajectoryProducers.size()+i,recoTrack.p(),recoTrack.pt(), recoTrack.chi2());
852 >              frogTrkColl->addDaughter(frogTrk);
853  
854 <                      MyRecoHit hit;          
855 <                      hit.x      = theDet->surface().toGlobal(localPos).x();
856 <                      hit.y      = theDet->surface().toGlobal(localPos).y();
857 <                      hit.z      = theDet->surface().toGlobal(localPos).z();
858 <                      hit.DetId  = detId.rawId();
859 <                      hit.Charge = -1;
860 <                      MyrecoTrack.Hits.push_back(hit);
861 <                }
862 <                MyEvent->MyRecoTrackCollection.push_back(MyrecoTrack);
854 >              for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
855 >                 TrackingRecHitRef h_it     = recoTrack.recHit(h);
856 >                 if(!h_it->isValid() )continue;
857 >                 DetId detId                = h_it->geographicalId();
858 >                 const GeomDet * theDet = NULL;
859 >
860 >                 if(detId.det()==DetId::Tracker)                        theDet = tkGeom->idToDet(detId);
861 >                 if(detId.det()==DetId::Muon && detId.subdetId() == 1)  theDet = DtGeom->idToDet(detId);
862 >                 if(detId.det()==DetId::Muon && detId.subdetId() == 2)  theDet = CscGeom->idToDet(detId);
863 >                 if(detId.det()==DetId::Muon && detId.subdetId() == 3)  theDet = RpcGeom->idToDet(detId);
864 >
865 >                 LocalPoint localPos        = h_it->localPosition();
866 >
867 >                 FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(
868 >                        detId.rawId(),
869 >                        theDet->surface().toGlobal(localPos).x(),
870 >                        theDet->surface().toGlobal(localPos).y(),
871 >                        theDet->surface().toGlobal(localPos).z(),
872 >                        -1);
873 >                 frogTrk->addDaughter(frogHit);
874 >              }
875             }
876          }
877  
878  
879 +
880          // ### ECALRecHits ###
881          for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
882             edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
883             iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
884             EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
885  
886 +           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_ECALHIT + i);
887 +           event->addDaughter(frogHitColl);
888 +
889             for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
890 <                MyCaloHit temp_EcalHit;
891 <                temp_EcalHit.E     = Ecal_RecHits[eh].energy();
892 <                temp_EcalHit.t     = Ecal_RecHits[eh].time();
498 <                temp_EcalHit.DetId = (Ecal_RecHits[eh].detid()).rawId();
499 <        
500 <                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalHit);
890 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((Ecal_RecHits[eh].detid()).rawId(),
891 >                        Ecal_RecHits[eh].energy(), Ecal_RecHits[eh].time());  
892 >                frogHitColl->addDaughter(frogCaloHit);
893             }
894          }
895  
# Line 508 | Line 900 | Frog_Analyzer::analyze(const edm::Event&
900             iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
901             HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
902  
903 <           for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
904 <                MyCaloHit temp_HcalHBHEHit;
513 <                temp_HcalHBHEHit.E      = HcalHBHE_RecHits[hh].energy();
514 <                temp_HcalHBHEHit.t      = HcalHBHE_RecHits[hh].time();
515 <                temp_HcalHBHEHit.DetId = (HcalHBHE_RecHits[hh].detid()).rawId();
903 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + i);
904 >           event->addDaughter(frogHitColl);
905  
906 <                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHBHEHit);
906 >           for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
907 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHBHE_RecHits[hh].detid()).rawId(),
908 >                        HcalHBHE_RecHits[hh].energy(), HcalHBHE_RecHits[hh].time());
909 >                frogHitColl->addDaughter(frogCaloHit);
910             }
911          }
912  
521
913          for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
914             edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
915             iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
916             HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
917  
918 <           for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
919 <                MyCaloHit temp_HcalHOHit;
529 <                temp_HcalHOHit.E      = HcalHO_RecHits[hh].energy();
530 <                temp_HcalHOHit.t      = HcalHO_RecHits[hh].time();
531 <                temp_HcalHOHit.DetId = (HcalHO_RecHits[hh].detid()).rawId();
918 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + i);
919 >           event->addDaughter(frogHitColl);
920  
921 <                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHOHit);
921 >           for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
922 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHO_RecHits[hh].detid()).rawId(),
923 >                        HcalHO_RecHits[hh].energy(), HcalHO_RecHits[hh].time());
924 >                frogHitColl->addDaughter(frogCaloHit);
925             }
926          }
927  
537
928          for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
929             edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
930             iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
931             HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
932  
933 <           for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
934 <                MyCaloHit temp_HcalHFHit;
545 <                temp_HcalHFHit.E      = HcalHF_RecHits[hh].energy();
546 <                temp_HcalHFHit.t      = HcalHF_RecHits[hh].time();
547 <                temp_HcalHFHit.DetId = (HcalHF_RecHits[hh].detid()).rawId();
933 >           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + HcalHORecHitProducers.size() + i);
934 >           event->addDaughter(frogHitColl);
935  
936 <                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHFHit);
936 >           for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
937 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHF_RecHits[hh].detid()).rawId(),
938 >                        HcalHF_RecHits[hh].energy(), HcalHF_RecHits[hh].time());
939 >                frogHitColl->addDaughter(frogCaloHit);
940             }
941          }
942  
# Line 556 | Line 946 | Frog_Analyzer::analyze(const edm::Event&
946             iEvent.getByLabel(CSCSegmentProducers[i], h_CSC_Segments);
947             CSCSegmentCollection CSC_Segments = *h_CSC_Segments.product();
948  
949 +           FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + i);
950 +           event->addDaughter(frogSegColl);
951 +
952             for(unsigned int s=0;s<CSC_Segments.size();s++){
953                  DetId theDetUnitId = CSC_Segments[s].geographicalId();
954                  const GeomDet* theDet = CscGeom->idToDet(theDetUnitId);
955  
956 <                MyMuonSegment temp_CscSeg;
957 <                temp_CscSeg.DetId = theDetUnitId.rawId();
958 <                temp_CscSeg.PosX  = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x();
959 <                temp_CscSeg.PosY  = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).y();
567 <                temp_CscSeg.PosZ  = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).z();
568 <                temp_CscSeg.DirX  = theDet->surface().toGlobal(CSC_Segments[s].localDirection()).x();
569 <                temp_CscSeg.DirY  = theDet->surface().toGlobal(CSC_Segments[s].localDirection()).y();
570 <                temp_CscSeg.DirZ  = theDet->surface().toGlobal(CSC_Segments[s].localDirection()).z();
571 <
572 <                MyEvent->MyMuonSegmentCollection.push_back(temp_CscSeg);
956 >                FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
957 >                theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).y() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).z()  ,
958 >                theDet->surface().toGlobal(CSC_Segments[s].localDirection()).x(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).y(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).z() );
959 >                frogSegColl->addDaughter(frogSeg);
960             }
961          }
962  
# Line 578 | Line 965 | Frog_Analyzer::analyze(const edm::Event&
965             iEvent.getByLabel(DTSegmentProducers[i], h_DT_Segments);
966             DTRecSegment4DCollection DT_Segments = *h_DT_Segments.product();
967  
968 +           FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + CSCSegmentProducers.size() + i);
969 +           event->addDaughter(frogSegColl);
970 +
971             for(unsigned int s=0;s<DT_Segments.size();s++){
972                  DetId theDetUnitId = DT_Segments[s].geographicalId();
973                  const GeomDet* theDet = DtGeom->idToDet(theDetUnitId);
974  
975 <                MyMuonSegment temp_DtSeg;
976 <                temp_DtSeg.DetId = theDetUnitId.rawId();
977 <                temp_DtSeg.PosX  = theDet->surface().toGlobal(DT_Segments[s].localPosition()).x();
978 <                temp_DtSeg.PosY  = theDet->surface().toGlobal(DT_Segments[s].localPosition()).y();
589 <                temp_DtSeg.PosZ  = theDet->surface().toGlobal(DT_Segments[s].localPosition()).z();
590 <                temp_DtSeg.DirX  = theDet->surface().toGlobal(DT_Segments[s].localDirection()).x();
591 <                temp_DtSeg.DirY  = theDet->surface().toGlobal(DT_Segments[s].localDirection()).y();
592 <                temp_DtSeg.DirZ  = theDet->surface().toGlobal(DT_Segments[s].localDirection()).z();
593 <
594 <                MyEvent->MyMuonSegmentCollection.push_back(temp_DtSeg);
975 >                FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
976 >                theDet->surface().toGlobal(DT_Segments[s].localPosition()).x() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).y() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).z()  ,
977 >                theDet->surface().toGlobal(DT_Segments[s].localDirection()).x(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).y(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).z() );
978 >                frogSegColl->addDaughter(frogSeg);
979             }
980          }
981  
# Line 601 | Line 985 | Frog_Analyzer::analyze(const edm::Event&
985             iEvent.getByLabel(RPCHitsProducers[i], h_RPC_Hits);
986             RPCRecHitCollection RPC_Hits = *h_RPC_Hits.product();
987  
988 +           FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONHIT + i);
989 +           event->addDaughter(frogHitColl);
990 +
991             for(unsigned int h=0;h<RPC_Hits.size();h++){
992                  DetId theDetUnitId = RPC_Hits[h].geographicalId();
993                  const GeomDet* theDet = RpcGeom->idToDet(theDetUnitId);
994  
995 <                MyMuonHit temp_RpcHit;
996 <                temp_RpcHit.DetId = theDetUnitId.rawId();
997 <                temp_RpcHit.x  = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).x();
611 <                temp_RpcHit.y  = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).y();
612 <                temp_RpcHit.z  = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).z();
613 <
614 <                MyEvent->MyMuonHitCollection.push_back(temp_RpcHit);
995 >                FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(theDetUnitId.rawId(),
996 >                theDet->surface().toGlobal(RPC_Hits[h].localPosition()).x() , theDet->surface().toGlobal(RPC_Hits[h].localPosition()).y() , theDet->surface().toGlobal(RPC_Hits[h].localPosition()).z(), -1 );
997 >                frogHitColl->addDaughter(frogHit);
998             }
999          }
1000  
1001 <        MyEvents->Events.push_back(MyEvent);  
1001 >
1002 >
1003   }
1004  
1005  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines