]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ACORDE/AcoReco.C
Macro that generates Res-MisAlignment in ACORDE Geometry
[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
48 //       printf("No Event %d",i);       
49        if (!rawReader->NextEvent()) break;
50         rawStream->Reset();
51       // printf("No Event %d",i);
52         
53         if (!rawStream->Next()) continue;
54         dy[0]=rawStream->GetWord(0);
55         dy[1]=rawStream->GetWord(1);
56         dy[2]=rawStream->GetWord(2);
57         dy[3]=rawStream->GetWord(3);
58         tmpDy=dy[0];
59         for(Int_t r=0;r<30;++r)
60         {
61                 kroSingle[r] = tmpDy & 1;
62                 tmpDy>>=1;
63         }
64         tmpDy=dy[1];
65         for(Int_t r=30;r<60;++r)
66         {
67                 kroSingle[r] = tmpDy & 1;
68                 tmpDy>>=1;
69         }
70         tmpDy=dy[2];
71         for(Int_t r=0;r<30;++r)
72         {
73                 kroMulti[r] = tmpDy & 1;
74                 tmpDy>>=1;
75         }
76         tmpDy=dy[3];
77         for(Int_t r=30;r<60;++r)
78         {
79                 kroMulti[r] = tmpDy & 1;
80                 tmpDy>>=1;
81         }
82         contSingle=0;   
83         for(Int_t r=0;r<60;++r) 
84         {
85                 if(kroSingle[r]==1) 
86                 {
87                         dyma[r]=dyma[r]+1;
88                         h1->Fill(r+1);
89                         contSingle=contSingle+1;
90                 }
91                 
92         }h2->Fill(contSingle);
93 }
94
95 TCanvas *acorde = new TCanvas("ACORDE","ACORDE-Hist-Real Data",1);
96 acorde->Divide(2,1);
97 acorde->cd(1);
98 h1->GetXaxis()->SetTitle("No. of Channel");
99 h1->GetYaxis()->SetTitle("No. of Hits");
100 h1->SetFillColor(kRed);
101 h1->Draw();
102 acorde->cd(2);
103 gPad->SetLogy();
104 h2->GetXaxis()->SetTitle("No. of Modules");
105 h2->GetYaxis()->SetTitle("Multiplicity");
106 h2->SetFillColor(kBlue);
107 h2->Draw();
108
109 delete rawReader;
110 delete rawStream;
111 timer.Stop();
112 timer.Print();
113 }