]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHitsToDigitsDefault.C
Updated code for tracking V2 (from Y. Belikov)
[u/mrichter/AliRoot.git] / ITS / AliITSHitsToDigitsDefault.C
CommitLineData
2603d98a 1Int_t AliITSHitsToDigitsDefault(Int_t evNumber1=0,Int_t evNumber2=0,
2 const char *inFile="galice.root"){
d4b94d24 3/////////////////////////////////////////////////////////////////////////
4// This macro is a small example of a ROOT macro
5// illustrating how to read the output of GALICE
6// and do some analysis.
7//
8/////////////////////////////////////////////////////////////////////////
9
10 // Dynamically link some shared libs
11 if (gClassTable->GetID("AliRun") < 0) {
12 gROOT->LoadMacro("loadlibs.C");
13 loadlibs();
14 } // end if
15
16 // Connect the Root Galice file containing Geometry, Kine and Hits
17
18 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
2603d98a 19 if (file) {file->Close(); delete file;}
20 cout << "AliITSHitsToDigitsDefault" << endl;
21 file = new TFile(inFile,"UPDATE");
22 if (!file->IsOpen()) {
23 cerr<<"Can't open "<<inFile<<" !" << endl;
24 return 1;
25 } // end if !file
d4b94d24 26 file->ls();
2603d98a 27
28 // Get AliRun object from file or return if not on file
29 if (gAlice) delete gAlice;
30 gAlice = (AliRun*)file->Get("gAlice");
d4b94d24 31 if (!gAlice) {
2603d98a 32 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
33 << endl;
34 return 2;
35 } // end if !gAlice
d4b94d24 36
2603d98a 37 gAlice->GetEvent(0);
38 AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
39 if (!ITS){
40 cerr << "ITS not found in gAlice. Exiting." << endl;
41 return 3;
42 } // end if
43 if(!(ITS->GetITSgeom())){
44 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
45 return 4;
46 } // end if
d4b94d24 47
48 if(!gAlice->TreeD()){
49 cout << "Having to create the Digits Tree." << endl;
50 gAlice->MakeTree("D");
51 } // end if !gAlice->TreeD()
52 //make branch
53 ITS->MakeBranch("D");
54 ITS->SetTreeAddress();
2603d98a 55
d4b94d24 56 cout<<"Digitizing ITS..." << endl;
57 TStopwatch timer;
58 Long_t size0 = file->GetSize();
59
60 for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
61 cout << "nev " <<nev<<endl;
62 if(nev>0) {
d4b94d24 63 gAlice->SetEvent(nev);
64 if(!gAlice->TreeD()) gAlice->MakeTree("D");
65 ITS->MakeBranch("D");
66 } // end if nev>0
d4b94d24 67 if (nev < evNumber1) continue;
d4b94d24 68 timer.Start();
2603d98a 69 ITS->HitsToDigits(nev,0,-1," ","All"," ");
d4b94d24 70 timer.Stop(); timer.Print();
71 } // event loop
72
2603d98a 73 delete gAlice; gAlice=0;
d4b94d24 74 file->Close();
75 Long_t size1 = file->GetSize();
76 cout << "File size before = " << size0 << " file size after = " << size1;
77 cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
78 delete file;
79 return 0;
80};