ROOT logo
#if !defined(__CINT__) || defined(__MAKECINT__)
  #include <TStopwatch.h>
  #include <TStyle.h>
  #include <TH1F.h>
  #include <TH2F.h>
  #include <TString.h>
  #include <TCanvas.h>
  #include "AliRawReader.h"
  #include "AliCaloRawStreamV3.h"
  #include "AliLog.h"
#endif


void readCaloV3(const char *fileName = "./", const TString calo="PHOS")
{
  TH1D *hAmplHG  = new TH1D("hAmplHG" ,"HG amplitude" ,1024,-0.5,1023.5);
  TH1D *hAmplLG  = new TH1D("hAmplLG" ,"LG amplitude" ,1024,-0.5,1023.5);
  TH1D *hAmplTRU = new TH1D("hAmplTRU","TRU amplitude",1024,-0.5,1023.5);
  TH1F *hModule  = new TH1F("hModule" ,"Module number",10,-0.5,9.5);
  TH2F *hXZHG    = new TH2F("hXZHG"   ,"XZ HG cells",64,-0.5,63.5,64,-0.5,63.5);
  TH2F *hXZLG    = new TH2F("hXZLG"   ,"XZ LG cells",64,-0.5,63.5,64,-0.5,63.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();

  AliCaloRawStreamV3 *stream = new AliCaloRawStreamV3(reader,calo);

  Int_t iev = 0;

  while (reader->NextEvent()) {
    AliInfoGeneral("",Form("Reading event %d\n",iev++));
    while (stream->NextDDL()) {
      while (stream->NextChannel()) {
// 	AliInfoGeneral("",Form("New channel: HW=%d, module=%d, row=%d, col=%d, caloflag=%d",
// 			    stream->GetHWAddress(),
// 			    stream->GetModule(),
// 			    stream->GetRow(),
// 			    stream->GetColumn(),
// 			    stream->GetCaloFlag()));
	hHWaddr->Fill(stream->GetDDLNumber(),stream->GetHWAddress());
	hModule->Fill(stream->GetModule());
	if (stream->IsHighGain())
	  hXZHG->Fill(stream->GetRow(),stream->GetColumn());
	if (stream->IsLowGain())
	  hXZLG->Fill(stream->GetRow(),stream->GetColumn());

	while (stream->NextBunch()) {
	  const UShort_t *sig = stream->GetSignals();
	  Int_t startBin = stream->GetStartTimeBin();
	  for (Int_t i = 0; i < stream->GetBunchLength(); i++) {
	    if (stream->IsHighGain())
	      hAmplHG->Fill(sig[i]);
	    if (stream->IsLowGain())
	      hAmplLG->Fill(sig[i]);
	    if (stream->IsTRUData())
	      hAmplTRU->Fill(sig[i]);
	  }
	}
      }
    }
    stream->Reset();
  }

  timer.Stop();
  timer.Print();

  gStyle->SetPalette(1);
  TCanvas *c1 = new TCanvas("c1","",0,0,900,600);
  c1->Divide(3,1);
  c1->cd(1);
  hAmplHG->Draw();
  c1->cd(2);
  hAmplLG->Draw();
  c1->cd(3);
  hAmplTRU->Draw();

  TCanvas *c2 = new TCanvas("c2","",0,0,900,600);
  c2->Divide(2,1);
  c2->cd(1);
  hModule->Draw();
  c2->cd(2);
  hHWaddr->Draw("colz");

  TCanvas *c3 = new TCanvas("c3","",0,0,900,600);
  c3->Divide(2,1);
  c3->cd(1);
  hXZHG->Draw("colz");
  c3->cd(2);
  hXZLG->Draw("colz");
}
 readCaloV3.C:1
 readCaloV3.C:2
 readCaloV3.C:3
 readCaloV3.C:4
 readCaloV3.C:5
 readCaloV3.C:6
 readCaloV3.C:7
 readCaloV3.C:8
 readCaloV3.C:9
 readCaloV3.C:10
 readCaloV3.C:11
 readCaloV3.C:12
 readCaloV3.C:13
 readCaloV3.C:14
 readCaloV3.C:15
 readCaloV3.C:16
 readCaloV3.C:17
 readCaloV3.C:18
 readCaloV3.C:19
 readCaloV3.C:20
 readCaloV3.C:21
 readCaloV3.C:22
 readCaloV3.C:23
 readCaloV3.C:24
 readCaloV3.C:25
 readCaloV3.C:26
 readCaloV3.C:27
 readCaloV3.C:28
 readCaloV3.C:29
 readCaloV3.C:30
 readCaloV3.C:31
 readCaloV3.C:32
 readCaloV3.C:33
 readCaloV3.C:34
 readCaloV3.C:35
 readCaloV3.C:36
 readCaloV3.C:37
 readCaloV3.C:38
 readCaloV3.C:39
 readCaloV3.C:40
 readCaloV3.C:41
 readCaloV3.C:42
 readCaloV3.C:43
 readCaloV3.C:44
 readCaloV3.C:45
 readCaloV3.C:46
 readCaloV3.C:47
 readCaloV3.C:48
 readCaloV3.C:49
 readCaloV3.C:50
 readCaloV3.C:51
 readCaloV3.C:52
 readCaloV3.C:53
 readCaloV3.C:54
 readCaloV3.C:55
 readCaloV3.C:56
 readCaloV3.C:57
 readCaloV3.C:58
 readCaloV3.C:59
 readCaloV3.C:60
 readCaloV3.C:61
 readCaloV3.C:62
 readCaloV3.C:63
 readCaloV3.C:64
 readCaloV3.C:65
 readCaloV3.C:66
 readCaloV3.C:67
 readCaloV3.C:68
 readCaloV3.C:69
 readCaloV3.C:70
 readCaloV3.C:71
 readCaloV3.C:72
 readCaloV3.C:73
 readCaloV3.C:74
 readCaloV3.C:75
 readCaloV3.C:76
 readCaloV3.C:77
 readCaloV3.C:78
 readCaloV3.C:79
 readCaloV3.C:80
 readCaloV3.C:81
 readCaloV3.C:82
 readCaloV3.C:83
 readCaloV3.C:84
 readCaloV3.C:85
 readCaloV3.C:86
 readCaloV3.C:87
 readCaloV3.C:88
 readCaloV3.C:89
 readCaloV3.C:90
 readCaloV3.C:91
 readCaloV3.C:92
 readCaloV3.C:93
 readCaloV3.C:94
 readCaloV3.C:95
 readCaloV3.C:96
 readCaloV3.C:97
 readCaloV3.C:98