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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines