From 73d9267f5ee4fb2a6514fd091035e1133e653e65 Mon Sep 17 00:00:00 2001 From: loizides Date: Thu, 11 Jul 2002 10:26:59 +0000 Subject: [PATCH] Changes for independant library of standalone l3 code. Most of them are by having #ifdef no_root preprocessor switches, but also added AliL3Stopwatch in AliL3Benchmark class. --- HLT/src/AliL3Benchmark.cxx | 103 ++++++++++++++++++++++-------------- HLT/src/AliL3Benchmark.h | 19 +++++-- HLT/src/AliL3MemHandler.cxx | 2 +- HLT/src/AliLevel3.cxx | 23 +++++++- HLT/src/AliLevel3.h | 15 ++++++ 5 files changed, 115 insertions(+), 47 deletions(-) diff --git a/HLT/src/AliL3Benchmark.cxx b/HLT/src/AliL3Benchmark.cxx index 68ed4d5fb40..2d5b81b4ed0 100644 --- a/HLT/src/AliL3Benchmark.cxx +++ b/HLT/src/AliL3Benchmark.cxx @@ -2,22 +2,28 @@ //*-- Copyright © Uli #include +#ifndef no_root #include -#include "TGraphAsymmErrors.h" -#include "TString.h" -#include "TStopwatch.h" +#include +#include +#include +#include +#endif + #include "AliL3Benchmark.h" -#include "TStopwatch.h" -#include "TMath.h" #include "AliL3Logging.h" +/** +// \class AliL3Benchmark //_____________________________________________________________ // +// AliL3Benchmark +// // Benchmark class for level3 code // -// -// +// +*/ 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;iReset(); -// 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;iClose(); delete file; file=0; +#endif delete[] x; delete[] y; delete[] eyl; diff --git a/HLT/src/AliL3Benchmark.h b/HLT/src/AliL3Benchmark.h index 1eb9da3d6da..83003370dd8 100644 --- a/HLT/src/AliL3Benchmark.h +++ b/HLT/src/AliL3Benchmark.h @@ -1,27 +1,38 @@ #ifndef AliL3_Benchmark #define AliL3_Benchmark +#ifndef no_root #include - class TStopwatch; class TString; +#else +#include +#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); diff --git a/HLT/src/AliL3MemHandler.cxx b/HLT/src/AliL3MemHandler.cxx index 732a951a5aa..14edb0a1d22 100644 --- a/HLT/src/AliL3MemHandler.cxx +++ b/HLT/src/AliL3MemHandler.cxx @@ -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) { diff --git a/HLT/src/AliLevel3.cxx b/HLT/src/AliLevel3.cxx index 24c870d6a3f..76ae3a167df 100644 --- a/HLT/src/AliLevel3.cxx +++ b/HLT/src/AliLevel3.cxx @@ -3,11 +3,13 @@ // Author: Anders Vestbo , Uli Frankenfeld //*-- Copyright © ASV +#ifndef no_root #include #include #include #include #include +#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 "<IsOpen()) { LOG(AliL3Log::kError,"AliLevel3::AliLevel3","File Open") - <<"Inputfile "< #include +#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); -- 2.39.3