dependence on reference point removed
[u/mrichter/AliRoot.git] / T0 / AliT0Hist.cxx
1 #include "AliT0RawReader.h"
2 #include "AliT0RawData.h"
3 #include "/home/alla/AliRoot/verynew/RAW/AliRawReaderFile.h"
4
5
6 #include <Riostream.h>
7 #include "TMath.h"
8 #include "TH1F.h"
9 #include "TH2F.h"
10 #include "TArrayI.h"
11 #include "AliT0Hist.h"  
12 #include "AliRunLoader.h"
13 #include "AliLoader.h"
14 #include "/home/alla/AliRoot/verynew/RAW/AliRawReader.h"
15 #include "/home/alla/AliRoot/verynew/RAW/AliRawReaderFile.h"
16 #include "AliT0RawReader.h"
17 ClassImp(AliT0Hist)
18
19   AliT0Hist::AliT0Hist() : TObject()
20 {
21   fhADCR = new TH1F("hADCR","ADC right",100,1.,500);
22   fhADCL = new TH1F("hADCL","ADC right",100,1.,500);
23   fhTimeR = new TH1F("hTimeR","Time Right",100,400,1000);
24   fhTimeL = new TH1F("hTimeL","Time Left",100,10,500);
25   fhBestTimeR = new TH1F("hBestTimeR","Time Right",100,400,1000);
26   fhBestTimeL = new TH1F("hBestTimeL","Time Left",100,0,500);
27   fhADCDet = new TH1F("hADCDet","ADC vs Ndet",30,0.,30);
28   fhTimeDet = new TH1F("hTimeDet","Time vs Ndet",30,0,30);
29   fhTimeDiff = new TH1F("hTimeDiff"," Time diff",100,350,450);
30   fhMeanTime = new TH1F("hMeanTime"," Mean Time ",100,250,350);
31   fhT0detR = new TH1F("hT0detR"," T0 vs Ndet right ",15,0,15);
32   fhT0detL = new TH1F("hT0detL"," T0 vs Ndet left ",15,0,15);
33   fhTimevsADCL = new TH2F("hTimevsADCL","time vs ADC left",100,0,500,100,1,500);
34   fhTimevsADCR = new TH2F("hTimevsADCR","time vs ADC right",100,0,500,100,400,1000);
35 }
36
37
38   AliT0Hist::~AliT0Hist()
39 {
40   /*
41   delete fhADCR;
42   delete fhADCL;
43   delete fhTimeR;
44   delete fhTimeL;
45   delete fhBestTimeR;
46   delete fhBestTimeL;
47   delete fhADCDet;
48   delete fhTimeDet;
49   delete fhTimeDiff;
50   delete fhMeanTime;
51   delete fhT0detR;
52   delete fhT0detL;
53   delete fhTimevsADCL;
54   */
55 }
56
57 void AliT0Hist::FillHist(AliRunLoader* runLoader, 
58                             AliRawReader* rawReader) const 
59 {
60
61    TArrayI *fTime= new TArrayI(24);
62    TArrayI *fADC = new TArrayI(24);
63    AliT0RawReader myrawreader;
64    
65
66    
67   Int_t iEvent = 0;
68   while (rawReader->NextEvent()) {
69       runLoader->GetEvent(iEvent++);
70       
71       myrawreader.NextThing( rawReader);
72       myrawreader.GetTime(*fTime);
73       myrawreader.GetADC(*fADC);
74       
75       Int_t besttimeleft=99999;
76       Int_t besttimeright=99999;
77       Int_t ibestR=999; Int_t ibestL=999;
78       for (Int_t i=0; i<12; i++ )
79         {
80           Int_t timel=fTime->At(i);
81           if(timel<besttimeleft && timel!=0) { besttimeleft=timel; ibestL=i;}
82           fhTimeL->Fill(timel);
83           fhTimeDet->Fill(i,timel);
84           Int_t adcl=fADC->At(i);
85           fhADCL->Fill(adcl);
86           fhADCDet->Fill(i,adcl);
87           Int_t timer=fTime->At(i+12);
88           if(timer<besttimeright && timer!=0){ besttimeright=timer; ibestR=i;}
89           fhTimeDet->Fill(i+12,timer);
90           fhTimeR->Fill(timer);
91           Int_t adcr=fADC->At(i+12);
92           fhADCR->Fill(adcr);
93           fhADCDet->Fill(i+12,adcr);
94           fhTimevsADCL->Fill(adcl,timel);
95           fhTimevsADCR->Fill(adcr,timer);
96
97         }
98       
99       fhBestTimeR->Fill(besttimeright);
100       fhBestTimeL->Fill(besttimeleft);
101       Int_t timeDiff1=besttimeright-besttimeleft;
102       Float_t meanTime=(besttimeright+besttimeleft)/2.;
103       fhTimeDiff->Fill(timeDiff1);
104       fhMeanTime->Fill(meanTime);
105       //     Float_t  timeDiff2=((besttimeright-besttimeleft)-(350.-69.7))/2;
106       fhT0detR->Fill(ibestR); fhT0detL->Fill(ibestL);
107   }
108 }
109
110
111