]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRD.cxx
Moving to standard names
[u/mrichter/AliRoot.git] / TRD / AliTRD.cxx
index 1c565ab89d3aed2364434dc1e190fef05a9a0f65..e8f69ec81d38c66b90f50375aa1d6dbd193d9fec 100644 (file)
@@ -46,6 +46,7 @@
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliTrackReference.h"
+#include "AliRawReader.h"
 
 #include "AliTRD.h"
 #include "AliTRDdigit.h"
@@ -56,7 +57,6 @@
 #include "AliTRDpoints.h"
 #include "AliTRDrawData.h"
 #include "AliTRDSimParam.h"
-#include "AliTRDRecParam.h"
 #include "AliTRDCommonParam.h"
 #include "AliTRDcalibDB.h"
 
@@ -68,6 +68,7 @@ AliTRD::AliTRD()
   ,fGeometry(0)
   ,fGasDensity(0)
   ,fFoilDensity(0)
+  ,fGasNobleFraction(0)
   ,fDrawTR(0)
   ,fDisplayType(0)
 {
@@ -83,6 +84,7 @@ AliTRD::AliTRD(const char *name, const char *title)
   ,fGeometry(0)
   ,fGasDensity(0)
   ,fFoilDensity(0)
+  ,fGasNobleFraction(0)
   ,fDrawTR(0)
   ,fDisplayType(0)
 {
@@ -107,18 +109,10 @@ AliTRD::AliTRD(const char *name, const char *title)
     exit(1);
   }
 
-  // Save the geometry
-  TDirectory *saveDir = gDirectory;
-  gAlice->GetRunLoader()->CdGAFile();
-  fGeometry->Write("TRDgeometry");
-  saveDir->cd();
-
   // Allocate the hit array
   fHits = new TClonesArray("AliTRDhit",405);
   gAlice->GetMCApp()->AddHitList(fHits);
 
-  //PH SetMarkerColor(kWhite);   
-
 }
 
 //_____________________________________________________________________________
@@ -149,7 +143,7 @@ void AliTRD::Hits2Digits()
 
   AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
   AliLog::SetClassDebugLevel("TRDdigitizer",AliDebugLevel());
-  
+
   // Initialization
   digitizer.InitDetector();
     
@@ -308,8 +302,6 @@ void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
                                                  ,q
                                                  ,time);
 
-  printf("AliTRD::AddHit --- time = %f\n",time);
-
   if (inDrift) {
     hit->SetDrift();
   }
@@ -345,7 +337,7 @@ void AliTRD::BuildGeometry()
   Float_t zmax1;
   Float_t zmax2;
 
-  Int_t   iPlan;
+  Int_t   iLayer;
  
   const Int_t kColorTRD = 46;
   
@@ -354,7 +346,7 @@ void AliTRD::BuildGeometry()
   
   if      (fDisplayType == 0) {
 
-    pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
+    pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsector(),4);
     rmin = kRmin;
     rmax = kRmax;
     pgon->DefineSection(0,-kZmax1,rmax,rmax);
@@ -380,10 +372,10 @@ void AliTRD::BuildGeometry()
     zmax2 = kZmax2 + slope * thickness;
     zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
 
-    for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
+    for (iLayer = 0; iLayer < AliTRDgeometry::Nlayer(); iLayer++) {
 
-      sprintf(name,"S_TR1%d",iPlan);
-      pgon  = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
+      sprintf(name,"S_TR1%d",iLayer);
+      pgon  = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsector(),4);
       pgon->DefineSection(0,-zmax1,rmax,rmax);
       pgon->DefineSection(1,-zmax2,rmin,rmax);
       pgon->DefineSection(2, zmax2,rmin,rmax);
@@ -407,10 +399,10 @@ void AliTRD::BuildGeometry()
     zmax2      = kZmax2 + slope * thickness;
     zmax1      = zmax2  + slope * AliTRDgeometry::AmThick();
 
-    for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
+    for (iLayer = 0; iLayer < AliTRDgeometry::Nlayer(); iLayer++) {
 
-      sprintf(name,"S_TR2%d",iPlan);
-      pgon  = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
+      sprintf(name,"S_TR2%d",iLayer);
+      pgon  = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsector(),4);
       pgon->DefineSection(0,-zmax1,rmax,rmax);
       pgon->DefineSection(1,-zmax2,rmin,rmax);
       pgon->DefineSection(2, zmax2,rmin,rmax);
@@ -469,7 +461,7 @@ void AliTRD::CreateMaterials()
   Float_t aco[2]    = { 12.011 , 15.9994 };
   Float_t zco[2]    = {  6.0   ,  8.0    };
   Float_t wco[2]    = {  1.0   ,  2.0    };
-  Float_t dco       = 0.00186;
+  Float_t dco       = 0.00186; // at 20C
 
   // For water
   Float_t awa[2]    = {  1.0079, 15.9994 };
@@ -477,12 +469,6 @@ void AliTRD::CreateMaterials()
   Float_t wwa[2]    = {  2.0   ,  1.0    };
   Float_t dwa       = 1.0;
 
-  // For isobutane (C4H10)
-  Float_t ais[2]    = { 12.011 ,  1.0079 };
-  Float_t zis[2]    = {  6.0   ,  1.0    };
-  Float_t wis[2]    = {  4.0   , 10.0    };
-  Float_t dis       = 0.00267;
-
   // For plexiglas (C5H8O2)
   Float_t apg[3]    = { 12.011 ,  1.0079, 15.9994 };
   Float_t zpg[3]    = {  6.0   ,  1.0   ,  8.0    };
@@ -519,8 +505,17 @@ void AliTRD::CreateMaterials()
   Float_t wXeCO2[3] = {   8.5    ,   1.5    ,   3.0     }; 
   // Xe-content of the Xe/CO2-mixture (85% / 15%) 
   Float_t fxc       = 0.85;
-  Float_t dxe       = 0.00549;
-  Float_t dgm       = fxc * dxe + (1.0 - fxc) * dco;
+  Float_t dxe       = 0.00549; // at 20C
+  Float_t dgmXe     = fxc * dxe + (1.0 - fxc) * dco;
+
+  // For Ar/CO2-gas-mixture
+  Float_t aArCO2[3] = {  39.948  ,  12.0107 ,  15.9994  };
+  Float_t zArCO2[3] = {  18.0    ,   6.0    ,   8.0     };
+  Float_t wArCO2[3] = {   8.2    ,   1.8    ,   3.6     }; 
+  // Ar-content of the Ar/CO2-mixture (82% / 18%) 
+  Float_t fac       = 0.82;
+  Float_t dar       = 0.00166; // at 20C
+  Float_t dgmAr     = fac * dar + (1.0 - fac) * dco;
   
   // General tracking parameter
   Float_t tmaxfd    = -10.0;
@@ -545,8 +540,17 @@ void AliTRD::CreateMaterials()
   AliMixture(2, "Air"         , aAir,   zAir,   dAir,    4, wAir  );
   AliMixture(3, "Polyethilene", ape,    zpe,    dpe,    -2, wpe   );
   AliMixture(8, "CO2",          aco,    zco,    dco,    -2, wco   );
-  AliMixture(9, "Isobutane",    ais,    zis,    dis,    -2, wis   );
-  AliMixture(10,"Gas mixture",  aXeCO2, zXeCO2, dgm,    -3, wXeCO2);
+  if      (AliTRDSimParam::Instance()->IsXenon()) {
+    AliMixture(10,"XeCO2",        aXeCO2, zXeCO2, dgmXe,  -3, wXeCO2);
+  }
+  else if (AliTRDSimParam::Instance()->IsArgon()) {
+    AliInfo("Gas mixture: Ar C02 (80/20)");
+    AliMixture(10,"ArCO2",        aArCO2, zArCO2, dgmAr,  -3, wArCO2);
+  }
+  else {
+    AliFatal("Wrong gas mixture");
+    exit(1);
+  }
   AliMixture(12,"G10",          aG10,   zG10,   dG10,    4, wG10  );
   AliMixture(13,"Water",        awa,    zwa,    dwa,    -2, wwa   );
   AliMixture(14,"Plexiglas",    apg,    zpg,    dpg,    -3, wpg   );
@@ -633,7 +637,14 @@ void AliTRD::CreateMaterials()
   // Save the density values for the TRD absorbtion
   Float_t dmy  = 1.39;
   fFoilDensity = dmy;
-  fGasDensity  = dgm;
+  if      (AliTRDSimParam::Instance()->IsXenon()) {
+    fGasDensity       = dgmXe;
+    fGasNobleFraction = fxc;
+  }
+  else if (AliTRDSimParam::Instance()->IsArgon()) {
+    fGasDensity       = dgmAr;
+    fGasNobleFraction = fac;
+  }
 
 }
 
@@ -685,18 +696,6 @@ void AliTRD::DrawModule() const
   gMC->Gdman(18, 4, "MAN");
 
 }
-
-//_____________________________________________________________________________
-Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
-{
-  //
-  // Distance between the mouse and the TRD detector on the screen
-  // Dummy routine
-  //
-  
-  return 9999;
-
-}
  
 //_____________________________________________________________________________
 void AliTRD::Init()
@@ -710,10 +709,14 @@ void AliTRD::Init()
   if (fGeometry->IsVersion() != 1) {
     AliError("Not a valid geometry");
   }
+
   // Special tracking options for charged particles for XeCO2
-  gMC->Gstpar((* fIdtmed)[9],"DRAY",1.0);
-  gMC->Gstpar((* fIdtmed)[9],"STRA",1.0); 
-  
+  gMC->Gstpar((* fIdtmed)[9],"DRAY"    , 1.0);
+  gMC->Gstpar((* fIdtmed)[9],"STRA"    , 1.0); 
+  gMC->Gstpar((* fIdtmed)[9],"LOSS"    ,13.0);      // Specific energy loss
+  gMC->Gstpar((* fIdtmed)[9],"PRIMIO_E",23.53);     // 1st ionisation potential
+  gMC->Gstpar((* fIdtmed)[9],"PRIMIO_N",19.344431); // Number of primaries
+
 }
 
 //_____________________________________________________________________________
@@ -909,351 +912,62 @@ void AliTRD::SetTreeAddress()
 }
 
 //_____________________________________________________________________________
-AliTRD &AliTRD::operator=(const AliTRD &trd)
+Bool_t AliTRD::Raw2SDigits(AliRawReader *rawReader)
 {
   //
-  // Assignment operator
+  // Converts RAW data to SDigits
   //
 
-  if (this != &trd) {
-    ((AliTRD &) trd).Copy(*this);
+  AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
+  if (!loader) {
+    AliError("Can not get TRD loader from Run Loader");
+    return kFALSE;
+  }
+    
+  TTree *tree = 0;
+  tree = loader->TreeS();
+  if (!tree) {
+    loader->MakeTree("S");
+    tree = loader->TreeS();
+  }
+
+  AliTRDrawData       *rawdata        = new AliTRDrawData();
+  AliTRDdigitsManager *sdigitsManager = rawdata->Raw2Digits(rawReader);
+  if (sdigitsManager) {
+    sdigitsManager->SetSDigits(kTRUE);
+    sdigitsManager->MakeBranch(tree);
+    sdigitsManager->WriteDigits();
+    return kTRUE;
+  } 
+  else {
+    return kFALSE;
   }
 
-  return *this;
-
-} 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+}
 
+//_____________________________________________________________________________
+AliLoader* AliTRD::MakeLoader(const char* topfoldername)
+{
+ fLoader = new AliLoader(GetName(),topfoldername);
 
+ AliInfo("Adding Tracklets-loader");
+ AliDataLoader *dl = new AliDataLoader("TRD.Tracklets.root","tracklets", "tracklets");
+ fLoader->AddDataLoader(dl);
 
+ return fLoader;
+}
 
+//_____________________________________________________________________________
+AliTRD &AliTRD::operator=(const AliTRD &trd)
+{
+  //
+  // Assignment operator
+  //
 
+  if (this != &trd) {
+    ((AliTRD &) trd).Copy(*this);
+  }
 
+  return *this;
 
+}