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.51 by querten, Thu Nov 20 12:07:18 2008 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines