]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/FindKrClusters.C
end-of-line normalization
[u/mrichter/AliRoot.git] / TPC / FindKrClusters.C
index d00b9ccc07f7b79713194aca6348566bbe5ea036..39336ad241e4de8e028b8f019af62f059ee9ccd8 100644 (file)
-\r
-/****************************************************************************\r
- *           Origin: A.Matyja amatyja@cern.ch                               *\r
- ****************************************************************************/\r
-\r
-/*\r
-\r
-  macro to create array of clusters from TPC digits\r
-  input files - galice.root \r
-                digits.root - file with digits - usualy use link to galice.root\r
-                           - in splitted mode - neccesary to create link to proper file\r
-                           \r
-   output file - TPC.RecPoints.root\r
-\r
-\r
-//  Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything\r
-              \r
\r
-*/\r
-\r
-\r
-#ifndef __CINT__\r
-#include <iostream.h>\r
-#include "AliRun.h"\r
-#include "AliTPCv4.h"\r
-#include "AliTPCParam.h"\r
-#include "AliTPCclusterKr.h"\r
-#include "AliTPCclustererKr.h"\r
-#include "TFile.h"\r
-#include "TStopwatch.h"\r
-#include "TTree.h"\r
-#endif\r
-\r
-Int_t FindKrClusters(){\r
-\r
-  //\r
-  //Load DataBase\r
-  //\r
-  //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";\r
-  //char *ocdbpath ="local:///home/matyja/baza/OCDB";\r
-  char *ocdbpath ="local:///data/baza/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(0);\r
-\r
-  AliRunLoader* rl = AliRunLoader::Open("galice.root");\r
-  if (rl == 0x0) {\r
-    cerr<<"Can not open session"<<endl;\r
-    return 1;\r
-  }\r
-  \r
-  AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");\r
-  if (tpcl == 0x0) {\r
-    cerr<<"Can not get TPC Loader"<<endl;\r
-    return 1;\r
-  }\r
-\r
-  if (tpcl->LoadDigits()) {\r
-    cerr<<"Error occured while loading digits"<<endl;\r
-    return 1;\r
-  }\r
-\r
-  if (rl->LoadgAlice()) {\r
-    cerr<<"Error occured while LoadgAlice"<<endl;\r
-    return 1;\r
-  }\r
-  \r
-  gAlice=rl->GetAliRun();\r
-  if (!gAlice) {\r
-    cerr<<"Can't get gAlice !\n";\r
-    return 1;\r
-  }\r
-\r
-  TDirectory *cwd = gDirectory;\r
-\r
-  AliTPCv4 *tpc = (AliTPCv4*)gAlice->GetDetector("TPC");\r
-  Int_t ver = tpc->IsVersion(); \r
-  cerr<<"TPC version "<<ver<<" has been found !\n";\r
-\r
-  rl->CdGAFile();\r
-  \r
-  AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");\r
-  if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}\r
-  \r
-  AliTPCDigitsArray *digarr=new AliTPCDigitsArray;\r
-  digarr->Setup(param);\r
-\r
-  cerr<<"It has begun"<<endl;  \r
-  TStopwatch timer;\r
-  timer.Start();\r
-  cwd->cd();\r
-\r
-  TTree *output_tree;\r
-  \r
-  AliTPCclustererKr *clusters = new AliTPCclustererKr();\r
-  clusters->SetParam(param);\r
-  clusters->SetOutput(output_tree);\r
-\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(7.);//distance of the cluster center to the max time bin on a pad (in tackts)\r
-  //ie. fabs(centerT - time)<7\r
-\r
-  clusters->SetIsolCut(3);//set isolation cut threshold\r
-  clusters->SetValueToSize(3.1);//cut reduce peak at 0\r
-\r
-  Int_t nevmax=rl->GetNumberOfEvents();//number of events in run\r
-  for(Int_t nev=0;nev<nevmax /*&& nev<1*/ ;nev++){\r
-    rl->GetEvent(nev);\r
-    \r
-    TTree* input_tree= tpcl->TreeD();//tree with digits\r
-    if (input_tree == 0x0){\r
-      cerr << "Can not get TreeD for event " <<nev<<endl;\r
-      continue;\r
-    }\r
-    digarr->ConnectTree(input_tree);\r
-    clusters->SetInput(input_tree);\r
-    clusters->SetDigArr(digarr);\r
-    cout<<"Processing event "<<nev<<endl;\r
-    clusters->FinderIO();\r
-\r
-  }\r
-  delete clusters;\r
-  timer.Stop(); timer.Print();\r
-  \r
-  delete rl;//cleans everything\r
-  \r
-  return 0;\r
-}\r
+
+/****************************************************************************
+ *           Origin: A.Matyja amatyja@cern.ch                               *
+ ****************************************************************************/
+
+/*
+
+  macro to create array of clusters from TPC digits
+  input files - galice.root 
+                digits.root - file with digits - usualy use link to galice.root
+                           - in splitted mode - neccesary to create link to proper file
+                           
+   output file - TPC.RecPoints.root
+
+
+//  Warning - if cluster file AliTPCclusters.root already exist - macro exit and don't produce anything
+              
+*/
+
+
+#ifndef __CINT__
+#include <iostream.h>
+#include "AliRun.h"
+#include "AliTPCv4.h"
+#include "AliTPCParam.h"
+#include "AliTPCclusterKr.h"
+#include "AliTPCclustererKr.h"
+#include "TFile.h"
+#include "TStopwatch.h"
+#include "TTree.h"
+#endif
+
+Int_t FindKrClusters(){
+
+  //
+  //Load DataBase
+  //
+  //char *ocdbpath ="local:///afs/cern.ch/alice/tpctest/OCDB";
+  //char *ocdbpath ="local:///home/matyja/baza/OCDB";
+  char *ocdbpath ="local:///data/baza/OCDB";
+  if (ocdbpath==0){
+    ocdbpath="alien://folder=/alice/data/2007/LHC07w/OCDB/";
+  }
+  printf("OCDB PATH = %s\n",ocdbpath); 
+  AliCDBManager * man = AliCDBManager::Instance();
+  man->SetDefaultStorage(ocdbpath);
+  man->SetRun(0);
+
+  AliRunLoader* rl = AliRunLoader::Open("galice.root");
+  if (rl == 0x0) {
+    cerr<<"Can not open session"<<endl;
+    return 1;
+  }
+  
+  AliTPCLoader *tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
+  if (tpcl == 0x0) {
+    cerr<<"Can not get TPC Loader"<<endl;
+    return 1;
+  }
+
+  if (tpcl->LoadDigits()) {
+    cerr<<"Error occured while loading digits"<<endl;
+    return 1;
+  }
+
+  if (rl->LoadgAlice()) {
+    cerr<<"Error occured while LoadgAlice"<<endl;
+    return 1;
+  }
+  
+  gAlice=rl->GetAliRun();
+  if (!gAlice) {
+    cerr<<"Can't get gAlice !\n";
+    return 1;
+  }
+
+  TDirectory *cwd = gDirectory;
+
+  AliTPCv4 *tpc = (AliTPCv4*)gAlice->GetDetector("TPC");
+  Int_t ver = tpc->IsVersion(); 
+  cerr<<"TPC version "<<ver<<" has been found !\n";
+
+  rl->CdGAFile();
+  
+  AliTPCParam *param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60");
+  if (!param) {cerr<<"TPC parameters have not been found !\n"; return 4;}
+  
+  AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
+  digarr->Setup(param);
+
+  cerr<<"It has begun"<<endl;  
+  TStopwatch timer;
+  timer.Start();
+  cwd->cd();
+
+  TTree *output_tree;
+  
+  AliTPCclustererKr *clusters = new AliTPCclustererKr();
+  clusters->SetParam(param);
+  clusters->SetOutput(output_tree);
+
+  clusters->SetMinAdc(3);//signal threshold (everything below is treated as 0)
+  clusters->SetMinTimeBins(2);//number of neighbouring timebins
+  clusters->SetMaxPadRangeCm(5.);//distance of the cluster center to the center of a pad (in cm)
+  clusters->SetMaxRowRangeCm(5.);//distance of the cluster center to the center of a padrow (in cm)
+  clusters->SetMaxTimeRange(7.);//distance of the cluster center to the max time bin on a pad (in tackts)
+  //ie. fabs(centerT - time)<7
+
+  clusters->SetIsolCut(3);//set isolation cut threshold
+  clusters->SetValueToSize(3.1);//cut reduce peak at 0
+
+  Int_t nevmax=rl->GetNumberOfEvents();//number of events in run
+  for(Int_t nev=0;nev<nevmax /*&& nev<1*/ ;nev++){
+    rl->GetEvent(nev);
+    
+    TTree* input_tree= tpcl->TreeD();//tree with digits
+    if (input_tree == 0x0){
+      cerr << "Can not get TreeD for event " <<nev<<endl;
+      continue;
+    }
+    digarr->ConnectTree(input_tree);
+    clusters->SetInput(input_tree);
+    clusters->SetDigArr(digarr);
+    cout<<"Processing event "<<nev<<endl;
+    clusters->FinderIO();
+
+  }
+  delete clusters;
+  timer.Stop(); timer.Print();
+  
+  delete rl;//cleans everything
+  
+  return 0;
+}