]> git.uio.no Git - u/mrichter/AliRoot.git/blame - START/readDigits.C
remove warning for (INCLUDEFILES)
[u/mrichter/AliRoot.git] / START / readDigits.C
CommitLineData
ef51244a 1void readDigits(Int_t evNumber=1)
2{
3
4 // Dynamically link some shared libs
5 if (gClassTable->GetID("AliRun") < 0) {
6 gROOT->LoadMacro("loadlibs.C");
7 loadlibs();
8 }
9
10 // Connect the Root Galice file containing Geometry, Kine and Hits
11 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
12 //TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
88cb7938 13 if (!file) file = new TFile("production.root","UPDATE");
ef51244a 14
15 // Get AliRun object from file or create it if not on file
16 if (!gAlice) {
17 gAlice = (AliRun*)file->Get("gAlice");
18 if (gAlice) printf("AliRun object found on file\n");
19 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
20 }
21 char nameTD[8],nameTR[8];
22
7115262b 23 TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,200);
e73d68f2 24 TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,-200,200);
25 TH1F *hMeanTime = new TH1F("hMeanTime","Time in Ps",100,2000,2500);
26 TH1F *hallADC = new TH1F("hallright","ADC summary right",100,0,200);
27 TH1F *hADCright = new TH1F("hADCright","ADC right",100,0,200);
28 TH1F *hADCleft = new TH1F("hADCleft","ADC left",100,0,200);
29 TH1F *hTimeright = new TH1F("hTimeright","Time right",100,2000.,3200.);
30 TH1F *hTimeleft = new TH1F("hTimeleft","Time left",100,2000.,3200.);
31 TH1F *hBestTimeright = new TH1F("hBestTimeright","First time right",
32 100,2000.,3200);
33 TH1F *hBestTimeleft = new TH1F("hBestTimeleft","First time left",
34 100,11000.,13000.);
35
ef51244a 36 digits = new AliSTARTdigit();
e73d68f2 37 timeRight = new TArrayI(12);
38 timeLeft = new TArrayI(12);
39 ADCRight = new TArrayI(12);
40 ADCLeft = new TArrayI(12);
ef51244a 41
42 // Event ------------------------- LOOP
e73d68f2 43 for (Int_t j=0; j<evNumber; j++){
44 // gAlice->GetEvent(j);
7115262b 45 sprintf(nameTD,"START_D_%d",j);
ef51244a 46 printf("%s\n",nameTD);
e73d68f2 47 TObject *td = (TObject*)gDirectory->Get(nameTD);
48 digits->Read(nameTD);
49 // digits->Dump();
50 // digits->Print();
51 printf("time %d\n",digits->GetTimeDiff());
ef51244a 52
e73d68f2 53 if(digits->GetTimeDiff()!=999999){
54 Int_t timediff = digits->GetTimeDiff();
7115262b 55 // Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
e73d68f2 56 Int_t timePs=(512-timediff)*2.5.; // time in Ps channel_width =10ps
7115262b 57 cout<<"timediff "<<timediff<<" timePs "<<timePs<<endl;
ef51244a 58 hTimediff->Fill(timediff);
59 hTimePs->Fill(timePs);
e73d68f2 60 Int_t mean=digits->GetMeanTime();
61 cout<<" mean "<<mean<<endl;
62 mean=mean*2.5;
63 hMeanTime->Fill(mean);
64 Int_t br=digits->GetBestTimeRight();
65 Int_t bl=digits->GetBestTimeLeft();
66 cout<<"BestTimeRight "<<br*2.5<<" BestTimeLeft "<<bl*2.5<<endl;
67 hBestTimeright->Fill(br*2.5);
68 hBestTimeleft ->Fill(bl*2.5);
69 digits->GetTimeRight(*timeRight );
70 digits->GetTimeLeft(*timeLeft );
71 digits->GetADCRight(*ADCRight );
72 digits->GetADCLeft(*ADCLeft );
73 for (Int_t i=0; i<12; i++)
74 {
75 Int_t t=timeRight.At(i);
76 Int_t ADC=ADCRight.At(i);
77 hTimeright->Fill(t*2.5);
78 hADCright->Fill(ADC);
79 }
80 for (Int_t i=0; i<12; i++)
81 {
82 Int_t ADC=ADCRight.At(i);
83 Int_t t=timeLeft.At(i);
84 hTimeleft->Fill(t*2.5);
85 hADCleft->Fill(ADC);
86 }
ef51244a 87 }
88 }
7115262b 89
e73d68f2 90 Hfile = new TFile("Figdigits.root","RECREATE","Histograms for START digits");
91 printf("Writting histograms to root file \n");
92 Hfile->cd();
93 //Create a canvas, set the view range, show histograms
94 gStyle->SetOptStat(111111);
7115262b 95 // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600);
e73d68f2 96 hADCright->Write();
97 hADCleft->Write();
98 hTimeright->Write();
99 hTimeleft->Write();
ef51244a 100 hTimePs->SetXTitle("arriving time, ps");
101 hTimePs->SetYTitle("number of events");
102 hTimePs->Write();
e73d68f2 103 hMeanTime->Write();
104 hBestTimeright->Write();
105 hBestTimeleft ->Write();
7115262b 106 Hfile->Close();
ef51244a 107
108
109} // end of macro
110
111
112
113