]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCHits2Digits.C
Setting active sectors added.
[u/mrichter/AliRoot.git] / TPC / AliTPCHits2Digits.C
1 Int_t AliTPCHits2Digits(Int_t nevent=1)
2 {
3
4   // new version by J.Belikov
5
6   // Connect the Root Galice file containing Geometry, Kine and Hits
7
8   const char * inFile_old = "galice.root"; 
9   const char * inFile_new = "rfio:galice.root";
10   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old);
11   if (file) {file->Close(); delete file;}
12   file =  TFile::Open(inFile_new,"UPDATE");
13   if (!file->IsOpen()) {
14     cerr<<"Can't open "<<inFile_new<<" !\n";
15     return 1;
16   }
17
18   // Get AliRun object from file or create it if not on file
19   if (gAlice) delete gAlice;
20   gAlice = (AliRun*)file->Get("gAlice");
21   if (!gAlice) {
22     cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
23     return 2;
24   }
25
26
27
28   // gAlice->GetEvent(0);
29   AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");      
30   TStopwatch timer;
31   timer.Start();
32
33   // uncomment below lines to set sectors active
34   //Int_t sec[10]={0,1,2,3,4,5,6,7,8,9};
35   //TPC->SetActiveSectors(sec,10);
36
37   for(Int_t eventn =0;eventn<nevent;eventn++){
38     printf("Processing event %d \n",eventn);
39     gAlice->GetEvent(eventn);
40     TPC->SetActiveSectors(); // all sectors set active
41     TPC->Hits2Digits(eventn);
42   }
43
44   delete gAlice; gAlice=0;
45   file->Close(); delete file;
46   timer.Stop();
47   timer.Print();
48
49   return 0;
50 };
51