]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHits2DigitsDefault.C
Replace ITSHitsToDigits.C with it's replacement AliITSHits2DigitsDefault.C.
[u/mrichter/AliRoot.git] / ITS / AliITSHits2DigitsDefault.C
CommitLineData
d4b94d24 1Int_t AliITSHits2DigitsDefault(const char *inFile = "galice.root"){
2 // Connect the Root Galice file containing Geometry, Kine and Hits
3
4 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
5 if (file) {file->Close(); delete file;}
6 cout << "AliITSHits2Digits" << endl;
7 file = new TFile(inFile,"UPDATE");
8 if (!file->IsOpen()) {
9 cerr<<"Can't open "<<inFile<<" !" << endl;
10 return 1;
11 } // end if !file
12 file->ls();
13
14 // Get AliRun object from file or return if not on file
15 if (gAlice) delete gAlice;
16 gAlice = (AliRun*)file->Get("gAlice");
17 if (!gAlice) {
18 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
19 << endl;
20 return 2;
21 } // end if !gAlice
22
23 gAlice->GetEvent(0);
24 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
25 if (!ITS) {
26 cerr<<"ITSHits2Digits.C : AliITS object not found on file\n";
27 return 3;
28 } // end if !ITS
29
30 if(!gAlice->TreeD()){
31 cout << "Having to create the Digits Tree." << endl;
32 gAlice->MakeTree("D");
33 } // end if !gAlice->TreeD()
34 //make branch
35 ITS->MakeBranch("D");
36 ITS->SetTreeAddress();
37 cout << "Digitizing ITS..." << endl;
38
39 TStopwatch timer;
40 Long_t size0 = file->GetSize();
41 timer.Start();
42 ITS->Hits2Digits();
43 timer.Stop(); timer.Print();
44
45 delete gAlice; gAlice=0;
46 file->Close();
47 Long_t size1 = file->GetSize();
48 cout << "File size before = " << size0 << " file size after = " << size1;
49 cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
50 delete file;
51 return 0;
52};
53