]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __CINT__ | |
2 | #include "alles.h" | |
3 | #include "AliTPCtracker.h" | |
4 | #endif | |
5 | Int_t AliTPCSDigits2Digits(Int_t nevent=1) | |
6 | { | |
7 | ||
8 | // new version by J.Belikov | |
9 | ||
10 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
11 | ||
12 | const char * inFile_old = "galice.root"; | |
13 | const char * inFile_new = "galice.root"; | |
14 | ||
15 | if (gAlice) | |
16 | { | |
17 | delete gAlice->GetRunLoader(); | |
18 | delete gAlice;//if everything was OK here it is already NULL | |
19 | gAlice = 0x0; | |
20 | } | |
21 | ||
22 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old); | |
23 | if (file) {file->Close(); delete file;} | |
24 | ||
25 | AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","update"); | |
26 | ||
27 | if (!rl) { | |
28 | cerr<<"Can't open "<<inFile_new<<" !\n"; | |
29 | return 1; | |
30 | } | |
31 | ||
32 | // Get AliRun object from file or create it if not on file | |
33 | // if (gAlice) delete gAlice; | |
34 | ||
35 | rl->LoadgAlice(); | |
36 | ||
37 | gAlice = rl->GetAliRun(); | |
38 | if (!gAlice) { | |
39 | cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n"; | |
40 | delete rl; | |
41 | return 2; | |
42 | } | |
43 | ||
44 | // gAlice->GetEvent(0); | |
45 | AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); | |
46 | ||
47 | AliLoader * tpcl = rl->GetLoader("TPCLoader"); | |
48 | ||
49 | if ((TPC == 0x0) || (tpcl == 0x0)) | |
50 | { | |
51 | cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n"; | |
52 | // delete rl; | |
53 | return 3; | |
54 | } | |
55 | ||
56 | tpcl->LoadSDigits("READ"); | |
57 | tpcl->LoadDigits("RECREATE"); | |
58 | rl->CdGAFile(); | |
59 | AliTPCParamSR *dig=(AliTPCParamSR *)gDirectory->Get("75x40_100x60"); | |
60 | if(dig){ | |
61 | cerr<<"2 pad-length geom hits with 3 pad-lengths geom digits\n"; | |
62 | delete dig; | |
63 | dig = new AliTPCParamSR(); | |
64 | } | |
65 | else | |
66 | { | |
67 | dig=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60"); | |
68 | } | |
69 | if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;} | |
70 | TPC->SetParam(dig); | |
71 | ||
72 | ||
73 | TStopwatch timer; | |
74 | timer.Start(); | |
75 | ||
76 | for(Int_t eventn =0;eventn<nevent;eventn++){ | |
77 | printf("Processing event %d\n",eventn); | |
78 | cout<<"rl->GetEvent(eventn);\n"; | |
79 | rl->GetEvent(eventn); | |
80 | cout<<"TPC->SDigits2Digits2(eventn);\n"; | |
81 | TPC->SDigits2Digits2(eventn); | |
82 | } | |
83 | ||
84 | timer.Stop(); | |
85 | timer.Print(); | |
86 | ||
87 | delete rl; | |
88 | return 0; | |
89 | }; | |
90 | ||
91 | ||
92 | ||
93 | ||
94 | ||
95 | ||
96 | ||
97 | ||
98 | ||
99 | ||
100 | ||
101 |