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