]>
Commit | Line | Data |
---|---|---|
e8189707 | 1 | #include "iostream.h" |
2 | ||
3 | void ITShuffman_f (Int_t evNumber1=0,Int_t evNumber2=0) | |
4 | { | |
5 | ///////////////////////////////////////////////////////////////////////// | |
6 | // This macro is a small example of a ROOT macro | |
7 | // illustrating how to read the output of GALICE | |
8 | // and do some analysis. | |
9 | // | |
10 | ///////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // Dynamically link some shared libs | |
13 | ||
14 | if (gClassTable->GetID("AliRun") < 0) { | |
15 | gROOT->LoadMacro("loadlibs.C"); | |
16 | loadlibs(); | |
17 | } | |
18 | ||
19 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
20 | ||
21 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("stream.root"); | |
22 | if (!file) file = new TFile("stream.root"); | |
23 | file->ls(); | |
24 | ||
25 | ||
26 | AliITSInStream *IStream; | |
27 | ||
28 | char *path=gDirectory->GetPath(); | |
29 | printf("path %s\n",path); | |
30 | ||
31 | ||
32 | Int_t nkeys=gDirectory->GetNkeys(); | |
33 | printf("nkeys %d\n",nkeys); | |
34 | char namecycle[40]; | |
35 | ||
36 | AliITSHTable *hufft=new AliITSHTable(256); | |
37 | for (int i=1;i<=nkeys;i++) { | |
38 | Int_t count=0; | |
39 | Int_t count1=0; | |
40 | Int_t count2=0; | |
41 | Int_t count3=0; | |
42 | sprintf(namecycle,"AliITSInStream;%d",i); | |
43 | printf("namecycle %s\n",namecycle); | |
44 | IStream=(AliITSInStream*)gDirectory->Get(namecycle); | |
45 | UChar_t *str=IStream->Stream(); | |
46 | Int_t len=IStream->StreamLength(); | |
47 | //printf("str len %p %d\n",str,len); | |
48 | for (int k=0;k<len;k++) { | |
49 | UChar_t elem=str[k]; | |
50 | // test | |
51 | if (elem==128) count++; | |
52 | if (elem==127) count1++; | |
53 | if (elem==129) count2++; | |
54 | if (elem==134) count3++; | |
55 | //if (elem != 128) printf("i,k,elem %d %d %d\n",i,k,elem); | |
56 | } | |
57 | //printf("count 128 127 129 134 %d %d %d %d \n",count,count1,count2,count3); | |
58 | hufft->GetFrequencies(len,str); | |
59 | } | |
60 | ||
61 | hufft->BuildHTable(); | |
62 | ||
63 | cout<<"END test for InStream "<<endl; | |
64 | ||
65 | file->Close(); | |
66 | } | |
67 | ||
68 | ||
69 |