From: fca Date: Fri, 20 Jan 2012 14:14:33 +0000 (+0000) Subject: Removing TClonesArray deletions (C.Cheshkov) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=51c3974f6891429a15c5210aad2796c0b60931da;p=u%2Fmrichter%2FAliRoot.git Removing TClonesArray deletions (C.Cheshkov) --- diff --git a/RAW/AliRawEquipmentV2.cxx b/RAW/AliRawEquipmentV2.cxx index 8bd2aed0674..46c1ba2c455 100644 --- a/RAW/AliRawEquipmentV2.cxx +++ b/RAW/AliRawEquipmentV2.cxx @@ -87,6 +87,17 @@ void AliRawEquipmentV2::Reset() fRawDataRef = NULL; } +//______________________________________________________________________________ +void AliRawEquipmentV2::Clear(Option_t*) +{ + // Clear the equipment in case it needs to be re-used (avoiding costly + // new/delete cycle). Called by AliRawEventV2 Clear method inside the event loop. + + fEqpHdr.Reset(); + fRawDataRef = NULL; + fRawData = NULL; +} + //______________________________________________________________________________ AliRawEquipmentV2::~AliRawEquipmentV2() { diff --git a/RAW/AliRawEquipmentV2.h b/RAW/AliRawEquipmentV2.h index 9c7b79e6244..351ec5e6e73 100644 --- a/RAW/AliRawEquipmentV2.h +++ b/RAW/AliRawEquipmentV2.h @@ -49,6 +49,7 @@ public: virtual AliRawEquipmentHeader *GetEquipmentHeader(); virtual AliRawData *GetRawData(); void Reset(); + virtual void Clear(Option_t* = ""); AliRawData *NextRawData(AliRawDataArrayV2 *array); virtual void CloneRawData(const AliRawData *rawData); diff --git a/RAW/AliRawEventV2.cxx b/RAW/AliRawEventV2.cxx index 5f4d542f476..a2e0c55b74f 100644 --- a/RAW/AliRawEventV2.cxx +++ b/RAW/AliRawEventV2.cxx @@ -215,3 +215,22 @@ AliRawEventV2::~AliRawEventV2() fEvtHdrs->Delete(); delete fEvtHdrs; } + +//______________________________________________________________________________ +void AliRawEventV2::Clear(Option_t*) +{ + // Clear the event in case it needs to be re-used (avoiding costly + // new/delete cycle). Can be used inside the event loop. + + fEquipments.Clear("C"); + + if (fEvtHdrs) { + for (int i = 0; i < fEvtHdrs->GetEntriesFast(); i++) { + AliRawEventHeaderBase *hdr = (AliRawEventHeaderBase *)fEvtHdrs->UncheckedAt(i); + hdr->Reset(); + } + fEvtHdrs->Clear(); + } + fIndex = 0; +} + diff --git a/RAW/AliRawEventV2.h b/RAW/AliRawEventV2.h index 070dd5f2a03..f6ab8d23986 100644 --- a/RAW/AliRawEventV2.h +++ b/RAW/AliRawEventV2.h @@ -60,6 +60,7 @@ public: AliRawEventV2 *NextSubEvent(); virtual AliRawVEvent *GetSubEvent(Int_t index); void Reset(); + virtual void Clear(Option_t* = ""); private: TClonesArray fEquipments; // AliRawEquipmentV2's diff --git a/RAW/alirawdump_main.cxx b/RAW/alirawdump_main.cxx index 464d079e90d..67768b5dcd5 100644 --- a/RAW/alirawdump_main.cxx +++ b/RAW/alirawdump_main.cxx @@ -237,13 +237,16 @@ int main(int argc, char **argv) cout << "*******************************************" << endl; for(Int_t iEvent=0; iEvent < nEvents; iEvent++) { - rawEvent=NULL; + // rawEvent=NULL; rawTree->GetEntry(iEvent); cout << " *********** Event " << iEvent << " *******" << endl; DumpEvent(argv[0],rawEvent); - delete rawEvent; + // delete rawEvent; + rawEvent->Clear(); } + delete rawEvent; + cout << "*******************************************" << endl; cout << "EOF" << endl; cout << "*******************************************" << endl;