2 /****************************************************************************
3 * Origin: A.Matyja amatyja@cern.ch *
4 ****************************************************************************/
8 macro to create array of clusters from TPC digits
9 input files - galice.root
10 digits.root - file with digits - usualy use link to galice.root
11 - in splitted mode - neccesary to create link to proper file
13 output file - TPC.RecPoints.root
16 // Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything
26 #include "AliTPCParam.h"
27 #include "AliTPCclusterKr.h"
28 #include "AliTPCclustererKr.h"
30 #include "TStopwatch.h"
34 Int_t FindKrClusters(){
39 //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";
40 //char *ocdbpath ="local:///home/matyja/baza/OCDB";
41 char *ocdbpath ="local:///data/baza/OCDB";
43 ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";
45 printf("OCDB PATH = %s\n",ocdbpath);
46 AliCDBManager * man = AliCDBManager::Instance();
47 man->SetDefaultStorage(ocdbpath);
50 AliRunLoader* rl = AliRunLoader::Open("galice.root");
52 cerr<<"Can not open session"<<endl;
56 AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
58 cerr<<"Can not get TPC Loader"<<endl;
62 if (tpcl->LoadDigits()) {
63 cerr<<"Error occured while loading digits"<<endl;
67 if (rl->LoadgAlice()) {
68 cerr<<"Error occured while LoadgAlice"<<endl;
72 gAlice=rl->GetAliRun();
74 cerr<<"Can't get gAlice !\n";
78 TDirectory *cwd = gDirectory;
80 AliTPCv4 *tpc = (AliTPCv4*)gAlice->GetDetector("TPC");
81 Int_t ver = tpc->IsVersion();
82 cerr<<"TPC version "<<ver<<" has been found !\n";
86 AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
87 if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}
89 AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
92 cerr<<"It has begun"<<endl;
99 AliTPCclustererKr *clusters = new AliTPCclustererKr();
100 clusters->SetParam(param);
101 clusters->SetOutput(output_tree);
103 clusters->SetMinAdc(3);//signal threshold (everything below is treated as 0)
104 clusters->SetMinTimeBins(2);//number of neighbouring timebins
105 clusters->SetMaxPadRangeCm(5.);//distance of the cluster center to the center of a pad (in cm)
106 clusters->SetMaxRowRangeCm(5.);//distance of the cluster center to the center of a padrow (in cm)
107 clusters->SetMaxTimeRange(7.);//distance of the cluster center to the max time bin on a pad (in tackts)
108 //ie. fabs(centerT - time)<7
110 clusters->SetIsolCut(3);//set isolation cut threshold
111 clusters->SetValueToSize(3.1);//cut reduce peak at 0
113 Int_t nevmax=rl->GetNumberOfEvents();//number of events in run
114 for(Int_t nev=0;nev<nevmax /*&& nev<1*/ ;nev++){
117 TTree* input_tree= tpcl->TreeD();//tree with digits
118 if (input_tree == 0x0){
119 cerr << "Can not get TreeD for event " <<nev<<endl;
122 digarr->ConnectTree(input_tree);
123 clusters->SetInput(input_tree);
124 clusters->SetDigArr(digarr);
125 cout<<"Processing event "<<nev<<endl;
126 clusters->FinderIO();
130 timer.Stop(); timer.Print();
132 delete rl;//cleans everything