]>
Commit | Line | Data |
---|---|---|
7a68e0ef | 1 | void readDigits() |
ef51244a | 2 | { |
3 | ||
4 | // Dynamically link some shared libs | |
051be46f | 5 | /* if (gClassTable->GetID("AliRun") < 0) { |
ef51244a | 6 | gROOT->LoadMacro("loadlibs.C"); |
7 | loadlibs(); | |
8 | } | |
051be46f | 9 | */ |
10 | Float_t c = 0.0299792; // cm/ps | |
11 | Float_t channelWidth = 25; | |
12 | Float_t timeDelay = 150; | |
13 | char filename[100]; | |
14 | sprintf(filename,"galice.root"); | |
15 | AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read"); | |
16 | if (rl == 0x0) | |
7a68e0ef | 17 | { |
18 | cerr<<"Can not open session for file galice.root\n"; | |
19 | return; | |
20 | } | |
051be46f | 21 | |
22 | rl->LoadgAlice(); | |
23 | gAlice = rl->GetAliRun(); | |
24 | ||
25 | AliSTART* START = (AliSTART *)gAlice->GetDetector("START"); | |
26 | ||
27 | rl->LoadHeader(); | |
28 | Int_t retval; | |
29 | AliLoader* lstart = rl->GetLoader("STARTLoader"); | |
7a68e0ef | 30 | |
31 | Int_t iNevents=rl->GetNumberOfEvents(); | |
32 | cout<<" nevents "<<iNevents<<endl; | |
33 | ||
ef51244a | 34 | |
051be46f | 35 | TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,5950,6050); |
e73d68f2 | 36 | TH1F *hBestTimeright = new TH1F("hBestTimeright","First time right", |
051be46f | 37 | 100,8450.,8650); |
e73d68f2 | 38 | TH1F *hBestTimeleft = new TH1F("hBestTimeleft","First time left", |
051be46f | 39 | 100,8450.,8650.); |
40 | TH1F *hRealVertex = new TH1F("hRealVertex","Real Vertex",100,-15,15); | |
41 | ||
42 | TH1F *hVertex = new TH1F("hVertex","Z position of vertex", 100,-15,15); | |
7a68e0ef | 43 | // digits = new AliSTARTdigit(); |
051be46f | 44 | AliSTARTdigit *fDigits ; // digits |
45 | fDigits = new AliSTARTdigit(); | |
ef51244a | 46 | |
47 | // Event ------------------------- LOOP | |
7a68e0ef | 48 | for (Int_t j=0; j<iNevents; j++){ |
7a68e0ef | 49 | rl->GetEvent(j); |
051be46f | 50 | |
51 | AliHeader *header = gAlice->GetHeader(); | |
52 | AliGenEventHeader* genHeader = header->GenEventHeader(); | |
53 | TArrayF *o = new TArrayF(3); | |
54 | genHeader->PrimaryVertex(*o); | |
55 | Float_t zRealVertex=o->At(2); | |
56 | hRealVertex->Fill( zRealVertex); | |
57 | ||
7a68e0ef | 58 | lstart->LoadDigits("READ"); |
051be46f | 59 | TTree *digitsTree = lstart->TreeD(); |
60 | TBranch *brDigits=digitsTree->GetBranch("START"); | |
61 | AliSTARTdigit *fDigits = new AliSTARTdigit(); | |
62 | if (brDigits) { | |
63 | brDigits->SetAddress(&fDigits); | |
64 | }else{ | |
65 | cerr<<"EXEC Branch START digits not found"<<endl; | |
66 | return; | |
ef51244a | 67 | } |
051be46f | 68 | brDigits->GetEntry(0); |
69 | Int_t besttimeright = fDigits->BestTimeRight(); | |
70 | Int_t besttimeleft = fDigits->BestTimeLeft(); | |
71 | Int_t timeDiff = fDigits->TimeDiff(); | |
72 | Int_t sumMult= fDigits->SumMult(); | |
73 | hTimediff->Fill(timeDiff); | |
74 | hBestTimeright->Fill(besttimeright); | |
75 | hBestTimeleft->Fill(besttimeleft ); | |
76 | Float_t vertex= (timeDiff* channelWidth - timeDelay*1000.)*c; | |
77 | cout<<j<<" "<<besttimeright<<" "<< besttimeleft<<" "<<timeDiff<<" "<<vertex<<endl; | |
78 | hVertex->Fill(vertex); | |
ef51244a | 79 | } |
e73d68f2 | 80 | Hfile = new TFile("Figdigits.root","RECREATE","Histograms for START digits"); |
81 | printf("Writting histograms to root file \n"); | |
82 | Hfile->cd(); | |
83 | //Create a canvas, set the view range, show histograms | |
84 | gStyle->SetOptStat(111111); | |
7115262b | 85 | // TCanvas *c1 = new TCanvas("c1","Alice START Time ",400,10,600,600); |
051be46f | 86 | hTimediff->Write(); |
e73d68f2 | 87 | hBestTimeright->Write(); |
88 | hBestTimeleft ->Write(); | |
051be46f | 89 | hVertex->Write(); |
90 | hRealVertex->Write(); | |
ef51244a | 91 | |
92 | ||
93 | } // end of macro | |
94 | ||
95 | ||
96 | ||
97 |