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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines