]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPC.cxx
added cutoff parameter in z direction to ignore clusters of large z (Gaute)
[u/mrichter/AliRoot.git] / TPC / AliTPC.cxx
index 372e8fd2130e84ee473937767101d672dd507ec3..48cfe97f8f4e10df3e0d07cddfc4f3f48fa23c7d 100644 (file)
 #include "AliTPCBuffer.h"
 #include "AliTPCDDLRawData.h"
 #include "AliLog.h"
+#include "AliTPCcalibDB.h"
+#include "AliTPCCalPad.h"
+#include "AliTPCCalROC.h"
+#include "AliTPCExB.h"
 #include "AliRawReader.h"
 #include "AliTPCRawStream.h"
 
@@ -92,10 +96,13 @@ ClassImp(AliTPC)
                   fHitType(0),
                   fDigitsSwitch(0),
                   fSide(0),
+                   fPrimaryIonisation(0),
                   fNoiseDepth(0),
                   fNoiseTable(0),
                   fCurrentNoise(0),
-                  fActiveSectors(0)
+                  fActiveSectors(0),
+                   fGainFactor(1.)
+                   
 
 {
   //
@@ -123,10 +130,13 @@ AliTPC::AliTPC(const char *name, const char *title)
                   fHitType(0),
                   fDigitsSwitch(0),
                   fSide(0),
+                   fPrimaryIonisation(0),
                   fNoiseDepth(0),
                   fNoiseTable(0),
                   fCurrentNoise(0),
-                  fActiveSectors(0)
+                   fActiveSectors(0),
+                   fGainFactor(1.)
+                  
 {
   //
   // Standard constructor
@@ -381,7 +391,7 @@ void AliTPC::CreateMaterials()
 
   AliMixture(12,"Ne-CO2-N-1",amat,zmat,density,4,wmat);
   AliMixture(13,"Ne-CO2-N-2",amat,zmat,density,4,wmat);
-
+  AliMixture(30,"Ne-CO2-N-3",amat,zmat,density,4,wmat);
   //----------------------------------------------------------------------
   //               solid materials
   //----------------------------------------------------------------------
@@ -646,6 +656,57 @@ void AliTPC::CreateMaterials()
   density=7.87;
 
   AliMaterial(29,"Fe",amat[0],zmat[0],density,999.,999.);
+  //
+  // Peek - (C6H4-O-OC6H4-O-C6H4-CO)n
+  amat[0]=12.011;
+  amat[1]=1.;
+  amat[2]=15.9994;
+
+  zmat[0]=6.;
+  zmat[1]=1.;
+  zmat[2]=8.;
+
+  wmat[0]=19.;
+  wmat[1]=12.;
+  wmat[2]=3.;
+  //
+  density=1.3;
+  //
+  AliMixture(30,"Peek",amat,zmat,density,-3,wmat);  
+  //
+  //  Ceramics - Al2O3
+  //
+  amat[0] = 26.98;
+  amat[1]= 15.9994;
+
+  zmat[0] = 13.;
+  zmat[1]=8.;
+  wmat[0]=2.;
+  wmat[1]=3.;
+  density = 3.97;
+
+  AliMixture(31,"Alumina",amat,zmat,density,-2,wmat);   
+
+  //
+  // liquids
+  //
+
+  // water
+
+  amat[0]=1.;
+  amat[1]=15.9994;
+
+  zmat[0]=1.;
+  zmat[1]=8.;
+
+  wmat[0]=2.;
+  wmat[1]=1.;
+
+  density=1.;
+
+  AliMixture(32,"Water",amat,zmat,density,-2,wmat);  
  
   //----------------------------------------------------------
   // tracking media for gases
@@ -655,7 +716,7 @@ void AliTPC::CreateMaterials()
   AliMedium(1, "Ne-CO2-N-1", 12, 0, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
   AliMedium(2, "Ne-CO2-N-2", 13, 1, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
   AliMedium(3,"CO2",10,0, iSXFLD, sXMGMX, 10., 999.,.1, .001, .001); 
-  AliMedium(20, "Ne-CO2-N-3", 13, 1, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
+  AliMedium(20, "Ne-CO2-N-3", 30, 1, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
   //-----------------------------------------------------------  
   // tracking media for solids
   //-----------------------------------------------------------
@@ -677,7 +738,9 @@ void AliTPC::CreateMaterials()
   AliMedium(16,"G10",22,0, iSXFLD, sXMGMX, 10., 999., .1, .001, .001);
   AliMedium(17,"Plexiglas",27,0, iSXFLD, sXMGMX, 10., 999., .1, .001, .001);
   AliMedium(18,"Steel",29,0, iSXFLD, sXMGMX, 10., 999., .1, .001, .001); 
-    
+  AliMedium(19,"Peek",30,0, iSXFLD, sXMGMX, 10., 999., .1, .001, .001);
+  AliMedium(21,"Alumina",31,0, iSXFLD, sXMGMX, 10., 999., .1, .001, .001);    
+  AliMedium(22,"Water",32,0, iSXFLD, sXMGMX, 10., 999., .1, .001, .001);  
 }
 
 void AliTPC::GenerNoise(Int_t tablesize)
@@ -1221,7 +1284,6 @@ void AliTPC::Hits2Digits()
 
   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
     //PH    runLoader->GetEvent(iEvent);
-    SetActiveSectors();   
     Hits2Digits(iEvent);
   }
 
@@ -1236,6 +1298,7 @@ void AliTPC::Hits2Digits(Int_t eventnumber)
  //----------------------------------------------------
   AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::GetRunLoaderName());
   rl->GetEvent(eventnumber);
+  SetActiveSectors();   
   if (fLoader->TreeH() == 0x0) {
     if(fLoader->LoadHits()) {
       AliError("Can not load hits.");
@@ -1757,11 +1820,38 @@ void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH,
   // contains the track label and the position of electrons.
   //-----------------------------------------------------------------
 
+  // 
+  // The trasport of the electrons through TPC drift volume
+  //    Drift (drift velocity + velocity map(not yet implemented)))
+  //    Application of the random processes (diffusion, gas gain)
+  //    Systematic effects (ExB effect in drift volume + ROCs)  
+  //
+  // Algorithm:
+  // Loop over primary electrons:
+  //    Creation of the secondary electrons
+  //    Loop over electrons (primary+ secondaries)
+  //        Global coordinate frame:
+  //          1. Skip electrons if attached  
+  //          2. ExB effect in drift volume
+  //             a.) Simulation   calib->GetExB()->CorrectInverse(dxyz0,dxyz1);
+  //             b.) Reconstruction -  calib->GetExB()->CorrectInverse(dxyz0,dxyz1);
+  //          3. Generation of gas gain (Random - Exponential distribution) 
+  //          4. TransportElectron function (diffusion)
+  //
+  //        5. Conversion to the local coordinate frame  pad-row, pad, timebin
+  //        6. Apply Time0 shift - AliTPCCalPad class 
+  //            a.) Plus sign in simulation
+  //            b.) Minus sign in reconstruction 
+  // end of loop          
+  //
   //-----------------------------------------------------------------
   // Origin: Marek Kowalski  IFJ, Krakow, Marek.Kowalski@ifj.edu.pl
+  // Origin: Marian Ivanov,  marian.ivanov@cern.ch
   //-----------------------------------------------------------------
+  AliTPCcalibDB* const calib=AliTPCcalibDB::Instance();
 
   Float_t gasgain = fTPCParam->GetGasGain();
+  gasgain = gasgain/fGainFactor;
   Int_t i;
   Float_t xyz[5]; 
 
@@ -1877,19 +1967,49 @@ void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH,
       for(Int_t nel=0;nel<qI;nel++){
        // skip if electron lost due to the attachment
        if((gRandom->Rndm(0)) < attProb) continue; // electron lost!
-       xyz[0]=tpcHit->X();
-       xyz[1]=tpcHit->Y();
-       xyz[2]=tpcHit->Z();     
+       
+       //
+       // ExB effect
+       //
+       Double_t dxyz0[3],dxyz1[3];
+       dxyz0[0]=tpcHit->X();
+       dxyz0[1]=tpcHit->Y();
+       dxyz0[2]=tpcHit->Z();   
+       if (calib->GetExB()){
+         calib->GetExB()->CorrectInverse(dxyz0,dxyz1);
+       }else{
+         AliError("Not valid ExB calibration");
+         dxyz1[0]=tpcHit->X();
+         dxyz1[1]=tpcHit->Y();
+         dxyz1[2]=tpcHit->Z();         
+       }
+       xyz[0]=dxyz1[0];
+       xyz[1]=dxyz1[1];
+       xyz[2]=dxyz1[2];        
+       //
+       //
        //
        // protection for the nonphysical avalanche size (10**6 maximum)
        //  
        Double_t rn=TMath::Max(gRandom->Rndm(0),1.93e-22);
        xyz[3]= (Float_t) (-gasgain*TMath::Log(rn)); 
        index[0]=1;
-       
+         
        TransportElectron(xyz,index);    
        Int_t rowNumber;
        fTPCParam->GetPadRow(xyz,index); 
+       //
+       // Add Time0 correction due unisochronity
+       // xyz[0] - pad row coordinate 
+       // xyz[1] - pad coordinate
+       // xyz[2] - is in now time bin coordinate system
+       Float_t correction =0;
+       if (calib->GetPadTime0()){
+         if (!calib->GetPadTime0()->GetCalROC(isec)) continue;
+         correction = calib->GetPadTime0()->GetCalROC(isec)->GetValue(TMath::Nint(xyz[0]),TMath::Nint(xyz[1]));
+       }
+       xyz[2]+=correction;
+       //
        // Electron track time (for pileup simulation)
        xyz[4] = tpcHit->Time()/fTPCParam->GetTSample();
        // row 0 - cross talk from the innermost row
@@ -2061,7 +2181,9 @@ void AliTPC::TransportElectron(Float_t *xyz, Int_t *index)
     Float_t dx = fTPCParam->Transform2to2NearestWire(xyz,index);
     xyz[1]+=dx*(fTPCParam->GetOmegaTau());
   }
-  //add nonisochronity (not implemented yet)  
+  //add nonisochronity (not implemented yet) 
+  
 }
   
 ClassImp(AliTPChit)
@@ -2170,14 +2292,6 @@ void AliTPC::SetTreeAddress2()
 //     else
 //       AliDebug(1,"fHitType&2 Failed (can not find branch)");
 //   }
-  //set address to TREETR
-  
-  TTree *treeTR = TreeTR();
-  if (treeTR && fTrackReferences) {
-    branch = treeTR->GetBranch(GetName());
-    if (branch) branch->SetAddress(&fTrackReferences);
-  }
-
 }
 
 void AliTPC::FinishPrimary()