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