//*-- Copyright © 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()
//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()
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)
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")
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]++;
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);
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);
file->Close();
delete file;
file=0;
+#endif
delete[] x;
delete[] y;
delete[] eyl;
#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);
// Author: Anders Vestbo <mailto:vestbo$fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>
//*-- Copyright © 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"
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.
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;
return;
}
}
+#endif
void AliLevel3::Init(Char_t *path,Bool_t binary=kTRUE,Int_t npatches=6)
{