]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update of digits test macros
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Nov 2000 12:36:01 +0000 (12:36 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Nov 2000 12:36:01 +0000 (12:36 +0000)
TRD/AliTRDanalyzeDigits.C
TRD/AliTRDcreateDigits.C

index 18b9c3ddddd501590814c3f8108d7ddfb5f9c55e..d40abcbc7963024c7e0012f36b07c8ddff40bec7 100644 (file)
@@ -6,6 +6,96 @@ Int_t AliTRDanalyzeDigits()
 
   Int_t rc = 0;
 
+  if (!gAlice) {
+    cout << "<AliTRDanalyzeDigits> No AliRun object found" << endl;
+    rc = 1;
+    return rc;
+  }
+  gAlice->GetEvent(0);
+
+  // Get the pointer to the TRD detector 
+  AliTRD *TRD = (AliTRD *) gAlice->GetDetector("TRD");
+  if (!TRD) {
+    cout << "<AliTRDanalyzeDigits> No TRD detector found" << endl;
+    rc = 2;
+    return rc;
+  }
+
+  // Define the histograms
+  TH1F *hAmp = new TH1F("hAmp","Amplitude of the digits",256,-0.5,255.5);
+
+  // Get the pointer to the geometry object
+  AliTRDgeometry *TRDgeometry;
+  if (TRD) {
+    TRDgeometry = TRD->GetGeometry();
+  }
+  else {
+    cout << "<AliTRDanalyzeDigits> No TRD geometry found" << endl;
+    rc = 3;
+    return rc;
+  }
+
+  // Create the digits manager
+  AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager();
+
+  // Read the digits from the file
+  if (!(DigitsManager->ReadDigits())) {
+    cout << "<AliTRDanalyzeDigits> Cannot read the digits" << endl;
+    rc = 4;
+    return rc;
+  }
+  
+  // Define the detector matrix for one chamber
+  Int_t iSec = TRD->GetSensSector();
+  Int_t iCha = TRD->GetSensChamber();
+  Int_t iPla = 0;
+  Int_t  rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
+  Int_t  colMax = TRDgeometry->GetColMax(iPla);
+  Int_t timeMax = TRDgeometry->GetTimeMax();
+  cout << "<AliTRDanalyzeDigits> Geometry: rowMax = "  <<  rowMax
+                                      << " colMax = "  <<  colMax
+                                      << " timeMax = " << timeMax << endl;
+  AliTRDmatrix *TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
+  // Get the detector number
+  Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec);
+  cout << "<AliTRDanalyzeDigits> iSec = " << iSec
+                            << " iCha = " << iCha 
+                            << " iPla = " << iPla 
+                            << " iDet = " << iDet << endl;
+
+  // Loop through the detector pixel
+  Int_t countDigits = 0;
+  for (Int_t time = 0; time < timeMax; time++) {
+    for (Int_t  col = 0;  col <  colMax;  col++) {
+      for (Int_t  row = 0;  row <  rowMax;  row++) {
+
+        AliTRDdigit *Digit = DigitsManager->GetDigit(row,col,time,iDet);
+        Int_t amp = Digit->GetAmp();
+
+        if (amp > 0) {
+          countDigits++;
+          hAmp->Fill(amp);
+          TRDmatrix->SetSignal(row,col,time,amp);
+       }
+
+        delete Digit;
+
+      }
+    }
+  }
+
+  cout << "<AliTRDanalyzeDigits> Found " << countDigits << " digits in total" << endl;
+
+  // Display the detector matrix
+  TRDmatrix->Draw();
+  TRDmatrix->ProjRow();
+  TRDmatrix->ProjCol();
+  TRDmatrix->ProjTime();
+
+  TCanvas *cDigits = new TCanvas("cDigits","AliTRDanalyzeDigits",50,50,600,600);
+  gPad->SetLogy();
+  hAmp->Draw();
+
   return rc;
 
 }
index da75b659fe49dacbb3f09d442d543acf08086fec..45b6d3d7aeb45a86a79bc3aa00772db18f10c5c9 100644 (file)
@@ -6,8 +6,6 @@ Int_t AliTRDcreateDigits()
 
   Int_t rc = 0;
 
-  return rc;
-
   if (!gAlice) {
     cout << "<AliTRDcreateDigits> No AliRun object found" << endl;
     rc = 1;
@@ -19,7 +17,7 @@ Int_t AliTRDcreateDigits()
   AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","Digitizer class");
 
   // Initialize the TRD and the geometry
-  if (!Digitizer->InitDetector()) {
+  if (!(Digitizer->InitDetector())) {
     cout << "<AliTRDcreateDigits> No TRD geometry found" << endl;
     rc = 2;
     return rc;
@@ -30,11 +28,23 @@ Int_t AliTRDcreateDigits()
   Digitizer->SetVerbose(1);
 
   // Create the digits
-  if (!Digitizer->MakeDigits()) {
+  if (!(Digitizer->MakeDigits())) {
     rc = 3;
     return rc;
   }
 
+  // Write the digits into the input file
+  if (!(Digitizer->WriteDigits())) {
+    rc = 4;
+    return rc;
+  }
+
+  // Save the digitizer class in the AliROOT file
+  if (!(Digitizer->Write())) {
+    rc = 5;
+    return rc;
+  }
+
   return rc;
 
 }