]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/AcoReco.C
Version number incremented
[u/mrichter/AliRoot.git] / ACORDE / AcoReco.C
1 //_____________________________________________________//
2 //                                                     //
3 //     This macro reads ACORDE Raw-Rootfied files      //
4 //     and draws Histograms of Acorde's Bitpattern     //    
5 //                                                     //
6 //     Author:                                         //
7 //                                                     //
8 //   Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> //
9 //                                                     //
10 //     Also comments to:                               //
11 //                                                     //
12 //   Mario Sitta <sitta@to.infn.it>                    //
13 //   Arturo Fernandez <afernan@mail.cern.ch>           //
14 //   Luciano Diaz <luciano.diaz@nucleares.unam.mx>     //
15 //   Eleazar Cuautle <ecuautle@nucleares.unam.mx>      //
16 //____________________________________________________ //
17
18
19 #include <TClonesArray.h>
20 #include <stdio.h>
21
22 //void AcoReco(char* fileName="08000020614001.20.root")
23 void AcoReco(char* fileName)
24 {
25   TStopwatch timer;
26   timer.Start();
27   AliRawReader* rawReader = new AliRawReaderRoot(fileName); 
28   AliRawReader* rCount = new AliRawReaderRoot(fileName);
29   AliACORDERawStream* rawStream  = new AliACORDERawStream(rawReader);    
30   TH1D *h1 = new TH1D("h1","ACORDE - Single Muon Hits",60,1,60);
31   TH1D *h2 = new TH1D("h2","ACORDE - Hit Multiplicity",60,1,60);
32   size_t contSingle=0;
33   size_t contMulti=0;
34   UInt_t dy[4];
35   bool kroSingle[60],kroMulti[60];
36   UInt_t tmpDy;
37   Int_t dyma[60],DyM,nEvents=0;
38   for(Int_t m=0;m<60;m++) {kroSingle[m]=0;kroMulti[m]=0;dyma[m]=0;}
39   
40  
41   Int_t nEvents = rawStream->GetNEvents(fileName);
42   
43   printf("Numero de eventos: %d \n",nEvents);
44
45 for (Int_t i=1; i<=nEvents; i++) 
46 {
47         if (!rawReader->NextEvent()) break;
48         rawStream->Reset();
49         if (!rawStream->Next()) break;
50         dy[0]=rawStream->GetWord(0);
51         dy[1]=rawStream->GetWord(1);
52         dy[2]=rawStream->GetWord(2);
53         dy[3]=rawStream->GetWord(3);
54         tmpDy=dy[0];
55         for(Int_t r=0;r<30;++r)
56         {
57                 kroSingle[r] = tmpDy & 1;
58                 tmpDy>>=1;
59         }
60         tmpDy=dy[1];
61         for(Int_t r=30;r<60;++r)
62         {
63                 kroSingle[r] = tmpDy & 1;
64                 tmpDy>>=1;
65         }
66         tmpDy=dy[2];
67         for(Int_t r=0;r<30;++r)
68         {
69                 kroMulti[r] = tmpDy & 1;
70                 tmpDy>>=1;
71         }
72         tmpDy=dy[3];
73         for(Int_t r=30;r<60;++r)
74         {
75                 kroMulti[r] = tmpDy & 1;
76                 tmpDy>>=1;
77         }
78         contSingle=0;   
79         for(Int_t r=0;r<60;++r) 
80         {
81                 if(kroSingle[r]==1) 
82                 {
83                         dyma[r]=dyma[r]+1;
84                         h1->Fill(r+1);
85                         contSingle=contSingle+1;
86                 }
87                 
88         }h2->Fill(contSingle);
89 }
90
91 TCanvas *acorde = new TCanvas("ACORDE","ACORDE-Hist-Real Data",1);
92 acorde->Divide(2,1);
93 acorde->cd(1);
94 h1->GetXaxis()->SetTitle("No. of Channel");
95 h1->GetYaxis()->SetTitle("No. of Hits");
96 h1->SetFillColor(kRed);
97 h1->Draw();
98 acorde->cd(2);
99 gPad->SetLogy();
100 h2->GetXaxis()->SetTitle("No. of Modules");
101 h2->GetYaxis()->SetTitle("Multiplicity");
102 h2->SetFillColor(kBlue);
103 h2->Draw();
104
105 delete rawReader;
106 delete rawStream;
107 timer.Stop();
108 timer.Print();
109 }