Fix for FMD DA
[u/mrichter/AliRoot.git] / RAW / readAltroV3.C
CommitLineData
d3de630e 1#if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TStopwatch.h>
3 #include <TH1F.h>
4 #include <TH2F.h>
5 #include <TCanvas.h>
6 #include "AliRawReader.h"
7 #include "AliAltroRawStreamV3.h"
8 #include "AliLog.h"
9#endif
10
11
12void readAltroV3(const char *fileName = "./",Int_t ddlId = -1)
13{
14 TH1D *hsignal = new TH1D("signalall","All ADC counts",1024,-0.5,1023.5);
15 TH1D *htime = new TH1D("timeall","All Time-Bins",1024,-0.5,1023.5);
16 TH2F *hhwaddr = new TH2F("hhwaddr","DDL is vs HW addr",216,-0.5,215.5,4096,-0.5,4095.5);
17
18 // AliLog::SetGlobalLogLevel(AliLog::kFatal);
19 // AliLog::SetPrintRepetitions(kFALSE);
20
21 AliRawReader *reader = AliRawReader::Create(fileName);
22 reader->Reset();
23
24 TStopwatch timer;
25 timer.Start();
26
27 AliAltroRawStreamV3 *stream = new AliAltroRawStreamV3(reader);
28 if (ddlId >= 0)
29 reader->Select("TPC",ddlId,ddlId);
30 else
31 reader->Select("TPC");
32
33 // stream->SelectRawData("TPC");
34
35 Int_t iev = 0;
36
37 while (reader->NextEvent()) {
38 AliInfoGeneral("",Form("Reading event %d\n",iev++));
39 while (stream->NextDDL()) {
40 while (stream->NextChannel()) {
41 while (stream->NextBunch()) {
42 const UShort_t *sig = stream->GetSignals();
43 Int_t startBin = stream->GetStartTimeBin();
44 for (Int_t i = 0; i < stream->GetBunchLength(); i++) {
45 hsignal->Fill(sig[i]);
46 htime->Fill(startBin--);
47 hhwaddr->Fill(stream->GetDDLNumber(),stream->GetHWAddress());
48 }
49 }
50 }
51 }
52 stream->Reset();
53 }
54
55 timer.Stop();
56 timer.Print();
57
58 TCanvas *c1 = new TCanvas("c1","",0,0,850,850);
59 hsignal->Draw();
60 TCanvas *c2 = new TCanvas("c2","",0,0,850,850);
61 htime->Draw();
62 TCanvas *c3 = new TCanvas("c3","",0,0,850,850);
63 hhwaddr->Draw("colz");
64
65}