Processing of many events possible now
[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
73042f01 7
106ea0fc 8 const char * inFile_old = "galice.root";
9 const char * inFile_new = "rfio:galice.root";
10 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile_old);
73042f01 11 if (file) {file->Close(); delete file;}
03b6834e 12 file = TFile::Open(inFile_new,"UPDATE");
73042f01 13 if (!file->IsOpen()) {
106ea0fc 14 cerr<<"Can't open "<<inFile_new<<" !\n";
73042f01 15 return 1;
16 }
50d005ae 17
73042f01 18 // Get AliRun object from file or create it if not on file
19 if (gAlice) delete gAlice;
50d005ae 20 gAlice = (AliRun*)file->Get("gAlice");
73042f01 21 if (!gAlice) {
22 cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
23 return 2;
24 }
50d005ae 25
73042f01 26
73042f01 27
afc42102 28 // gAlice->GetEvent(0);
29 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
50d005ae 30
afc42102 31 TStopwatch timer;
32 timer.Start();
50d005ae 33
afc42102 34 for(Int_t eventn =0;eventn<nevent;eventn++){
35 printf("Processing event %d",eventn);
36 gAlice->GetEvent(eventn);
73042f01 37
afc42102 38 TPC->Hits2Digits(eventn);
39 }
73042f01 40
41 delete gAlice; gAlice=0;
42 file->Close(); delete file;
afc42102 43 timer.Stop();
44 timer.Print();
45
73042f01 46 return 0;
8c555625 47};
48