]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/SMcalib/dumpCCUSB.C
Fixed typo
[u/mrichter/AliRoot.git] / EMCAL / SMcalib / dumpCCUSB.C
1 // aliroot macro to dump CC-USB raw data
2 // 
3
4 void dumpCCUSB(const int runno  = 117, const int evtnum = -1 )
5 {
6         TH1F *hTDC[40], *hQDC[32], *hScalerCCUSB[2], *hScalerLecroy[12];
7         
8         for (Int_t i=0;i<40;i++) hTDC[i]          = new TH1F(Form("hTDC%d",i),Form("hTDC%d",i),4096,0.,4096.);
9         for (Int_t i=0;i<32;i++) hQDC[i]          = new TH1F(Form("hQDC%d",i),Form("hQDC%d",i),4096,0.,4096.);
10         for (Int_t i=0;i<2;i++)  hScalerCCUSB[i]  = new TH1F(Form("hScalerCCUSB%d",i),Form("hScalerCCUSB%d",i),4096,0.,4096.);
11         for (Int_t i=0;i<12;i++) hScalerLecroy[i] = new TH1F(Form("hScalerLecroy%d",i),Form("hScalerLecroy%d",i),4096,0.,4096.);
12         
13         Char_t fname[256];
14         sprintf(fname, "/local/data/Run_%09d.Seq_1A.Stream_0.root",runno);
15         
16         cout << "Reading file: " << fname << endl;
17         AliRawReader *rawReader = new AliRawReaderRoot(fname);
18         rawReader->SelectEvents( 7 ); // physics events
19         
20         int firstevent = evtnum;
21         int lastevent  = evtnum;
22         
23         if (evtnum < 0) { // get a bunch of events
24                 firstevent = 0;
25                 lastevent  = - evtnum;
26         }
27         
28         if (evtnum == 0) { // get all events
29                 firstevent = 0;
30                 lastevent  = 1000000;
31         }
32   
33         Int_t iev = 1;
34   
35         while ( rawReader->NextEvent() && iev <= lastevent ) 
36         {
37                 AliEMCALCCUSBRawStream *inCCUSB = new AliEMCALCCUSBRawStream(rawReader);
38                 
39                 while ( inCCUSB->Next() )
40                 {
41                         for (Int_t i=0;i<2;i++)  hScalerCCUSB[i]->Fill(inCCUSB->GetScalerCCUSB(i));
42                         for (Int_t i=0;i<12;i++) hScalerLecroy[i]->Fill(inCCUSB->GetScalerLecroy(i));
43                         for (Int_t i=0;i<40;i++) hTDC[i]->Fill(inCCUSB->GetTDC(i));
44                         for (Int_t i=0;i<32;i++) hQDC[i]->Fill(inCCUSB->GetQDC(i));
45                 }
46
47                 iev ++;
48         }
49         
50         TCanvas *c1 = new TCanvas("c1","",600,600);
51         c1->Divide(4,4);
52         for (Int_t i=0;i<8;i++) {c1->cd(i+1); hTDC[i]->Draw();}
53         c1->cd(9); hScalerCCUSB[0]->Draw(); 
54 }
55
56
57
58
59