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