]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFv5T0.cxx
Removal of memory small leaks.
[u/mrichter/AliRoot.git] / TOF / AliTOFv5T0.cxx
index 1c3ea185dee6c016cb52b2293a086d03ec8c27f7..db6208e1de41147b47e877f54fe73e664229f04b 100644 (file)
@@ -112,16 +112,14 @@ Revision 0.1 2004 November G. Cara Romeo and A. De Caro
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "TDirectory.h"
-#include "TBRIK.h"
-#include "TGeometry.h"
-#include "TLorentzVector.h"
-#include "TNode.h"
-#include "TVirtualMC.h"
-#include "TGeoManager.h"
+#include <TDirectory.h>
+#include <TGeoGlobalMagField.h>
+#include <TGeoManager.h>
 #include <TGeoMatrix.h>
 #include <TGeoPhysicalNode.h>
 #include <TGeoVolume.h>
+#include <TLorentzVector.h>
+#include <TVirtualMC.h>
 
 #include "AliConst.h"
 #include "AliGeomManager.h"
@@ -204,7 +202,7 @@ AliTOFv5T0::AliTOFv5T0(const char *name, const char *title):
 
   // Save the geometry
   TDirectory* saveDir = gDirectory;
-  AliRunLoader::GetRunLoader()->CdGAFile();
+  AliRunLoader::Instance()->CdGAFile();
   fTOFGeometry->Write("TOFgeometry");
   saveDir->cd();
 
@@ -338,89 +336,6 @@ void AliTOFv5T0::AddAlignableVolumes() const
 
   }
   
-}
-//____________________________________________________________________________
-void AliTOFv5T0::BuildGeometry()
-{
-  //
-  // Build TOF ROOT geometry for the ALICE event display
-  //
-  TNode *node, *top;
-  const int kColorTOF  = 27;
-  
-  TGeometry *globalGeometry = (TGeometry*)gAlice->GetGeometry();
-
-  // Find top TNODE
-  top = globalGeometry->GetNode("alice");
-  
-  // Position the different copies
-  const Float_t krTof  =(fTOFGeometry->Rmax()+fTOFGeometry->Rmin())/2.;
-  const Float_t khTof  = fTOFGeometry->Rmax()-fTOFGeometry->Rmin();
-  const Int_t   kNTof  = fTOFGeometry->NSectors();
-  const Float_t kangle = k2PI/kNTof;
-
-  const Float_t kInterCentrModBorder1 = 49.5;
-  const Float_t kInterCentrModBorder2 = 57.5;
-
-  Float_t ang;
-  
-  // define offset for nodes
-  Float_t zOffsetB = (fTOFGeometry->ZlenA()*0.5 + (kInterCentrModBorder1+kInterCentrModBorder2)*0.5)*0.5;
-  Float_t zOffsetA = 0.;
-  // Define TOF basic volume
-  
-  char nodeName0[16], nodeName1[16], nodeName2[16];
-  char nodeName3[16], nodeName4[16], rotMatNum[16];
-
-  if (fTOFHoles) {
-    new TBRIK("S_TOF_B","TOF box","void",
-             fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
-    new TBRIK("S_TOF_C","TOF box","void",
-             fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenB()*0.5);
-  }
-  new TBRIK("S_TOF_A","TOF box","void",
-            fTOFGeometry->StripLength()*0.5, khTof*0.5, fTOFGeometry->ZlenA()*0.5);
-  
-  for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
-    
-    if (nodeNum<10) {
-      sprintf(rotMatNum,"rot50%i",nodeNum);
-      sprintf(nodeName0,"FTO00%i",nodeNum);
-      sprintf(nodeName1,"FTO10%i",nodeNum);
-      sprintf(nodeName2,"FTO20%i",nodeNum);
-      sprintf(nodeName3,"FTO30%i",nodeNum);
-      sprintf(nodeName4,"FTO40%i",nodeNum);
-    }
-    if (nodeNum>9) {
-      sprintf(rotMatNum,"rot5%i",nodeNum);
-      sprintf(nodeName0,"FTO0%i",nodeNum);
-      sprintf(nodeName1,"FTO1%i",nodeNum);
-      sprintf(nodeName2,"FTO2%i",nodeNum);
-      sprintf(nodeName3,"FTO3%i",nodeNum);
-      sprintf(nodeName4,"FTO4%i",nodeNum);
-    }
-    
-    new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
-    ang = (4.5-nodeNum) * kangle;
-
-    if (fTOFHoles) {   
-      top->cd();
-      node = new TNode(nodeName2,nodeName2,"S_TOF_B", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetB,rotMatNum);
-      node->SetLineColor(kColorTOF);
-      fNodes->Add(node);
-      
-      top->cd();
-      node = new TNode(nodeName3,nodeName3,"S_TOF_C", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
-      node->SetLineColor(kColorTOF);
-      fNodes->Add(node);
-    }
-
-    top->cd();
-    node = new TNode(nodeName4,nodeName4,"S_TOF_A", krTof*TMath::Cos(ang), krTof*TMath::Sin(ang), zOffsetA,rotMatNum);
-    node->SetLineColor(kColorTOF);
-    fNodes->Add(node);
-  } // end loop on nodeNum
-
 }
 
 //_____________________________________________________________________________
@@ -1396,7 +1311,7 @@ void AliTOFv5T0::CreateMaterials()
 
   //AliTOF::CreateMaterials();
 
-  AliMagF *magneticField = (AliMagF*)gAlice->Field();
+  AliMagF *magneticField = (AliMagF*)((AliMagF*)TGeoGlobalMagField::Instance()->GetField());
 
   Int_t   isxfld = magneticField->Integ();
   Float_t sxmgmx = magneticField->Max();