1 /// \file FindKrClusters.C
2 /// \brief Macro to create array of clusters from TPC digits
7 /// * digits.root: file with digits - usualy use link to galice.root
8 /// in splitted mode - neccesary to create link to proper file
12 /// * TPC.RecPoints.root
14 /// Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything
16 /// \author A.Matyja amatyja@cern.ch
22 #include "AliTPCParam.h"
23 #include "AliTPCclusterKr.h"
24 #include "AliTPCclustererKr.h"
26 #include "TStopwatch.h"
30 Int_t FindKrClusters(){
35 //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";
36 //char *ocdbpath ="local:///home/matyja/baza/OCDB";
37 char *ocdbpath ="local:///data/baza/OCDB";
39 ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";
41 printf("OCDB PATH = %s\n",ocdbpath);
42 AliCDBManager * man = AliCDBManager::Instance();
43 man->SetDefaultStorage(ocdbpath);
46 AliRunLoader* rl = AliRunLoader::Open("galice.root");
48 cerr<<"Can not open session"<<endl;
52 AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
54 cerr<<"Can not get TPC Loader"<<endl;
58 if (tpcl->LoadDigits()) {
59 cerr<<"Error occured while loading digits"<<endl;
63 if (rl->LoadgAlice()) {
64 cerr<<"Error occured while LoadgAlice"<<endl;
68 gAlice=rl->GetAliRun();
70 cerr<<"Can't get gAlice !\n";
74 TDirectory *cwd = gDirectory;
76 AliTPCv4 *tpc = (AliTPCv4*)gAlice->GetDetector("TPC");
77 Int_t ver = tpc->IsVersion();
78 cerr<<"TPC version "<<ver<<" has been found !\n";
82 AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
83 if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}
85 AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
88 cerr<<"It has begun"<<endl;
95 AliTPCclustererKr *clusters = new AliTPCclustererKr();
96 clusters->SetParam(param);
97 clusters->SetOutput(output_tree);
99 clusters->SetMinAdc(3);//signal threshold (everything below is treated as 0)
100 clusters->SetMinTimeBins(2);//number of neighbouring timebins
101 clusters->SetMaxPadRangeCm(5.);//distance of the cluster center to the center of a pad (in cm)
102 clusters->SetMaxRowRangeCm(5.);//distance of the cluster center to the center of a padrow (in cm)
103 clusters->SetMaxTimeRange(7.);//distance of the cluster center to the max time bin on a pad (in tackts)
104 //ie. fabs(centerT - time)<7
106 clusters->SetIsolCut(3);//set isolation cut threshold
107 clusters->SetValueToSize(3.1);//cut reduce peak at 0
109 Int_t nevmax=rl->GetNumberOfEvents();//number of events in run
110 for(Int_t nev=0;nev<nevmax /*&& nev<1*/ ;nev++){
113 TTree* input_tree= tpcl->TreeD();//tree with digits
114 if (input_tree == 0x0){
115 cerr << "Can not get TreeD for event " <<nev<<endl;
118 digarr->ConnectTree(input_tree);
119 clusters->SetInput(input_tree);
120 clusters->SetDigArr(digarr);
121 cout<<"Processing event "<<nev<<endl;
122 clusters->FinderIO();
126 timer.Stop(); timer.Print();
128 delete rl;//cleans everything