]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCv3.cxx
Adding anti-Lambda and anti-Xi
[u/mrichter/AliRoot.git] / TPC / AliTPCv3.cxx
index 0b77fcf74ca2082d355c1f74c72464851d351566..d4c64568debb226da4ead89f2e68950d1eb20dbf 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "AliConst.h"
 #include "AliRun.h"
+#include "AliMathBase.h"
 #include "AliTPCDigitsArray.h"
 #include "AliTPCParam.h"
 #include "AliTPCParamSR.h"
@@ -59,7 +60,8 @@
 ClassImp(AliTPCv3)
 //_____________________________________________________________________________
 
-  AliTPCv3::AliTPCv3(){
+  AliTPCv3::AliTPCv3():AliTPC(),fIdSens(0)
+{
 
   fHitType = 1;
 
@@ -67,15 +69,13 @@ ClassImp(AliTPCv3)
 
 //_____________________________________________________________________________
 AliTPCv3::AliTPCv3(const char *name, const char *title) :
-  AliTPC(name, title) 
+  AliTPC(name, title), fIdSens(0)
 {
   //
   // Standard constructor for Time Projection Chamber version 3
   //
 
   SetBufferSize(128000);
-  fIdSens=0;
-
 
   if (fTPCParam)
      fTPCParam->Write(fTPCParam->GetTitle());
@@ -114,33 +114,52 @@ void AliTPCv3::CreateGeometry()
   // here I define a volume TPC
   // retrive the medium name with "TPC_" as a leading string
   //
-  TGeoPcon *tpc = new TGeoPcon(0.,360.,18); //18 sections
-  tpc->DefineSection(0,-290.,77.,278.);
-  tpc->DefineSection(1,-259.6,77.,278.);
+  TGeoPcon *tpc = new TGeoPcon(0.,360.,30); //30 sections
+  //
+  tpc->DefineSection(0,-289.6,77.,278.);
+  tpc->DefineSection(1,-262.1,77.,278.);
+  //
+  tpc->DefineSection(2,-262.1,83.1,278.);
+  tpc->DefineSection(3,-260.,83.1,278.);
+  //
+  tpc->DefineSection(4,-260.,70.,278.);    
+  tpc->DefineSection(5,-259.6,70.,278.);
   //
-  tpc->DefineSection(2,-259.6,68.1,278.);
-  tpc->DefineSection(3,-253.6,68.1,278.);
+  tpc->DefineSection(6,-259.6,68.1,278.);
+  tpc->DefineSection(7,-253.6,68.1,278.);
   //
-  tpc->DefineSection(4,-253.6,68.,278.);
-  tpc->DefineSection(5,-74.0,60.8,278.);
+  tpc->DefineSection(8,-253.6,68.,278.);
+  tpc->DefineSection(9,-74.0,60.8,278.);
   //
-  tpc->DefineSection(6,-74.0,60.1,278.);
-  tpc->DefineSection(7,-73.3,60.1,278.);
+  tpc->DefineSection(10,-74.0,60.1,278.);
+  tpc->DefineSection(11,-73.3,60.1,278.);
   //
-  tpc->DefineSection(8,-73.3,56.9,278.); 
-  tpc->DefineSection(9,73.3,56.9,278.);
+  tpc->DefineSection(12,-73.3,56.9,278.); 
+  tpc->DefineSection(13,-68.5,56.9,278.);
   //
-  tpc->DefineSection(10,73.3,60.1,278.);
-  tpc->DefineSection(11,74.0,60.1,278.);
+  tpc->DefineSection(14,-68.5,60.,278.);
+  tpc->DefineSection(15,-64.7,60.,278.);
   //
-  tpc->DefineSection(12,74.0,60.8,278.);
-  tpc->DefineSection(13,253.6,65.5,278.);
+  tpc->DefineSection(16,-64.7,56.9,278.); 
+  tpc->DefineSection(17,73.3,56.9,278.);
   //
-  tpc->DefineSection(14,253.6,65.6,278.);
-  tpc->DefineSection(15,259.6,65.6,278.);
+  tpc->DefineSection(18,73.3,60.1,278.);
+  tpc->DefineSection(19,74.0,60.1,278.);
   //
-  tpc->DefineSection(16,259.6,77.0,278.);
-  tpc->DefineSection(17,290.,77.,278.);
+  tpc->DefineSection(20,74.0,60.8,278.);
+  tpc->DefineSection(21,253.6,65.5,278.);
+  tpc->DefineSection(22,253.6,65.6,278.);
+  tpc->DefineSection(23,259.6,65.6,278.);
+  //
+  tpc->DefineSection(24,259.6,70.0,278.);
+  tpc->DefineSection(25,260.,70.0,278.);
+  //
+  tpc->DefineSection(26,260.,83.1,278.);
+  tpc->DefineSection(27,262.1,83.1,278.);
+  //
+  tpc->DefineSection(28,262.1,77.,278);
+  tpc->DefineSection(29,289.6,77.,278.);
+
   //
   TGeoMedium *m1 = gGeoManager->GetMedium("TPC_Air");
   TGeoVolume *v1 = new TGeoVolume("TPC_M",tpc,m1);
@@ -158,7 +177,7 @@ void AliTPCv3::CreateGeometry()
   dvol->DefineSection(4,253.6,74.5,264.4);
   dvol->DefineSection(5,260.,74.5,264.4);
   //
-  TGeoMedium *m5 = gGeoManager->GetMedium("TPC_Ne-CO2-N-2");
+  TGeoMedium *m5 = gGeoManager->GetMedium("TPC_Ne-CO2-2");
   TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
   //
   v1->AddNode(v9,1);
@@ -244,7 +263,7 @@ void AliTPCv3::CreateGeometry()
   //
   tf1v->AddNode(tf2v,1); tf2v->AddNode(tf3v,1);
   //
-  v3->AddNode(tov1,1); v4->AddNode(tf1v,1);
+  v3->AddNode(tov1,1,new TGeoTranslation(0.,0.,-1.5)); v4->AddNode(tf1v,1);
   //
   v2->AddNode(v3,1); v2->AddNode(v4,1); 
   //
@@ -410,8 +429,8 @@ void AliTPCv3::CreateGeometry()
   TGeoTube *cs = new TGeoTube(56.9,61.2,0.1);
   TGeoMedium *sm7 = gGeoManager->GetMedium("TPC_Mylar");
   TGeoVolume *csv = new TGeoVolume("TPC_CDRS",cs,sm7);
-  v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.));
-  v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.));
+  v1->AddNode(csv,1,new TGeoTranslation(0.,0.,-71.2));
+  v1->AddNode(csv,2,new TGeoTranslation(0.,0.,71.2));
   //
   // seal collars 
   TGeoPcon *se = new TGeoPcon(0.,360.,6);
@@ -431,12 +450,12 @@ void AliTPCv3::CreateGeometry()
   //
   // define reflection matrix 
   //
-  TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,270.,180.,0.);
+  TGeoRotation *ref = new TGeoRotation("ref",90.,0.,90.,90.,180.,0.);
   //
   cd1v->AddNode(cd2v,1); cd2v->AddNode(cd3v,1); cflv->AddNode(cd1v,1);
   //
-  v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-72.1));
-  v1->AddNode(siv,2,new TGeoTranslation(0.,0.,72.1));
+  v1->AddNode(siv,1,new TGeoTranslation(0.,0.,-69.9));
+  v1->AddNode(siv,2,new TGeoTranslation(0.,0.,69.9));
   v1->AddNode(sev,1); v1->AddNode(sev,2,ref); v1->AddNode(cflv,1);
   //
   // central membrane - 2 rings and a mylar membrane - assembly
@@ -457,25 +476,25 @@ void AliTPCv3::CreateGeometry()
   // end caps - they are make as an assembly of single segments
   // containing both readout chambers
   //
-  Double_t OpeningAngle = 10.*TMath::DegToRad();
+  Double_t openingAngle = 10.*TMath::DegToRad();
   Double_t thick=1.5; // rib
-  Double_t shift = thick/TMath::Sin(OpeningAngle);
+  Double_t shift = thick/TMath::Sin(openingAngle);
   //
-  Double_t LowEdge = 86.3; // hole in the wheel
-  Double_t UpEdge = 240.4; // hole in the wheel
+  Double_t lowEdge = 86.3; // hole in the wheel
+  Double_t upEdge = 240.4; // hole in the wheel
   //
   new TGeoTubeSeg("sec",74.5,264.4,3.,0.,20.);
   //
   TGeoPgon *hole = new TGeoPgon("hole",0.,20.,1,4);
   //
-  hole->DefineSection(0,-3.5,LowEdge-shift,UpEdge-shift);
-  hole->DefineSection(1,-1.5,LowEdge-shift,UpEdge-shift);
+  hole->DefineSection(0,-3.5,lowEdge-shift,upEdge-shift);
+  hole->DefineSection(1,-1.5,lowEdge-shift,upEdge-shift);
   //
-  hole->DefineSection(2,-1.5,LowEdge-shift,UpEdge+3.-shift);
-  hole->DefineSection(3,3.5,LowEdge-shift,UpEdge+3.-shift);
+  hole->DefineSection(2,-1.5,lowEdge-shift,upEdge+3.-shift);
+  hole->DefineSection(3,3.5,lowEdge-shift,upEdge+3.-shift);
   //
-  Double_t ys = shift*TMath::Sin(OpeningAngle); 
-  Double_t xs = shift*TMath::Cos(OpeningAngle);
+  Double_t ys = shift*TMath::Sin(openingAngle); 
+  Double_t xs = shift*TMath::Cos(openingAngle);
   TGeoTranslation *tr = new TGeoTranslation("tr",xs,ys,0.);  
   tr->RegisterYourself();
   TGeoCompositeShape *chamber = new TGeoCompositeShape("sec-hole:tr");
@@ -526,9 +545,10 @@ void AliTPCv3::CreateGeometry()
    ifstream in;
    in.open(fileName.Data(), ios_base::in); // asci file
    for(Int_t i =0;i<86;i++){
-      Double_t y = 3.9;
+      Double_t y = 3.99;
       Double_t x,z,ang;
       in>>x>>z>>ang;
+      z-=26.5;
       TGeoRotation *rrr = new TGeoRotation();
       rrr->RotateY(ang);
       TGeoCombiTrans *trans = new TGeoCombiTrans("trans",x,y,z,rrr);
@@ -692,7 +712,8 @@ void AliTPCv3::CreateGeometry()
    // 
    // now iroc and oroc are placed into a sector...
    //
-   TGeoVolumeAssembly *sect = new TGeoVolumeAssembly("TPC_SECT");
+   TGeoVolumeAssembly *secta = new TGeoVolumeAssembly("TPC_SECT"); // a-side
+   TGeoVolumeAssembly *sectc = new TGeoVolumeAssembly("TPC_SECT"); // c-side
    TGeoRotation rot1("rot1",90.,90.,0.);
    TGeoRotation rot2("rot2");
    rot2.RotateY(10.);
@@ -700,33 +721,44 @@ void AliTPCv3::CreateGeometry()
    *rot=rot1*rot2;
    //
    Double_t x0,y0;
-   x0=110.2*TMath::Cos(OpeningAngle);
-   y0=110.2*TMath::Sin(OpeningAngle);
-   TGeoCombiTrans *combi1 = new TGeoCombiTrans("combi1",x0,y0,1.09,rot);
-   x0=188.45*TMath::Cos(OpeningAngle);
-   y0=188.45*TMath::Sin(OpeningAngle);
-   TGeoCombiTrans *combi2 = new TGeoCombiTrans("combi2",x0,y0,0.99,rot);
+   x0=110.2*TMath::Cos(openingAngle);
+   y0=110.2*TMath::Sin(openingAngle);
+   TGeoCombiTrans *combi1a = new TGeoCombiTrans("combi1",x0,y0,1.09+0.195,rot); //a-side 
+   TGeoCombiTrans *combi1c = new TGeoCombiTrans("combi1",x0,y0,1.09+0.222,rot); //c-side
+   x0=188.45*TMath::Cos(openingAngle);
+   y0=188.45*TMath::Sin(openingAngle);
+   TGeoCombiTrans *combi2a = new TGeoCombiTrans("combi2",x0,y0,0.99+0.195,rot); //a-side
+   TGeoCombiTrans *combi2c = new TGeoCombiTrans("combi2",x0,y0,0.99+0.222,rot); //c-side
    //
-   sect->AddNode(ch,1);
-   sect->AddNode(iroc,1,combi1);
-   sect->AddNode(oroc,1,combi2);
+   // A-side
    //
-   // segment is ready...
-   // now I try to make a wheel...
+   secta->AddNode(ch,1);
+   secta->AddNode(iroc,1,combi1a);
+   secta->AddNode(oroc,1,combi2a);
    //
-   TGeoVolumeAssembly *wheel = new TGeoVolumeAssembly("TPC_ENDCAP");
+   // C-side
+   //
+   sectc->AddNode(ch,1);
+   sectc->AddNode(iroc,1,combi1c);
+   sectc->AddNode(oroc,1,combi2c);
+   //
+   // now I try to make  wheels...
+   //
+   TGeoVolumeAssembly *wheela = new TGeoVolumeAssembly("TPC_ENDCAP");
+   TGeoVolumeAssembly *wheelc = new TGeoVolumeAssembly("TPC_ENDCAP");
    //
    for(Int_t i =0;i<18;i++){
      Double_t phi = (20.*i);
      TGeoRotation *r = new TGeoRotation();
      r->RotateZ(phi);
-     wheel->AddNode(sect,i+1,r);
+     wheela->AddNode(secta,i+1,r);
+     wheelc->AddNode(sectc,i+1,r);
     
    }
    // wheels in the drift volume!
-   v9->AddNode(wheel,1,new TGeoTranslation(0.,0.,-256.6));
    TGeoCombiTrans *combi3 = new TGeoCombiTrans("combi3",0.,0.,256.6,ref);
-   v9->AddNode(wheel,2,combi3);
+   v9->AddNode(wheela,1,combi3);
+   v9->AddNode(wheelc,2,new TGeoTranslation(0.,0.,-256.6));
    
    //_____________________________________________________________
    // service support wheel
@@ -737,14 +769,22 @@ void AliTPCv3::CreateGeometry()
   TGeoVolume *swv = new TGeoVolume("TPC_SWSEG",sw,m3); //Al
   //
   thick=1.;
-  shift = thick/TMath::Sin(OpeningAngle);
+  shift = thick/TMath::Sin(openingAngle);
   TGeoPgon *sh = new TGeoPgon(0.,20.,1,2);
   sh->DefineSection(0,-4.,81.5-shift,250.75-shift);
   sh->DefineSection(1,4.,81.5-shift,250.75-shift);
   TGeoVolume *shv = new TGeoVolume("TPC_SWS1",sh,m1); //Air
   //
-  ys = shift*TMath::Sin(OpeningAngle);
-  xs = shift*TMath::Cos(OpeningAngle);
+  TGeoMedium *m9 =  gGeoManager->GetMedium("TPC_Si"); 
+  TGeoPgon *el = new TGeoPgon(0.,20.,1,2);
+  el->DefineSection(0,-1.872,81.5-shift,250.75-shift);
+  el->DefineSection(1,1.872,81.5-shift,250.75-shift);
+  TGeoVolume *elv = new TGeoVolume("TPC_ELEC",el,m9); //Si 
+  //
+  shv->AddNode(elv,1);
+  //
+  ys = shift*TMath::Sin(openingAngle);
+  xs = shift*TMath::Cos(openingAngle);
   swv->AddNode(shv,1,new TGeoTranslation(xs,ys,0.));
   // cover
   TGeoPgon *co = new TGeoPgon(0.,20.,1,2);
@@ -753,14 +793,14 @@ void AliTPCv3::CreateGeometry()
   TGeoVolume *cov = new TGeoVolume("TPC_SWC1",co,m3);//Al
   // hole in a cover
   TGeoPgon *coh = new TGeoPgon(0.,20.,1,2);
-  shift=4./TMath::Sin(OpeningAngle);
+  shift=4./TMath::Sin(openingAngle);
   coh->DefineSection(0,-0.5,85.-shift,247.25-shift);
   coh->DefineSection(1,0.5,85.-shift,247.25-shift);  
   //
   TGeoVolume *cohv = new TGeoVolume("TPC_SWC2",coh,m1);
   //
-  ys = shift*TMath::Sin(OpeningAngle);
-  xs = shift*TMath::Cos(OpeningAngle);  
+  ys = shift*TMath::Sin(openingAngle);
+  xs = shift*TMath::Cos(openingAngle);  
   cov->AddNode(cohv,1,new TGeoTranslation(xs,ys,0.));
   //
   // Sector as an Assembly
@@ -787,6 +827,9 @@ void AliTPCv3::CreateGeometry()
   //----------------------------------------------------------
   TGeoMedium *m6=gGeoManager->GetMedium("TPC_Makrolon");
   TGeoMedium *m7=gGeoManager->GetMedium("TPC_Cu");
+  TGeoMedium *m10 =  gGeoManager->GetMedium("TPC_Alumina");
+  TGeoMedium *m11 =  gGeoManager->GetMedium("TPC_Peek");
+  TGeoMedium *m12 =  gGeoManager->GetMedium("TPC_Water");
   // upper and lower rods differ in length!
   Double_t *upar;
   upar=NULL;
@@ -797,13 +840,61 @@ void AliTPCv3::CreateGeometry()
   
   //
   //HV rods - makrolon + 0.58cm (diameter) Cu
-  TGeoTube *hvr = new TGeoTube(0.,4.4,126.64);
+  TGeoTube *hvr = new TGeoTube(0.,2.2,126.64);
   TGeoTube *hvc = new TGeoTube(0.,0.29,126.64);
   //
   TGeoVolume *hvrv = new TGeoVolume("TPC_HV_Rod",hvr,m6);
   TGeoVolume *hvcv = new TGeoVolume("TPC_HV_Cable",hvc,m7);
   hvrv->AddNode(hvcv,1);
-  for(Int_t i=0;i<17;i++){
+  //
+  // resistor rods
+  //
+  TGeoTube *cri = new TGeoTube(0.,0.45,126.64); //inner 
+  TGeoTube *cro = new TGeoTube(0.,0.45,126.54); //outer 
+  TGeoTube *cwi = new TGeoTube(0.,0.15,126.64); // water inner
+  TGeoTube *cwo = new TGeoTube(0.,0.15,126.54); // water outer
+  //
+  TGeoVolume *criv = new TGeoVolume("TPC_CR_I",cri,m10);
+  TGeoVolume *crov = new TGeoVolume("TPC_CR_O",cro,m10);    
+  TGeoVolume *cwiv = new TGeoVolume("TPC_W_I",cwi,m11);
+  TGeoVolume *cwov = new TGeoVolume("TPC_W_O",cwo,m11);   
+  //
+  // ceramic rod with water
+  //
+  criv->AddNode(cwiv,1); 
+  crov->AddNode(cwov,1);
+  //
+  TGeoTube *pri =new TGeoTube(0.2,0.35,126.64); //inner 
+  TGeoTube *pro = new TGeoTube(0.2,0.35,126.54); //outer    
+  //
+  // peek rod
+  //
+  TGeoVolume *priv = new TGeoVolume("TPC_PR_I",pri,m12);
+  TGeoVolume *prov = new TGeoVolume("TPC_PR_O",pro,m12); 
+  //
+  // resistor rods assembly
+  //
+   TGeoRotation *rotr = new TGeoRotation("rotr");
+   rotr->RotateZ(-21.);
+  //
+  TGeoTube *rri = new TGeoTube(1.8,2.2,126.64);//inner
+  TGeoTube *rro = new TGeoTube(1.8,2.2,126.54);//inner
+  //
+  TGeoVolume *rriv = new TGeoVolume("TPC_RR_I",rri,m6);
+  TGeoVolume *rrov = new TGeoVolume("TPC_RR_O",rro,m6);  
+  //
+  TGeoVolumeAssembly *rrin = new TGeoVolumeAssembly("TPC_RROD_I");
+  TGeoVolumeAssembly *rrou = new TGeoVolumeAssembly("TPC_RROD_O");
+  rrin->AddNode(rriv,1);
+  rrin->AddNode(criv,1,new TGeoTranslation(0.5,0.866, 0.));
+  rrin->AddNode(criv,2,new TGeoTranslation(0.5,-0.866, 0.)); 
+  rrin->AddNode(priv,1); 
+  //
+  rrou->AddNode(rrov,1);
+  rrou->AddNode(crov,1,new TGeoTranslation(0.5,0.866, 0.));
+  rrou->AddNode(crov,2,new TGeoTranslation(0.5,-0.866, 0.)); 
+  rrou->AddNode(prov,1);
+  for(Int_t i=0;i<18;i++){
     Double_t angle,x,y;
     Double_t z,r; 
     angle=TMath::DegToRad()*20.*(Double_t)i;
@@ -812,135 +903,46 @@ void AliTPCv3::CreateGeometry()
     y=r * TMath::Sin(angle);
     upar[2]=126.64; //lower
     z= 126.96;
-    if(i==15){
-      v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z));
-      v9->AddNode(hvrv,2,new TGeoTranslation(x,y,-z));
-    }
-    else{
-     gGeoManager->Node("TPC_Rod",i+1,"TPC_Drift",x,y,z,0,kTRUE,upar,3);//shaft
-     gGeoManager->Node("TPC_Rod",i+18,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);//muon
+    //
+    if(i==3){
+      v9->AddNode(rrin,1,new TGeoCombiTrans(x,y,z,rotr)); //A
+      v9->AddNode(rrin,2,new TGeoCombiTrans(x,y,-z,rotr)); //C 
+    } 
+    else { 
+      gGeoManager->Node("TPC_Rod",i+1,"TPC_Drift",x,y,z,0,kTRUE,upar,3);//shaft
+      gGeoManager->Node("TPC_Rod",i+19,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);//muon
     }
+   
+
+    //
     r=254.25;
     x=r * TMath::Cos(angle);
     y=r * TMath::Sin(angle);
     upar[2]=126.54; //upper
     z=127.06;
-    gGeoManager->Node("TPC_Rod",i+36,"TPC_Drift",x,y,z,0,kTRUE,upar,3);
-    gGeoManager->Node("TPC_Rod",i+54,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);
+    if(i==15){
+      //v9->AddNode(hvrv,1,new TGeoTranslation(x,y,z));//A-side only
+      v9->AddNode(hvrv,1,new TGeoTranslation(x,y,127.14));//A-side only
+      gGeoManager->Node("TPC_Rod",i+55,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);
+    }
+    else if(i==11){
+      v9->AddNode(rrou,1,new TGeoCombiTrans(x,y,z,rotr)); //A
+      v9->AddNode(rrou,2,new TGeoCombiTrans(x,y,-z,rotr)); //C
+    }
+    else{
+    //
+      gGeoManager->Node("TPC_Rod",i+37,"TPC_Drift",x,y,z,0,kTRUE,upar,3);
+      gGeoManager->Node("TPC_Rod",i+55,"TPC_Drift",x,y,-z,0,kTRUE,upar,3);
+    }
   }
 
-
-   
-  gMC->Gspos("TPC_M ",1,"ALIC",0.,0.,0.,0,"ONLY");
+  TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
+  alice->AddNode(v1,1);
+  
 
  
 } // end of function
  
-//_____________________________________________________________________________
-void AliTPCv3::DrawDetector()
-{
-  //
-  // Draw a shaded view of the Time Projection Chamber version 3
-  //
-
-
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-  // 
-  // Set ALIC mother transparent
-  gMC->Gsatt("ALIC","SEEN",0);
-  //
-  // Set the volumes visible
-  //
-
-  gMC->Gsatt("TPC ","SEEN",0);
-  gMC->Gsatt("TOIN","SEEN",1);
-  gMC->Gsatt("TOIN","COLO",7);
-  gMC->Gsatt("TOCV","SEEN",1);
-  gMC->Gsatt("TOCV","COLO",4);
-  gMC->Gsatt("TSA1","SEEN",0);
-  gMC->Gsatt("TSA2","SEEN",0);
-  gMC->Gsatt("TSA3","SEEN",0);
-  gMC->Gsatt("TSA4","SEEN",0);  
-  gMC->Gsatt("TSA5","SEEN",0);
-  gMC->Gsatt("TOFC","SEEN",1);
-  gMC->Gsatt("TOFC","COLO",4);
-  gMC->Gsatt("TSA6","SEEN",0);
-  gMC->Gsatt("TSA7","SEEN",0);
-  gMC->Gsatt("TSA8","SEEN",0);    
-  gMC->Gsatt("TIIN","SEEN",1);
-  gMC->Gsatt("TIIN","COLO",7);
-  gMC->Gsatt("TII1","SEEN",0);
-  gMC->Gsatt("TIFC","SEEN",1);
-  gMC->Gsatt("TIFC","COLO",4);
-  gMC->Gsatt("TSA9","SEEN",0); 
-  gMC->Gsatt("TS10","SEEN",0);
-  gMC->Gsatt("TS11","SEEN",0);
-  gMC->Gsatt("TS12","SEEN",0);
-  gMC->Gsatt("TS13","SEEN",0);
-  gMC->Gsatt("TS14","SEEN",0);
-  gMC->Gsatt("TICC","SEEN",0);
-  gMC->Gsatt("TICM","SEEN",0);
-  gMC->Gsatt("TS15","SEEN",0);
-  gMC->Gsatt("TS16","SEEN",0);
-  gMC->Gsatt("TS17","SEEN",0);
-  gMC->Gsatt("TS18","SEEN",0);  
-  gMC->Gsatt("TS19","SEEN",0); 
-  gMC->Gsatt("TPJ1","SEEN",0);
-  gMC->Gsatt("TPJ2","SEEN",0);
-  gMC->Gsatt("TICS","SEEN",0);
-  gMC->Gsatt("TDGS","SEEN",0); 
-  gMC->Gsatt("TIRC","SEEN",0);
-  gMC->Gsatt("TIC1","SEEN",1);
-  gMC->Gsatt("TIPP","SEEN",0);
-  gMC->Gsatt("TIC3","SEEN",0);
-  gMC->Gsatt("TRCE","SEEN",0);
-  gMC->Gsatt("TPSC","SEEN",0);
-  gMC->Gsatt("TPCC","SEEN",0); 
-  gMC->Gsatt("TORC","SEEN",0);
-  gMC->Gsatt("TOPP","SEEN",0);
-  gMC->Gsatt("TOC3","SEEN",0);
-  gMC->Gsatt("TOC1","SEEN",1);
-  gMC->Gsatt("TSSW","SEEN",1);
-  gMC->Gsatt("TSWC","SEEN",1);
-  gMC->Gsatt("TSSW","COLO",3);
-  gMC->Gsatt("TSWC","COLO",3);
-  gMC->Gsatt("TSCE","COLO",6);
-  gMC->Gsatt("TSCE","SEEN",1);
-  gMC->Gsatt("TWES","SEEN",0);
-  gMC->Gsatt("TSWB","SEEN",0);
-  gMC->Gsatt("TPEL","SEEN",0);
-  gMC->Gsatt("TPMW","SEEN",1);
-  gMC->Gsatt("TESR","SEEN",1);
-  gMC->Gsatt("TPMW","COLO",12);
-  gMC->Gsatt("TIC1","COLO",5);
-  gMC->Gsatt("TOC1","COLO",5);
-  gMC->Gsatt("TESB","SEEN",0);
-  gMC->Gsatt("THVM","SEEN",1);
-  gMC->Gsatt("THVM","COLO",11);
-  gMC->Gsatt("THVH","SEEN",0);
-  gMC->Gsatt("TPSR","SEEN",0); 
-  gMC->Gsatt("THVL","SEEN",0);
-  gMC->Gsatt("THVC","SEEN",0);  
-  gMC->Gsatt("THVE","SEEN",0);
-  gMC->Gsatt("THVR","SEEN",0);
-
-  //
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("TPMW",-300,300,-300,300,254.,270.);
-  gMC->SetClipBox("TESR",-300,300,-300,300,254.,270.);
-  gMC->SetClipBox("TSSW",-300,300,-300,300,283.,284.);
-  gMC->SetClipBox("TSWC",-300,300,-300,300,283.,284.);
-  gMC->SetClipBox("*", 0, 300, -300, 300, -290, 290);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
-  gMC->Gdhead(1111, "Time Projection Chamber");
-  gMC->Gdman(18, 4, "MAN");
-  gMC->Gdopt("hide","off");
-}
 
 //_____________________________________________________________________________
 void AliTPCv3::CreateMaterials()
@@ -960,15 +962,15 @@ void AliTPCv3::Init()
   //
   // Initialises version 3 of the TPC after that it has been built
   //
-  Int_t *idtmed = fIdtmed->GetArray();
+  //Int_t *idtmed = fIdtmed->GetArray();
 
   AliTPC::Init();
 
    fIdSens=gMC->VolId("TPC_Drift"); // drift gas as a sensitive volume
 
-  gMC->SetMaxNStep(30000); // max. number of steps increased
+  gMC->SetMaxNStep(-30000); // max. number of steps increased
 
-  gMC->Gstpar(idtmed[2],"LOSS",5);
+  // specific energy loss is now set in galice.cuts
 
   printf("%s: *** TPC version 3 initialized***\n",ClassName());
 
@@ -1070,7 +1072,7 @@ void AliTPCv3::StepManager()
   else
     {
       betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); 
-      pp=kprim*BetheBloch(betaGamma);    
+      pp=kprim*AliMathBase::BetheBlochAleph(betaGamma);    
       if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
     }
   
@@ -1079,27 +1081,3 @@ void AliTPCv3::StepManager()
   gMC->SetMaxStep(-TMath::Log(rnd)/pp);
   
 }
-
-//_____________________________________________________________________________
-Float_t AliTPCv3::BetheBloch(Float_t bg)
-{
-  //
-  // Bethe-Bloch energy loss formula
-  //
-  const Double_t kp1=0.76176e-1;
-  const Double_t kp2=10.632;
-  const Double_t kp3=0.13279e-4;
-  const Double_t kp4=1.8631;
-  const Double_t kp5=1.9479;
-
-  Double_t dbg = (Double_t) bg;
-
-  Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
-
-  Double_t aa = TMath::Power(beta,kp4);
-  Double_t bb = TMath::Power(1./dbg,kp5);
-
-  bb=TMath::Log(kp3+bb);
-  
-  return ((Float_t)((kp2-aa-bb)*kp1/aa));
-}