Names changed in order to avoid clash with FLUKA.
[u/mrichter/AliRoot.git] / TPC / AliTPCHits2Digits.C
CommitLineData
afc42102 1Int_t AliTPCHits2Digits(Int_t nevent=1)
8c555625 2{
50d005ae 3
73042f01 4 // new version by J.Belikov
50d005ae 5
6 // Connect the Root Galice file containing Geometry, Kine and Hits
88cb7938 7 if (gAlice)
8 {
9 delete gAlice->GetRunLoader();
10 delete gAlice;//if everything was OK here it is already NULL
11 gAlice = 0x0;
12 }
73042f01 13
88cb7938 14 AliRunLoader *rl = AliRunLoader::Open("galice.root","Event","update");
15 if (!rl)
16 {
17 cerr<<"Can't load RunLoader from "<<inFile_new<<" !\n";
73042f01 18 return 1;
88cb7938 19 }
50d005ae 20
73042f01 21 // Get AliRun object from file or create it if not on file
88cb7938 22
23 rl->LoadgAlice();
24
25 gAlice = rl->GetAliRun();
73042f01 26 if (!gAlice) {
27 cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
28 return 2;
29 }
50d005ae 30
73042f01 31
73042f01 32
afc42102 33 // gAlice->GetEvent(0);
34 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
88cb7938 35 AliLoader * tpcl = rl->GetLoader("TPCLoader");
36 if ((TPC == 0x0) || (tpcl == 0x0))
37 {
38 cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n";
39// delete rl;
40 return 3;
41 }
42 tpcl->LoadHits("READ");
43 tpcl->LoadDigits("recreate");
44
afc42102 45 TStopwatch timer;
46 timer.Start();
50d005ae 47
dbab3f1e 48 // uncomment below lines to set sectors active
7a09f434 49 // Int_t sec[10]={0,1,2,3,4,5,6,7,8,9};
50 // TPC->SetActiveSectors(sec,10);
dbab3f1e 51
afc42102 52 for(Int_t eventn =0;eventn<nevent;eventn++){
dbab3f1e 53 printf("Processing event %d \n",eventn);
88cb7938 54 rl->GetEvent(eventn);
dbab3f1e 55 TPC->SetActiveSectors(); // all sectors set active
88cb7938 56 for (Int_t i=0;i<72;i++) if (TPC->IsSectorActive(i)) printf("%d\t",i);
afc42102 57 TPC->Hits2Digits(eventn);
58 }
73042f01 59
88cb7938 60 delete rl;
61
afc42102 62 timer.Stop();
63 timer.Print();
64
73042f01 65 return 0;
8c555625 66};
67