Index: /trunk/Utilities/FROG/config.txt
===================================================================
--- /trunk/Utilities/FROG/config.txt	(revision 111)
+++ /trunk/Utilities/FROG/config.txt	(revision 112)
@@ -88,12 +88,4 @@
 Id_21005000_Color       = {0.0  , 1.0  , 1.0  , 1.0};    // Jets
 Id_21006000_Color       = {0.5  , 0.5  , 0.5  , 1.0};    // MET
-=======
-Id_21001000_Color       = {0.0 , 1.0 , 0.0 , 1.0};    // Electrons
-Id_21002000_Color       = {0.0 , 0.0 , 1.0 , 1.0};    // Muons
-Id_21003000_Color       = {1.0 , 0.0 , 0.0 , 1.0};    // Taus
-Id_21004000_Color       = {1.0 , 1.0 , 0.0 , 1.0};    // Photons
-Id_21005000_Color       = {0.0 , 1.0 , 1.0 , 1.0};    // Jets
-Id_21006000_Color       = {1.0 , 0.0 , 1.0 , 1.0};    // MET
->>>>>>> 1.3
 
 
Index: /trunk/src/FrogUtil.cc
===================================================================
--- /trunk/src/FrogUtil.cc	(revision 111)
+++ /trunk/src/FrogUtil.cc	(revision 112)
@@ -79,4 +79,6 @@
   FROG_Element_Event_Hit* hit1 = new FROG_Element_Event_Hit(400000001 + ((int)pos1_z)/50, pos1_x, pos1_y, pos1_z, -1);
   track1->addDaughter(hit1);
+  
+
   trackCollection->addDaughter(track1);
   // photon 2
@@ -360,6 +362,4 @@
   const TClonesArray* branchJet      = treeReader   ->UseBranch("Jet");
   const TClonesArray* branchMET      = treeReader   ->UseBranch("ETmis");
-  const TClonesArray* branchTracks   = treeReader   ->UseBranch("Tracks");
-  const TClonesArray* particles      = treeReaderGen->UseBranch("Particle");
   
   TRootElectron* elec;
@@ -385,4 +385,5 @@
     
     //Create a new event
+    
     FROG_Element_Event* frog_event =  new FROG_Element_Event(1,entry);
     frog_events->AddEvent(frog_event);
@@ -439,6 +440,5 @@
     
     //SIM JETS
-
-//Create a new sub-branch in the SIM branch with name Jets: this sub branch will contais all the 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");
     frog_branchSIM->addDaughter(frog_branchJets);
@@ -446,5 +446,4 @@
       jet = (TRootJet*) branchJet->At(p);
       cout<<"Jet nO"<<p<<" PT: "<<jet->PT<<"Eta "<<jet->Eta<<" Phi"<<jet->Phi<<endl;
-cout<<"eta du jet "<<jet->Eta<<" theta du jet "<<FROG_COORD::EtaToTheta(jet->Eta)<<" et en degre "<<57.29*FROG_COORD::EtaToTheta(jet->Eta)<<endl;
       FROG_Element_Event_Jet* frog_jet = new FROG_Element_Event_Jet(jet->E,jet->Eta,jet->Phi);
       frog_branchJets->addDaughter(frog_jet);
@@ -486,5 +485,5 @@
   mygeom->addDaughter(detector);
   
-  double Rayon_Tracker=50;
+  double Rayon_Tracker=40;
   double Rayon_Calo = Rayon_Tracker*1.5;
   double Rayon_Muon = Rayon_Tracker*2;
@@ -492,14 +491,9 @@
   double Lenght_Calo=Lenght_Tracker+Lenght_Tracker/2.5;
   double Lenght_Muon=Lenght_Calo+Lenght_Calo/2.5;
-  double Lenght_FWCalo=Lenght_Tracker+1.5*Lenght_Tracker;
-  
-  int plus=1;
-  
-int NumPhi=20;
-
-
- 
-
- 
+  double Lenght_CaloFwd=Lenght_Muon+Lenght_Muon/2.5;
+  
+  int NumPhi=100;
+  float frac=1;
+  
   //************************************************Tracker*************************************************
   //********************************************************************************************************
@@ -508,18 +502,57 @@
   detector->addDaughter(Tracker);
   unsigned int DetIdCountTracker = 1;
-  for(double ray=0;ray <= Rayon_Tracker;ray +=plus){
-  //  double ray=Rayon_Tracker;
-    double length = ray/tan(EtaToTheta(DET->CEN_max_tracker));
-    if(length >= Lenght_Tracker)
-      {
-	FROG_Element_Primitive_Cylinder* tracker = new FROG_Element_Primitive_Cylinder(9100000+DetIdCountTracker*10,ray,0,0,0,0,0,Lenght_Tracker,NumPhi,1);
-//	FROG_Element_Primitive_Cone* tracker = new FROG_Element_Primitive_Cone(9100000+DetIdCountTracker*10,ray,0,0,0,0,0,Lenght_Tracker,NumPhi,1);
-	Tracker->addDaughter(tracker);   DetIdCountTracker++;
-      }
-    else {
-      FROG_Element_Primitive_Cylinder* tracker = new FROG_Element_Primitive_Cylinder(9100000+DetIdCountTracker*10,ray,0,0,0,0,0,length,NumPhi,0);                                  
-      Tracker->addDaughter(tracker);   DetIdCountTracker++;         
-    }
+  
+  double ray=Rayon_Tracker;
+  double rayCone = tan(EtaToTheta(DET->CEN_max_tracker))*Lenght_Tracker/2;
+  if(ray < rayCone)ray=rayCone;
+
+  double dphi  = 6.283185307179586476925286766559 /NumPhi;
+  for(double phi=0; phi<=6.2831/frac;phi+=dphi){
+
+    FROG_Element_Primitive_CustomSurface* trackerCone1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,    
+												  rayCone*sin(phi)      ,rayCone*cos(phi)       ,-Lenght_Tracker/2,
+												  rayCone*sin(phi+dphi) ,rayCone*cos(phi+dphi)  ,-Lenght_Tracker/2,
+												  0                 , 0                 , 0,
+                                                                                                  0                 , 0                 , 0
+												  );
+
+    Tracker->addDaughter(trackerCone1);   DetIdCountTracker++;					
+
+    FROG_Element_Primitive_CustomSurface* trackerCone2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,    
+												  0                 , 0                  ,0,
+												  0                 , 0                  ,0,
+												  rayCone*sin(phi)      , rayCone*cos(phi)       , Lenght_Tracker/2,
+												  rayCone*sin(phi+dphi) , rayCone*sin(phi+dphi)  , Lenght_Tracker/2
+												  );
+    Tracker->addDaughter(trackerCone2);   DetIdCountTracker++;		
+    
+    
+    FROG_Element_Primitive_CustomSurface* trackerB = new FROG_Element_Primitive_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,
+											      ray*sin(phi+dphi)   ,ray*cos(phi+dphi)  , Lenght_Tracker*0.5,
+											      ray*sin(phi)        ,ray*cos(phi)       , Lenght_Tracker*0.5);
+    
+    Tracker->addDaughter(trackerB);   DetIdCountTracker++;
+    
+    FROG_Element_Primitive_CustomSurface* trackerEndCap1 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
+												    rayCone*sin(phi)      , rayCone*cos(phi)      ,  -(Lenght_Tracker)/2,
+												    rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) ,  -(Lenght_Tracker)/2,
+												    ray*sin(phi+dphi)     , ray*cos(phi+dphi)     ,  -(Lenght_Tracker)/2,
+												    ray*sin(phi)          , ray*cos(phi)          ,  -(Lenght_Tracker)/2
+												    );
+    Tracker->addDaughter(trackerEndCap1);   DetIdCountTracker++;
+    
+    FROG_Element_Primitive_CustomSurface* trackerEndCap2 = new FROG_Element_Primitive_CustomSurface(9100000+DetIdCountTracker*10,
+												    rayCone*sin(phi)      , rayCone*cos(phi)      ,  (Lenght_Tracker)/2,
+												    rayCone*sin(phi+dphi) , rayCone*cos(phi+dphi) ,  (Lenght_Tracker)/2,
+												    ray*sin(phi+dphi)     , ray*cos(phi+dphi)     ,  (Lenght_Tracker)/2,
+												    ray*sin(phi)          , ray*cos(phi)          ,  (Lenght_Tracker)/2
+												    );
+    Tracker->addDaughter(trackerEndCap2);   DetIdCountTracker++;
+    
   }
+  
+  Rayon_Calo = ray*1.5;
   
   //******************************************Central calorimeters******************************************
@@ -530,87 +563,199 @@
   unsigned int DetIdCountCalo = 1;
   
-  for(double ray=Rayon_Tracker;ray <= Rayon_Calo ;ray +=plus){
-    double length = ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
-    double add;
-    if(length >= Lenght_Calo)add=Lenght_Calo;
-    else add=ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
-    if(add > 0)
-      {
-	FROG_Element_Primitive_Cylinder* calo = new FROG_Element_Primitive_Cylinder(9200000+DetIdCountCalo*10,ray,0,0,0,0,0,add,NumPhi,0);
-	CALO->addDaughter(calo);   DetIdCountCalo++;
-      }
+  float rayConeD = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Tracker/2;
+  float rayConeF = tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_Calo/2;
+  ray=Rayon_Calo;
+  if(ray<rayConeF)ray=rayConeF;
+   
+  for(double phi=0; phi<=6.2831/frac;phi+=dphi){
+    
+    //BARREL
+    FROG_Element_Primitive_CustomSurface* caloB = new FROG_Element_Primitive_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,
+											   ray*sin(phi+dphi)   ,ray*cos(phi+dphi)  , Lenght_Calo*0.5,
+											   ray*sin(phi)        ,ray*cos(phi)       , Lenght_Calo*0.5
+											   );
+    
+    CALO->addDaughter(caloB);   DetIdCountCalo++;
+    
+    //Partial cone + side
+    FROG_Element_Primitive_CustomSurface* caloEndCap1a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
+												  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  (Lenght_Tracker)/2,
+												  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  (Lenght_Tracker)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_Calo)/2,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_Calo)/2
+												  );
+    CALO->addDaughter(caloEndCap1a);   DetIdCountCalo++;
+    
+    //Close Endcap + side
+    FROG_Element_Primitive_CustomSurface* caloEndCap1b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_Calo)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_Calo)/2,
+												  ray*sin(phi+dphi)      , ray*cos(phi+dphi)      ,  (Lenght_Calo)/2,
+												  ray*sin(phi)           , ray*cos(phi)           ,  (Lenght_Calo)/2
+												  );
+    CALO->addDaughter(caloEndCap1b);   DetIdCountCalo++;
+    
+    //Partial cone - side
+    FROG_Element_Primitive_CustomSurface* caloEndCap2a = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountCalo*10,
+												  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  -(Lenght_Tracker)/2,
+												  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  -(Lenght_Tracker)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_Calo)/2,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_Calo)/2
+												  );
+    CALO->addDaughter(caloEndCap2a);   DetIdCountCalo++;
+    
+    //Close Endcap - side
+    FROG_Element_Primitive_CustomSurface* caloEndCap2b = new FROG_Element_Primitive_CustomSurface(9200000+DetIdCountTracker*10,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_Calo)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_Calo)/2,
+												  ray*sin(phi+dphi)      , ray*cos(phi+dphi)      ,  -(Lenght_Calo)/2,
+												  ray*sin(phi)           , ray*cos(phi)           ,  -(Lenght_Calo)/2
+												  );
+    CALO->addDaughter(caloEndCap2b);   DetIdCountCalo++;
+    
   }
-  for(double ray=0;ray <= Rayon_Tracker;ray +=plus){
-    double length = ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
-    double add;
-    if(length >= Lenght_Calo)add=(Lenght_Calo-Lenght_Tracker)/2;
-    else add=(length-Lenght_Tracker)/2;
-    if(add > 0)
-      {
-	FROG_Element_Primitive_Cylinder* caloP = new FROG_Element_Primitive_Cylinder(9200000+DetIdCountCalo*10,ray,0,0,(Lenght_Tracker+add)/2,0,0,add,NumPhi,0);
-	CALO->addDaughter(caloP);   DetIdCountCalo++;
-	FROG_Element_Primitive_Cylinder* caloM = new FROG_Element_Primitive_Cylinder(9200000+DetIdCountCalo*10,ray,0,0,-(Lenght_Tracker+add)/2,0,0,add,NumPhi,0);
-	CALO->addDaughter(caloM);   DetIdCountCalo++;
-      }        
+ 
+  Rayon_Muon = ray*1.2;
+ 
+  //***********************************************Muon chambers********************************************
+  //********************************************************************************************************
+  
+  FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(930000000,"Muon");
+  detector->addDaughter(MUON);
+  unsigned int DetIdCountMuon = 1;
+  
+  rayConeD = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Calo/2;
+  rayConeF = tan(EtaToTheta(DET->CEN_max_mu))*Lenght_Muon/2;
+  ray=Rayon_Muon;
+  if(ray<rayConeF)ray=rayConeF;
+ 
+  for(double phi=0; phi<=6.2831/frac;phi+=dphi){
+    
+    //BARREL
+    FROG_Element_Primitive_CustomSurface* muonB = new FROG_Element_Primitive_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,
+											   ray*sin(phi+dphi) ,ray*cos(phi+dphi)  , Lenght_Muon*0.5,
+											   ray*sin(phi)      ,ray*cos(phi)       , Lenght_Muon*0.5);
+    
+    MUON->addDaughter(muonB);   DetIdCountMuon++;
+    
+    //Partial cone + side
+    FROG_Element_Primitive_CustomSurface* muonEndCap1a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+												  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  (Lenght_Calo)/2,
+												  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  (Lenght_Calo)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_Muon)/2,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_Muon)/2
+												  );
+    MUON->addDaughter(muonEndCap1a);   DetIdCountMuon++;
+    
+    //Close Endcap + side
+    FROG_Element_Primitive_CustomSurface* muonEndCap1b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_Muon)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_Muon)/2,
+												  ray*sin(phi+dphi)      , ray*cos(phi+dphi)      ,  (Lenght_Muon)/2,
+												  ray*sin(phi)           , ray*cos(phi)           ,  (Lenght_Muon)/2
+												  );
+    MUON->addDaughter(muonEndCap1b);   DetIdCountMuon++;
+    
+    //Partial cone - side
+    FROG_Element_Primitive_CustomSurface* muonEndCap2a = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+												  rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  -(Lenght_Calo)/2,
+												  rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  -(Lenght_Calo)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_Muon)/2,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_Muon)/2
+												  );
+    MUON->addDaughter(muonEndCap2a);   DetIdCountMuon++;
+    
+    //Close Endcap - side
+    FROG_Element_Primitive_CustomSurface* muonEndCap2b = new FROG_Element_Primitive_CustomSurface(9300000+DetIdCountMuon*10,
+												  rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_Muon)/2,
+												  rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_Muon)/2,
+												  ray*sin(phi+dphi)      , ray*cos(phi+dphi)      ,  -(Lenght_Muon)/2,
+												  ray*sin(phi)           , ray*cos(phi)           ,  -(Lenght_Muon)/2
+												  );
+    MUON->addDaughter(muonEndCap2b);   DetIdCountMuon++;
+    
   }
   
+
   //******************************************Forward calorimeters******************************************
   //********************************************************************************************************
   
-  FROG_Element_Base_With_DetId_And_Name* FWCALO = new FROG_Element_Base_With_DetId_And_Name(930000000,"FWCalo");
-  detector->addDaughter(FWCALO);
-  unsigned int DetIdCountFwCalo = 1;
-  
-  double eta_Max=DET->CEN_max_calo_fwd,eta_Min=DET->CEN_max_calo_cen;
-  
-  for(double ray=0;ray <= 50;ray +=plus){
-    double length = ray/tan(EtaToTheta(eta_Max));
-    double add;
-    if(length >= Lenght_FWCalo)add=(Lenght_FWCalo-Lenght_Muon)/2;
-    else add=(length-Lenght_Muon)/2;
-    
-    if(add > 0 && ray < Lenght_FWCalo*tan(EtaToTheta(eta_Min)))
-      {
-	FROG_Element_Primitive_Cylinder* caloFW1 = new FROG_Element_Primitive_Cylinder(9300000+DetIdCountFwCalo*10,ray,0,0,(Lenght_Muon+add)/2,0,0,add,NumPhi,0);
-	FWCALO->addDaughter(caloFW1);   DetIdCountFwCalo++;
-	FROG_Element_Primitive_Cylinder* caloFW2 = new FROG_Element_Primitive_Cylinder(9300000+DetIdCountFwCalo*10,ray,0,0,-(Lenght_Muon+add)/2,0,0,add,NumPhi,0);
-	FWCALO->addDaughter(caloFW2);   DetIdCountFwCalo++;
-      }
+  FROG_Element_Base_With_DetId_And_Name* CALOFWD = new FROG_Element_Base_With_DetId_And_Name(940000000,"CaloFwd");
+  detector->addDaughter(CALOFWD);
+  unsigned int DetIdCountCaloFwd = 1;
+  
+  rayConeD = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_Muon;
+  rayConeF = tan(EtaToTheta(DET->CEN_max_calo_fwd))*Lenght_CaloFwd;
+  ray=tan(EtaToTheta(DET->CEN_max_calo_cen))*Lenght_CaloFwd;
+   
+  for(double phi=0; phi<=6.2831/frac;phi+=dphi){
+    
+    
+    //Partial cone + side
+    FROG_Element_Primitive_CustomSurface* caloFWDEndCap1a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+												     rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  (Lenght_Muon)/2,
+												     rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  (Lenght_Muon)/2,
+												     rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_CaloFwd)/2,
+												     rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_CaloFwd)/2
+												     );
+    CALOFWD->addDaughter(caloFWDEndCap1a);   DetIdCountCaloFwd++;
+    
+    //Close Endcap + side
+    FROG_Element_Primitive_CustomSurface* caloFWDEndCap1b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+												     rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  (Lenght_CaloFwd)/2,
+												     rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  (Lenght_CaloFwd)/2,
+												     ray*sin(phi+dphi)      , ray*cos(phi+dphi)      ,  (Lenght_CaloFwd)/2,
+												     ray*sin(phi)           , ray*cos(phi)           ,  (Lenght_CaloFwd)/2
+												     );
+    CALOFWD->addDaughter(caloFWDEndCap1b);   DetIdCountCaloFwd++;
+												     
+    //BARREL
+    FROG_Element_Primitive_CustomSurface* caloFWDB1 = new FROG_Element_Primitive_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,
+											   ray*sin(phi+dphi) ,ray*cos(phi+dphi)  , Lenght_CaloFwd*0.5,
+											   ray*sin(phi)      ,ray*cos(phi)       , Lenght_CaloFwd*0.5);
+    
+    CALOFWD->addDaughter(caloFWDB1);   DetIdCountCaloFwd++;
+
+
+    									   
+    
+    //Partial cone - side
+    FROG_Element_Primitive_CustomSurface* caloFWDEndCap2a = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+												     rayConeD*sin(phi)      , rayConeD*cos(phi)      ,  -(Lenght_Muon)/2,
+												     rayConeD*sin(phi+dphi) , rayConeD*cos(phi+dphi) ,  -(Lenght_Muon)/2,
+												     rayConeF*sin(phi+dphi) , rayConeF*cos(phi+dphi) ,  -(Lenght_CaloFwd)/2,
+												     rayConeF*sin(phi)      , rayConeF*cos(phi)      ,  -(Lenght_CaloFwd)/2
+												     );
+    CALOFWD->addDaughter(caloFWDEndCap2a);   DetIdCountCaloFwd++;
+   
+    //Close Endcap - side
+    FROG_Element_Primitive_CustomSurface* caloFWDEndCap2b = new FROG_Element_Primitive_CustomSurface(9400000+DetIdCountCaloFwd*10,
+												     rayConeF*sin(phi)       , rayConeF*cos(phi)      ,  -(Lenght_CaloFwd)/2,
+												     rayConeF*sin(phi+dphi)  , rayConeF*cos(phi+dphi) ,  -(Lenght_CaloFwd)/2,
+												     ray*sin(phi+dphi)       , ray*cos(phi+dphi)      ,  -(Lenght_CaloFwd)/2,
+												     ray*sin(phi)            , ray*cos(phi)           ,  -(Lenght_CaloFwd)/2);
+    
+    CALOFWD->addDaughter(caloFWDEndCap2b);   DetIdCountCaloFwd++;
+
+    //BARREL
+    FROG_Element_Primitive_CustomSurface* caloFWDB2 = new FROG_Element_Primitive_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,
+											       ray*sin(phi+dphi) ,ray*cos(phi+dphi)  , -Lenght_CaloFwd*0.5,
+											       ray*sin(phi)      ,ray*cos(phi)       , -Lenght_CaloFwd*0.5);
+    
+    CALOFWD->addDaughter(caloFWDB2);   DetIdCountCaloFwd++;
+
   }
-
-  //***********************************************Muon chambers********************************************
-  //********************************************************************************************************
-  //
-  FROG_Element_Base_With_DetId_And_Name* MUON = new FROG_Element_Base_With_DetId_And_Name(940000000,"MuonDet");
-  detector->addDaughter(MUON);
-  unsigned int DetIdCountMuon = 1;
-
-  for(double ray=Rayon_Calo;ray <= Rayon_Muon ;ray +=plus){
-    double length = ray/tan(EtaToTheta(DET->CEN_max_mu));
-    double add;
-    if(length >= Lenght_Muon)add=Lenght_Muon;
-    else add=ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
-    if(add > 0)
-      {
-        FROG_Element_Primitive_Cylinder* muon = new FROG_Element_Primitive_Cylinder(9400000+DetIdCountMuon*10,ray,0,0,0,0,0,add,NumPhi,0);
-        MUON->addDaughter(muon);   DetIdCountMuon++;
-      }
-  }
-  for(double ray=0;ray <= Rayon_Calo;ray +=plus){
-    double length = ray/tan(EtaToTheta(DET->CEN_max_calo_cen));
-    double add;
-    if(length >= Lenght_Muon)add=(Lenght_Muon-Lenght_Calo)/2;
-    else add=(length-Lenght_Calo)/2;
-    if(add > 0)
-      {
-        FROG_Element_Primitive_Cylinder* muonP = new FROG_Element_Primitive_Cylinder(9400000+DetIdCountMuon*10,ray,0,0,(Lenght_Calo+add)/2,0,0,add,NumPhi,0);
-        MUON->addDaughter(muonP);   DetIdCountMuon++;
-        FROG_Element_Primitive_Cylinder* muonM = new FROG_Element_Primitive_Cylinder(9400000+DetIdCountMuon*10,ray,0,0,-(Lenght_Calo+add)/2,0,0,add,NumPhi,0);
-        MUON->addDaughter(muonM);   DetIdCountMuon++;
-      }
-  }
-
-  
-    
+  
+  
+  
+  
   FROG_Geometry* CustomGeom = new FROG_Geometry(prim);
   CustomGeom->Save("DelphesToFrog.geom");
