1 void readDigits(Int_t evNumber=1)
4 // Dynamically link some shared libs
5 if (gClassTable->GetID("AliRun") < 0) {
6 gROOT->LoadMacro("loadlibs.C");
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");
13 if (!file) file = new TFile("galice.root","UPDATE");
15 // Get AliRun object from file or create it if not on file
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");
21 char nameTD[8],nameTR[8];
23 TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,200);
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",
33 TH1F *hBestTimeleft = new TH1F("hBestTimeleft","First time left",
36 digits = new AliSTARTdigit();
37 timeRight = new TArrayI(12);
38 timeLeft = new TArrayI(12);
39 ADCRight = new TArrayI(12);
40 ADCLeft = new TArrayI(12);
42 // Event ------------------------- LOOP
43 for (Int_t j=0; j<evNumber; j++){
44 // gAlice->GetEvent(j);
45 sprintf(nameTD,"START_D_%d",j);
46 printf("%s\n",nameTD);
47 TObject *td = (TObject*)gDirectory->Get(nameTD);
51 printf("time %d\n",digits->GetTimeDiff());
53 if(digits->GetTimeDiff()!=999999){
54 Int_t timediff = digits->GetTimeDiff();
55 // Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
56 Int_t timePs=(512-timediff)*2.5.; // time in Ps channel_width =10ps
57 cout<<"timediff "<<timediff<<" timePs "<<timePs<<endl;
58 hTimediff->Fill(timediff);
59 hTimePs->Fill(timePs);
60 Int_t mean=digits->GetMeanTime();
61 cout<<" mean "<<mean<<endl;
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++)
75 Int_t t=timeRight.At(i);
76 Int_t ADC=ADCRight.At(i);
77 hTimeright->Fill(t*2.5);
80 for (Int_t i=0; i<12; i++)
82 Int_t ADC=ADCRight.At(i);
83 Int_t t=timeLeft.At(i);
84 hTimeleft->Fill(t*2.5);
90 Hfile = new TFile("Figdigits.root","RECREATE","Histograms for START digits");
91 printf("Writting histograms to root file \n");
93 //Create a canvas, set the view range, show histograms
94 gStyle->SetOptStat(111111);
95 // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600);
100 hTimePs->SetXTitle("arriving time, ps");
101 hTimePs->SetYTitle("number of events");
104 hBestTimeright->Write();
105 hBestTimeleft ->Write();