For Pythia with tune don't switch off MI in ConfigHeavyFlavor
[u/mrichter/AliRoot.git] / ITS / PlotSDDRawData.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TH2F.h>
3 #include <TGrid.h>
4 #include <TCanvas.h>
5 #include <TStopwatch.h>
6 #include <TStyle.h>
7 #include "AliRawReaderDate.h"
8 #include "AliRawReaderRoot.h"
9 #include "AliITSRawStreamSDD.h"
10 #include "AliITSRawStreamSDDCompressed.h"
11 #endif
12
13 // Macro to display the SDD Raw Data for 1 DDL
14 // Origin: F. Prino,   prino@to.infn.it
15
16 void PlotSDDRawData(Char_t datafil[100], Int_t nDDL, Int_t firstEv=18, Int_t lastEv=20){
17
18   const Int_t nHybrids=24;
19   Bool_t writtenoutput=kFALSE;
20   TH2F** histo = new TH2F*[nHybrids];
21   Char_t nome[20];
22   for(Int_t i=0;i<nHybrids;i++){
23     sprintf(nome,"histo%d",i);
24     histo[i]=new TH2F(nome,"",256,-0.5,255.5,256,-0.5,255.5);
25     histo[i]->SetStats(0);
26   }
27
28   Int_t iev=firstEv;
29   AliRawReader *rd; 
30   if(strstr(datafil,".root")!=0){
31     rd=new AliRawReaderRoot(datafil,iev);
32   }else{
33     rd=new AliRawReaderDate(datafil,iev);
34   }
35   TStopwatch *evtime=new TStopwatch();
36   TCanvas* c0 = new TCanvas("cd0","c0",900,900);
37   gStyle->SetPalette(1);
38
39   do{
40     c0->Clear();                                
41     c0->Divide(4,6,0.001,0.001);
42
43     evtime->Start();
44     printf("Event # %d\n",iev);
45     rd->Reset();
46     for(Int_t i=0;i<nHybrids;i++) histo[i]->Reset();
47     UChar_t cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rd);
48     UInt_t amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
49     AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rd,cdhAttr);
50     if(!writtenoutput){
51       printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
52       writtenoutput=kTRUE;
53     }
54
55     Int_t iCountNext=0;    
56     while(s->Next()){
57       iCountNext++;
58       if(s->IsCompletedModule()==kFALSE && s->IsCompletedDDL()==kFALSE){
59         Int_t i=s->GetCarlosId()*2+s->GetChannel();
60         if(rd->GetDDLID()==nDDL) histo[i]->Fill(s->GetCoord2(),s->GetCoord1(),s->GetSignal());
61       }
62     }
63     evtime->Stop();
64     printf("**** Event=%d  \n",iev);
65     evtime->Print("u");
66     evtime->Reset();
67     iev++;
68     
69     for(Int_t i=0;i<nHybrids;i++){
70       c0->cd(i+1);
71       histo[i]->DrawCopy("colz");
72     }
73     c0->Update();
74   }while(rd->NextEvent()&&iev<=lastEv);
75
76 }
77
78 void PlotSDDRawData(Int_t nrun, Int_t n2, Int_t year=2009, Char_t* dir="LHC09b_SDD",
79                     Int_t nDDL=0, 
80                     Int_t firstEv=18, 
81                     Int_t lastEv=20){
82
83   TGrid::Connect("alien:",0,0,"t");
84   Char_t filnam[200];
85   sprintf(filnam,"alien:///alice/data/%d/%s/%09d/raw/%02d%09d%03d.10.root",year,dir,nrun,year-2000,nrun,n2);
86   printf("Open file %s\n",filnam);
87   PlotSDDRawData(filnam,nDDL,firstEv,lastEv);
88 }
89