]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for independant library of standalone l3 code. Most of them are by having...
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Jul 2002 10:26:59 +0000 (10:26 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Jul 2002 10:26:59 +0000 (10:26 +0000)
HLT/src/AliL3Benchmark.cxx
HLT/src/AliL3Benchmark.h
HLT/src/AliL3MemHandler.cxx
HLT/src/AliLevel3.cxx
HLT/src/AliLevel3.h

index 68ed4d5fb4036260ad738c16b9d720875cb3644e..2d5b81b4ed0cc6d126911c8fce36ad6a752de225 100644 (file)
@@ -2,22 +2,28 @@
 //*-- Copyright &copy Uli
 
 #include <time.h>
+#ifndef no_root
 #include <TFile.h>
-#include "TGraphAsymmErrors.h"
-#include "TString.h"
-#include "TStopwatch.h"
+#include <TGraphAsymmErrors.h>
+#include <TString.h>
+#include <TStopwatch.h>
+#include <TMath.h>
+#endif
+
 #include "AliL3Benchmark.h"
-#include "TStopwatch.h"
-#include "TMath.h"
 #include "AliL3Logging.h"
 
 
+/**
+// \class AliL3Benchmark
 //_____________________________________________________________
 //
+// AliL3Benchmark
+//
 //   Benchmark class for level3 code
 //  
-//
-//
+//</pre>
+*/
 
 ClassImp(AliL3Benchmark)
 AliL3Benchmark::AliL3Benchmark()
@@ -25,14 +31,14 @@ AliL3Benchmark::AliL3Benchmark()
   //Constructor
 
   fNbench = 0;
-   fNmax   = 20;
-   fNames  = 0;
-   fTimer  = 0;
-   fSum    = 0;
-   fMin    = 0;
-   fMax    = 0;
-   fCount  = 0;
-//   fStopwatch = 0;
+  fNmax   = 20;
+  fNames  = 0;
+  fTimer  = 0;
+  fSum    = 0;
+  fMin    = 0;
+  fMax    = 0;
+  fCount  = 0;
+  //fStopwatch = 0;
 }
 
 AliL3Benchmark::~AliL3Benchmark()
@@ -44,7 +50,7 @@ AliL3Benchmark::~AliL3Benchmark()
    if (fMin)    {delete [] fMin;   fMin   = 0;}
    if (fMax)    {delete [] fMax;   fMax   = 0;}
    if (fCount)  {delete [] fCount; fCount =0;}
-//   if(fStopwatch) {delete fStopwatch; fStopwatch =0;}
+   //if(fStopwatch) {delete fStopwatch; fStopwatch =0;}
 }
 
 Int_t AliL3Benchmark::GetBench(const char *name)
@@ -59,39 +65,50 @@ Int_t AliL3Benchmark::GetBench(const char *name)
 void AliL3Benchmark::Start(const char *name)
 {
    if (!fNbench) {
-      fNames = new TString[fNmax];
-      fTimer = new TStopwatch[fNmax];
-      fSum   = new Float_t[fNmax];
-      fMin   = new Float_t[fNmax];
-      fMax   = new Float_t[fNmax];
-      fCount = new Int_t[fNmax];
-      for(Int_t i =0;i<fNmax;i++){
-         fSum[i]=0;
-         fMin[i]=0;
-         fMax[i]=0;
-         fCount[i]=0;
-      }
+#ifdef no_root
+     fNames=new Char_t*[fNmax];
+     fTimer = new AliL3Stopwatch[fNmax];
+#else
+     fNames = new TString[fNmax];
+     fTimer = new TStopwatch[fNmax];
+#endif
+
+     fSum   = new Float_t[fNmax];
+     fMin   = new Float_t[fNmax];
+     fMax   = new Float_t[fNmax];
+     fCount = new Int_t[fNmax];
+     for(Int_t i =0;i<fNmax;i++){
+       fSum[i]=0;
+       fMin[i]=0;
+       fMax[i]=0;
+       fCount[i]=0;
+     }
    }
    Int_t bench = GetBench(name);
    if (bench < 0 && fNbench < fNmax ) {
-   // define a new benchmark to Start
+      // define a new benchmark to Start
+#ifdef no_root
+     fNames[fNbench]=new Char_t[strlen(name)+1];
+     strcpy(fNames[fNbench],name);
+#else
       fNames[fNbench] = name;
+#endif
       bench = fNbench;
       fNbench++;
       fTimer[bench].Reset();
       fTimer[bench].Start();
-//      if(fStopwatch) {delete fStopwatch; fStopwatch =0;}
-//      fStopwatch = new TStopwatch();
-//      fStopwatch->Reset();
-//      fStopwatch->Start();
+      //if(fStopwatch) {delete fStopwatch; fStopwatch =0;}
+      //fStopwatch = new TStopwatch();
+      //fStopwatch->Reset();
+      //fStopwatch->Start();
    } else if (bench >=0) {
-   // Resume the existen benchmark
+   // Resume the existent benchmark
       fTimer[bench].Reset();
       fTimer[bench].Start();
-//      if(fStopwatch) {delete fStopwatch; fStopwatch =0;}
-//      fStopwatch = new TStopwatch();
-//      fStopwatch->Reset();
-//      fStopwatch->Start();
+      //if(fStopwatch) {delete fStopwatch; fStopwatch =0;}
+      //fStopwatch = new TStopwatch();
+      //fStopwatch->Reset();
+      //fStopwatch->Start();
    }
    else
      LOG(AliL3Log::kWarning,"AliL3Benchmark::Start","Start")
@@ -105,8 +122,8 @@ void AliL3Benchmark::Stop(const char *name)
 
    fTimer[bench].Stop();
    Float_t val = fTimer[bench].CpuTime();
-//   fStopwatch->Stop();
-//   Float_t val = fStopwatch->CpuTime();
+   //fStopwatch->Stop();
+   //Float_t val = fStopwatch->CpuTime();
    
    fSum[bench] += val; 
    fCount[bench]++;
@@ -135,7 +152,11 @@ void AliL3Benchmark::Analyze(const char* name){
     y[i]=av*1000;
     eyl[i]=(av-fMin[i])*1000;
     eyh[i]=(fMax[i]-av)*1000;
+#ifdef no_root
+    fprintf(f,"%2d. %s: ",i+1,fNames[i]);
+#else
     fprintf(f,"%2d. %s: ",i+1,fNames[i].Data());
+#endif
     fprintf(f,"%4.0f ms\n",av*1000);
   }
   fclose(f);
@@ -148,6 +169,7 @@ void AliL3Benchmark::Analyze(const char* name){
   for (Int_t i=0;i<fNbench;i++) fprintf(f2,"%f ",eyh[i]); fprintf(f2,"\n");
   fclose(f2);
 */
+#ifndef no_root
   sprintf(filename,"%s.root",name);
   TFile *file = new TFile(filename,"RECREATE");
   TGraphAsymmErrors *gr = new TGraphAsymmErrors(fNbench,x,y,0,0,eyl,eyh);
@@ -159,6 +181,7 @@ void AliL3Benchmark::Analyze(const char* name){
   file->Close();
   delete file; 
   file=0;
+#endif
   delete[] x;
   delete[] y;
   delete[] eyl;
index 1eb9da3d6da651e4c24d7c3076ba66c3740129a1..83003370dd8c2a4beb4b13448bd4ef34a2ed14ea 100644 (file)
@@ -1,27 +1,38 @@
 #ifndef AliL3_Benchmark
 #define AliL3_Benchmark
 
+#ifndef no_root
 #include <Rtypes.h>
-
 class TStopwatch;
 class TString;
+#else
+#include <string.h>
+#include "AliL3RootTypes.h"
+#include "AliL3Stopwatch.h"
+#endif
+
 class AliL3Benchmark {
 
 private:
 
    Int_t      fNbench;          //Number of active benchmarks
    Int_t      fNmax;            //Maximum number of benchmarks initialized
+#ifndef no_root
    TString    *fNames;          //Names of benchmarks
    TStopwatch *fTimer;          //Timers
+#else
+   Char_t **fNames;
+   AliL3Stopwatch *fTimer;
+#endif
    Float_t    *fSum;
    Float_t    *fMin;
    Float_t    *fMax;
    Int_t      *fCount;
+   //TStopwatch *fStopwatch;    //Stopwatch
 
-//   TStopwatch *fStopwatch;          //Stopwatch
 public:
-              AliL3Benchmark();
-   virtual           ~AliL3Benchmark();
+   AliL3Benchmark();
+   virtual ~AliL3Benchmark();
    Int_t      GetBench(const char *name);
    void       Start(const char *name);
    void       Stop(const char *name);
index 732a951a5aa19f3c156d3838d3bcc261164566cb..14edb0a1d229277cf7ddfb8213952f1f18ed136e 100644 (file)
@@ -105,7 +105,7 @@ AliL3MemHandler::~AliL3MemHandler()
   if(fDPt) delete [] fDPt;
 }
 
-void AliL3MemHandler::Init(Int_t s,Int_t p, Int_t *r=0)
+void AliL3MemHandler::Init(Int_t s,Int_t p, Int_t *r)
 {
   fSlice=s;fPatch=p;
   if(r) {
index 24c870d6a3f1a10f2307ddf71e24d51b4940ff44..76ae3a167df43556276f6b5cedde89cad52daebe 100644 (file)
@@ -3,11 +3,13 @@
 // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>
 //*-- Copyright &copy ASV
 
+#ifndef no_root
 #include <TFile.h>
 #include <TDirectory.h>
 #include <TClonesArray.h>
 #include <TStopwatch.h>
 #include <iostream.h>
+#endif
 
 #include "AliL3Logging.h"
 #include "AliLevel3.h"
@@ -59,6 +61,21 @@ AliLevel3::AliLevel3()
   fInputFile=0;
 }
 
+#ifdef no_root
+AliLevel3::AliLevel3(Char_t *infile)
+{
+  //Constructor. Calls constructor of the tracker, vertexfinder and merger classes.
+  
+  fInputFile = fopen(infile,"r");
+  
+  if(!fInputFile)
+    {
+      LOG(AliL3Log::kError,"AliLevel3::AliLevel3","File Open")
+       <<"Inputfile "<<infile<<" does not exist!"<<ENDLOG;
+      return;
+    }
+}
+#else
 AliLevel3::AliLevel3(Char_t *infile)
 {
   //Constructor. Calls constructor of the tracker, vertexfinder and merger classes.
@@ -68,12 +85,13 @@ AliLevel3::AliLevel3(Char_t *infile)
   if(!fInputFile->IsOpen())
     {
       LOG(AliL3Log::kError,"AliLevel3::AliLevel3","File Open")
-       <<"Inputfile "<<infile<<" does not exist"<<ENDLOG;
+       <<"Inputfile "<<infile<<" does not exist!"<<ENDLOG;
       return;
     }
-  
 }
+#endif
 
+#ifndef no_root
 AliLevel3::AliLevel3(TFile *in)
 {
   fInputFile  =  in;
@@ -90,6 +108,7 @@ AliLevel3::AliLevel3(TFile *in)
       return;
     }
 }
+#endif
 
 void AliLevel3::Init(Char_t *path,Bool_t binary=kTRUE,Int_t npatches=6)
 {
index e7adf35a139deedfbffee3e7fdf1d066d71bc5e2..4cf746c92ca777efc4d47cf5bd33ca12c2c50cb8 100644 (file)
@@ -1,8 +1,10 @@
 #ifndef ALILEVEL3_H
 #define ALILEVEL3_H
 
+#ifndef no_root
 #include <TObject.h>
 #include <TFile.h>
+#endif
 
 #include "AliL3DigitData.h"
 #include "AliL3RootTypes.h"
@@ -16,7 +18,9 @@ class AliL3Vertex;
 class AliL3VertexFinder;
 class AliL3TrackMerger;
 class AliL3GlobalMerger;
+#ifndef no_root
 class TDirectory;
+#endif
 class AliL3ClustFinderNew;
 class AliL3Merger;
 class AliL3InterMerger;
@@ -28,7 +32,11 @@ class AliL3MemHandler;
 #endif
 class AliL3Benchmark;
 
+#ifdef no_root
+class AliLevel3 {
+#else
 class AliLevel3 : public TObject {
+#endif
 
  private:
   UInt_t fNTrackData;
@@ -52,8 +60,13 @@ class AliLevel3 : public TObject {
   Int_t fRow[6][2];
   Float_t fEta[2];
   
+#ifdef no_root
+  FILE *fInputFile;
+#else
   TDirectory *savedir;
   TFile *fInputFile;
+#endif
+
   Char_t fPath[256];
   Char_t fWriteOutPath[256];
 
@@ -79,7 +92,9 @@ class AliLevel3 : public TObject {
  public:
   AliLevel3 ();
   AliLevel3(Char_t *infile);
+#ifndef no_root
   AliLevel3(TFile *in);
+#endif
   virtual ~AliLevel3();
   
   void Init(Char_t *path,Bool_t binary=kTRUE,Int_t npatches=6);