]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSHits2SDigitsDefault.C
New macro's to create create digits or SDigits (PreDigits). Those marked
[u/mrichter/AliRoot.git] / ITS / AliITSHits2SDigitsDefault.C
1 Int_t AliITSHits2SDigitsDefault(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<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
27             << endl;
28         return 3;
29     }  // end if !ITS
30
31     if(!gAlice->TreeS()){ 
32         cout << "Having to create the SDigits Tree." << endl;
33         gAlice->MakeTree("S");
34     } // end if !gAlice->TreeS()
35     //make branch
36     ITS->MakeBranch("S");
37     ITS->SetTreeAddress();
38     cout << "Digitizing ITS..." << endl;
39
40     TStopwatch timer;
41     Long_t size0 = file->GetSize();
42     timer.Start();
43     ITS->Hits2SDigits();
44     timer.Stop(); timer.Print();
45
46     delete gAlice;   gAlice=0;
47     file->Close();
48     Long_t size1 = file->GetSize();
49     cout << "File size before = " << size0 << " file size after = " << size1;
50     cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
51     delete file;
52     return 0;
53 };
54