]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPC.cxx
update to the runGrid Macro
[u/mrichter/AliRoot.git] / TPC / AliTPC.cxx
index 19f97c717817f6a46a3782d257bcc39733ad46a7..b7aa8998cdd3b9277f01948c68a08500adc14092 100644 (file)
@@ -101,13 +101,15 @@ ClassImp(AliTPC)
                   fActiveSectors(0),
                    fGainFactor(1.),
                    fDebugStreamer(0),
-                   fLHCclockPhaseSw(0)
+                   fLHCclockPhaseSw(0),
+                  fIsGEM(0)
 
 {
   //
   // Default constructor
   //
   fIshunt   = 0;
+  for(Int_t i=0;i<4;i++) fCurrentIndex[i]=0;
  
   //  fTrackHitsOld = 0;   
 #if ROOT_VERSION_CODE >= ROOT_VERSION(4,0,1)
@@ -136,7 +138,8 @@ AliTPC::AliTPC(const char *name, const char *title)
                    fActiveSectors(0),
                    fGainFactor(1.),
                    fDebugStreamer(0),
-                   fLHCclockPhaseSw(0)
+    fLHCclockPhaseSw(0),
+    fIsGEM(0)
                   
 {
   //
@@ -165,7 +168,7 @@ AliTPC::AliTPC(const char *name, const char *title)
   fHitType = 2;
 #endif
 
-
+  for(Int_t i=0;i<4;i++) fCurrentIndex[i]=0;
 
   //
   fIshunt     =  0;
@@ -293,30 +296,33 @@ void AliTPC::CreateMaterials()
 
   //
   // Drift gases 1 - nonsensitive, 2 - sensitive
-  // Ne-CO2-N2 (90-10-5) (volume) values at 20deg and 1 atm.
-  // rho(Ne) = 0.839 g/cm^3, rho(CO2) = 1.842 g/cm^3, rho(N2) = 1.165 g/cm^3
-  // for the calculation - everything is normalized to 1
+  // Ne-CO2 (90-10) (volume) values at 20deg and 1 atm.
+  // rho(Ne) = 0.839 g/cm^3, rho(CO2) = 1.842 g/cm^3
+  
 
   amat[0]= 20.18;
   amat[1]=12.011;
   amat[2]=15.9994;
-  amat[3]=14.007;
+  // amat[3]=14.007;
 
   zmat[0]= 10.; 
   zmat[1]=6.;
   zmat[2]=8.;
-  zmat[3]=7.;
-
-  wmat[0]=0.756992632;
-  wmat[1]=0.056235789;
-  wmat[2]=0.128469474;
-  wmat[3]=0.058395789;
+  // zmat[3]=7.;
+
+  //wmat[0]=0.756992632;
+  wmat[0]=0.8038965;
+  //wmat[1]=0.056235789;
+  wmat[1]= 0.053519;
+  //wmat[2]=0.128469474;
+  wmat[2]= 0.1425743;
+  // wmat[3]=0.058395789;
  
-  density=0.000904929;
+  density=0.0009393;
 
-  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);
+  AliMixture(12,"Ne-CO2-1",amat,zmat,density,3,wmat);
+  AliMixture(13,"Ne-CO2-2",amat,zmat,density,3,wmat);
+  AliMixture(35,"Ne-CO2-3",amat,zmat,density,3,wmat);
   //----------------------------------------------------------------------
   //               solid materials
   //----------------------------------------------------------------------
@@ -679,10 +685,10 @@ void AliTPC::CreateMaterials()
   //----------------------------------------------------------
 
   AliMedium(0, "Air", 11, 0, iSXFLD, sXMGMX, 10., 999., .1, .01, .1);
-  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(1, "Ne-CO2-1", 12, 0, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
+  AliMedium(2, "Ne-CO2-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", 30, 1, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
+  AliMedium(20, "Ne-CO2-3", 35, 1, iSXFLD, sXMGMX, 10., 999.,.1,.001, .001);
   //-----------------------------------------------------------  
   // tracking media for solids
   //-----------------------------------------------------------
@@ -773,14 +779,16 @@ void    AliTPC::SetActiveSectors(Int_t flag)
     return;
   }
   for (Int_t i=0;i<fTPCParam->GetNSector();i++) fActiveSectors[i]=kFALSE;
-  TBranch * branch=0;
+  //TBranch * branch=0;
   if (fLoader->TreeH() == 0x0)
    {
      AliFatal("Can not find TreeH in folder");
      return;
    }
-  if (fHitType>1) branch = fLoader->TreeH()->GetBranch("TPC2");
-  else branch = fLoader->TreeH()->GetBranch("TPC");
+  //if (fHitType>1) branch = fLoader->TreeH()->GetBranch("TPC2");
+  if (fHitType>1) fLoader->TreeH()->GetBranch("TPC2");
+  //else branch = fLoader->TreeH()->GetBranch("TPC");
+  else fLoader->TreeH()->GetBranch("TPC");
   Stat_t ntracks = fLoader->TreeH()->GetEntries();
   // loop over all hits
   AliDebug(1,Form("Got %d tracks", (Int_t) ntracks));
@@ -1044,6 +1052,7 @@ Bool_t AliTPC::Raw2SDigits(AliRawReader* rawReader){
          if (q <= 0) continue;
          q *= 16;
          dig->SetDigitFast((Short_t)q,iTimeBin,iPad);
+         ((AliSimDigits*)dig)->SetTrackIDFast( 3141593, iTimeBin,iPad,0); 
        }
       }
       fDigitsArray->StoreRow(iSector,iRow);
@@ -1089,9 +1098,9 @@ Bool_t AliTPC::Raw2SDigits(AliRawReader* rawReader){
 }
 
 //______________________________________________________________________
-AliDigitizer* AliTPC::CreateDigitizer(AliRunDigitizer* manager) const
+AliDigitizer* AliTPC::CreateDigitizer(AliDigitizationInput* digInput) const
 {
-  return new AliTPCDigitizer(manager);
+  return new AliTPCDigitizer(digInput);
 }
 //__
 void AliTPC::SDigits2Digits2(Int_t /*eventnumber*/)  
@@ -1208,25 +1217,20 @@ void AliTPC::SetDefaults(){
   //
   AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::GetRunLoaderName());
   rl->CdGAFile();
-  AliTPCParamSR *param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60");
-  // if(param){
-//     AliInfo("You are using 2 pad-length geom hits with 3 pad-lenght geom digits...");
-//     delete param;
-//     param = new AliTPCParamSR();
-//   }
-//   else {
-//     param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60_150x60");
-//   }
-  param = (AliTPCParamSR*)AliTPCcalibDB::Instance()->GetParameters();
+  //AliTPCParamSR *param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60");
+  //gDirectory->Get("75x40_100x60");
+  AliTPCParamSR *param = (AliTPCParamSR*)AliTPCcalibDB::Instance()->GetParameters();
+  if(!param){
+    AliFatal("No TPC parameters found");
+    return;
+  }
   if (!param->IsGeoRead()){
       //
       // read transformation matrices for gGeoManager
       //
       param->ReadGeoMatrices();
     }
-  if(!param){
-    AliFatal("No TPC parameters found");
-  }
+
 
 
   AliTPCPRF2D    * prfinner   = new AliTPCPRF2D;
@@ -1242,37 +1246,65 @@ void AliTPC::SetDefaults(){
   // Use gamma 4
   //
   char  strgamma4[1000];
-  sprintf(strgamma4,"AliTPCRF1D::Gamma4((x-0.135+%f)*%f,55,160)",3*param->GetZSigma(), 1000000000*param->GetTSample()/param->GetZWidth());
+  //sprintf(strgamma4,"AliTPCRF1D::Gamma4((x-0.135+%f)*%f,55,160)",3*param->GetZSigma(), 1000000000*param->GetTSample()/param->GetZWidth());
   
+  snprintf(strgamma4,1000,"AliTPCRF1D::Gamma4((x-0.135+%f)*%f,55,160)",3*param->GetZSigma(), 1000000000*param->GetTSample()/param->GetZWidth());
   TF1 * fgamma4 = new TF1("fgamma4",strgamma4, -1,1);
   AliTPCRF1D     * rf    = new AliTPCRF1D(kTRUE,1000);
   rf->SetParam(fgamma4,param->GetZWidth(), 1,0.2);
   rf->SetOffset(3*param->GetZSigma()); 
   rf->Update();
-
   TDirectory *savedir=gDirectory;
-  TFile *f=TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
-  if (!f->IsOpen()) 
-    AliFatal("Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !");
-
-  TString s;
-  prfinner->Read("prf_07504_Gati_056068_d02");
-  //PH Set different names
-  s=prfinner->GetGRF()->GetName();
-  s+="in";
-  prfinner->GetGRF()->SetName(s.Data());
-
-  prfouter1->Read("prf_10006_Gati_047051_d03");
-  s=prfouter1->GetGRF()->GetName();
-  s+="out1";
-  prfouter1->GetGRF()->SetName(s.Data());
-
-  prfouter2->Read("prf_15006_Gati_047051_d03");  
-  s=prfouter2->GetGRF()->GetName();
-  s+="out2";
-  prfouter2->GetGRF()->SetName(s.Data());
-
-  f->Close();
+
+  if (fIsGEM==0){
+    printf ("TPC MWPC readout\n");
+    TFile *f=TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
+    if (!f->IsOpen()) 
+      AliFatal("Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !");
+    
+    TString s;
+    prfinner->Read("prf_07504_Gati_056068_d02");
+    //PH Set different names
+    s=prfinner->GetGRF()->GetName();
+    s+="in";
+    prfinner->GetGRF()->SetName(s.Data());
+    
+    prfouter1->Read("prf_10006_Gati_047051_d03");
+    s=prfouter1->GetGRF()->GetName();
+    s+="out1";
+    prfouter1->GetGRF()->SetName(s.Data());
+    
+    prfouter2->Read("prf_15006_Gati_047051_d03");  
+    s=prfouter2->GetGRF()->GetName();
+    s+="out2";
+    prfouter2->GetGRF()->SetName(s.Data());    
+    f->Close();
+  }
+
+  if (fIsGEM==1){
+    printf ("TPC GEM readout\n");
+    TFile *f=TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2dGEM.root");
+    if (!f->IsOpen()) 
+      AliFatal("Can't open $ALICE_ROOT/TPC/AliTPCprf2dGEM.root !");
+    
+    TString s;
+    prfinner->Read("prf0");
+    //PH Set different names
+    s=prfinner->GetGRF()->GetName();
+    s+="in";
+    prfinner->GetGRF()->SetName(s.Data());
+    
+    prfouter1->Read("prf1");
+    s=prfouter1->GetGRF()->GetName();
+    s+="out1";
+    prfouter1->GetGRF()->SetName(s.Data());
+    
+    prfouter2->Read("prf2");  
+    s=prfouter2->GetGRF()->GetName();
+    s+="out2";
+    prfouter2->GetGRF()->SetName(s.Data());    
+    f->Close();
+  }
   savedir->cd();
 
   param->SetInnerPRF(prfinner);
@@ -1536,13 +1568,10 @@ void AliTPC::Hits2DigitsSector(Int_t isec)
 
   Stat_t ntracks = tH->GetEntries();
 
-
-
-    TObjArray **row;
-    
     Int_t nrows =fTPCParam->GetNRow(isec);
 
-    row= new TObjArray* [nrows+2]; // 2 extra rows for cross talk
+    TObjArray **row=new TObjArray* [nrows+2]; // 2 extra rows for cross talk
+    for(Int_t j=0;j<nrows+2;j++) row[j]=0;
     
     MakeSector(isec,nrows,tH,ntracks,row);
 
@@ -2322,7 +2351,8 @@ void AliTPC::MakeBranch(Option_t *option)
   AliDebug(1,"");
   if (fHitType<2) return;
   char branchname[10];
-  sprintf(branchname,"%s2",GetName());  
+  //sprintf(branchname,"%s2",GetName()); 
+  snprintf(branchname,10,"%s2",GetName()); 
   //
   // Get the pointer to the header
   const char *cH = strstr(option,"H");
@@ -2359,7 +2389,8 @@ void AliTPC::SetTreeAddress2()
   
   TBranch *branch;
   char branchname[20];
-  sprintf(branchname,"%s2",GetName());
+  //sprintf(branchname,"%s2",GetName());
+  snprintf(branchname,20,"%s2",GetName());
   //
   // Branch address for hit tree
   TTree *treeH = fLoader->TreeH();
@@ -2571,7 +2602,8 @@ AliTPCParam* AliTPC::LoadTPCParam(TFile *file) {
 // and one has to decide where to store the TPC parameters
 // M.Kowalski
   char paramName[50];
-  sprintf(paramName,"75x40_100x60_150x60");
+  //sprintf(paramName,"75x40_100x60_150x60");
+  snprintf(paramName,50,"75x40_100x60_150x60");
   AliTPCParam *paramTPC=(AliTPCParam*)file->Get(paramName);
   if (paramTPC) {
     AliDebugClass(1,Form("TPC parameters %s found.",paramName));