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.2 by querten, Sat Apr 19 14:34:58 2008 UTC vs.
Revision 1.41 by querten, Sat Oct 4 13:17:18 2008 UTC

# Line 49 | Line 49
49   #include "Geometry/Records/interface/IdealGeometryRecord.h"
50   #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
51   #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
52 < #include "Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h"
53 < #include "Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h"
52 > //#include "Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h"
53 > //#include "Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h"
54 > #include "Geometry/Records/interface/CaloGeometryRecord.h"
55 > #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
56 > #include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
57   #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
58   #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
59  
# Line 60 | Line 63
63   #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
64   #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
65  
66 + #include "DataFormats/Common/interface/DetSetVector.h"
67 + #include "DataFormats/Common/interface/DetSetVectorNew.h"
68 +
69 + #include "DataFormats/SiStripCluster/interface/SiStripClusterCollection.h"
70  
71   #include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
72   #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
# Line 79 | Line 86
86   #include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
87   #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
88   #include "DataFormats/TrackReco/interface/Track.h"
89 + #include "TrackingTools/PatternTools/interface/Trajectory.h"
90 + #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
91 +
92 + #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
93 +
94  
95   #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
96   #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
# Line 91 | Line 103
103   #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
104   #include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
105  
106 < #include "Visualisation/Frog/interface/SimEvent.h"
107 < #include "Visualisation/Frog/interface/Geometry.h"
106 > #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
107 > #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
108 > #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
109 > #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
110 > #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
111 > #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
112 > #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
113 > #include "DataFormats/SiStripDetId/interface/TECDetId.h"
114 >
115 > #include "DataFormats/MuonDetId/interface/DTChamberId.h"
116 > #include "DataFormats/MuonDetId/interface/CSCDetId.h"
117 > #include "DataFormats/MuonDetId/interface/RPCDetId.h"
118 >
119 > #include "DataFormats/EcalDetId/interface/EBDetId.h"
120 > #include "DataFormats/EcalDetId/interface/EEDetId.h"
121 > #include "DataFormats/EcalDetId/interface/ESDetId.h"
122 > #include "DataFormats/HcalDetId/interface/HcalDetId.h"
123 >
124 > #include "DataFormats/VertexReco/interface/NuclearInteraction.h"
125 >
126 > #include "DataFormats/JetReco/interface/Jet.h"
127 > #include "DataFormats/JetReco/interface/BasicJetCollection.h"
128 > #include "DataFormats/JetReco/interface/GenJetCollection.h"
129 > #include "DataFormats/JetReco/interface/CaloJetCollection.h"
130 > #include "DataFormats/JetReco/interface/PFJetCollection.h"
131 > #include "DataFormats/METReco/interface/CaloMET.h"
132 > #include "DataFormats/METReco/interface/CaloMETFwd.h"
133 >
134 > //#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Base_With_DetId_And_Name.h"
135 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.h"
136 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.cpp"
137 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_Track.h"
138 >
139 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.h"
140 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.cpp"
141 >
142 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.h"
143 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.cpp"
144 >
145 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_DetId.h"
146 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_ReadCards.cpp"
147 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_NuclInt.h"
148 >
149 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Coord.h"
150 > #include "Visualisation/Frog/soft/Includes/FROG/FROG_Coord.cpp"
151 >
152 >
153  
154   using namespace edm;
155   using namespace std;
156 + using namespace reco;
157  
158   //
159   // class decleration
# Line 112 | Line 170 | class Frog_Analyzer : public edm::EDAnal
170        virtual void analyze (const edm::Event&, const edm::EventSetup&);
171        virtual void endJob  ();
172  
173 +      FROG_Element_Base*    events_prim;
174  
175 <      MySimEvents* MyEvents;
117 <      Geometry*    Geom_Tracker;
118 <      Geometry*    Geom_ECAL;
119 <      Geometry*    Geom_HCAL;
120 <      Geometry*    Geom_Muon;
175 >      std::string           OutputFile;
176  
177 <
123 <      std::string              OutputFile;
177 >      std::vector<InputTag> GenParticlesProducers;
178  
179        std::vector<InputTag> SimTrackProducers;
180        std::vector<InputTag> SimVertexProducers;
181        std::vector<InputTag> SimHitProducers;
182 +      std::vector<InputTag> SimCaloHitProducers;
183 +
184 +      std::vector<InputTag> NIProducers;
185  
186        std::vector<InputTag> TrackProducers;
187 +      std::vector<InputTag> TrajectoryProducers;
188 +      std::vector<InputTag> SiStripClusterProducers;
189        std::vector<InputTag> EcalRecHitProducers;
190        std::vector<InputTag> HcalHBHERecHitProducers;
191        std::vector<InputTag> HcalHORecHitProducers;
# Line 136 | Line 195 | class Frog_Analyzer : public edm::EDAnal
195  
196        std::vector<InputTag> RPCHitsProducers;
197  
198 +      std::vector<InputTag> CaloTowersProducers;
199 +      bool                  CaloTowersProducersBasedOnCaloHits;
200 +
201 +      std::vector<InputTag> BasicJetsProducers;
202 +      std::vector<InputTag> CaloJetsProducers;
203 +      bool                  CaloJetsProducersBasedOnCaloTowers;
204  
205 +      std::vector<InputTag> RecoCandidateProducers;
206 +      std::vector<InputTag> CaloMETProducers;
207  
208  
209        // ----------member data ---------------------------
210 +
211 +      bool                  ProduceGeom;
212 +      int                   NEventsInVisFile;
213 +      int                   NEvents;
214 +
215 +      unsigned int          SRun;
216 +      unsigned int          SEvent;
217   };
218  
219   //
# Line 149 | Line 223 | Frog_Analyzer::Frog_Analyzer(const edm::
223   {
224      OutputFile              = iConfig.getParameter<std::string >("OutputFile");
225  
226 +    GenParticlesProducers   = iConfig.getParameter<std::vector<InputTag> >("GenParticlesProducers");
227 +
228      SimTrackProducers       = iConfig.getParameter<std::vector<InputTag> >("SimTrackProducers");
229      SimVertexProducers      = iConfig.getParameter<std::vector<InputTag> >("SimVertexProducers");
230      SimHitProducers         = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
231 +    SimCaloHitProducers     = iConfig.getParameter<std::vector<InputTag> >("SimCaloHitProducers");
232 +
233  
234      TrackProducers          = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
235 +    TrajectoryProducers     = iConfig.getParameter<std::vector<InputTag> >("TrajectoryProducers");
236 +    SiStripClusterProducers = iConfig.getParameter<std::vector<InputTag> >("SiStripClusterProducers");
237      EcalRecHitProducers     = iConfig.getParameter<std::vector<InputTag> >("EcalRecHitProducers");
238      HcalHBHERecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHBHERecHitProducers");
239      HcalHORecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
240      HcalHFRecHitProducers   = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers");
241  
242 +    NIProducers             = iConfig.getParameter<std::vector<InputTag> >("NIProducers");
243 +
244      DTSegmentProducers      = iConfig.getParameter<std::vector<InputTag> >("DTSegmentProducers");
245      CSCSegmentProducers     = iConfig.getParameter<std::vector<InputTag> >("CSCSegmentProducers");
246  
247      RPCHitsProducers        = iConfig.getParameter<std::vector<InputTag> >("RPCHitsProducers");
248  
249 +    CaloTowersProducers     = iConfig.getParameter<std::vector<InputTag> >("CaloTowersProducers");
250 +    CaloTowersProducersBasedOnCaloHits = iConfig.getParameter<bool>("CaloTowersProducersBasedOnCaloHits");
251 +
252 +
253 +    BasicJetsProducers      = iConfig.getParameter<std::vector<InputTag> >("BasicJetsProducers");
254 +    CaloJetsProducers       = iConfig.getParameter<std::vector<InputTag> >("CaloJetsProducers");
255 +    CaloJetsProducersBasedOnCaloTowers = iConfig.getParameter<bool>("CaloJetsProducersBasedOnCaloTowers");
256 +
257 +    RecoCandidateProducers  = iConfig.getParameter<std::vector<InputTag> >("RecoCandidateProducers");
258 +    CaloMETProducers        = iConfig.getParameter<std::vector<InputTag> >("CaloMETProducers");
259 +
260 +    ProduceGeom             = iConfig.getParameter<bool  >("ProduceGeom"       );
261 +    NEventsInVisFile        = iConfig.getParameter<int   >("NEventsInVisFile"  );
262 +
263 +    NEvents = 0;
264   }
265  
266  
# Line 175 | Line 272 | Frog_Analyzer::~Frog_Analyzer()
272   void
273   Frog_Analyzer::beginJob(const edm::EventSetup& iSetup)
274   {
275 <   DetId  Detid;
276 <   int    SubDet;
277 <
278 <   MyEvents     = new MySimEvents();
279 <   Geom_Tracker = new Geometry();
280 <   Geom_ECAL    = new Geometry();
281 <   Geom_HCAL    = new Geometry();
282 <   Geom_Muon    = new Geometry();
275 >   if(ProduceGeom){
276 >      DetId  Detid;
277 >      unsigned int    SubDet;
278 >
279 >      unsigned int Frog_DetId;
280 >      FROG_Element_Base*            FEB      = NULL;
281 >      FROG_Element_Base_With_DetId_And_Name* FEB_Temp = NULL;
282 >
283 >      FROG_Element_Base* prim               = new FROG_Element_Base(C_PRIMARY);
284 >      FROG_Element_Base* geom               = new FROG_Element_Base(C_GEOMETRY);                                  prim->addDaughter(geom);
285 >      FROG_Element_Base_With_DetId_And_Name* tracker = new FROG_Element_Base_With_DetId_And_Name( DETID_TRK  , "Tracker"); geom->addDaughter(tracker);
286 >      FROG_Element_Base_With_DetId_And_Name* muon    = new FROG_Element_Base_With_DetId_And_Name( DETID_MUON , "Muon");    geom->addDaughter(muon);
287 >      FROG_Element_Base_With_DetId_And_Name* ecal    = new FROG_Element_Base_With_DetId_And_Name( DETID_ECAL , "ECAL");    geom->addDaughter(ecal);
288 >      FROG_Element_Base_With_DetId_And_Name* hcal    = new FROG_Element_Base_With_DetId_And_Name( DETID_HCAL , "HCAL");    geom->addDaughter(hcal);
289 >      FROG_Element_Base_With_DetId_And_Name* calo    = new FROG_Element_Base_With_DetId_And_Name( DETID_CALO , "Calo");    geom->addDaughter(calo);
290  
291  
188   // ### TRACKER GEOMETRY ###
292  
293 <   edm::ESHandle<TrackerGeometry> tkGeom;
294 <   iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
295 <   vector<GeomDet*> TrackerDets = tkGeom->dets();
293 >      // ### TRACKER GEOMETRY ###
294 >
295 >      edm::ESHandle<TrackerGeometry> tkGeom;
296 >      iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
297 >      vector<GeomDet*> TrackerDets = tkGeom->dets();
298 >
299 >      for(unsigned int i=0;i<TrackerDets.size();i++){
300 >         Detid  = TrackerDets[i]->geographicalId();
301 >         SubDet = Detid.subdetId();
302 >         if(SubDet<1 || SubDet>6) continue;
303  
194   for(unsigned int i=0;i<TrackerDets.size();i++){
195      Detid  = TrackerDets[i]->geographicalId();
196 //    SubDet = Detid.subdetId();
304    
305 <      GeomDet* DetUnit = TrackerDets[i];
306 <      if(!DetUnit)continue;
307 <      const BoundPlane plane = DetUnit->surface();
308 <      const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
309 <      const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));  
310 <
311 <      float width            = 0;
312 <      float length           = 0;
313 <      float thickness        = 0;
314 <      float TrapezoidalParam = 0;
305 >         GeomDet* DetUnit = TrackerDets[i];
306 >         if(!DetUnit)continue;
307 >         const BoundPlane plane = DetUnit->surface();
308 >         const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
309 >         const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));  
310 >
311 >         float width            = 0;
312 >         float length           = 0;
313 >         float thickness        = 0;
314 >         float TrapezoidalParam = 0;
315 >
316 >         if(trapezoidalBounds){
317 >            std::vector<float> const & parameters = (*trapezoidalBounds).parameters();      
318 >            width            = parameters[0]*2;
319 >            length           = parameters[3]*2;  
320 >            thickness        = (*trapezoidalBounds).thickness();
321 >            TrapezoidalParam = parameters[1]/parameters[0];
322 >         }else if(rectangularBounds){
323 >            width            = DetUnit->surface().bounds().width();
324 >            length           = DetUnit->surface().bounds().length();
325 >            thickness        = DetUnit->surface().bounds().thickness();
326 >            TrapezoidalParam = 1;
327 >         }
328 >
329 >         Surface::GlobalPoint WidthVector  = plane.toGlobal( LocalPoint(width/2, 0, 0) );
330 >         Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
331 >         Surface::GlobalPoint ThickVector  = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
332 >
333 >         GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
334 >
335 >         FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
336 >              Detid.rawId(),           TrapezoidalParam,
337 >              Pos.x(),                  Pos.y(),                  Pos.z(),
338 >              WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
339 >              LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
340 >              ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
341  
342 <      if(trapezoidalBounds)
343 <      {
344 <         std::vector<float> const & parameters = (*trapezoidalBounds).parameters();      
345 <         width            = parameters[0]*2;
346 <         length           = parameters[3]*2;  
347 <         thickness        =  (*trapezoidalBounds).thickness();
348 <         TrapezoidalParam = parameters[1]/parameters[0];
349 <      }else if(rectangularBounds){
350 <         width            = DetUnit->surface().bounds().width();
351 <         length           = DetUnit->surface().bounds().length();
352 <         thickness        = DetUnit->surface().bounds().thickness();
353 <         TrapezoidalParam = 1;
342 >
343 >         Frog_DetId = DETID_TRK;
344 >         FEB        = tracker;
345 >
346 >         Frog_DetId += SubDet*100000;
347 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
348 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
349 > //         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId); FEB_Temp->addDaughter(FEB);}
350 >
351 >         if(SubDet==PixelSubdetector::PixelBarrel){
352 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "PIB"); FEB_Temp->addDaughter(FEB);}
353 >
354 >            PXBDetId detid = PXBDetId(Detid);
355 >
356 >            Frog_DetId += detid.layer()*10000;
357 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
358 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
359 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Layer%i", detid.layer() ); FEB_Temp->addDaughter(FEB);}
360 >
361 >            Frog_DetId += detid.ladder()*100;
362 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
363 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
364 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ladder%i", detid.ladder() ); FEB_Temp->addDaughter(FEB);}
365 >         }else if(SubDet==PixelSubdetector::PixelEndcap){
366 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "PIE"); FEB_Temp->addDaughter(FEB);}
367 >
368 >            PXFDetId detid = PXFDetId(Detid);
369 >
370 >            Frog_DetId += detid.side()*10000;
371 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
372 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
373 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%i",detid.side()); FEB_Temp->addDaughter(FEB);}
374 >
375 >            Frog_DetId += detid.disk()*1000;
376 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
377 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
378 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Disk%i", detid.disk()); FEB_Temp->addDaughter(FEB);}
379 >
380 >            Frog_DetId += detid.blade()*10;
381 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
382 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
383 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Blade%i", detid.blade()); FEB_Temp->addDaughter(FEB);}
384 >
385 >            Frog_DetId += detid.panel()*1;
386 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
387 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
388 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Panel%i", detid.panel()); FEB_Temp->addDaughter(FEB);}
389 >         }else if(SubDet==StripSubdetector::TIB){
390 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TIB"); FEB_Temp->addDaughter(FEB);}
391 >
392 >            TIBDetId detid = TIBDetId(Detid);
393 >
394 >            Frog_DetId += detid.layer()*10000;
395 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
396 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
397 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Layer%i", detid.layer()); FEB_Temp->addDaughter(FEB);}
398 >
399 >            Frog_DetId += detid.stringNumber()*100;
400 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
401 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
402 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "String%i", detid.stringNumber()); FEB_Temp->addDaughter(FEB);}
403 >         }else if(SubDet==StripSubdetector::TID){
404 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TID"); FEB_Temp->addDaughter(FEB);}
405 >
406 >            TIDDetId detid = TIDDetId(Detid);
407 >
408 >            Frog_DetId += detid.side()*10000;
409 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
410 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
411 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Slide%i", detid.side()); FEB_Temp->addDaughter(FEB);}
412 >
413 >            Frog_DetId += detid.wheel()*1000;
414 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
415 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
416 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Wheel%i", detid.wheel()); FEB_Temp->addDaughter(FEB);}
417 >
418 >            Frog_DetId += detid.ring()*10;
419 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
420 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
421 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
422 >         }else if(SubDet==StripSubdetector::TOB){
423 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TOB"); FEB_Temp->addDaughter(FEB);}
424 >
425 >            TOBDetId detid = TOBDetId(Detid);
426 >
427 >            Frog_DetId += detid.layer()*10000;
428 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
429 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
430 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Layer%i",  detid.layer()); FEB_Temp->addDaughter(FEB);}
431 >
432 >            Frog_DetId += detid.rodNumber()*100;
433 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
434 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
435 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Rod%i", detid.rodNumber()); FEB_Temp->addDaughter(FEB);}
436 >         }else if(SubDet==StripSubdetector::TEC){
437 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TEC"); FEB_Temp->addDaughter(FEB);}
438 >
439 >            TECDetId detid = TECDetId(Detid);
440 >
441 >            Frog_DetId += detid.side()*10000;
442 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
443 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
444 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%i",detid.side()); FEB_Temp->addDaughter(FEB);}
445 >
446 >            Frog_DetId += detid.wheel()*1000;
447 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
448 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
449 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Wheel%i", detid.wheel() ); FEB_Temp->addDaughter(FEB);}
450 >
451 >            Frog_DetId += detid.ring()*10;
452 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
453 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
454 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
455 >
456 >            Frog_DetId += detid.petalNumber();
457 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
458 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
459 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Petal%i", detid.petalNumber()); FEB_Temp->addDaughter(FEB);}
460 >         }else{
461 >            if(mod)delete mod;
462 >            continue;
463 >         }
464 >         FEB->addDaughter(mod);
465        }
466  
223      Surface::GlobalPoint WidthVector  = plane.toGlobal( LocalPoint(width/2, 0, 0) );
224      Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
225      Surface::GlobalPoint ThickVector  = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
226
227      GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
228
229      Geom_Tracker->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
230           Pos.x(),                  Pos.y(),                  Pos.z(),
231           WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
232           LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
233           ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
234      
467  
468 <   }
468 >      // ### MUON GEOMETRY ###
469 >
470 >      edm::ESHandle<DTGeometry> DtGeom;
471 >      iSetup.get<MuonGeometryRecord>().get( DtGeom );
472 >      const vector<GeomDet*> DtDets = DtGeom->dets();
473 >
474 >      edm::ESHandle<CSCGeometry> CscGeom;
475 >      iSetup.get<MuonGeometryRecord>().get( CscGeom );
476 >      const vector<GeomDet*> CscDets = CscGeom->dets();
477 >
478 >      edm::ESHandle<RPCGeometry> RpcGeom;
479 >      iSetup.get<MuonGeometryRecord>().get( RpcGeom );
480 >      const vector<GeomDet*> RpcDets = RpcGeom->dets();
481 >
482 >      vector<GeomDet*> MuonDets;
483 >      for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
484 >      for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
485 >      for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
486  
487 +      for(unsigned int i=0;i<MuonDets.size();i++)
488 +      {
489 +         Detid  = DetId(MuonDets[i]->geographicalId());
490 +         SubDet = Detid.subdetId();
491  
492 <   // ### CALO GEOMETRY ###
492 >         GeomDet* DetUnit = MuonDets[i];
493 >         if(!DetUnit)continue;
494 >         const BoundPlane plane = DetUnit->surface();
495 >         const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
496 >         const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
497 >
498 >         float width            = 0;
499 >         float length           = 0;
500 >         float thickness        = 0;
501 >         float TrapezoidalParam = 0;
502 >
503 >         if(trapezoidalBounds)
504 >         {
505 >            std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
506 >            width            = parameters[0]*2;
507 >            length           = parameters[3]*2;
508 >            thickness        =  (*trapezoidalBounds).thickness();
509 >            TrapezoidalParam = parameters[1]/parameters[0];
510 >         }else if(rectangularBounds){
511 >            width            = DetUnit->surface().bounds().width();
512 >            length           = DetUnit->surface().bounds().length();
513 >            thickness        = DetUnit->surface().bounds().thickness();
514 >            TrapezoidalParam = 1;
515 >         }
516 >
517 >         Surface::GlobalPoint WidthVector  = plane.toGlobal( LocalPoint(width/2, 0, 0) );
518 >         Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
519 >         Surface::GlobalPoint ThickVector  = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
520 >
521 >         GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
522 >
523 >         FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
524 >              Detid.rawId(),           TrapezoidalParam,
525 >              Pos.x(),                  Pos.y(),                  Pos.z(),
526 >              WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
527 >              LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
528 >              ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
529 >
530 >         Frog_DetId = DETID_MUON;
531 >         FEB        = muon;
532 >
533 >         Frog_DetId += SubDet*100000;
534 >         FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
535 >         FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
536 > //         if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId); FEB_Temp->addDaughter(FEB);}
537 >
538 >         if(SubDet==1){
539 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "DT"); FEB_Temp->addDaughter(FEB);}
540 >
541 >            DTChamberId detid = DTChamberId(Detid);
542 >
543 >            Frog_DetId += (detid.wheel()+3)*10000;
544 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
545 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
546 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Wheel%+i", detid.wheel()); FEB_Temp->addDaughter(FEB);}
547 >
548 >            Frog_DetId += detid.station()*100;
549 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
550 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
551 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Station%i", detid.station()); FEB_Temp->addDaughter(FEB);}
552 >
553 >            Frog_DetId += detid.sector()*1;
554 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
555 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
556 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Sector%i", detid.sector()); FEB_Temp->addDaughter(FEB);}
557 >         }else if(SubDet==2){
558 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "CSC"); FEB_Temp->addDaughter(FEB);}
559  
560 <   edm::ESHandle<CaloGeometry> CaloGeom;
561 <   iSetup.get<IdealGeometryRecord>().get( CaloGeom );
562 <   const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
563 <
564 <   for(unsigned int i=0;i<CaloDets.size();i++)
565 <   {
566 <      Detid  = CaloDets[i];
567 <      SubDet = Detid.subdetId();
568 <
569 <      Geometry* Geom_temp = NULL;
570 <      if(Detid.det()==DetId::Ecal){
571 <        Geom_temp = Geom_ECAL;
572 <
573 <        if(SubDet<1 || SubDet>3){
574 <                printf("Don't Save EcalTriggerTower or EcalLaserPnDiode\n");
575 <                continue;
576 <        }
577 <      }else if(Detid.det()==DetId::Hcal){
578 <        Geom_temp = Geom_HCAL;
579 <
580 <        if(SubDet<1 || SubDet>4){
581 <                printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n");
582 <                continue;
583 <        }
584 <      }else{
585 <        continue;
560 >            CSCDetId detid = CSCDetId(Detid);
561 >  
562 >            Frog_DetId += detid.endcap()*10000;
563 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
564 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
565 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%i", detid.endcap()); FEB_Temp->addDaughter(FEB);}
566 >  
567 >            Frog_DetId += detid.station()*1000;
568 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
569 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
570 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Station%i", detid.station()); FEB_Temp->addDaughter(FEB);}
571 >  
572 >            Frog_DetId += detid.ring()*100;
573 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
574 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
575 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
576 >
577 >            Frog_DetId += detid.chamber()*1;
578 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
579 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
580 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Chamber%i", detid.chamber()); FEB_Temp->addDaughter(FEB);}
581 >         }else if(SubDet==3){
582 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "RPC"); FEB_Temp->addDaughter(FEB);}
583 >
584 >            RPCDetId detid = RPCDetId(Detid);
585 >
586 >            Frog_DetId += (detid.region()+2)*10000;
587 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
588 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
589 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Region+%i", detid.region()); FEB_Temp->addDaughter(FEB);}
590 >
591 >            // Barrel
592 >            if(detid.region()==0){
593 >               Frog_DetId += (detid.ring()+3)*1000;
594 >               FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
595 >               FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
596 >               if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring+%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
597 >            // Endcap
598 >            }else{
599 >               Frog_DetId += detid.ring()*1000;
600 >               FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
601 >               FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
602 >               if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Ring+%i", detid.ring()); FEB_Temp->addDaughter(FEB);}
603 >            }
604 >
605 >            Frog_DetId += detid.station()*100;
606 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
607 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
608 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Station%i", detid.station()); FEB_Temp->addDaughter(FEB);}
609 >
610 >            Frog_DetId += detid.sector()*1;
611 >            FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
612 >            FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
613 >            if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Sector%i", detid.sector()); FEB_Temp->addDaughter(FEB);}
614 >         }
615 >
616 >         FEB->addDaughter(mod);
617        }
618  
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()  );
283   }
619  
620 <   // ### MUON GEOMETRY ###
620 >      
621 >      // ### CALO GEOMETRY ###
622  
623 <   edm::ESHandle<DTGeometry> DtGeom;
624 <   iSetup.get<MuonGeometryRecord>().get( DtGeom );
625 <   const vector<GeomDet*> DtDets = DtGeom->dets();
290 <
291 <   edm::ESHandle<CSCGeometry> CscGeom;
292 <   iSetup.get<MuonGeometryRecord>().get( CscGeom );
293 <   const vector<GeomDet*> CscDets = CscGeom->dets();
294 <
295 <   edm::ESHandle<RPCGeometry> RpcGeom;
296 <   iSetup.get<MuonGeometryRecord>().get( RpcGeom );
297 <   const vector<GeomDet*> RpcDets = RpcGeom->dets();
298 <
299 <   vector<GeomDet*> MuonDets;
300 <   for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
301 <   for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
302 <   for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
303 <
304 <
305 <   for(unsigned int i=0;i<MuonDets.size();i++)
306 <   {
307 <      Detid  = DetId(MuonDets[i]->geographicalId());
308 <      SubDet = Detid.subdetId();
309 <
310 <      GeomDet* DetUnit = MuonDets[i];
311 <      if(!DetUnit)continue;
312 <      const BoundPlane plane = DetUnit->surface();
313 <      const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
314 <      const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
315 <
316 <      float width            = 0;
317 <      float length           = 0;
318 <      float thickness        = 0;
319 <      float TrapezoidalParam = 0;
623 >      edm::ESHandle<CaloGeometry> CaloGeom;
624 >      iSetup.get<CaloGeometryRecord>().get( CaloGeom );
625 >      const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
626  
627 <      if(trapezoidalBounds)
627 >      for(unsigned int i=0;i<CaloDets.size();i++)
628        {
629 <         std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
630 <         width            = parameters[0]*2;
325 <         length           = parameters[3]*2;
326 <         thickness        =  (*trapezoidalBounds).thickness();
327 <         TrapezoidalParam = parameters[1]/parameters[0];
328 <      }else if(rectangularBounds){
329 <         width            = DetUnit->surface().bounds().width();
330 <         length           = DetUnit->surface().bounds().length();
331 <         thickness        = DetUnit->surface().bounds().thickness();
332 <         TrapezoidalParam = 1;
333 <      }
629 >         Detid  = CaloDets[i];
630 >         SubDet = Detid.subdetId();
631  
632 <      Surface::GlobalPoint WidthVector  = plane.toGlobal( LocalPoint(width/2, 0, 0) );
633 <      Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
634 <      Surface::GlobalPoint ThickVector  = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
635 <
636 <      GlobalVector Pos =  GlobalVector(DetUnit->position().basicVector());
637 <
638 <      Geom_Muon->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
639 <           Pos.x(),                  Pos.y(),                  Pos.z(),
640 <           WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
641 <           LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
642 <           ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
643 <   }
632 >                 if(Detid.det()==DetId::Ecal){
633 >                        if(SubDet<1 || SubDet>3) continue;
634 >
635 >                        Frog_DetId = DETID_ECAL;
636 >                        FEB        = ecal;
637 >
638 >                        Frog_DetId += SubDet*100000;
639 >                        FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
640 >                        FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
641 > //                      if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId); FEB_Temp->addDaughter(FEB);}
642 >
643 >                        if(SubDet==1){
644 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "EB"); FEB_Temp->addDaughter(FEB);}
645 >
646 >                           EBDetId detid = EBDetId(Detid);
647 >
648 >                           Frog_DetId += ((detid.zside()==1)+1)*10000;
649 >                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
650 >                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
651 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
652 >
653 >                           Frog_DetId += (detid.tower_ieta()*detid.zside())*100;
654 >                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
655 >                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
656 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TowerIEta%+i", detid.tower_ieta()); FEB_Temp->addDaughter(FEB);}
657 >
658 >                           Frog_DetId += detid.tower_iphi()*1;
659 >                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
660 >                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
661 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "TowerIPhi%i", detid.tower_iphi()); FEB_Temp->addDaughter(FEB);}
662 >                        }else if(SubDet==2){
663 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "EE"); FEB_Temp->addDaughter(FEB);}
664 >
665 >                           EEDetId detid = EEDetId(Detid);
666 >
667 >                           Frog_DetId += ((detid.zside()==1)+1)*10000;
668 >                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
669 >                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
670 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
671 >
672 >                           Frog_DetId += detid.iquadrant()*1000;
673 >                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
674 >                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
675 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Quadran%i", detid.iquadrant()); FEB_Temp->addDaughter(FEB);}
676 >
677 >                           Frog_DetId += detid.isc();
678 >                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
679 >                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
680 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "ISC%i", detid.isc()); FEB_Temp->addDaughter(FEB);}
681 >                        }else if(SubDet==3){
682 >                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "ES"); FEB_Temp->addDaughter(FEB);}
683  
684 +                           ESDetId detid = ESDetId(Detid);
685 +
686 +                           Frog_DetId += ((detid.zside()==1)+1)*10000;
687 +                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
688 +                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
689 +                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
690 +
691 +                           Frog_DetId += detid.plane()*1000;
692 +                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
693 +                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
694 +                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Plane%i", detid.plane()); FEB_Temp->addDaughter(FEB);}
695 +
696 +                           Frog_DetId += detid.six()*50;
697 +                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
698 +                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
699 +                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Six%i", detid.six()); FEB_Temp->addDaughter(FEB);}
700 +
701 +                           Frog_DetId += detid.siy();
702 +                           FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
703 +                           FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
704 +                           if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Siy%i", detid.siy()); FEB_Temp->addDaughter(FEB);}
705 +                         }
706 +                 }else if(Detid.det()==DetId::Hcal){
707 +                        if(SubDet<1 || SubDet>4) continue;
708 +
709 +                        Frog_DetId = DETID_HCAL;
710 +                        FEB        = hcal;
711 +
712 +                        Frog_DetId += SubDet*100000;
713 +                        FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
714 +                        FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
715 +                        if(FEB==NULL){
716 +                                if(SubDet==1){   FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HB"); FEB_Temp->addDaughter(FEB);}
717 +                                if(SubDet==2){   FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HE"); FEB_Temp->addDaughter(FEB);}
718 +                                if(SubDet==3){   FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HO"); FEB_Temp->addDaughter(FEB);}
719 +                                if(SubDet==4){   FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "HF"); FEB_Temp->addDaughter(FEB);}
720 +                        }
721 +
722 +                        HcalDetId detid = HcalDetId(Detid);
723 +
724 +                        Frog_DetId += ((detid.zside()==1)+1)*10000;
725 +                        FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
726 +                        FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
727 +                        if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
728 +
729 +                        Frog_DetId += detid.ietaAbs()*100;
730 +                        FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
731 +                        FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
732 +                        if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IEta%+i", detid.ieta()); FEB_Temp->addDaughter(FEB);}
733 +
734 +                        Frog_DetId += detid.iphi()*1;
735 +                        FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
736 +                        FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
737 +                        if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IPhi%i", detid.iphi()); FEB_Temp->addDaughter(FEB);}
738 +
739 +                 }else if(Detid.det() == DetId::Calo){        
740  
741 <   // ### Save .geom ###
741 >                   Frog_DetId = DETID_CALO;
742 >                   FEB        = calo;
743  
744 <   Geom_Tracker->Save("Tracker.geom");    
352 <   Geom_ECAL   ->Save("Ecal.geom");
353 <   Geom_HCAL   ->Save("Hcal.geom");
354 <   Geom_Muon   ->Save("Muon.geom");
744 >                   if(SubDet!=(unsigned int)CaloTowerDetId::SubdetId)continue;
745  
746 +                   Frog_DetId += SubDet*100000;
747 +                   FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
748 +                   FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
749 +                   if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "CaloTowers"); FEB_Temp->addDaughter(FEB);}
750 +
751 +                   if(SubDet==(unsigned int)CaloTowerDetId::SubdetId){
752 +                      CaloTowerDetId detid = CaloTowerDetId(Detid);
753 +
754 +                      Frog_DetId += ((detid.zside()==1)+1)*10000;
755 +                      FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
756 +                      FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
757 +                      if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "Side%+i", detid.zside()); FEB_Temp->addDaughter(FEB);}
758 +
759 +                      Frog_DetId += (detid.ieta()*detid.zside())*100;
760 +                      FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
761 +                      FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
762 +                      if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IEta%+i", detid.ieta()); FEB_Temp->addDaughter(FEB);}
763 +
764 +                      Frog_DetId += detid.iphi()*1;
765 +                      FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId_And_Name*>(FEB);
766 +                      FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
767 +                      if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId_And_Name( Frog_DetId, "IPhi%i", detid.iphi()); FEB_Temp->addDaughter(FEB);}
768 +                   }
769 +                }
770 +
771 +                 const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
772 +                 GlobalPoint CellPos =  CellGeom->getPosition();
773 +                 const CaloCellGeometry::CornersVec CellCorners =  CellGeom->getCorners();
774 +
775 +                 float cX = (CellCorners[0].x() + CellCorners[2].x())/2;
776 +                 float cY = (CellCorners[0].y() + CellCorners[2].y())/2;
777 +                 float cZ = (CellCorners[0].z() + CellCorners[2].z())/2;
778 +
779 +                 float wX = (CellCorners[1].x() - CellCorners[0].x())/2;
780 +                 float wY = (CellCorners[1].y() - CellCorners[0].y())/2;
781 +                 float wZ = (CellCorners[1].z() - CellCorners[0].z())/2;
782 +                
783 +                 float hX = (CellCorners[3].x() - CellCorners[0].x())/2;
784 +                 float hY = (CellCorners[3].y() - CellCorners[0].y())/2;
785 +                 float hZ = (CellCorners[3].z() - CellCorners[0].z())/2;
786 +
787 +                 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) );
788 +                           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) );
789 +
790 +                 FROG_Element_Geom_CaloMod* mod = new FROG_Element_Geom_CaloMod(
791 +                        Detid.rawId(), F,
792 +                        cX  ,   cY  , cZ ,
793 +                        wX  ,   wY  , wZ ,
794 +                        hX  ,   hY  , hZ );
795 +
796 +                 FEB->addDaughter(mod);  
797 +      }
798 +
799 +      // ### Save .geom ###
800 +
801 +      FROG_Geometry* CMS_Geom = new FROG_Geometry(prim);
802 +      CMS_Geom->Save("CMS.geom");  
803 +   }
804 +
805 +   events_prim = new FROG_Element_Base(C_PRIMARY);  
806   }
807  
808   // ------------ method called once each job just after ending the event loop  ------------
809   void
810 < Frog_Analyzer::endJob() {
811 <  
812 <   MyEvents->Save((char*) OutputFile.c_str());
813 < //   MyEvents->Load((char*) OutputFile.c_str());
810 > Frog_Analyzer::endJob()
811 > {
812 >   if(NEvents>0){
813 >      char OutputFileName[1024];
814 >      sprintf(OutputFileName,"%s",OutputFile.substr(0,OutputFile.size()-4).c_str());
815 >      if(NEventsInVisFile>=0)sprintf(OutputFileName,"%s_R%i_E%i.vis",OutputFileName,SRun,SEvent);
816 >      sprintf(OutputFileName,"%s.vis",OutputFileName);
817 >
818 >      FROG_Events* events = new FROG_Events(events_prim);
819 >      events->Save((char*) OutputFileName);
820 >      delete events;
821 >      delete events_prim;
822 >
823 >      events_prim = new FROG_Element_Base(C_PRIMARY);
824 >      NEvents=0;
825 >   }
826   }
827  
828  
# Line 373 | Line 835 | Frog_Analyzer::endJob() {
835   void
836   Frog_Analyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
837   {
838 <        MySimEvent* MyEvent = new MySimEvent;
838 >        if(NEvents == 0){
839 >           SRun   = iEvent.id().run();
840 >           SEvent = iEvent.id().event();
841 >        }
842 >
843 >
844 >        FROG_Element_Event* event =  new FROG_Element_Event(iEvent.id().run(), iEvent.id().event(), iEvent.time().value() );
845 >        events_prim->addDaughter(event);
846  
847          // access the tracker
848          edm::ESHandle<TrackerGeometry> tkGeom;
# Line 388 | Line 857 | Frog_Analyzer::analyze(const edm::Event&
857          edm::ESHandle<RPCGeometry> RpcGeom;
858          iSetup.get<MuonGeometryRecord>().get( RpcGeom );
859  
860 +        edm::ESHandle<CaloGeometry> CaloGeom;
861 +        iSetup.get<CaloGeometryRecord>().get( CaloGeom );
862 +
863 +
864 +        // ### GEN OBJECTS CONTAINER ###
865 +        FROG_Element_Base_With_DetId_And_Name* frogGen = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN, "GEN");
866 +        event->addDaughter(frogGen);
867 +
868 +        // ### GENPARTICLES ###
869 +        FROG_Element_Base_With_DetId_And_Name* frogGenPartColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN_CAND, "GenParticles");
870 +        frogGen->addDaughter(frogGenPartColl);
871 +
872 +
873 +        for(unsigned int i=0;i<GenParticlesProducers.size();i++){
874 +           edm::Handle<GenParticleCollection> h_gen_Particles;
875 +           iEvent.getByLabel(GenParticlesProducers[i], h_gen_Particles);
876 +           GenParticleCollection gen_Particles = *h_gen_Particles.product();
877 +
878 +           FROG_Element_Base_With_DetId_And_Name* frogGenPartCollb = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN_CAND + i + 1, GenParticlesProducers[i].encode().c_str());
879 +           frogGenPartColl->addDaughter(frogGenPartCollb);
880 +
881 +           for(unsigned int h=0;h<gen_Particles.size();h++){
882 +             if(gen_Particles[h].status()!=1)continue;
883 +             FROG_Element_Event_Candidate* frogGenPart = new FROG_Element_Event_Candidate(gen_Particles[h].pdgId(), gen_Particles[h].p(), gen_Particles[h].eta(), gen_Particles[h].phi());
884 +             frogGenPartCollb->addDaughter(frogGenPart);
885 +           }
886 +        }
887 +
888 +
889 +        // ### SIM OBJECTS CONTAINER ###
890 +        FROG_Element_Base_With_DetId_And_Name* frogSim = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN, "SIM");
891 +        event->addDaughter(frogSim);
892  
392        // Save Data
893          // ### SIMTRACK ###
894 +        FROG_Element_Base_With_DetId_And_Name* frogSimTrkColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMTRK, "SimTracks");
895 +        frogSim->addDaughter(frogSimTrkColl);
896 +
897          for(unsigned int i=0;i<SimTrackProducers.size();i++){
898             edm::Handle<std::vector< SimTrack > > h_SimTracks;
899             iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
900             std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
901  
902             for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
400                MySimTrack  MysimTrack;
903                  SimTrack    simTrack    =SimTrackColl[a];
904  
905 <                MysimTrack.track_id     =simTrack.trackId();
906 <                MysimTrack.Type         =simTrack.type();
907 <                MysimTrack.parent_vertex=simTrack.vertIndex();
908 <                MysimTrack.Px           =simTrack.momentum().x();
909 <                MysimTrack.Py           =simTrack.momentum().y();
408 <                MysimTrack.Pz           =simTrack.momentum().z();
409 <                MysimTrack.E            =simTrack.momentum().e();
410 <                MysimTrack.charge       =simTrack.charge();
411 <
412 <                MyEvent->MySimTrackCollection.push_back(MysimTrack);
905 >                FROG_Element_Event_Sim_Track* frogSimTrk =  new FROG_Element_Event_Sim_Track(simTrack.trackId(),
906 >                        simTrack.momentum().x(),     simTrack.momentum().y(),     simTrack.momentum().z(),
907 >                        simTrack.momentum().e(),     simTrack.type(),             simTrack.vertIndex(),
908 >                        simTrack.charge() );
909 >                frogSimTrkColl->addDaughter(frogSimTrk);
910             }      
911          }
912  
913          // ### SIMVERTEX ###
914 +        FROG_Element_Base_With_DetId_And_Name* frogSimVtx = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMVTX, "SimVertex");
915 +        frogSim->addDaughter(frogSimVtx);
916 +
917          for(unsigned int i=0;i<SimVertexProducers.size();i++){
918             edm::Handle<std::vector< SimVertex > > h_Vertex;
919             iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
920             std::vector< SimVertex > VertexColl = *h_Vertex.product();
921  
922             for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
423                MySimVertex     MyVertex;
923                  SimVertex       Vertex  =  VertexColl[b];
924  
925 <                MyVertex.parentTrack_id =Vertex.parentIndex ();
926 <                MyVertex.x              =Vertex.position().x();
927 <                MyVertex.y              =Vertex.position().y();
429 <                MyVertex.z              =Vertex.position().z();
925 >                FROG_Element_Event_Sim_Vertex* frogSimVertex = new FROG_Element_Event_Sim_Vertex(
926 >                        Vertex.position().x(),  Vertex.position().y(),  Vertex.position().z(),
927 >                        Vertex.parentIndex());
928  
929 <                MyEvent->MySimVertexCollection.push_back(MyVertex);
929 >                frogSimVtx->addDaughter(frogSimVertex);
930             }
931          }
932  
933 +
934          // ### SIMHIT ###
935 +
936 +        FROG_Element_Base_With_DetId_And_Name* frogSimHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMHIT, "SimHits");
937 +        frogSim->addDaughter(frogSimHit);
938          for(unsigned int i=0;i<SimHitProducers.size();i++){
939             edm::Handle<std::vector< PSimHit > > h_Hits;
940             iEvent.getByLabel(SimHitProducers[i], h_Hits);
941             std::vector< PSimHit > Hits = *h_Hits.product();
942  
943 +           FROG_Element_Base_With_DetId_And_Name* frogSimHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMHIT + i + 1, SimHitProducers[i].encode().c_str() );
944 +           frogSimHit->addDaughter(frogSimHitColl);
945 +
946             for(unsigned int h=0; h<Hits.size(); h++)
947             {
948                  DetId theDetUnitId(Hits[h].detUnitId());
949 <                const GeomDet* theDet = tkGeom->idToDet(theDetUnitId);
949 >                const GeomDet* theDet = NULL;
950 >                if(theDetUnitId.det() == DetId::Tracker)theDet = tkGeom->idToDet(theDetUnitId);
951 >                if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::DT) theDet = DtGeom->idToDet(theDetUnitId);
952 >                if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::CSC)theDet = CscGeom->idToDet(theDetUnitId);
953 >                if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::RPC)theDet = RpcGeom->idToDet(theDetUnitId);
954 >
955 >                
956 >                FROG_Element_Event_Sim_Hit* frogSimHit = new FROG_Element_Event_Sim_Hit(
957 >                        theDet->surface().toGlobal(Hits[h].localPosition()).x(),theDet->surface().toGlobal(Hits[h].localPosition()).y(),theDet->surface().toGlobal(Hits[h].localPosition()).z(),
958 >                        Hits[h].energyLoss(), Hits[h].processType() );
959 >                frogSimHitColl->addDaughter(frogSimHit);
960 >           }
961 >        }
962  
963 <                MyPSimHit Hit;
447 <                Hit.x           = theDet->surface().toGlobal(Hits[h].localPosition()).x();
448 <                Hit.y           = theDet->surface().toGlobal(Hits[h].localPosition()).y();
449 <                Hit.z           = theDet->surface().toGlobal(Hits[h].localPosition()).z();
450 <                Hit.ProcessType = Hits[h].processType();
451 <                Hit.dEdX        = Hits[h].energyLoss();
963 >        // ### SIMCALOHIT ###
964  
965 <                MyEvent->MyPSimHitCollection.push_back(Hit);
965 >        for(unsigned int i=0;i<SimCaloHitProducers.size();i++){
966 >           edm::Handle<std::vector< PCaloHit > > h_CaloHits;
967 >           iEvent.getByLabel(SimCaloHitProducers[i], h_CaloHits);
968 >           std::vector< PCaloHit > CaloHits = *h_CaloHits.product();
969 >
970 >           FROG_Element_Base_With_DetId_And_Name* frogSimHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SIMHIT + SimHitProducers.size() + i + 1, SimCaloHitProducers[i].encode().c_str());
971 >           frogSimHit->addDaughter(frogSimHitColl);
972 >
973 >           for(unsigned int h=0; h<CaloHits.size(); h++)
974 >           {
975 >                DetId theDetUnitId(CaloHits[h].id());
976 >                const CaloCellGeometry* CellGeom = NULL;
977 >                if(theDetUnitId.det() == DetId::Ecal || theDetUnitId.det() == DetId::Hcal)CellGeom = CaloGeom->getGeometry(theDetUnitId);
978 >                if(CellGeom==NULL)continue;
979 >
980 >
981 >                FROG_Element_Event_Sim_Hit* frogSimCaloHit = new FROG_Element_Event_Sim_Hit(
982 >                        CellGeom->getPosition().x(),CellGeom->getPosition().y(),CellGeom->getPosition().z(),
983 >                        CaloHits[h].energy(), CaloHits[h].depth() );
984 >                frogSimHitColl->addDaughter(frogSimCaloHit);
985             }
986 <        }
986 >        }
987  
988  
458        // ### TRACKS ###
459        for(unsigned int i=0;i<TrackProducers.size();i++){
460           edm::Handle<std::vector< reco::Track > > h_Tracks;
461           iEvent.getByLabel(TrackProducers[i], h_Tracks);
462           std::vector< reco::Track > TrackColl = *h_Tracks.product();
989  
464           for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
465                MyRecoTrack  MyrecoTrack;
466                reco::Track  recoTrack  =TrackColl[t];
990  
991 <                for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
992 <                      TrackingRecHitRef h_it     = recoTrack.recHit(h);
993 <                      if(!h_it->isValid() )continue;
994 <                      DetId detId                = h_it->geographicalId();
995 <                      const GeomDet * theDet     = tkGeom->idToDet(detId);
996 <                      LocalPoint localPos        = h_it->localPosition();
991 >        // ### LOW RECO OBJECTS CONTAINER ###
992 >        FROG_Element_Base_With_DetId_And_Name* frogLowReco = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN, "RECO LOW");
993 >        event->addDaughter(frogLowReco);
994 >
995 >
996 >
997 >        // ### SiStrip Clusters ###
998 >        FROG_Element_Base_With_DetId_And_Name* frogSSTHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_SISTRIPHIT, "SiStrip Clusters");
999 >        frogLowReco->addDaughter(frogSSTHit);
1000 >        for(unsigned int i=0;i<SiStripClusterProducers.size();i++){
1001 >           edm::Handle<edmNew::DetSetVector<SiStripCluster> > h_Sst_Hits;
1002 >           iEvent.getByLabel(SiStripClusterProducers[i], h_Sst_Hits);
1003 >           const edmNew::DetSetVector<SiStripCluster>&  Sst_Hits = *h_Sst_Hits.product();
1004 >
1005 >
1006 >           FROG_Element_Base_With_DetId_And_Name* frogSstHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_SISTRIPHIT + i + 1, SiStripClusterProducers[i].encode().c_str());
1007 >           frogSSTHit->addDaughter(frogSstHitColl);
1008 >
1009 >
1010 >           for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = Sst_Hits.begin(); DSViter != Sst_Hits.end(); ++DSViter) {
1011 >           edmNew::DetSet<SiStripCluster>::const_iterator begin=DSViter->begin();
1012 >           edmNew::DetSet<SiStripCluster>::const_iterator end  =DSViter->end();
1013 >           for(edmNew::DetSet<SiStripCluster>::const_iterator iCluster=begin;iCluster!=end;++iCluster){
1014 >
1015 >                const GeomDetUnit* detUnit = tkGeom->idToDetUnit (DetId( iCluster->geographicalId() ) );
1016 >                if(!detUnit)continue;
1017 >
1018 >                const StripGeomDetUnit* DetUnit = dynamic_cast<const StripGeomDetUnit*> ( detUnit  );
1019 >                if(!DetUnit)continue;
1020 >
1021 >                const StripTopology& Topo  = DetUnit->specificTopology();
1022 >
1023 >                unsigned int Charge = 0;
1024 >                for(unsigned int i=0;i<iCluster->amplitudes().size();i++){Charge+=iCluster->amplitudes()[i];}
1025 >
1026 >                unsigned int MiddleStrip = iCluster->firstStrip() + iCluster->amplitudes().size()/2;
1027 >
1028 >                float Pitch = DetUnit->surface().bounds().width() / Topo.nstrips();
1029 >                float XPos = (MiddleStrip * Pitch) - DetUnit->surface().bounds().width()/2;
1030 >                //float YPos = DetUnit->surface().bounds().thickness()/2;
1031 >                //float ZPos = DetUnit->surface().bounds().length()/2;
1032 >
1033 >                Surface::GlobalPoint Pos  = DetUnit->surface().toGlobal( LocalPoint(XPos, 0, 0) );
1034 >
1035 >
1036 >                FROG_Element_Event_Hit_SiStrip* frogStripHit = new FROG_Element_Event_Hit_SiStrip(iCluster->geographicalId(), iCluster->firstStrip(), Pitch);
1037 >                for(unsigned int i=0;i<iCluster->amplitudes().size();i++){frogStripHit->Ampl_.push_back(iCluster->amplitudes()[i]);}
1038 >                frogSstHitColl->addDaughter(frogStripHit);
1039 >           }}
1040  
475                      MyRecoHit hit;          
476                      hit.x      = theDet->surface().toGlobal(localPos).x();
477                      hit.y      = theDet->surface().toGlobal(localPos).y();
478                      hit.z      = theDet->surface().toGlobal(localPos).z();
479                      hit.DetId  = detId.rawId();
480                      hit.Charge = -1;
481                      MyrecoTrack.Hits.push_back(hit);
482                }
483                MyEvent->MyRecoTrackCollection.push_back(MyrecoTrack);
484           }
1041          }
1042  
1043  
1044 +
1045 +        // ### CALORecHits ###
1046 +        FROG_Element_Base_With_DetId_And_Name* frogCaloHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_CALOHIT, "CALO Hits");
1047 +        frogLowReco->addDaughter(frogCaloHit);
1048 +
1049 +
1050          // ### ECALRecHits ###
1051 +        FROG_Element_Base_With_DetId_And_Name* frogEcalHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_ECALHIT, "ECAL RecHits");
1052 +        frogCaloHit->addDaughter(frogEcalHit);
1053          for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
1054             edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
1055             iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
1056             EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
1057  
1058 +           FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_ECALHIT + i + 1, EcalRecHitProducers[i].encode().c_str());
1059 +           frogEcalHit->addDaughter(frogHitColl);
1060 +
1061             for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
1062 <                MyCaloHit temp_EcalHit;
1063 <                temp_EcalHit.E     = Ecal_RecHits[eh].energy();
1064 <                temp_EcalHit.t     = Ecal_RecHits[eh].time();
498 <                temp_EcalHit.DetId = (Ecal_RecHits[eh].detid()).rawId();
499 <        
500 <                MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalHit);
1062 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((Ecal_RecHits[eh].detid()).rawId(),
1063 >                        Ecal_RecHits[eh].energy(), Ecal_RecHits[eh].time());  
1064 >                frogHitColl->addDaughter(frogCaloHit);
1065             }
1066          }
1067  
1068  
1069          // ### HCALRecHits ###
1070 +        FROG_Element_Base_With_DetId_And_Name* frogHcalHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT, "HCAL RecHits");
1071 +        frogCaloHit->addDaughter(frogHcalHit);
1072          for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
1073             edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
1074             iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
1075             HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
1076  
1077 <           for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
1078 <                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();
1077 >           FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT + i + 1, HcalHBHERecHitProducers[i].encode().c_str());
1078 >           frogHcalHit->addDaughter(frogHitColl);
1079  
1080 <                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHBHEHit);
1080 >           for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
1081 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHBHE_RecHits[hh].detid()).rawId(),
1082 >                        HcalHBHE_RecHits[hh].energy(), HcalHBHE_RecHits[hh].time());
1083 >                frogHitColl->addDaughter(frogCaloHit);
1084             }
1085          }
1086  
521
1087          for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
1088             edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
1089             iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
1090             HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
1091  
1092 <           for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
1093 <                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();
1092 >           FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT + HcalHBHERecHitProducers.size() + i + 1, HcalHORecHitProducers[i].encode().c_str());
1093 >           frogHcalHit->addDaughter(frogHitColl);
1094  
1095 <                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHOHit);
1095 >           for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
1096 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHO_RecHits[hh].detid()).rawId(),
1097 >                        HcalHO_RecHits[hh].energy(), HcalHO_RecHits[hh].time());
1098 >                frogHitColl->addDaughter(frogCaloHit);
1099             }
1100          }
1101  
537
1102          for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
1103             edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
1104             iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
1105             HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
1106  
1107 <           for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
1108 <                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();
1107 >           FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_HCALHIT + HcalHBHERecHitProducers.size() + HcalHORecHitProducers.size() + i + 1, HcalHFRecHitProducers[i].encode().c_str());
1108 >           frogHcalHit->addDaughter(frogHitColl);
1109  
1110 <                MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHFHit);
1110 >           for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
1111 >                FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHF_RecHits[hh].detid()).rawId(),
1112 >                        HcalHF_RecHits[hh].energy(), HcalHF_RecHits[hh].time());
1113 >                frogHitColl->addDaughter(frogCaloHit);
1114             }
1115          }
1116  
1117 +
1118          // ### Muon Segments ###
1119 +        FROG_Element_Base_With_DetId_And_Name* frogMuonSeg = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONSEG, "MuonSegments");
1120 +        frogLowReco->addDaughter(frogMuonSeg);
1121 +
1122          for(unsigned int i=0;i<CSCSegmentProducers.size();i++){
1123             edm::Handle<CSCSegmentCollection > h_CSC_Segments;
1124             iEvent.getByLabel(CSCSegmentProducers[i], h_CSC_Segments);
1125             CSCSegmentCollection CSC_Segments = *h_CSC_Segments.product();
1126  
1127 +           FROG_Element_Base_With_DetId_And_Name* frogSegColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONSEG + i + 1, CSCSegmentProducers[i].encode().c_str());
1128 +           frogMuonSeg->addDaughter(frogSegColl);
1129 +
1130             for(unsigned int s=0;s<CSC_Segments.size();s++){
1131                  DetId theDetUnitId = CSC_Segments[s].geographicalId();
1132                  const GeomDet* theDet = CscGeom->idToDet(theDetUnitId);
1133  
1134 <                MyMuonSegment temp_CscSeg;
1135 <                temp_CscSeg.DetId = theDetUnitId.rawId();
1136 <                temp_CscSeg.PosX  = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x();
1137 <                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);
1134 >                FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
1135 >                theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).y() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).z()  ,
1136 >                theDet->surface().toGlobal(CSC_Segments[s].localDirection()).x(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).y(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).z() );
1137 >                frogSegColl->addDaughter(frogSeg);
1138             }
1139          }
1140  
# Line 578 | Line 1143 | Frog_Analyzer::analyze(const edm::Event&
1143             iEvent.getByLabel(DTSegmentProducers[i], h_DT_Segments);
1144             DTRecSegment4DCollection DT_Segments = *h_DT_Segments.product();
1145  
1146 +           FROG_Element_Base_With_DetId_And_Name* frogSegColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONSEG + CSCSegmentProducers.size() + i + 1, DTSegmentProducers[i].encode().c_str());
1147 +           frogMuonSeg->addDaughter(frogSegColl);
1148 +
1149             for(unsigned int s=0;s<DT_Segments.size();s++){
1150                  DetId theDetUnitId = DT_Segments[s].geographicalId();
1151                  const GeomDet* theDet = DtGeom->idToDet(theDetUnitId);
1152  
1153 <                MyMuonSegment temp_DtSeg;
1154 <                temp_DtSeg.DetId = theDetUnitId.rawId();
1155 <                temp_DtSeg.PosX  = theDet->surface().toGlobal(DT_Segments[s].localPosition()).x();
1156 <                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);
1153 >                FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
1154 >                theDet->surface().toGlobal(DT_Segments[s].localPosition()).x() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).y() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).z()  ,
1155 >                theDet->surface().toGlobal(DT_Segments[s].localDirection()).x(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).y(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).z() );
1156 >                frogSegColl->addDaughter(frogSeg);
1157             }
1158          }
1159  
1160          // ### Muon Hits ###
1161 +        FROG_Element_Base_With_DetId_And_Name* frogMuonHit = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONHIT, "MuonHits");
1162 +        frogLowReco->addDaughter(frogMuonHit);
1163          for(unsigned int i=0;i<RPCHitsProducers.size();i++){
1164             edm::Handle<RPCRecHitCollection > h_RPC_Hits;
1165             iEvent.getByLabel(RPCHitsProducers[i], h_RPC_Hits);
1166             RPCRecHitCollection RPC_Hits = *h_RPC_Hits.product();
1167  
1168 +           FROG_Element_Base_With_DetId_And_Name* frogHitColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MUONHIT + i + 1, RPCHitsProducers[i].encode().c_str());
1169 +           frogMuonHit->addDaughter(frogHitColl);
1170 +
1171             for(unsigned int h=0;h<RPC_Hits.size();h++){
1172                  DetId theDetUnitId = RPC_Hits[h].geographicalId();
1173                  const GeomDet* theDet = RpcGeom->idToDet(theDetUnitId);
1174  
1175 <                MyMuonHit temp_RpcHit;
1176 <                temp_RpcHit.DetId = theDetUnitId.rawId();
1177 <                temp_RpcHit.x  = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).x();
1178 <                temp_RpcHit.y  = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).y();
1179 <                temp_RpcHit.z  = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).z();
1175 >                FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(theDetUnitId.rawId(),
1176 >                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 );
1177 >                frogHitColl->addDaughter(frogHit);
1178 >           }
1179 >        }
1180 >
1181 >
1182 >        // ### Calo Towers ###
1183 >        FROG_Element_Base_With_DetId_And_Name* frogCaloTower = new FROG_Element_Base_With_DetId_And_Name( EVTID_CALOTOWER, "CaloTowers");
1184 >        frogLowReco->addDaughter(frogCaloTower);
1185 >        for(unsigned int i=0;i<CaloTowersProducers.size();i++){
1186 >           edm::Handle<CaloTowerCollection> h_Calo_Towers;
1187 >           iEvent.getByLabel(CaloTowersProducers[i], h_Calo_Towers);
1188 >           CaloTowerCollection Calo_Towers = *h_Calo_Towers.product();
1189 >
1190 >           FROG_Element_Base_With_DetId_And_Name* frogCaloTowerColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_CALOTOWER + i + 1, CaloTowersProducers[i].encode().c_str());
1191 >           frogCaloTower->addDaughter(frogCaloTowerColl);
1192 >
1193 >           for(unsigned int h=0;h<Calo_Towers.size();h++){
1194 >                FROG_Element_Event_CaloTower* frogTower = new FROG_Element_Event_CaloTower(Calo_Towers[h].id().rawId(), Calo_Towers[h].emEnergy(),Calo_Towers[h].hadEnergy());
1195 >                frogCaloTowerColl->addDaughter(frogTower);
1196 >
1197 >                if(i==0 && CaloTowersProducersBasedOnCaloHits){
1198 >                   frogTower->Components_CollEvtId_ = EVTID_CALOHIT;
1199 >                   std::vector<DetId> TowersDetIds = Calo_Towers[h].constituents();
1200 >                   for(unsigned int D=0;D<TowersDetIds.size();D++){frogTower->Components_Vector_.push_back(TowersDetIds[D]);}
1201 >                }
1202 >
1203 >           }
1204 >        }
1205 >
1206 >
1207 >
1208 >        // ### MED RECO OBJECTS CONTAINER ###
1209 >        FROG_Element_Base_With_DetId_And_Name* frogMedReco = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN, "RECO MED");
1210 >        event->addDaughter(frogMedReco);
1211 >
1212  
1213 <                MyEvent->MyMuonHitCollection.push_back(temp_RpcHit);
1213 >
1214 >
1215 >
1216 >        FROG_Element_Base_With_DetId_And_Name* frogNIVertex = new FROG_Element_Base_With_DetId_And_Name( EVTID_NUCLINT, "Vertex from NI");
1217 >        frogMedReco->addDaughter(frogNIVertex);
1218 >
1219 >        // NUCLEAR INTERACTIONS
1220 >        for(unsigned int i=0;i<NIProducers.size();i++) {
1221 >          edm::Handle<std::vector<reco::NuclearInteraction> > h_NIs;
1222 >          iEvent.getByLabel(NIProducers[i], h_NIs);
1223 >          std::vector<reco::NuclearInteraction> NIs = *h_NIs.product();
1224 >          FROG_Element_Base_With_DetId_And_Name* frogNIColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_NUCLINT + i + 1, NIProducers[i].encode().c_str());
1225 >          frogNIVertex->addDaughter(frogNIColl);
1226 >
1227 >          for(unsigned int h=0; h<NIs.size();h++){
1228 >             reco::NuclearInteraction ni = NIs[i];
1229 >             float vtx_x = ni.vertex().x();
1230 >             float vtx_y = ni.vertex().y();
1231 >             float vtx_z = ni.vertex().z();
1232 >             float like  = ni.likelihood();
1233 >             FROG_Element_Event_NuclInt*  frogNI = new FROG_Element_Event_NuclInt(vtx_x, vtx_y, vtx_z, like );
1234 >             frogNIColl->addDaughter(frogNI);
1235 >          }
1236 >        }
1237 >
1238 >
1239 >
1240 >        // ### TRAJECTORY ###
1241 >        FROG_Element_Base_With_DetId_And_Name* frogTrk = new FROG_Element_Base_With_DetId_And_Name( EVTID_TRK, "Tracks & Trajectories");
1242 >        frogMedReco->addDaughter(frogTrk);
1243 >
1244 >        for(unsigned int i=0;i<TrajectoryProducers.size();i++){
1245 >             Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
1246 >             iEvent.getByLabel(TrajectoryProducers[i], trajTrackAssociationHandle);
1247 >             const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
1248 >
1249 >             FROG_Element_Base_With_DetId_And_Name* frogTrkColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_TRK + i + 1,  "Traj  | %s", TrajectoryProducers[i].encode().c_str());
1250 >             frogTrk->addDaughter(frogTrkColl);
1251 >
1252 >             for(TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it!=TrajToTrackMap.end(); ++it) {
1253 >                Trajectory  recoTraj     = *it->key;
1254 >                FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(i,it->val->p(),it->val->pt(),it->key->chiSquared());
1255 >                frogTrkColl->addDaughter(frogTrk);
1256 >
1257 >                std::vector<TrajectoryMeasurement> measurements = recoTraj.measurements();
1258 >                for(unsigned int h=0;h<measurements.size();h++){
1259 >
1260 >                      TrajectoryMeasurement::ConstRecHitPointer h_it = measurements[h].recHit();
1261 >                      if(!h_it->isValid() )continue;
1262 >                      DetId detId                = h_it->geographicalId();
1263 >                      GlobalPoint globalPos      = measurements[h].updatedState().globalPosition();
1264 >
1265 >                      FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(detId.rawId(), globalPos.x(),globalPos.y(),  globalPos.z(), -1);
1266 >                      frogTrk->addDaughter(frogHit);
1267 >                }
1268 >              //  printf("Add a Trajectory\n");
1269             }
1270          }
1271  
618        printf("RPC Hits = %i\n",MyEvent->MyMuonHitCollection.size());
1272  
1273 <        MyEvents->Events.push_back(MyEvent);  
1273 >
1274 >
1275 >        // ### TRACK ###
1276 >
1277 >        for(unsigned int i=0;i<TrackProducers.size();i++){
1278 >           edm::Handle<std::vector< reco::Track > > h_Tracks;
1279 >           iEvent.getByLabel(TrackProducers[i], h_Tracks);
1280 >           std::vector< reco::Track > TrackColl = *h_Tracks.product();
1281 >
1282 >           FROG_Element_Base_With_DetId_And_Name* frogTrkColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_TRK + TrajectoryProducers.size() + i + 1, "Track | %s", TrackProducers[i].encode().c_str());
1283 >           frogTrk->addDaughter(frogTrkColl);
1284 >
1285 >           //printf("Size of the TrackCOllection : %i = %i\n",i,TrackColl.size());
1286 >           for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
1287 >              reco::Track  recoTrack  =TrackColl[t];
1288 >
1289 >              FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(TrajectoryProducers.size()+i,recoTrack.p(),recoTrack.pt(), recoTrack.chi2());
1290 >              frogTrkColl->addDaughter(frogTrk);
1291 >
1292 >              for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
1293 >                 TrackingRecHitRef h_it     = recoTrack.recHit(h);
1294 >                 if(!h_it->isValid() )continue;
1295 >                 DetId detId                = h_it->geographicalId();
1296 >                 const GeomDet * theDet = NULL;
1297 >
1298 >                 if(detId.det()==DetId::Tracker)                        theDet = tkGeom->idToDet(detId);
1299 >                 if(detId.det()==DetId::Muon && detId.subdetId() == 1)  theDet = DtGeom->idToDet(detId);
1300 >                 if(detId.det()==DetId::Muon && detId.subdetId() == 2)  theDet = CscGeom->idToDet(detId);
1301 >                 if(detId.det()==DetId::Muon && detId.subdetId() == 3)  theDet = RpcGeom->idToDet(detId);
1302 >
1303 >                 LocalPoint localPos        = h_it->localPosition();
1304 >
1305 >                 FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(
1306 >                        detId.rawId(),
1307 >                        theDet->surface().toGlobal(localPos).x(),
1308 >                        theDet->surface().toGlobal(localPos).y(),
1309 >                        theDet->surface().toGlobal(localPos).z(),
1310 >                        -1);
1311 >                 frogTrk->addDaughter(frogHit);
1312 >              }
1313 >              //printf("Add a Track\n");
1314 >
1315 >           }
1316 >        }
1317 >
1318 >
1319 >
1320 >
1321 >
1322 >
1323 >        // ### HIGH RECO OBJECTS CONTAINER ###
1324 >        FROG_Element_Base_With_DetId_And_Name* frogHighReco = new FROG_Element_Base_With_DetId_And_Name( EVTID_GEN, "RECO HIGH");
1325 >        event->addDaughter(frogHighReco);
1326 >
1327 >
1328 >
1329 >        FROG_Element_Base_With_DetId_And_Name* frogJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET, "Jets");
1330 >        frogHighReco->addDaughter(frogJet);
1331 >
1332 >
1333 >        // ### Basic Jets ###
1334 >        FROG_Element_Base_With_DetId_And_Name* frogBasicJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_BASIC, "BasicJets");
1335 >        frogJet->addDaughter(frogBasicJet);
1336 >        for(unsigned int i=0;i<BasicJetsProducers.size();i++){
1337 >           edm::Handle<BasicJetCollection> h_Basic_Jets;
1338 >           iEvent.getByLabel(BasicJetsProducers[i], h_Basic_Jets);
1339 >           BasicJetCollection Basic_Jets = *h_Basic_Jets.product();
1340 >
1341 >           FROG_Element_Base_With_DetId_And_Name* frogBasicJetColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_BASIC + i + 1, BasicJetsProducers[i].encode().c_str());
1342 >           frogBasicJet->addDaughter(frogBasicJetColl);
1343 >
1344 >           for(unsigned int h=0;h<Basic_Jets.size();h++){
1345 >                FROG_Element_Event_Jet* frogJet = new FROG_Element_Event_Jet(Basic_Jets[h].p(), Basic_Jets[h].eta(),Basic_Jets[h].phi());
1346 >                frogBasicJet->addDaughter(frogJet);
1347 >           }
1348 >        }
1349 >
1350 >
1351 >        // ### Calo Jets ###
1352 >        FROG_Element_Base_With_DetId_And_Name* frogCaloJet = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_CALO, "CaloJets");
1353 >        frogJet->addDaughter(frogCaloJet);
1354 >        for(unsigned int i=0;i<CaloJetsProducers.size();i++){
1355 >           edm::Handle<CaloJetCollection> h_Calo_Jets;
1356 >           iEvent.getByLabel(CaloJetsProducers[i], h_Calo_Jets);
1357 >           CaloJetCollection Calo_Jets = *h_Calo_Jets.product();
1358 >
1359 >           FROG_Element_Base_With_DetId_And_Name* frogCaloJetColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_JET_CALO + i + 1, CaloJetsProducers[i].encode().c_str());
1360 >           frogCaloJet->addDaughter(frogCaloJetColl);
1361 >
1362 >           for(unsigned int h=0;h<Calo_Jets.size();h++){
1363 >                FROG_Element_Event_Jet* frogJet = new FROG_Element_Event_Jet(Calo_Jets[h].p(), Calo_Jets[h].eta(),Calo_Jets[h].phi());
1364 >                frogCaloJetColl->addDaughter(frogJet);
1365 >
1366 >                if(CaloJetsProducersBasedOnCaloTowers){
1367 >                   std::vector<CaloTowerPtr> CaloTowers = Calo_Jets[h].getCaloConstituents();
1368 >                   frogJet->Components_CollEvtId_ = EVTID_CALOTOWER + 1;
1369 >                   for(unsigned int t=0;t<CaloTowers.size();t++){  frogJet->Components_Vector_.push_back(CaloTowers[t]->id().rawId());}
1370 >                }
1371 >           }
1372 >        }
1373 >
1374 >        // ### MET ###
1375 >        FROG_Element_Base_With_DetId_And_Name* frogMET = new FROG_Element_Base_With_DetId_And_Name( EVTID_MET_CALO, "MET");
1376 >        frogHighReco->addDaughter(frogMET);
1377 >        for(unsigned int i=0;i<CaloMETProducers.size();i++){
1378 >           edm::Handle<CaloMETCollection> h_met;
1379 >           iEvent.getByLabel(CaloMETProducers[i], h_met);
1380 >           CaloMETCollection reco_met = *h_met.product();
1381 >
1382 >           FROG_Element_Base_With_DetId_And_Name* frogMETColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_MET_CALO + i + 1, CaloMETProducers[i].encode().c_str());
1383 >           frogMET->addDaughter(frogMETColl);
1384 >
1385 >           for(unsigned int h=0;h<reco_met.size();h++){
1386 >                FROG_Element_Event_MET* frogMETevt = new FROG_Element_Event_MET(i, reco_met[h].p(), reco_met[h].eta(),reco_met[h].phi(), reco_met[h].sumEt());
1387 >                frogMETColl->addDaughter(frogMETevt);
1388 >           }
1389 >        }
1390 >
1391 >
1392 >        // ### RecoCandidates ###
1393 >        FROG_Element_Base_With_DetId_And_Name* frogRecoCand = new FROG_Element_Base_With_DetId_And_Name( EVTID_RECOCAND, "RecoCandidates");
1394 >        frogHighReco->addDaughter(frogRecoCand);
1395 >        for(unsigned int i=0;i<RecoCandidateProducers.size();i++){
1396 >           edm::Handle<CandidateCollection> h_reco_Candidates;
1397 >           iEvent.getByLabel(RecoCandidateProducers[i], h_reco_Candidates);
1398 >           CandidateCollection reco_Candidates = *h_reco_Candidates.product();
1399 >
1400 >           FROG_Element_Base_With_DetId_And_Name* frogRecoCandColl = new FROG_Element_Base_With_DetId_And_Name( EVTID_RECOCAND + i + 1, RecoCandidateProducers[i].encode().c_str());
1401 >           frogRecoCand->addDaughter(frogRecoCandColl);
1402 >
1403 >           for(unsigned int h=0;h<reco_Candidates.size();h++){
1404 >                FROG_Element_Event_Candidate* frogCandidate = new FROG_Element_Event_Candidate(reco_Candidates[h].pdgId(), reco_Candidates[h].p(), reco_Candidates[h].eta(),reco_Candidates[h].phi());
1405 >                frogRecoCandColl->addDaughter(frogCandidate);
1406 >           }
1407 >        }
1408 >
1409 >
1410 >
1411 >   NEvents++;
1412 >   if(NEvents == NEventsInVisFile){
1413 >      char OutputFileName[1024];
1414 >      sprintf(OutputFileName,"%s",OutputFile.substr(0,OutputFile.size()-4).c_str());
1415 >      if(NEventsInVisFile>=0)sprintf(OutputFileName,"%s_R%i_E%i.vis",OutputFileName,SRun,SEvent);
1416 >      sprintf(OutputFileName,"%s.vis",OutputFileName);
1417 >
1418 >      FROG_Events* events = new FROG_Events(events_prim);
1419 >      events->Save((char*) OutputFileName);
1420 >      delete events;
1421 >      delete events_prim;
1422 >
1423 >      events_prim = new FROG_Element_Base(C_PRIMARY);
1424 >      NEvents=0;
1425 >   }
1426 >
1427   }
1428  
1429  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines