]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDanaDigits.C
Updating
[u/mrichter/AliRoot.git] / TRD / AliTRDanaDigits.C
index 7e3e9d7c428bc470ee94942ffc822320e2363080..266d6cb946a7a617a21e80db6ae81288aa97d6e2 100644 (file)
@@ -15,39 +15,25 @@ void AliTRDanaDigits()
   }
 
   // Input file name
-  //Char_t *alifile = "galice.root"; 
-  Char_t *alifile = "galice_jiri.root"; 
+  Char_t *alifile = "galice.root"; 
 
   // Event number
   Int_t   nEvent  = 0;
 
   // Define the objects
-  AliTRDv1       *trd;
-  AliTRDgeometry *geo;
-  AliTRDdigit    *digit;
+  AliTRDv1        *trd;
+  AliTRDgeometry  *geo;
+  AliTRDdigit     *digit;
+  AliTRDparameter *par;
 
   Int_t           track;
 
-  // Connect the AliRoot file containing Geometry, Kine, Hits, and digits
-  TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
-  if (!gafl) {
-    cout << "Open the ALIROOT-file " << alifile << endl;
-    gafl = new TFile(alifile);
-  }
-  else {
-    cout << alifile << " is already open" << endl;
-  }
-
-  // Get AliRun object from file or create it if not on file
-  gAlice = (AliRun*) gafl->Get("gAlice");
-  if (gAlice)  
-    cout << "AliRun object found on file" << endl;
-  else
-    gAlice = new AliRun("gAlice","Alice test program");
-
-  // Import the Trees for the event nEvent in the file
-  Int_t nparticles = gAlice->GetEvent(nEvent);
-  if (nparticles <= 0) break;
+  AliRunLoader* rl = AliRunLoader::Open(alifile);
+  AliLoader* loader = rl->GetLoader("TRDLoader");
+  rl->LoadDigits();
+  
+  rl->LoadgAlice();
+  gAlice = rl->GetAliRun();
   
   // Get the pointer to the detector object
   trd = (AliTRDv1*) gAlice->GetDetector("TRD");
@@ -61,26 +47,28 @@ void AliTRDanaDigits()
     break;
   }
 
+  // The parameter object
+  par = new AliTRDparameter("TRDparameter","TRD parameter class");
+
   // Create the digits manager
   AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
   digitsManager->SetDebug(1);
-  digitsManager->SetSDigits(kTRUE);
 
   // Read the digits from the file
-  digitsManager->Open(alifile);
-  digitsManager->ReadDigits();
+  
+  digitsManager->ReadDigits(loader->TreeD());
 
   // Get the detector number
-  Int_t iDet = 423;
+  Int_t iDet = 514;
   cout << " iDet = " << iDet << endl;
 
   // Define the detector matrix for one chamber
   const Int_t iSec = geo->GetSector(iDet);
   const Int_t iCha = geo->GetChamber(iDet);
   const Int_t iPla = geo->GetPlane(iDet);
-  Int_t  rowMax = geo->GetRowMax(iPla,iCha,iSec);
-  Int_t  colMax = geo->GetColMax(iPla);
-  Int_t timeMax = geo->GetTimeMax();
+  Int_t  rowMax = par->GetRowMax(iPla,iCha,iSec);
+  Int_t  colMax = par->GetColMax(iPla);
+  Int_t timeMax = par->GetTimeMax();
   cout << "Geometry: rowMax = "  <<  rowMax
                 << " colMax = "  <<  colMax
                 << " timeMax = " << timeMax << endl;
@@ -94,7 +82,6 @@ void AliTRDanaDigits()
         digit = digitsManager->GetDigit(row,col,time,iDet);
         track = digitsManager->GetTrack(0,row,col,time,iDet);
         
-        printf("time=%d, col=%d, row=%d, amp=%f\n",time,col,row,digit->GetAmp());
         matrix->SetSignal(row,col,time,digit->GetAmp());
 
         delete digit;
@@ -105,11 +92,8 @@ void AliTRDanaDigits()
 
   // Display the detector matrix
   matrix->Draw();
-  //matrix->DrawRow(18);
-  //matrix->DrawCol(58);
-  //matrix->DrawTime(20);
   matrix->ProjRow();
   matrix->ProjCol();
   matrix->ProjTime();
-
+  delete rl;
 }