New macro converting RAW to digits
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Jun 2004 08:56:40 +0000 (08:56 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Jun 2004 08:56:40 +0000 (08:56 +0000)
TRD/AliTRDRaw2Digits.C [new file with mode: 0644]

diff --git a/TRD/AliTRDRaw2Digits.C b/TRD/AliTRDRaw2Digits.C
new file mode 100644 (file)
index 0000000..0a950b4
--- /dev/null
@@ -0,0 +1,94 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TH1.h>
+#include <TCanvas.h>
+#include "AliTRDrawData.h"
+#include "AliTRDdigitsManager.h"
+#include "AliTRDdigit.h"
+#include "AliTRDgeometryFull.h"
+#include "AliTRDparameter.h"
+#include "AliTRDmatrix.h"
+#include "AliRawReaderFile.h"
+#include "AliRunLoader.h"
+#endif
+
+void AliTRDRaw2Digits(Int_t iEvent = 0, Int_t iDet = 0)
+{
+
+  AliTRDrawData *raw = new AliTRDrawData();
+  raw->SetDebug(1);
+  AliRawReaderFile rawReader(iEvent);
+  AliTRDdigitsManager *digitsManagerRaw = raw->Raw2Digits(&rawReader);
+
+  // The geometry object
+  AliTRDgeometryFull *geo = new AliTRDgeometryFull();
+
+  // The parameter object
+  AliTRDparameter    *par = new AliTRDparameter("TRDparameter"
+                                               ,"TRD parameter class");
+
+  // Print the event and detector number
+  cout << " iEvent = " << iEvent << endl;
+  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 = 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;
+  AliTRDmatrix *matrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
+
+  AliRunLoader* rl = AliRunLoader::Open("galice.root");
+  AliLoader* loader = rl->GetLoader("TRDLoader");
+  rl->GetEvent(iEvent);
+  loader->LoadDigits();
+  
+  // Create the digits manager
+  AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
+  digitsManager->SetDebug(1);
+
+  // Read the digits from the file
+  digitsManager->ReadDigits(loader->TreeD());
+
+  TH1F *DigDiff = new TH1F("DigDiff","DigDiff",100,-10,+10);
+  Int_t DigAmpRaw, DigAmp;
+
+  // Loop through the detector pixel
+  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 = digitsManagerRaw->GetDigit(row,col,time,iDet);
+        
+        matrix->SetSignal(row,col,time,digit->GetAmp());
+
+       DigAmpRaw = digit->GetAmp();
+
+        digit = digitsManager->GetDigit(row,col,time,iDet);
+
+       DigAmp = digit->GetAmp();
+
+       DigDiff->Fill((Float_t)DigAmp-(Float_t)DigAmpRaw);
+
+        delete digit;
+
+      }
+    }
+  }
+
+  // Display the detector matrix
+  matrix->Draw();
+  matrix->ProjRow();
+  matrix->ProjCol();
+  matrix->ProjTime();
+
+  TCanvas *c1 = new TCanvas("c1","Canvas 1",10,10,600,500);
+  DigDiff->Draw();
+
+}
+
+