Index: trunk/src/FrogUtil.cc
===================================================================
--- trunk/src/FrogUtil.cc	(revision 579)
+++ trunk/src/FrogUtil.cc	(revision 580)
@@ -44,26 +44,8 @@
 #include "FrogUtil.h"
 
-#include "FROG_Coord.h"
-#include "FROG_Coord.cpp"
-#include "FROG_Geometry.h"
-#include "FROG_Geometry.cpp"
-#include "FROG_DetId.h"
-#include "FROG_Events.h"
-#include "FROG_Events.cpp"
-#include "FROG_Element_Tools.h"
-#include "FROG_Element_Tools.cpp"
-#include "FROG_Net_Tools.h"
-#include "FROG_Net_Tools.cpp"
-#include "FROG_Path.h"
-#include "FROG_Path.cpp"
-#include "FROG_ReadCards.h"
-#include "FROG_ReadCards.cpp"
-#include "FROG_ZLib.h"
-#include "FROG_ZLib.cpp"
-
 using namespace std;
-using namespace FROG_COORD;
-
 const float twopi = 6.283185307179586476925286766559;
+
+inline float EtaToTheta(float Eta){return 2*atan(exp(-Eta));}
 
 FrogDisplay::FrogDisplay() {
@@ -137,5 +119,5 @@
   unsigned int allEntries=treeReader->GetEntries();
   
-  FROG_Events* frog_events = new FROG_Events();
+  BaseColl* frog_events = new BaseColl();
   if(nEntryFrog > allEntries) {
   cerr <<"**     ERROR: number of entries to display > available events      **"<< endl;
@@ -149,9 +131,9 @@
     
     //Create a new event
-    FROG_Element_Event* frog_event =  new FROG_Element_Event(1,entry);
-    frog_events->AddEvent(frog_event);
+    Event* frog_event =  new Event(1,entry);
+    frog_events->addDaughter(frog_event);
     
     //Create a new branch in the event with name SIM and ID = EVTID_SIM
-    FROG_Element_Base_With_DetId_And_Name* frog_branchSIM = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM,"SIM");
+    BaseColl_Name* frog_branchSIM = new BaseColl_Name(EVTID_SIM,"SIM");
     frog_event->addDaughter(frog_branchSIM);
    
@@ -159,5 +141,5 @@
     //SIM ELEC
     //Create a new sub-branch in the SIM branch with name Electrons: this sub branch will contais all the electrons
-    FROG_Element_Base_With_DetId_And_Name* frog_branchElectrons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+1000,"Electrons");
+    BaseColl_Name* frog_branchElectrons = new BaseColl_Name(EVTID_SIM+1000,"Electrons");
     frog_branchSIM->addDaughter(frog_branchElectrons);
     
@@ -165,5 +147,5 @@
       elec = (TRootElectron*) branchElectron->At(p);
       //      cout<<"Elec nO "<<p<<" PT: "<<elec->PT<<" Eta "<<elec->Eta<<" Phi"<<elec->Phi<<endl;
-      FROG_Element_Event_Candidate* frog_elec = new FROG_Element_Event_Candidate(11,elec->E,elec->Eta,elec->Phi);
+      Event_Candidate* frog_elec = new Event_Candidate(11,elec->E,elec->Eta,elec->Phi);
       frog_branchElectrons->addDaughter(frog_elec);
     }
@@ -172,10 +154,10 @@
     //SIM MUONS
     //Create a new sub-branch in the SIM branch with name Muons: this sub branch will contais all the muons
-    FROG_Element_Base_With_DetId_And_Name* frog_branchMuons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+2000,"Muons");
+    BaseColl_Name* frog_branchMuons = new BaseColl_Name(EVTID_SIM+2000,"Muons");
     frog_branchSIM->addDaughter(frog_branchMuons);
     for(int p=0;p<branchMuon->GetEntriesFast();p++){
       muon = (TRootMuon*) branchMuon->At(p);
       //      cout<<"Muon nO"<<p<<" PT: "<<muon->PT<<"Eta "<<muon->Eta<<" Phi"<<muon->Phi<<endl;
-      FROG_Element_Event_Candidate* frog_muon = new FROG_Element_Event_Candidate(13,muon->E,muon->Eta,muon->Phi);
+      Event_Candidate* frog_muon = new Event_Candidate(13,muon->E,muon->Eta,muon->Phi);
       frog_branchMuons->addDaughter(frog_muon);
     }
@@ -184,10 +166,10 @@
     //SIM TAUS
     //Create a new sub-branch in the SIM branch with name Taus: this sub branch will contais all the Taus
-    FROG_Element_Base_With_DetId_And_Name* frog_branchTaus = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+3000,"Taus");
+    BaseColl_Name* frog_branchTaus = new BaseColl_Name(EVTID_SIM+3000,"Taus");
     frog_branchSIM->addDaughter(frog_branchTaus);
     for(int p=0;p<branchTau->GetEntriesFast();p++){
       tau = (TRootTauJet*) branchTau->At(p);
       //      cout<<"Tau nO"<<p<<" PT: "<<tau->PT<<"Eta "<<tau->Eta<<" Phi"<<tau->Phi<<endl;
-      FROG_Element_Event_Candidate* frog_tau = new FROG_Element_Event_Candidate(15,tau->E,tau->Eta,tau->Phi);
+      Event_Candidate* frog_tau = new Event_Candidate(15,tau->E,tau->Eta,tau->Phi);
       frog_branchTaus->addDaughter(frog_tau);
     }
@@ -196,10 +178,10 @@
     //SIM PHOTONS
     //Create a new sub-branch in the SIM branch with name Photons: this sub branch will contais all the Photons
-    FROG_Element_Base_With_DetId_And_Name* frog_branchPhotons = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+4000,"Photons");
+    BaseColl_Name* frog_branchPhotons = new BaseColl_Name(EVTID_SIM+4000,"Photons");
     frog_branchSIM->addDaughter(frog_branchPhotons);
     for(int p=0;p<branchPhoton->GetEntriesFast();p++){
       photon = (TRootPhoton*) branchPhoton->At(p);
       //      cout<<"Photon nO"<<p<<" PT: "<<photon->PT<<"Eta "<<photon->Eta<<" Phi"<<photon->Phi<<endl;
-      FROG_Element_Event_Candidate* frog_photon = new FROG_Element_Event_Candidate(22,photon->E,photon->Eta,photon->Phi);
+      Event_Candidate* frog_photon = new Event_Candidate(22,photon->E,photon->Eta,photon->Phi);
       frog_branchPhotons->addDaughter(frog_photon);
     }
@@ -208,10 +190,10 @@
     //SIM JETS
     //Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the Jets
-    FROG_Element_Base_With_DetId_And_Name* frog_branchJets = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+5000,"Jets");
+    BaseColl_Name* frog_branchJets = new BaseColl_Name(EVTID_SIM+5000,"Jets");
     frog_branchSIM->addDaughter(frog_branchJets);
     for(int p=0;p<branchJet->GetEntriesFast();p++){
       jet = (TRootJet*) branchJet->At(p);
       //      cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl;
-      FROG_Element_Event_Jet* frog_jet = new FROG_Element_Event_Jet(jet->E,jet->Eta,jet->Phi);
+      Event_Jet* frog_jet = new Event_Jet(jet->E,jet->Eta,jet->Phi);
       frog_branchJets->addDaughter(frog_jet);
     }
@@ -220,16 +202,17 @@
     //SIM MET
     //Create a new sub-branch in the SIM branch with name MET: this sub branch will contais all the METs
-    FROG_Element_Base_With_DetId_And_Name* frog_branchMET = new FROG_Element_Base_With_DetId_And_Name(EVTID_SIM+6000,"MET");
+    BaseColl_Name* frog_branchMET = new BaseColl_Name(EVTID_SIM+6000,"MET");
     frog_branchSIM->addDaughter(frog_branchMET);
     for(int p=0;p<branchMET->GetEntriesFast();p++){
       met = (TRootETmis*) branchMET->At(p);
       //      cout<<"MET nO"<<p<<" ET: "<<met->ET<<"Eta "<<0<<" Phi"<<met->Phi<<endl;
-      FROG_Element_Event_MET* frog_met = new FROG_Element_Event_MET(0,met->ET,0,met->Phi, met->ET);
+      Event_MET* frog_met = new Event_MET(0,met->ET,0,met->Phi, met->ET);
       frog_branchMET->addDaughter(frog_met);
     }
     
-    //Save the event in the .vis file
-    frog_events->SaveInLive("DelphesToFrog.vis",false,false,(unsigned int)-1);
   }
+  //Save events in the .vis file
+  frog_events->save("DelphesToFrog.vis");
+
  
 /* Pointer hierachy
@@ -261,10 +244,10 @@
 
   // This element is the root of the "file" tree.  (don't change this line)
-  FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);
-
-  FROG_Element_Base* mygeom = new FROG_Element_Base(C_GEOMETRY);
+  BaseColl* prim = new BaseColl();
+
+  BaseColl* mygeom = new BaseColl();
   prim->addDaughter(mygeom);
   
-  FROG_Element_Base_With_DetId_And_Name* detector = new FROG_Element_Base_With_DetId_And_Name(900000000,"Delphes");
+  BaseColl_Name* detector = new BaseColl_Name(900000000,"Delphes");
   mygeom->addDaughter(detector);
   
@@ -283,5 +266,5 @@
   //********************************************************************************************************
   
-  FROG_Element_Base_With_DetId_And_Name* Tracker = new FROG_Element_Base_With_DetId_And_Name(910000000,"Tracker");
+  BaseColl_Name* Tracker = new BaseColl_Name(910000000,"Tracker");
   detector->addDaughter(Tracker);
   unsigned int DetIdCountTracker = 1;
@@ -294,5 +277,5 @@
   for(double phi=0; phi<=twopi/frac;phi+=dphi){
 
-    FROG_Element_Primitive_CustomSurface* trackerCone1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,    
+    Prim_CustomSurface* trackerCone1 = new Prim_CustomSurface(9100000+DetIdCountTracker*10,    
 	  rayCone*sin(phi)      ,rayCone*cos(phi)       ,-Lenght_Tracker/2,
 	  rayCone*sin(phi+dphi) ,rayCone*cos(phi+dphi)  ,-Lenght_Tracker/2,
@@ -301,5 +284,5 @@
     Tracker->addDaughter(trackerCone1);   DetIdCountTracker++;					
 
-    FROG_Element_Primitive_CustomSurface* trackerCone2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,    
+    Prim_CustomSurface* trackerCone2 = new Prim_CustomSurface(9100000+DetIdCountTracker*10,    
 	  0                 , 0                  ,0,
 	  0                 , 0                  ,0,
@@ -309,5 +292,5 @@
     
     
-    FROG_Element_Primitive_CustomSurface* trackerB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,    
+    Prim_CustomSurface* trackerB = new Prim_CustomSurface(9100000+DetIdCountTracker*10,    
       ray*sin(phi)        ,ray*cos(phi)       ,-Lenght_Tracker*0.5, 
       ray*sin(phi+dphi)   ,ray*cos(phi+dphi)  ,-Lenght_Tracker*0.5,
@@ -316,5 +299,5 @@
     Tracker->addDaughter(trackerB);   DetIdCountTracker++;
     
-    FROG_Element_Primitive_CustomSurface* trackerEndCap1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
+    Prim_CustomSurface* trackerEndCap1 = new Prim_CustomSurface(9100000+DetIdCountTracker*10,
       rayCone*sin(phi)      , rayCone*cos(phi)      ,  -(Lenght_Tracker)/2,
       rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) ,  -(Lenght_Tracker)/2,
@@ -323,5 +306,5 @@
     Tracker->addDaughter(trackerEndCap1);   DetIdCountTracker++;
     
-    FROG_Element_Primitive_CustomSurface* trackerEndCap2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
+    Prim_CustomSurface* trackerEndCap2 = new Prim_CustomSurface(9100000+DetIdCountTracker*10,
       rayCone*sin(phi)      , rayCone*cos(phi)      ,  (Lenght_Tracker)/2,
       rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) ,  (Lenght_Tracker)/2,
@@ -337,5 +320,5 @@
   //********************************************************************************************************
   
-  FROG_Element_Base_With_DetId_And_Name* CALO = new FROG_Element_Base_With_DetId_And_Name(920000000,"Calo");
+  BaseColl_Name* CALO = new BaseColl_Name(920000000,"Calo");
   detector->addDaughter(CALO);
   unsigned int DetIdCountCalo = 1;
@@ -351,5 +334,5 @@
     
     //BARREL
-    FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountCalo*10,
+    Prim_CustomSurface* caloB = new Prim_CustomSurface(9100000+DetIdCountCalo*10,
      ray*sin(phi)        ,ray*cos(phi)       ,-Lenght_Calo*0.5,  
      ray*sin(phi+dphi)   ,ray*cos(phi+dphi)  ,-Lenght_Calo*0.5,
@@ -359,5 +342,5 @@
     
     //Partial cone + side
-    FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
+    Prim_CustomSurface* caloEndCap1a = new Prim_CustomSurface(9200000+DetIdCountCalo*10,
           rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  (Lenght_Tracker)/2,
 	  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  (Lenght_Tracker)/2,
@@ -367,5 +350,5 @@
     
     //Close Endcap + side
-    FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
+    Prim_CustomSurface* caloEndCap1b = new Prim_CustomSurface(9200000+DetIdCountTracker*10,
 	  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_Calo)/2,
 	  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_Calo)/2,
@@ -375,5 +358,5 @@
     
     //Partial cone - side
-    FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
+    Prim_CustomSurface* caloEndCap2a = new Prim_CustomSurface(9200000+DetIdCountCalo*10,
 	  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  -(Lenght_Tracker)/2,
 	  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  -(Lenght_Tracker)/2,
@@ -383,5 +366,5 @@
     
     //Close Endcap - side
-    FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
+    Prim_CustomSurface* caloEndCap2b = new Prim_CustomSurface(9200000+DetIdCountTracker*10,
 	  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_Calo)/2,
 	  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_Calo)/2,
@@ -397,5 +380,5 @@
   //********************************************************************************************************
   
-  FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(930000000,"Muon");
+  BaseColl_Name* MUON = new BaseColl_Name(930000000,"Muon");
   detector->addDaughter(MUON);
   unsigned int DetIdCountMuon = 1;
@@ -409,5 +392,5 @@
     
     //BARREL
-    FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+    Prim_CustomSurface* muonB = new Prim_CustomSurface(9300000+DetIdCountMuon*10,
 	   ray*sin(phi)      ,ray*cos(phi)       ,-Lenght_Muon*0.5,    
 	   ray*sin(phi+dphi) ,ray*cos(phi+dphi)  ,-Lenght_Muon*0.5,
@@ -417,5 +400,5 @@
     
     //Partial cone + side
-    FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+    Prim_CustomSurface* muonEndCap1a = new Prim_CustomSurface(9300000+DetIdCountMuon*10,
 	  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  (Lenght_Calo)/2,
 	  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  (Lenght_Calo)/2,
@@ -425,5 +408,5 @@
     
     //Close Endcap + side
-    FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+    Prim_CustomSurface* muonEndCap1b = new Prim_CustomSurface(9300000+DetIdCountMuon*10,
 	  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_Muon)/2,
 	  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_Muon)/2,
@@ -433,5 +416,5 @@
     
     //Partial cone - side
-    FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+    Prim_CustomSurface* muonEndCap2a = new Prim_CustomSurface(9300000+DetIdCountMuon*10,
 	  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  -(Lenght_Calo)/2,
 	  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  -(Lenght_Calo)/2,
@@ -441,5 +424,5 @@
     
     //Close Endcap - side
-    FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+    Prim_CustomSurface* muonEndCap2b = new Prim_CustomSurface(9300000+DetIdCountMuon*10,
 	  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_Muon)/2,
 	  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_Muon)/2,
@@ -453,5 +436,5 @@
   //********************************************************************************************************
   
-  FROG_Element_Base_With_DetId_And_Name* CALOFWD = new FROG_Element_Base_With_DetId_And_Name(940000000,"CaloFwd");
+  BaseColl_Name* CALOFWD = new BaseColl_Name(940000000,"CaloFwd");
   detector->addDaughter(CALOFWD);
   unsigned int DetIdCountCaloFwd = 1;
@@ -465,5 +448,5 @@
     
     //Partial cone + side
-    FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+    Prim_CustomSurface* caloFWDEndCap1a = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10,
      rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  (Lenght_Muon)/2,
      rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  (Lenght_Muon)/2,
@@ -473,5 +456,5 @@
     
     //Close Endcap + side
-    FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+    Prim_CustomSurface* caloFWDEndCap1b = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10,
      rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_CaloFwd)/2,
      rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_CaloFwd)/2,
@@ -481,5 +464,5 @@
 												     
     //BARREL
-    FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
+    Prim_CustomSurface* caloFWDB1 = new Prim_CustomSurface(9400000+DetIdCountMuon*10,
      ray*sin(phi)      ,ray*cos(phi)       , Lenght_Muon*0.5,    
      ray*sin(phi+dphi) ,ray*cos(phi+dphi)  , Lenght_Muon*0.5,
@@ -489,5 +472,5 @@
     
     //Partial cone - side
-    FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+    Prim_CustomSurface* caloFWDEndCap2a = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10,
      rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  -(Lenght_Muon)/2,
      rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  -(Lenght_Muon)/2,
@@ -497,5 +480,5 @@
    
     //Close Endcap - side
-    FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+    Prim_CustomSurface* caloFWDEndCap2b = new Prim_CustomSurface(9400000+DetIdCountCaloFwd*10,
      rayConeF*sin(phi)       , rayConeF*cos(phi)      ,  -(Lenght_CaloFwd)/2,
      rayConeF*sin(phi+dphi)  , rayConeF*cos(phi+dphi) ,  -(Lenght_CaloFwd)/2,
@@ -505,5 +488,5 @@
 
     //BARREL
-    FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountMuon*10,
+    Prim_CustomSurface* caloFWDB2 = new Prim_CustomSurface(9400000+DetIdCountMuon*10,
        ray*sin(phi)      ,ray*cos(phi)       , -Lenght_Muon*0.5,    
        ray*sin(phi+dphi) ,ray*cos(phi+dphi)  , -Lenght_Muon*0.5,
@@ -512,10 +495,7 @@
     CALOFWD->addDaughter(caloFWDB2);   DetIdCountCaloFwd++;
   }
-
-  FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
-  CustomGeom->Save("DelphesToFrog.geom");
+  prim->save("DelphesToFrog.geom");
 
   delete prim;
-  delete CustomGeom;
 
 /* pointer hierarchy
@@ -531,5 +511,4 @@
 
 
-  //FROG_ELEMENT::PrintTree(prim);
   return;
 
