]>
Commit | Line | Data |
---|---|---|
7a68e0ef | 1 | void readDigits() |
ef51244a | 2 | { |
3 | ||
4 | // Dynamically link some shared libs | |
5 | if (gClassTable->GetID("AliRun") < 0) { | |
6 | gROOT->LoadMacro("loadlibs.C"); | |
7 | loadlibs(); | |
8 | } | |
7a68e0ef | 9 | char filename[100]; |
10 | sprintf(filename,"galice.root"); | |
f5a857b2 | 11 | AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read"); |
7a68e0ef | 12 | if (rl == 0x0) |
13 | { | |
14 | cerr<<"Can not open session for file galice.root\n"; | |
15 | return; | |
16 | } | |
17 | ||
18 | rl->LoadgAlice(); | |
19 | gAlice = rl->GetAliRun(); | |
ef51244a | 20 | |
7a68e0ef | 21 | AliSTART* START = (AliSTART *)gAlice->GetDetector("START"); |
ef51244a | 22 | |
7a68e0ef | 23 | rl->LoadHeader(); |
24 | rl->LoadKinematics("READ"); | |
25 | Int_t retval; | |
26 | AliLoader* lstart = rl->GetLoader("STARTLoader"); | |
27 | ||
28 | Int_t iNevents=rl->GetNumberOfEvents(); | |
29 | cout<<" nevents "<<iNevents<<endl; | |
30 | ||
31 | char nameTD[8],nameTR[8]; | |
ef51244a | 32 | |
7115262b | 33 | TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,0,200); |
e73d68f2 | 34 | TH1F *hTimePs = new TH1F("hTimePs","Time in Ps",100,-200,200); |
35 | TH1F *hMeanTime = new TH1F("hMeanTime","Time in Ps",100,2000,2500); | |
36 | TH1F *hallADC = new TH1F("hallright","ADC summary right",100,0,200); | |
37 | TH1F *hADCright = new TH1F("hADCright","ADC right",100,0,200); | |
38 | TH1F *hADCleft = new TH1F("hADCleft","ADC left",100,0,200); | |
39 | TH1F *hTimeright = new TH1F("hTimeright","Time right",100,2000.,3200.); | |
40 | TH1F *hTimeleft = new TH1F("hTimeleft","Time left",100,2000.,3200.); | |
41 | TH1F *hBestTimeright = new TH1F("hBestTimeright","First time right", | |
42 | 100,2000.,3200); | |
43 | TH1F *hBestTimeleft = new TH1F("hBestTimeleft","First time left", | |
44 | 100,11000.,13000.); | |
45 | ||
7a68e0ef | 46 | // digits = new AliSTARTdigit(); |
47 | AliSTARTdigit *digits ; // digits | |
ef51244a | 48 | digits = new AliSTARTdigit(); |
7a68e0ef | 49 | |
e73d68f2 | 50 | timeRight = new TArrayI(12); |
51 | timeLeft = new TArrayI(12); | |
52 | ADCRight = new TArrayI(12); | |
53 | ADCLeft = new TArrayI(12); | |
ef51244a | 54 | |
55 | // Event ------------------------- LOOP | |
7a68e0ef | 56 | for (Int_t j=0; j<iNevents; j++){ |
e73d68f2 | 57 | // gAlice->GetEvent(j); |
7a68e0ef | 58 | rl->GetEvent(j); |
59 | // lstart->Dump(); | |
60 | lstart->LoadHits("READ"); | |
61 | lstart->LoadDigits("READ"); | |
7115262b | 62 | sprintf(nameTD,"START_D_%d",j); |
ef51244a | 63 | printf("%s\n",nameTD); |
7a68e0ef | 64 | TObject *td = (TObject*)gDirectory->Get(nameTD); |
65 | // td->Dump(); | |
66 | // cout<<" td "<<td<<endl; | |
67 | td->Read(nameTD); | |
68 | digits->Read(nameTD); | |
69 | // digits->Read(nameTD); | |
e73d68f2 | 70 | // digits->Print(); |
7a68e0ef | 71 | printf("time %d\n",digits->GetTimeDiff()); |
72 | ||
e73d68f2 | 73 | if(digits->GetTimeDiff()!=999999){ |
74 | Int_t timediff = digits->GetTimeDiff(); | |
7115262b | 75 | // Double_t timePs=(timediff-128)*10.; // time in Ps channel_width =10ps |
e73d68f2 | 76 | Int_t timePs=(512-timediff)*2.5.; // time in Ps channel_width =10ps |
7115262b | 77 | cout<<"timediff "<<timediff<<" timePs "<<timePs<<endl; |
ef51244a | 78 | hTimediff->Fill(timediff); |
79 | hTimePs->Fill(timePs); | |
e73d68f2 | 80 | Int_t mean=digits->GetMeanTime(); |
81 | cout<<" mean "<<mean<<endl; | |
82 | mean=mean*2.5; | |
83 | hMeanTime->Fill(mean); | |
84 | Int_t br=digits->GetBestTimeRight(); | |
85 | Int_t bl=digits->GetBestTimeLeft(); | |
86 | cout<<"BestTimeRight "<<br*2.5<<" BestTimeLeft "<<bl*2.5<<endl; | |
87 | hBestTimeright->Fill(br*2.5); | |
88 | hBestTimeleft ->Fill(bl*2.5); | |
89 | digits->GetTimeRight(*timeRight ); | |
90 | digits->GetTimeLeft(*timeLeft ); | |
91 | digits->GetADCRight(*ADCRight ); | |
92 | digits->GetADCLeft(*ADCLeft ); | |
93 | for (Int_t i=0; i<12; i++) | |
94 | { | |
95 | Int_t t=timeRight.At(i); | |
96 | Int_t ADC=ADCRight.At(i); | |
97 | hTimeright->Fill(t*2.5); | |
98 | hADCright->Fill(ADC); | |
99 | } | |
100 | for (Int_t i=0; i<12; i++) | |
101 | { | |
102 | Int_t ADC=ADCRight.At(i); | |
103 | Int_t t=timeLeft.At(i); | |
104 | hTimeleft->Fill(t*2.5); | |
105 | hADCleft->Fill(ADC); | |
106 | } | |
ef51244a | 107 | } |
108 | } | |
7115262b | 109 | |
e73d68f2 | 110 | Hfile = new TFile("Figdigits.root","RECREATE","Histograms for START digits"); |
111 | printf("Writting histograms to root file \n"); | |
112 | Hfile->cd(); | |
113 | //Create a canvas, set the view range, show histograms | |
114 | gStyle->SetOptStat(111111); | |
7115262b | 115 | // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600); |
e73d68f2 | 116 | hADCright->Write(); |
117 | hADCleft->Write(); | |
118 | hTimeright->Write(); | |
119 | hTimeleft->Write(); | |
ef51244a | 120 | hTimePs->SetXTitle("arriving time, ps"); |
121 | hTimePs->SetYTitle("number of events"); | |
122 | hTimePs->Write(); | |
e73d68f2 | 123 | hMeanTime->Write(); |
124 | hBestTimeright->Write(); | |
125 | hBestTimeleft ->Write(); | |
7115262b | 126 | Hfile->Close(); |
ef51244a | 127 | |
128 | ||
129 | } // end of macro | |
130 | ||
131 | ||
132 | ||
133 |