]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/FindKrClustersRaw.C
Some of the coding violations corrected
[u/mrichter/AliRoot.git] / TPC / FindKrClustersRaw.C
index 7110bd4d30cae8aaf36569334496f5164465d041..0a00aeadc249fdd91527b513b50f8cf05e389c34 100644 (file)
-Int_t FindKrClustersRaw(const char *fileName="data.root"){
-
-  //define tree
-  TFile *hfile=new TFile("adc.root","RECREATE","ADC file");
-  // Create a ROOT Tree
-  TTree *mytree = new TTree("Kr","Krypton cluster tree");
-
-
-  AliRawReader *reader = new AliRawReaderRoot(fileName);
-  //AliRawReader *reader = new AliRawReaderDate(fileName);
-  reader->Reset();
-
-  TStopwatch timer;
-  timer.Start();
-
-  AliAltroRawStreamFast* stream = new AliAltroRawStreamFast(reader);
-  stream->SelectRawData("TPC");
-
-  //one general output
-  AliTPCclustererKr *clusters = new AliTPCclustererKr();
-  clusters->SetOutput(mytree);
-  clusters->SetRecoParam(0);
-
-  //only for geometry parameters loading - temporarly
-  AliRunLoader* rl = AliRunLoader::Open("galice.root");
-  AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
-  //if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}
-  clusters->SetParam(param);
-
-
-  Int_t evtnr=0;
-  while (reader->NextEvent()) {
-    //output for each event
-    //  AliTPCclustererKr *clusters = new AliTPCclustererKr();
-    //  clusters->SetOutput(mytree);
-
-    //if(evtnr++<35)continue;
-    cout<<"Evt = "<<evtnr<<endl;
-    clusters->finderIO(reader);
-    evtnr++;
-
-
-  }
-
-  //mytree->Print();//print rootuple summary 
-  // Save all objects in this file
-  hfile->Write();
-  // Close the file
-  hfile->Close();
-
-  timer.Stop();
-  timer.Print();
-
-  delete stream;
-
-  return 0;
-}
+//\r
+\r
+Int_t FindKrClusterCheck(const char *fileName="data.root");\r
+\r
+\r
+Int_t FindKrClustersRaw(const char *fileName="data.root"){\r
+\r
+  \r
+\r
+  //\r
+  // remove Altro warnings\r
+  //\r
+  AliLog::SetClassDebugLevel("AliTPCRawStream",-5);\r
+  AliLog::SetClassDebugLevel("AliRawReaderDate",-5);\r
+  AliLog::SetClassDebugLevel("AliTPCAltroMapping",-5);\r
+  AliLog::SetModuleDebugLevel("RAW",-5);\r
+  //\r
+  // Get calibration\r
+  //\r
+  char *ocdbpath = gSystem->Getenv("OCDB_PATH");\r
+  //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";\r
+  if (ocdbpath==0){\r
+    ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";\r
+  }\r
+  printf("OCDB PATH = %s\n",ocdbpath); \r
+  AliCDBManager * man = AliCDBManager::Instance();\r
+  man->SetDefaultStorage(ocdbpath);\r
+  man->SetRun(100000000);\r
+\r
+  AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();\r
+  AliTPCAltroMapping** mapping =AliTPCcalibDB::Instance()->GetMapping();\r
+  //\r
+  //\r
+\r
+\r
+  //define tree\r
+  TFile *hfile=new TFile("adc.root","RECREATE","ADC file");\r
+  // Create a ROOT Tree\r
+  TTree *mytree = new TTree("Kr","Krypton cluster tree");\r
+\r
+\r
+  Int_t debugLevel=1;\r
+  if(debugLevel>0){\r
+    TH1F *histoRow   =new TH1F("histoRow","rows",100,0.,100.);\r
+    TH1F *histoPad   =new TH1F("histoPad","pads",150,0.,150.);\r
+    TH1F *histoTime  =new TH1F("histoTime","timebins",100,0.,1000.);\r
+    TH2F *histoRowPad=new TH2F("histoRowPad","pads-vs-rows" ,150,0.,150.,100,0.,100.);\r
+  }\r
+\r
+\r
+  //one general output\r
+  AliTPCclustererKr *clusters = new AliTPCclustererKr();\r
+  clusters->SetOutput(mytree);\r
+  clusters->SetRecoParam(0);\r
+\r
+  if(debugLevel>0){\r
+    clusters->SetDebugLevel(debugLevel);\r
+    clusters->SetHistoRow(histoRow   );\r
+    clusters->SetHistoPad(histoPad   );\r
+    clusters->SetHistoTime(histoTime  );\r
+    clusters->SetHistoRowPad(histoRowPad);\r
+  }\r
+\r
+\r
+  AliTPCParamSR *param=new AliTPCParamSR();\r
+  //only for geometry parameters loading - temporarly\r
+//  AliRunLoader* rl = AliRunLoader::Open("galice.root");\r
+//  AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");\r
+  //if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}\r
+\r
+  clusters->SetParam(param);\r
+\r
+  //set cluster finder parameters (from data)\r
+  clusters->SetZeroSup(param->GetZeroSup());//zero suppression parameter\r
+  clusters->SetFirstBin(60);//first bin\r
+  clusters->SetLastBin(950);//last bin\r
+  clusters->SetMaxNoiseAbs(2);//maximal noise\r
+  clusters->SetMaxNoiseSigma(3);//maximal amount of sigma of noise\r
+\r
+  //set cluster finder parameters (from MC)\r
+  clusters->SetMinAdc(3);//signal threshold (everything below is treated as 0)\r
+  clusters->SetMinTimeBins(2);//number of neighbouring timebins\r
+  clusters->SetMaxPadRangeCm(5.);//distance of the cluster center to the center of a pad (in cm)\r
+  clusters->SetMaxRowRangeCm(5.);//distance of the cluster center to the center of a padrow (in cm)\r
+  clusters->SetMaxTimeRange(5.);//distance of the cluster center to the max time bin on a pad (in tackts)\r
+  //ie. fabs(centerT - time)<7\r
+  clusters->SetValueToSize(7.);//cut reduce peak at 0\r
+  clusters->SetIsolCut(3);//set isolation cut threshold\r
+\r
+  AliRawReader *reader = new AliRawReaderRoot(fileName);\r
+  reader->Reset();\r
+\r
+  TStopwatch timer;\r
+  timer.Start();\r
+\r
+  AliAltroRawStreamFast* stream = new AliAltroRawStreamFast(reader);\r
+  stream->SelectRawData("TPC");\r
+\r
+  Int_t evtnr=0;\r
+  while (reader->NextEvent()) {\r
+    //output for each event\r
+\r
+    //if(evtnr>4) break;\r
+    cout<<"Evt = "<<evtnr<<endl;\r
+    clusters->FinderIO(reader);\r
+    evtnr++;\r
+    AliSysInfo::AddStamp(Form("Event%d",evtnr),evtnr);\r
+  }\r
+\r
+\r
+  mytree->Print();//print rootuple summary \r
+  // Save all objects in this file\r
+  hfile->Write();\r
+  // Close the file\r
+  hfile->Close();\r
+\r
+  timer.Stop();\r
+  timer.Print();\r
+  printf("Deleting clusterer\n");\r
+  delete clusters;\r
+  printf("Deleting stream\n");\r
+  delete stream;\r
+  printf("Deleting raw reader\n");\r
+  delete reader;\r
+\r
+//   TCanvas *c2=new TCanvas("c2","title",800,800);\r
+//   c2->SetHighLightColor(2);\r
+//   c2->Range(-458.9552,-2948.238,3296.642,26856.6);\r
+//   c2->SetBorderSize(2);\r
+//   c2->SetLeftMargin(0.15);\r
+//   c2->SetRightMargin(0.06);\r
+//   c2->SetFrameFillColor(0);\r
+\r
+//   gStyle->SetOptStat(111111);\r
+//   histoRow->Draw();\r
+//   c2->Print("rows.ps");\r
+//   histoPad->Draw();\r
+//   c2->Print("pads.ps");\r
+//   histoTime->Draw();\r
+//   c2->Print("timebins.ps");\r
+//   histoRowPad->Draw();\r
+//   c2->Print("row-pad.ps");\r
+\r
+  return 0;\r
+}\r
+\r
+\r
+Int_t FindKrClusterCheck(const char *fileName){\r
+  //\r
+  //\r
+  gSystem->Load("$ROOTSYS/lib/libGui.so");\r
+  gSystem->Load("$ROOTSYS/lib/libTree.so");\r
+  gSystem->Load("$MEMSTAT/libMemStat.so");\r
+  {\r
+    TMemStat memstat(1000000,100000,kTRUE);\r
+    AliSysInfo::AddCallBack(TMemStatManager::GetInstance()->fStampCallBack);\r
+    FindKrClustersRaw(fileName); \r
+  }\r
+  // the output memstat.root file\r
+  TMemStat draw("memstat.root");\r
+  // Print some information\r
+  // code info\r
+  draw.MakeReport(0,0);\r
+\r
+}\r