]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHitsToSDigitsDefault.C
Added new inline function SetITSgeom needed for alignment. New function
[u/mrichter/AliRoot.git] / ITS / AliITSHitsToSDigitsDefault.C
CommitLineData
d4b94d24 1Int_t AliITSHitsToSDigitsDefault(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
2603d98a 16
d4b94d24 17 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
2603d98a 18 if (file) {file->Close(); delete file;}
19 cout << "AliITSHits2SDigitsDefault" << endl;
20 file = new TFile(inFile,"UPDATE");
21 if (!file->IsOpen()) {
22 cerr<<"Can't open "<<inFile<<" !" << endl;
23 return 1;
24 } // end if !file
d4b94d24 25 file->ls();
26
27 // Get AliRun object from file or create it if not on file
2603d98a 28 if (gAlice) delete gAlice;
29 gAlice = (AliRun*)file->Get("gAlice");
d4b94d24 30 if (!gAlice) {
2603d98a 31 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
32 << endl;
33 return 2;
34 } // end if !gAlice
d4b94d24 35
2603d98a 36 gAlice->GetEvent(0);
37 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
38 if (!ITS) {
39 cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
40 << endl;
41 return 3;
42 } // end if !ITS
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->TreeS()){
49 cout << "Having to create the SDigits Tree." << endl;
50 gAlice->MakeTree("S");
51 } // end if !gAlice->TreeS()
52 //make branch
53 ITS->MakeBranch("S");
54 ITS->SetTreeAddress();
55 gAlice->GetEvent(0);
56 cout<<"SDigitizing ITS..." << endl;
2603d98a 57
d4b94d24 58 TStopwatch timer;
59 Long_t size0 = file->GetSize();
60
61 for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
62 cout << "nev " <<nev<<endl;
63 if(nev>0) {
d4b94d24 64 gAlice->SetEvent(nev);
65 if(!gAlice->TreeD()) gAlice->MakeTree("D");
66 ITS->MakeBranch("D");
67 } // end if nev>0
d4b94d24 68 if (nev < evNumber1) continue;
d4b94d24 69 timer.Start();
2603d98a 70 ITS->HitsToDigits(nev,0,-1," ","All"," ");
d4b94d24 71 timer.Stop(); timer.Print();
72 } // event loop
73
2603d98a 74 delete gAlice; gAlice=0;
d4b94d24 75 file->Close();
76 Long_t size1 = file->GetSize();
77 cout << "File size before = " << size0 << " file size after = " << size1;
78 cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
79 delete file;
80 return 0;
81};