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