]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCv2.cxx
Drift gas selection via title in the AliTPC constructor
[u/mrichter/AliRoot.git] / TPC / AliTPCv2.cxx
index f0307f2f7dd96ed50a2678a6a3bc9f8a87b83f15..edd27669b6feee6618fa7029dddaef84b1912892 100644 (file)
@@ -44,6 +44,7 @@
 #include "TGeoVolume.h"
 #include "TGeoPcon.h"
 #include "TGeoTube.h"
+#include "TGeoCone.h"
 #include "TGeoPgon.h"
 #include "TGeoTrd1.h"
 #include "TGeoCompositeShape.h"
@@ -52,6 +53,8 @@
 #include "TGeoHalfSpace.h"
 #include "TTreeStream.h"
 
+using std::ifstream;
+using std::ios_base;
 ClassImp(AliTPCv2)
  
 //_____________________________________________________________________________
@@ -103,43 +106,52 @@ void AliTPCv2::CreateGeometry()
   // here I define a volume TPC
   // retrive the medium name with "TPC_" as a leading string
   //
-  TGeoPcon *tpc = new TGeoPcon(0.,360.,24); //24 sections
+  TGeoPcon *tpc = new TGeoPcon(0.,360.,30); //30 sections
   //
-  tpc->DefineSection(0,-291.,77.,278.);
-  tpc->DefineSection(1,-270,77.,278.);
+  tpc->DefineSection(0,-289.6,77.,278.);
+  tpc->DefineSection(1,-262.1,77.,278.);
   //
-  tpc->DefineSection(2,-270.,77.,278.);
-  tpc->DefineSection(3,-259.6,70.,278.);
+  tpc->DefineSection(2,-262.1,83.1,278.);
+  tpc->DefineSection(3,-260.,83.1,278.);
   //
-  tpc->DefineSection(4,-259.6,68.1,278.);
-  tpc->DefineSection(5,-253.6,68.1,278.);
+  tpc->DefineSection(4,-260.,70.,278.);    
+  tpc->DefineSection(5,-259.6,70.,278.);
   //
-  tpc->DefineSection(6,-253.6,68.,278.);
-  tpc->DefineSection(7,-74.0,60.8,278.);
+  tpc->DefineSection(6,-259.6,68.1,278.);
+  tpc->DefineSection(7,-253.6,68.1,278.);
   //
-  tpc->DefineSection(8,-74.0,60.1,278.);
-  tpc->DefineSection(9,-73.3,60.1,278.);
+  tpc->DefineSection(8,-253.6,67.88,278.);//hs
+  tpc->DefineSection(9,-74.0,60.68,278.);// hs
   //
-  tpc->DefineSection(10,-73.3,56.9,278.); 
-  tpc->DefineSection(11,-68.5,56.9,278.);
+  tpc->DefineSection(10,-74.0,60.1,278.);
+  tpc->DefineSection(11,-73.3,60.1,278.);
   //
-  tpc->DefineSection(12,-68.5,60.,278.);
-  tpc->DefineSection(13,-65.,60.,278.);
+  tpc->DefineSection(12,-73.3,56.9,278.); 
+  tpc->DefineSection(13,-68.5,56.9,278.);
   //
-  tpc->DefineSection(14,-65.,56.9,278.); 
-  tpc->DefineSection(15,73.3,56.9,278.);
+  tpc->DefineSection(14,-68.5,60.,278.);
+  tpc->DefineSection(15,-64.7,60.,278.);
   //
-  tpc->DefineSection(16,73.3,60.1,278.);
-  tpc->DefineSection(17,74.0,60.1,278.);
+  tpc->DefineSection(16,-64.7,56.9,278.); 
+  tpc->DefineSection(17,73.3,56.9,278.);
   //
-  tpc->DefineSection(18,74.0,60.8,278.);
-  tpc->DefineSection(19,253.6,65.5,278.);
+  tpc->DefineSection(18,73.3,60.1,278.);
+  tpc->DefineSection(19,74.0,60.1,278.);
   //
-  tpc->DefineSection(20,253.6,65.6,278.);
-  tpc->DefineSection(21,259.6,65.6,278.);
+  tpc->DefineSection(20,74.0,60.68,278.);// hs
+  tpc->DefineSection(21,253.6,65.38,278.);// hs
   //
-  tpc->DefineSection(22,259.6,70.0,278.);
-  tpc->DefineSection(23,291.,77.,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);
@@ -157,7 +169,7 @@ void AliTPCv2::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_DriftGas2");
   TGeoVolume *v9 = new TGeoVolume("TPC_Drift",dvol,m5);
   //
   v1->AddNode(v9,1);
@@ -212,6 +224,9 @@ void AliTPCv2::CreateGeometry()
   TGeoVolume *tov3 = new TGeoVolume("TPC_OCV3",to3,sm3);
   TGeoVolume *tov4 = new TGeoVolume("TPC_OCV4",to4,sm4);
   TGeoVolume *togv5 = new TGeoVolume("TPC_OCVG5",tog5,sm1);
+  //
+  TGeoMedium *mhs = gGeoManager->GetMedium("TPC_Steel");
+  TGeoMedium *m12 =  gGeoManager->GetMedium("TPC_Water");
   //-------------------------------------------------------
   //  Tpc Outer Field Cage
   //  daughters - composite (sandwich)
@@ -329,6 +344,16 @@ void AliTPCv2::CreateGeometry()
   tcms->DefineSection(9,-71.3,56.9,58.8);
   //
   TGeoVolume *v7 = new TGeoVolume("TPC_ICVM",tcms,m3);
+  //------------------------------------------------
+  //  Heat screen muon side
+  //------------------------------------------------
+  TGeoCone *thsm = new TGeoCone(89.8,67.88,68.1,60.68,60.9);
+  TGeoCone *thsmw = new TGeoCone(89.8,67.94,68.04,60.74,60.84);
+  TGeoVolume *hvsm = new TGeoVolume("TPC_HSM",thsm,mhs); //steel
+  TGeoVolume *hvsmw = new TGeoVolume("TPC_HSMW",thsmw,m12); //water 
+  // assembly heat screen muon
+  hvsm->AddNode(hvsmw,1);
   //-----------------------------------------------
   // inner containment vessel - shaft side
   //-----------------------------------------------
@@ -350,6 +375,15 @@ void AliTPCv2::CreateGeometry()
   tcss->DefineSection(9,258.1,65.6,74.2);
   //
   TGeoVolume *v8 = new TGeoVolume("TPC_ICVS",tcss,m3);
+  //-------------------------------------------------
+  //  Heat screen shaft side
+  //--------------------------------------------------
+  TGeoCone *thss = new TGeoCone(89.8,60.68,60.9,65.38,65.6);       
+  TGeoCone *thssw = new TGeoCone(89.8,60.74,60.84,65.44,65.54);     
+  TGeoVolume *hvss = new TGeoVolume("TPC_HSS",thss,mhs); //steel
+  TGeoVolume *hvssw = new TGeoVolume("TPC_HSSW",thssw,m12); //water 
+  //assembly heat screen shaft
+  hvss->AddNode(hvssw,1);
   //-----------------------------------------------
   //  Inner field cage
   //  define 4 parts and make an assembly
@@ -499,6 +533,8 @@ void AliTPCv2::CreateGeometry()
   v5->AddNode(v6,1, new TGeoTranslation(0.,0.,-252.1));
   v5->AddNode(v6,2, new TGeoTranslation(0.,0.,252.1));
   v1->AddNode(v5,1); v1->AddNode(v7,1); v1->AddNode(v8,1); 
+  v1->AddNode(hvsm,1,new TGeoTranslation(0.,0.,-163.8)); 
+  v1->AddNode(hvss,1,new TGeoTranslation(0.,0.,163.8)); 
   v9->AddNode(tv100,1);
   //
   // central drum 
@@ -1014,8 +1050,7 @@ void AliTPCv2::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");
+  TGeoMedium *m11 =  gGeoManager->GetMedium("TPC_Peek");;
   TGeoMedium *m13 = gGeoManager->GetMedium("TPC_Brass");
   // 
   // tpc rod is an assembly of 10 long parts and 2 short parts
@@ -1514,113 +1549,6 @@ void AliTPCv2::SetOuterChambersAlignable() const
   }
 }
 
-//_____________________________________________________________________________
-void AliTPCv2::DrawDetector() const
-{
-  //
-  // Draw a shaded view of the Time Projection Chamber version 1
-  //
-
-  // 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("TDGN","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->Gsatt("TPSS","SEEN",0);
-  gMC->Gsatt("TPUS","SEEN",0);
-  gMC->Gsatt("TPLS","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 AliTPCv2::CreateMaterials()
@@ -1706,6 +1634,15 @@ void AliTPCv2::StepManager()
   id = gMC->CurrentVolID(copy); // vol ID and copy number (starts from 1!)
   if(id != fIDrift && id != fIdSens) return; // not in the sensitive folume 
 
+  if ( fPrimaryIonisation && id == fIDrift ) {
+    Double_t rnd = gMC->GetRandom()->Rndm();
+    gMC->SetMaxStep(0.2+(2.*rnd-1.)*0.05);  // 2 mm +- rndm*0.5mm step
+  }   
+
+  //if ( fPrimaryIonisation && id == fIDrift && gMC->IsTrackEntering()) {
+  //  gMC->SetMaxStep(0.2);  // 2 mm 
+  //}   
+  
   gMC->TrackPosition(p);
   Double_t r = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
   //
@@ -1800,8 +1737,14 @@ void AliTPCv2::StepManager()
       nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
     }
     else {
-         Float_t edep = gMC->Edep();
-         if (edep > 0.) nel = (Int_t)((gMC->Edep()*1.5)/kwIon) + 1;      
+      static Double_t deForNextStep = 0.;
+      // Geant4 (the meaning of Edep as in Geant3) - wrong
+      //nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
+
+      // Geant4 (the meaning of Edep as in Geant3) - NEW
+      Double_t eAvailable = gMC->Edep() + deForNextStep;
+      nel = (Int_t)(eAvailable/kwIon);
+      deForNextStep = eAvailable - nel*kwIon;
     }
     nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
     //
@@ -1813,7 +1756,8 @@ void AliTPCv2::StepManager()
 
     // Add this hit
 
-    if (fHitType&&2){
+    //    if (fHitType&&2){
+    if(fHitType){
       gMC->TrackMomentum(p);
       Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
       Float_t precision =   (momentum>0.1) ? 0.002 :0.01;