1 /****************************************************************************
2 * Origin: M.Ivanov marian.ivanov@cern.ch *
3 ****************************************************************************/
7 macro to create array of clusters from TPC digits
8 input files - galice.root
9 digits.root - file with digits - usualy use link to galice.root
10 - in splitted mode - neccesary to create link to proper file
12 output file - AliTPCclusters.root
13 - to be used by AliTPCTrackFinderMI.C
15 Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything
26 #include "AliTPCParam.h"
27 #include "AliTPCclustererMI.h"
29 #include "TStopwatch.h"
33 Int_t AliTPCFindClustersMI(Int_t n=1) {
35 AliRunLoader* rl = AliRunLoader::Open("galice.root");
37 cerr<<"Can not open session"<<endl;
41 AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
43 cerr<<"Can not get TPC Loader"<<endl;
47 if (tpcl->LoadDigits()) {
48 cerr<<"Error occured while loading digits"<<endl;
52 if (tpcl->LoadRecPoints("recreate")) {
53 cerr<<"Error occured while loading digits"<<endl;
57 if (rl->LoadgAlice()) {
58 cerr<<"Error occured while l"<<endl;
62 gAlice=rl->GetAliRun();
64 cerr<<"Can't get gAlice !\n";
68 TDirectory *cwd = gDirectory;
70 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
71 Int_t ver = TPC->IsVersion();
72 cerr<<"TPC version "<<ver<<" has been found !\n";
76 AliTPCParam *dig=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
77 if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 4;}
83 cerr<<"Making clusters...\n";
85 AliTPCv1 &tpc=*((AliTPCv1*)TPC);
86 tpc.SetParam(dig); timer.Start(); cwd->cd();
87 for(Int_t i=0;i<n;i++){
88 printf("Processing event %d\n",i);
90 tpc.Hits2Clusters(out,i);
95 cerr<<"Looking for clusters...\n";
97 // delete gAlice; gAlice=0;
99 tpc.SetParam(dig); timer.Start(); cwd->cd();
101 n = rl->GetNumberOfEvents();
102 for (Int_t i=0;i<n;i++)
105 AliTPCclustererMI clusterer(dig);
107 TTree * input = tpcl->TreeD();
110 cerr << "Can not get TreeD for event " << i <<endl;
114 TTree * output = tpcl->TreeR();
118 output = tpcl->TreeR();
121 cerr << "Problems with output tree (TreeR) for event " << i <<endl;
126 printf("Processing event %d\n",i);
127 clusterer.SetInput(input);
128 clusterer.SetOutput(output);
129 clusterer.Digits2Clusters();
131 tpcl->WriteRecPoints("OVERWRITE");
136 cerr<<"Invalid TPC version !\n";
140 timer.Stop(); timer.Print();
142 delete rl;//cleans everything