Example macro for RCU v3 raw-data reading. Uses the recently introduced fast altro...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 May 2009 09:13:54 +0000 (09:13 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 May 2009 09:13:54 +0000 (09:13 +0000)
RAW/readAltroV3.C [new file with mode: 0644]

diff --git a/RAW/readAltroV3.C b/RAW/readAltroV3.C
new file mode 100644 (file)
index 0000000..746cdc1
--- /dev/null
@@ -0,0 +1,65 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+  #include <TStopwatch.h>
+  #include <TH1F.h>
+  #include <TH2F.h>
+  #include <TCanvas.h>
+  #include "AliRawReader.h"
+  #include "AliAltroRawStreamV3.h"
+  #include "AliLog.h"
+#endif
+
+
+void readAltroV3(const char *fileName = "./",Int_t ddlId = -1)
+{
+  TH1D *hsignal = new TH1D("signalall","All ADC counts",1024,-0.5,1023.5);
+  TH1D *htime = new TH1D("timeall","All Time-Bins",1024,-0.5,1023.5);
+  TH2F *hhwaddr = new TH2F("hhwaddr","DDL is vs HW addr",216,-0.5,215.5,4096,-0.5,4095.5);
+
+  //  AliLog::SetGlobalLogLevel(AliLog::kFatal);
+  //  AliLog::SetPrintRepetitions(kFALSE);
+
+  AliRawReader *reader = AliRawReader::Create(fileName);
+  reader->Reset();
+
+  TStopwatch timer;
+  timer.Start();
+
+  AliAltroRawStreamV3 *stream = new AliAltroRawStreamV3(reader);
+  if (ddlId >= 0)
+    reader->Select("TPC",ddlId,ddlId);
+  else
+    reader->Select("TPC");
+
+  //  stream->SelectRawData("TPC");
+
+  Int_t iev = 0;
+
+  while (reader->NextEvent()) {
+    AliInfoGeneral("",Form("Reading event %d\n",iev++));
+    while (stream->NextDDL()) {
+      while (stream->NextChannel()) {
+       while (stream->NextBunch()) {
+         const UShort_t *sig = stream->GetSignals();
+         Int_t startBin = stream->GetStartTimeBin();
+         for (Int_t i = 0; i < stream->GetBunchLength(); i++) {
+           hsignal->Fill(sig[i]);
+           htime->Fill(startBin--);
+           hhwaddr->Fill(stream->GetDDLNumber(),stream->GetHWAddress());
+         }
+       }
+      }
+    }
+    stream->Reset();
+  }
+
+  timer.Stop();
+  timer.Print();
+
+  TCanvas *c1 = new TCanvas("c1","",0,0,850,850);
+  hsignal->Draw();
+  TCanvas *c2 = new TCanvas("c2","",0,0,850,850);
+  htime->Draw();
+  TCanvas *c3 = new TCanvas("c3","",0,0,850,850);
+  hhwaddr->Draw("colz");
+
+}