AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCFindClusters.C
Go to the documentation of this file.
1 
15 #ifndef __CINT__
16 #include <iostream.h>
17 #include "AliRun.h"
18 #include "AliTPCv1.h"
19 #include "AliTPCv2.h"
20 #include "AliTPCParam.h"
21 #include "AliTPCclusterer.h"
22 #include "TFile.h"
23 #include "TStopwatch.h"
24 #include "TTree.h"
25 #endif
26 
27 Int_t AliTPCFindClustersMI(Int_t n=1) {
28 
29  AliRunLoader* rl = AliRunLoader::Open("galice.root");
30  if (rl == 0x0) {
31  cerr<<"Can not open session"<<endl;
32  return 1;
33  }
34 
35  AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
36  if (tpcl == 0x0) {
37  cerr<<"Can not get TPC Loader"<<endl;
38  return 1;
39  }
40 
41  if (tpcl->LoadDigits()) {
42  cerr<<"Error occured while loading digits"<<endl;
43  return 1;
44  }
45 
46  if (tpcl->LoadRecPoints("recreate")) {
47  cerr<<"Error occured while loading digits"<<endl;
48  return 1;
49  }
50 
51  if (rl->LoadgAlice()) {
52  cerr<<"Error occured while l"<<endl;
53  return 1;
54  }
55 
56  gAlice=rl->GetAliRun();
57  if (!gAlice) {
58  cerr<<"Can't get gAlice !\n";
59  return 1;
60  }
61 
62  TDirectory *cwd = gDirectory;
63 
64  AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
65  Int_t ver = TPC->IsVersion();
66  cerr<<"TPC version "<<ver<<" has been found !\n";
67 
68  rl->CdGAFile();
69 
70  AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
71  if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
72 
73  TStopwatch timer;
74 
75  switch (ver) {
76  case 1:
77  cerr<<"Making clusters...\n";
78  {
79  AliTPCv1 &tpc=*((AliTPCv1*)TPC);
80  tpc.SetParam(dig); timer.Start(); cwd->cd();
81  for(Int_t i=0;i<n;i++){
82  printf("Processing event %d\n",i);
83  gAlice->GetEvent(i);
84  tpc.Hits2Clusters(out,i);
85  }
86  }
87  break;
88  case 2:
89  cerr<<"Looking for clusters...\n";
90  {
91  // delete gAlice; gAlice=0;
92  AliTPCv2 tpc;
93  tpc.SetParam(dig); timer.Start(); cwd->cd();
94 
95  n = rl->GetNumberOfEvents();
96  for (Int_t i=0;i<n;i++)
97  {
98  rl->GetEvent(i);
99  AliTPCclusterer clusterer(dig);
100 
101  TTree * input = tpcl->TreeD();
102  if (input == 0x0)
103  {
104  cerr << "Can not get TreeD for event " << i <<endl;
105  continue;
106  }
107 
108  TTree * output = tpcl->TreeR();
109  if (output == 0x0)
110  {
111  tpcl->MakeTree("R");
112  output = tpcl->TreeR();
113  if (output == 0x0)
114  {
115  cerr << "Problems with output tree (TreeR) for event " << i <<endl;
116  continue;
117  }
118  }
119 
120  printf("Processing event %d\n",i);
121  clusterer.SetInput(input);
122  clusterer.SetOutput(output);
123  clusterer.Digits2Clusters();
124 
125  tpcl->WriteRecPoints("OVERWRITE");
126  }
127  }
128  break;
129  default:
130  cerr<<"Invalid TPC version !\n";
131  return 5;
132  }
133 
134  timer.Stop(); timer.Print();
135 
136  delete rl;//cleans everything
137 
138  return 0;
139 }
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile * Open(const char *filename, Long64_t &nevents)
Manager and of geomety classes for set: TPC.
Definition: AliTPCParam.h:18
Int_t AliTPCFindClustersMI(Int_t n=1)
base class for loaders
Definition: AliTPCLoader.h:15
AliRun * gAlice