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

Comparing UserCode/FastOpenGlDisplayer/src/Frog_Analyzer.cc (file contents):
Revision 1.3 by querten, Sat Apr 19 14:46:02 2008 UTC vs.
Revision 1.37 by querten, Mon Aug 25 06:35:02 2008 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines