]>
Commit | Line | Data |
---|---|---|
1 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
2 | #include <Riostream.h> | |
3 | ||
4 | #include "AliRun.h" | |
5 | #include "AliRunLoader.h" | |
6 | #include "AliLoader.h" | |
7 | #include "AliTPC.h" | |
8 | ||
9 | #include "TStopwatch.h" | |
10 | #endif | |
11 | ||
12 | extern AliRun *gAlice; | |
13 | ||
14 | Int_t AliTPCHits2Digits(Int_t nev=5) { | |
15 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
16 | if (gAlice) { | |
17 | delete gAlice->GetRunLoader(); | |
18 | delete gAlice;//if everything was OK here it is already NULL | |
19 | gAlice = 0x0; | |
20 | } | |
21 | ||
22 | AliRunLoader *rl = AliRunLoader::Open("galice.root","Event","update"); | |
23 | if (!rl) { | |
24 | cerr<<"Can't load RunLoader from "<<endl; | |
25 | return 1; | |
26 | } | |
27 | ||
28 | // Get AliRun object from file or create it if not on file | |
29 | ||
30 | rl->LoadgAlice(); | |
31 | ||
32 | gAlice = rl->GetAliRun(); | |
33 | if (!gAlice) { | |
34 | cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n"; | |
35 | return 2; | |
36 | } | |
37 | ||
38 | AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); | |
39 | AliLoader * tpcl = rl->GetLoader("TPCLoader"); | |
40 | if ((TPC == 0x0) || (tpcl == 0x0)) { | |
41 | cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n"; | |
42 | delete rl; | |
43 | return 3; | |
44 | } | |
45 | tpcl->LoadHits("READ"); | |
46 | tpcl->LoadDigits("recreate"); | |
47 | ||
48 | TStopwatch timer; | |
49 | timer.Start(); | |
50 | ||
51 | // uncomment below lines to set sectors active | |
52 | // Int_t sec[10]={0,1,2,3,4,5,6,7,8,9}; | |
53 | // TPC->SetActiveSectors(sec,10); | |
54 | ||
55 | for (Int_t i=0; i<nev; i++){ | |
56 | printf("Processing event %d \n",i); | |
57 | rl->GetEvent(i); | |
58 | TPC->SetActiveSectors(); // all sectors set active | |
59 | TPC->Hits2Digits(i); | |
60 | } | |
61 | ||
62 | delete rl; | |
63 | ||
64 | timer.Stop(); | |
65 | timer.Print(); | |
66 | ||
67 | return 0; | |
68 | } | |
69 |