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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines