All volume names start with "S".
[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");
7115262b 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);
24 TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,2000,3000);
ef51244a 25
26 digits = new AliSTARTdigit();
ef51244a 27
28
29 // Event ------------------------- LOOP
30 for (j=0; j<evNumber; j++){
7115262b 31 gAlice->GetEvent(j);
32 sprintf(nameTD,"START_D_%d",j);
ef51244a 33 printf("%s\n",nameTD);
7115262b 34 TObject *td = (TObject*)gDirectory->Get(nameTD);
35 digits->Read(nameTD);
36 digits->Dump();
37 printf("time %d\n",digits->GetTime());
ef51244a 38
39 if(digits->GetTime()!=999999){
7115262b 40 Int_t timediff = digits->GetMeanTime();
41 // Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps
42 Double_t timePs=(timediff)*10.; // time in Ps channel_width =10ps
43 cout<<"timediff "<<timediff<<" timePs "<<timePs<<endl;
ef51244a 44 hTimediff->Fill(timediff);
45 hTimePs->Fill(timePs);
46 }
47 }
7115262b 48
49 Hfile = new TFile("figs.root","UPDATE","Histograms for STASRT digits");
50 printf("Writting histograms to root file \n");
51 Hfile->cd();
ef51244a 52//Create a canvas, set the view range, show histograms
7115262b 53 gStyle->SetOptStat(111111);
54 // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600);
ef51244a 55 hTimePs->SetXTitle("arriving time, ps");
56 hTimePs->SetYTitle("number of events");
57 hTimePs->Write();
7115262b 58 Hfile->Close();
ef51244a 59
60
61} // end of macro
62
63
64
65