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