]>
Commit | Line | Data |
---|---|---|
e8189707 | 1 | #include "iostream.h" |
2 | ||
3 | void ITSstream (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 | // Get AliRun object from file or create it if not on file | |
26 | ||
27 | /* | |
28 | if (!gAlice) { | |
29 | gAlice = (AliRun*)file->Get("gAlice"); | |
30 | if (gAlice) printf("AliRun object found on file\n"); | |
31 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
32 | } | |
33 | */ | |
34 | ||
35 | AliITSInStream *IStream; | |
36 | ||
37 | char *path=gDirectory->GetPath(); | |
38 | printf("path %s\n",path); | |
39 | ||
40 | ||
41 | Int_t nkeys=gDirectory->GetNkeys(); | |
42 | printf("nkeys %d\n",nkeys); | |
43 | char namecycle[40]; | |
44 | ||
45 | for (int i=1;i<=nkeys;i++) { | |
46 | //sprintf(namecycle,"%s%d",GetName(),i); | |
47 | sprintf(namecycle,"AliITSInStream;%d",i); | |
48 | printf("namecycle %s\n",namecycle); | |
49 | IStream=(AliITSInStream*)gDirectory->Get(namecycle); | |
50 | //Char_t *str=IStream->Stream(); | |
51 | UChar_t *str=IStream->Stream(); | |
52 | Int_t len=IStream->StreamLength(); | |
53 | printf("str len %p %d\n",str,len); | |
54 | for (int k=0;k<len;k++) { | |
55 | //Char_t elem=str[k]; | |
56 | UChar_t elem=str[k]; | |
57 | printf("i,k,elem %d %d %d\n",i,k,elem); | |
58 | //if (elem > 0) printf("i,k,elem %d %d %d\n",i,k,elem); | |
59 | } | |
60 | } | |
61 | ||
62 | cout<<"END test for InStream "<<endl; | |
63 | ||
64 | file->Close(); | |
65 | } | |
66 | ||
67 | ||
68 |