New topdir Makefile for compiling all libraries in the HLT tree.
[u/mrichter/AliRoot.git] / HLT / programs / runit.cxx
index 602769bb9c6d9f118445dbc5270726d88c7fe960..6258e71da4d125bc45793ff095208a4e75ec3096 100644 (file)
 
 #include <stream.h>
 #include <libgen.h>
+#include "AliL3RootTypes.h"
 #include "AliL3Transform.h"
 #include "AliL3ClustFinderNew.h"
 #include "AliL3MemHandler.h"
 #include "AliL3SpacePointData.h"
+#include "AliL3Logger.h"
 
+#define MAXCLUSTER 15000
 /**
  Example program how to run the "standalone" clusterfinder.
+
+ Import: give patch=-1 for one-patch slices.
 */
 
 int main(int argc,char **argv)
 {
-  if(argc!=2)
-    {
-      cout<<"Usage: runit datafile"<<endl;
-      return -1;
-    }
+  Int_t slice=0;
+  Int_t patch=0;
+  Int_t fm=4;
+  Int_t th=10;
+
+  //AliL3Logger l;
+  //l.Set(AliL3Logger::kAll);
+  //l.UseStdout();
+  //l.UseStream();
+
+  if(argc<2){
+    cout<<"Usage: runit datafile [slice] [patch] [match] [threshold]"<<endl;
+    return -1;
+  }
+  if (argc>2) {
+    slice=atoi(argv[2]);
+  }
+  if (argc>3) {
+    patch=atoi(argv[3]);
+  }
+  if (argc>4) {
+    fm=atoi(argv[4]);
+  }
+  if (argc>5) {
+    th=atoi(argv[5]);
+  }
 
   AliL3DigitRowData *digits = 0;
-  unsigned int ndigits=0;
+  unsigned int nrows=0;
   
+  //Storing all specific quantities, needed by the Cluster Finder.
+  Char_t fname[1024];
+  strcpy(fname,argv[1]);
+  AliL3Transform::Init(dirname(fname)); 
+  strcpy(fname,argv[1]);
+
   //Does all the file/data handling  
   AliL3MemHandler file; 
 
+  //Give slice and patch information (see filename convention)
+  if((patch>=0)&&(patch<6)) file.Init(slice,patch);
+  else {
+    Int_t srows[2]={0,175};
+    patch=0;
+    file.Init(slice,patch,srows);
+  }
+
   //Open the data file:
-  if(!file.SetBinaryInput(argv[1]))
+  if(!file.SetBinaryInput(fname))
     {
-      cerr<<"Error opening file "<<argv[1]<<endl;
+      cerr<<"Error opening file "<<fname<<endl;
       return -1;
     }
 
   //Store the data in memory, and get the pointer to it:
-  digits = file.CompBinary2Memory(ndigits);
+  digits = file.CompBinary2Memory(nrows);
   file.CloseBinaryInput();
 
-  //Storing all detector-spesific quantities, needed by the clusterfinder.
-  AliL3Transform::Init(dirname(argv[1])); 
-
   //The cluster finder itself.
   AliL3ClustFinderNew cf; 
 
   //Init cluster finder
-  cf.InitSlice(0,0,0,ndigits-1,10000);
+  cf.InitSlice(slice,patch,0,nrows-1,MAXCLUSTER);
+  cf.SetMatchWidth(fm);
+  cf.SetThreshold(th);
   //cf.SetXYError(0.2);
   //cf.SetZError(0.3);
   cf.SetSTDOutput(kTRUE);
   cf.SetCalcErr(kTRUE);
 
   //Switch off deconvolution:
-  cf.SetDeconv(false);
+  cf.SetDeconv(kFALSE);
   
   //Allocate memory to store found spacepoints 
   AliL3MemHandler fpoints;
-  AliL3SpacePointData *points=(AliL3SpacePointData*)fpoints.Allocate(10000*sizeof(AliL3SpacePointData));
+  AliL3SpacePointData *points=(AliL3SpacePointData*)fpoints.Allocate(MAXCLUSTER*sizeof(AliL3SpacePointData));
   cf.SetOutputArray(points);
 
   //Give the data pointer to the cluster finder
-  cf.Read(ndigits,digits);
+  cf.Read(nrows,digits);
 
   //Start processing:
   cf.ProcessDigits();
-  
-  return 0;
-}
 
+  exit(0);
+}