Put back the two bellows in front of the absorber.
[u/mrichter/AliRoot.git] / TPC / TPCHits2ExactClusters.C
CommitLineData
cc80f89e 1//#include "alles.h"
2
3void TPCHits2ExactClusters()
4{
5 if (gTPCParam==0) {
6 cout<<"TPC Param Not Initialised\n";
7 return;
8 }
9 // Dynamically link some shared libs
10 if (gClassTable->GetID("AliRun") < 0) {
11 gROOT->LoadMacro("loadlibs.C");
12 loadlibs();
13 }
14 // Connect the Root Galice file containing Geometry, Kine and Hits
15 const char * inFile = "galice.root";
16 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
17 if (file) file->Close();
18 file = new TFile(inFile,"UPDATE");
19 // Get AliRun object from file or create it if not on file
20 // if (!gAlice) {
21 gAlice = (AliRun*)file->Get("gAlice");
22 if (gAlice) printf("AliRun object found on file\n");
23 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
24 // };
25 gAlice->GetEvent(0);
26 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
27
28 //setup AliTPCClustersArray
29 AliTPCClustersArray * arr=new AliTPCClustersArray;
30 arr->SetClusterType("AliCluster");
31 arr->Setup(gTPCParam);
32 TPC->SetParam(gTPCParam);
33 arr->MakeTree();
34
35 TPC->SetClustersArray(arr);
36 TPC->Hits2ExactClustersSector(0);
37 //write results
38 char treeName[100];
39 sprintf(treeName,"TreeCExact_%s",gTPCParam->GetTitle());
40 TPC->GetClustersArray()->GetTree()->Write(treeName);
41}
42
43
44AliTPCClustersArray * GetExactClustersArray(Bool_t newtree=kFALSE, const char* name=0 )
45{
46 AliTPCClustersArray * arr;
47 if ( (gAlice!=0) && (gAlice->GetDetector("TPC")!=0) ) {
48 arr = ((AliTPC*)gAlice->GetDetector("TPC"))->GetClustersArray();
49 if (arr!=0) arr->Update();
50 }
51 if (arr==0) {
52 arr = new AliTPCClustersArray;
53 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
54 if (file==0) file = new TFile("galice.root","update");
55 arr->SetClusterType("AliCluster");
56 arr->Setup(gTPCParam);
57 cout<<"Update status : "<<arr->Update()<<"\n";
58 char treeName[100];
59 if (name==0)
60 sprintf(treeName,"TreeCExact_%s",gTPCParam->GetTitle());
61 else sprintf(treeName,"TreeCExact_%s",name);
62 if (newtree!=kTRUE){
63 cout<<"Connect tree status : "<<arr->ConnectTree(treeName)<<"\n";
64 }
65 else
66 arr->MakeTree();
67 }
68 return arr;
69}
70
71
72
73