]>
Commit | Line | Data |
---|---|---|
d4b94d24 | 1 | Int_t AliITSHits2DigitsDefault(const char *inFile = "galice.root"){ |
bcb08e43 | 2 | //////////////////////////////////////////////////////////////////// |
3 | // This macro will take hits from a galice.root file and | |
4 | // produce digits for the ITS using the standard detector | |
5 | // simulations. It will measure the time required to do so and the | |
6 | // increase in the galice.root file. There is only one input, that | |
7 | // of the name of the root file containing the hits and to which the | |
8 | // digits will be written to. This macro will process all of the | |
9 | // events on the root file. | |
10 | //////////////////////////////////////////////////////////////////// | |
2603d98a | 11 | |
12 | // Dynamically link some shared libs | |
13 | if (gClassTable->GetID("AliRun") < 0) { | |
14 | gROOT->LoadMacro("loadlibs.C"); | |
15 | loadlibs(); | |
16 | } // end if | |
17 | ||
d4b94d24 | 18 | // Connect the Root Galice file containing Geometry, Kine and Hits |
19 | ||
20 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile); | |
21 | if (file) {file->Close(); delete file;} | |
2603d98a | 22 | cout << "AliITSHits2DigitsDefault" << endl; |
d4b94d24 | 23 | file = new TFile(inFile,"UPDATE"); |
24 | if (!file->IsOpen()) { | |
25 | cerr<<"Can't open "<<inFile<<" !" << endl; | |
26 | return 1; | |
27 | } // end if !file | |
28 | file->ls(); | |
29 | ||
30 | // Get AliRun object from file or return if not on file | |
31 | if (gAlice) delete gAlice; | |
32 | gAlice = (AliRun*)file->Get("gAlice"); | |
33 | if (!gAlice) { | |
34 | cerr << "AliITSITSHits2Digits.C : AliRun object not found on file" | |
35 | << endl; | |
36 | return 2; | |
37 | } // end if !gAlice | |
38 | ||
d4b94d24 | 39 | AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); |
40 | if (!ITS) { | |
2603d98a | 41 | cerr<<"ITSHits2Digits.C : AliITS object not found on file" << endl; |
d4b94d24 | 42 | return 3; |
43 | } // end if !ITS | |
2603d98a | 44 | if(!(ITS->GetITSgeom())){ |
45 | cerr << " AliITSgeom not found. Can't digitize with out it." << endl; | |
46 | return 4; | |
47 | } // end if | |
d4b94d24 | 48 | cout << "Digitizing ITS..." << endl; |
49 | ||
50 | TStopwatch timer; | |
51 | Long_t size0 = file->GetSize(); | |
52 | timer.Start(); | |
bcb08e43 | 53 | gAlice->Hits2Digits("ITS"); |
d4b94d24 | 54 | timer.Stop(); timer.Print(); |
55 | ||
d4b94d24 | 56 | file->Close(); |
57 | Long_t size1 = file->GetSize(); | |
58 | cout << "File size before = " << size0 << " file size after = " << size1; | |
59 | cout << "Increase in file size is " << size1-size0 << " Bytes" << endl; | |
60 | delete file; | |
61 | return 0; | |
62 | }; | |
63 |