New macro "MUONreco.C" for using the event reconstruction package in C++
[u/mrichter/AliRoot.git] / TPC / AliTPCHits2Digits.C
CommitLineData
50d005ae 1void TPCHits2Digits()
8c555625 2{
8c555625 3 // Dynamically link some shared libs
50d005ae 4 if (gClassTable->GetID("AliRun") < 0) {
5 gROOT->LoadMacro("loadlibs.C");
6 loadlibs();
7 }
8 gROOT->LoadMacro("SetTPCParam.C");
9 AliTPCParam *par=SetTPCParam();
10
11
12 // Connect the Root Galice file containing Geometry, Kine and Hits
13 const char * inFile = "galice.root";
14 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
15 if (file) file->Close();
16 file = new TFile(inFile,"UPDATE");
17 // Get AliRun object from file or create it if not on file
18
19 gAlice = (AliRun*)file->Get("gAlice");
20 if (gAlice) printf("AliRun object found on file\n");
21 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
22
23 gAlice->GetEvent(0);
24 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
25
26 cerr<<"Hits2Digits\n";
27 //setup TPCDigitsArray
28 AliTPCDigitsArray *arr = new AliTPCDigitsArray;
29 arr->SetClass("AliSimDigits");
30 arr->Setup(par);
31 TPC->SetParam(par);
32 arr->MakeTree();
33
34 TPC->SetDigitsArray(arr);
35 TPC->Hits2DigitsSector(1);
36 TPC->Hits2DigitsSector(2);
37 TPC->Hits2DigitsSector(3);
38 TPC->Hits2DigitsSector(1+18);
39 TPC->Hits2DigitsSector(2+18);
40 TPC->Hits2DigitsSector(3+18);
41
42 TPC->Hits2DigitsSector(36+1);
43 TPC->Hits2DigitsSector(36+2);
44 TPC->Hits2DigitsSector(36+3);
45 TPC->Hits2DigitsSector(36+1+18);
46 TPC->Hits2DigitsSector(36+2+18);
47 TPC->Hits2DigitsSector(36+3+18);
48 //write results
49 char treeName[100];
50 sprintf(treeName,"TreeD_%s",par->GetTitle());
51 TPC->GetDigitsArray()->GetTree()->Write(treeName);
52 par->Write(par->GetTitle());
53 file->Close();
8c555625 54};
55