doxy: TPC/stressTest/testSparse converted
[u/mrichter/AliRoot.git] / TPC / FindKrClustersRaw.C
CommitLineData
a7a1dd76 1/// \file FindKrClustersRaw.C
a65a7e70 2
3Int_t FindKrClusterCheck(const char *fileName="data.root");
4
5
6Int_t FindKrClustersRaw(const char *fileName="data.root"){
7
8
9
3a4edebe 10 /// remove Altro warnings
11
a65a7e70 12 AliLog::SetClassDebugLevel("AliRawReaderDate",-5);
13 AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);
14 AliLog::SetModuleDebugLevel("RAW",-5);
15 //
16 // Get calibration
17 //
18 char *ocdbpath = gSystem->Getenv("OCDB_PATH");
19 //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";
20 if (ocdbpath==0){
21 ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";
22 }
23 printf("OCDB PATH = %s\n",ocdbpath);
24 AliCDBManager * man = AliCDBManager::Instance();
25 man->SetDefaultStorage(ocdbpath);
26 man->SetRun(100000000);
27
28 AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
29 AliTPCAltroMapping** mapping =AliTPCcalibDB::Instance()->GetMapping();
30 //
31 //
32
33
34 //define tree
35 TFile *hfile=new TFile("adc.root","RECREATE","ADC file");
36 // Create a ROOT Tree
37 TTree *mytree = new TTree("Kr","Krypton cluster tree");
38
39
40 Int_t debugLevel=1;
41 if(debugLevel>0){
42 TH1F *histoRow =new TH1F("histoRow","rows",100,0.,100.);
43 TH1F *histoPad =new TH1F("histoPad","pads",150,0.,150.);
44 TH1F *histoTime =new TH1F("histoTime","timebins",100,0.,1000.);
45 TH2F *histoRowPad=new TH2F("histoRowPad","pads-vs-rows" ,150,0.,150.,100,0.,100.);
46 }
47
48
49 //one general output
50 AliTPCclustererKr *clusters = new AliTPCclustererKr();
51 clusters->SetOutput(mytree);
52 clusters->SetRecoParam(0);
53
54 if(debugLevel>0){
55 clusters->SetDebugLevel(debugLevel);
56 clusters->SetHistoRow(histoRow );
57 clusters->SetHistoPad(histoPad );
58 clusters->SetHistoTime(histoTime );
59 clusters->SetHistoRowPad(histoRowPad);
60 }
61
62
63 AliTPCParamSR *param=new AliTPCParamSR();
64 //only for geometry parameters loading - temporarly
65// AliRunLoader* rl = AliRunLoader::Open("galice.root");
66// AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
67 //if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}
68
69 clusters->SetParam(param);
70
71 //set cluster finder parameters (from data)
72 clusters->SetZeroSup(param->GetZeroSup());//zero suppression parameter
73 clusters->SetFirstBin(60);//first bin
74 clusters->SetLastBin(950);//last bin
75 clusters->SetMaxNoiseAbs(2);//maximal noise
76 clusters->SetMaxNoiseSigma(3);//maximal amount of sigma of noise
77
78 //set cluster finder parameters (from MC)
79 clusters->SetMinAdc(3);//signal threshold (everything below is treated as 0)
80 clusters->SetMinTimeBins(2);//number of neighbouring timebins
81 clusters->SetMaxPadRangeCm(5.);//distance of the cluster center to the center of a pad (in cm)
82 clusters->SetMaxRowRangeCm(5.);//distance of the cluster center to the center of a padrow (in cm)
83 clusters->SetMaxTimeRange(5.);//distance of the cluster center to the max time bin on a pad (in tackts)
84 //ie. fabs(centerT - time)<7
85 clusters->SetValueToSize(7.);//cut reduce peak at 0
86 clusters->SetIsolCut(3);//set isolation cut threshold
87
88 AliRawReader *reader = new AliRawReaderRoot(fileName);
89 reader->Reset();
90
91 TStopwatch timer;
92 timer.Start();
93
94 AliAltroRawStreamFast* stream = new AliAltroRawStreamFast(reader);
95 stream->SelectRawData("TPC");
96
97 Int_t evtnr=0;
98 while (reader->NextEvent()) {
99 //output for each event
100
101 //if(evtnr>4) break;
102 cout<<"Evt = "<<evtnr<<endl;
103 clusters->FinderIO(reader);
104 evtnr++;
105 AliSysInfo::AddStamp(Form("Event%d",evtnr),evtnr);
106 }
107
108
109 mytree->Print();//print rootuple summary
110 // Save all objects in this file
111 hfile->Write();
112 // Close the file
113 hfile->Close();
114
115 timer.Stop();
116 timer.Print();
117 printf("Deleting clusterer\n");
118 delete clusters;
119 printf("Deleting stream\n");
120 delete stream;
121 printf("Deleting raw reader\n");
122 delete reader;
123
124// TCanvas *c2=new TCanvas("c2","title",800,800);
125// c2->SetHighLightColor(2);
126// c2->Range(-458.9552,-2948.238,3296.642,26856.6);
127// c2->SetBorderSize(2);
128// c2->SetLeftMargin(0.15);
129// c2->SetRightMargin(0.06);
130// c2->SetFrameFillColor(0);
131
132// gStyle->SetOptStat(111111);
133// histoRow->Draw();
134// c2->Print("rows.ps");
135// histoPad->Draw();
136// c2->Print("pads.ps");
137// histoTime->Draw();
138// c2->Print("timebins.ps");
139// histoRowPad->Draw();
140// c2->Print("row-pad.ps");
141
142 return 0;
143}
144
145
146Int_t FindKrClusterCheck(const char *fileName){
3a4edebe 147 ///
148
b0635849 149 gSystem->Load("$ROOTSYS/lib/libGui");
150 gSystem->Load("$ROOTSYS/lib/libTree");
151 gSystem->Load("$MEMSTAT/libMemStat");
a65a7e70 152 {
153 TMemStat memstat(1000000,100000,kTRUE);
154 AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack);
155 FindKrClustersRaw(fileName);
156 }
157 // the output memstat.root file
158 TMemStat draw("memstat.root");
159 // Print some information
160 // code info
161 draw.MakeReport(0,0);
162
163}