From a815f9dd810aff16dd3f8e9cf06cd67adff5fd66 Mon Sep 17 00:00:00 2001 From: vestbo Date: Tue, 28 May 2002 14:53:36 +0000 Subject: [PATCH] Bugfix in AliL3FileHandler::GetDigitsTree. Added a new function AliL3FileHandler::FreeDigitsTree(), in order to be able to clear the digits tree from memory, without deleting the object. Useful feature if you want to loop over several events in a single rootfile. --- HLT/src/AliL3FileHandler.cxx | 23 +++++++++++++++++++---- HLT/src/AliL3FileHandler.h | 4 +++- HLT/src/AliL3MemHandler.h | 1 + 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/HLT/src/AliL3FileHandler.cxx b/HLT/src/AliL3FileHandler.cxx index b26415c67eb..397ba2089ed 100644 --- a/HLT/src/AliL3FileHandler.cxx +++ b/HLT/src/AliL3FileHandler.cxx @@ -70,11 +70,25 @@ AliL3FileHandler::~AliL3FileHandler() { //Destructor if(fMC) CloseMCOutput(); - if(fDigitsTree) delete fDigitsTree; + FreeDigitsTree(); if(fInAli) CloseAliInput(); } +void AliL3FileHandler::FreeDigitsTree() +{ + if(!fDigitsTree) + { + LOG(AliL3Log::kWarning,"AliL3FileHandler::FreeDigitsTree()","Pointer") + <<"Cannot free digitstree, it is not present"<Delete(); + fDigitsTree=0; +} + + Bool_t AliL3FileHandler::SetMCOutput(char *name) { fMC = fopen(name,"w"); @@ -233,7 +247,7 @@ AliL3DigitRowData * AliL3FileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event if(!fDigitsTree) GetDigitsTree(event); - + UShort_t dig; Int_t time,pad,sector,row; Int_t nrows=0; @@ -252,7 +266,7 @@ AliL3DigitRowData * AliL3FileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event if(lslice != fSlice) break; if(lrow < fRowMin) continue; if(lrow > fRowMax) break; - + Float_t xyz[3]; ndigits[lrow] = 0; fDigits->First(); @@ -352,6 +366,7 @@ AliL3DigitRowData * AliL3FileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event return data; } + Bool_t AliL3FileHandler::GetDigitsTree(Int_t event) { //Connects to the TPC digit tree in the AliROOT file. @@ -359,7 +374,7 @@ Bool_t AliL3FileHandler::GetDigitsTree(Int_t event) fInAli->cd(); Char_t dname[100]; sprintf(dname,"TreeD_75x40_100x60_%d",event); - fDigitsTree = (TTree*)fInAli->Get("TreeD_75x40_100x60_0"); + fDigitsTree = (TTree*)fInAli->Get(dname); if(!fDigitsTree) { LOG(AliL3Log::kError,"AliL3FileHandler::GetDigitsTree","Digits Tree") diff --git a/HLT/src/AliL3FileHandler.h b/HLT/src/AliL3FileHandler.h index 31e0d6f71a2..08b8b4fdaa1 100644 --- a/HLT/src/AliL3FileHandler.h +++ b/HLT/src/AliL3FileHandler.h @@ -30,11 +30,13 @@ class AliL3FileHandler:public AliL3MemHandler{ AliL3FileHandler(); virtual ~AliL3FileHandler(); + void FreeDigitsTree(); Bool_t SetAliInput(char *name); Bool_t SetAliInput(TFile *file); void CloseAliInput(); Bool_t IsDigit(); - + + Bool_t SetMCOutput(char *name); Bool_t SetMCOutput(FILE *file); void CloseMCOutput(); diff --git a/HLT/src/AliL3MemHandler.h b/HLT/src/AliL3MemHandler.h index 120f90f7bde..0e7c0295ef3 100644 --- a/HLT/src/AliL3MemHandler.h +++ b/HLT/src/AliL3MemHandler.h @@ -136,6 +136,7 @@ class AliL3MemHandler{ Int_t GetPatch(){return fPatch;} //virtual functions: + virtual void FreeDigitsTree() {return;} virtual Bool_t SetAliInput(char *name){return 0;} virtual void CloseAliInput(){return;} virtual Bool_t IsDigit(){return 0;} -- 2.31.1