From df16faa380166e0c47b092048f0937ec9559337e Mon Sep 17 00:00:00 2001 From: panos Date: Wed, 7 Jun 2006 12:48:22 +0000 Subject: [PATCH] Modify the QueryTags method: instead of a list of files it returns an ESD chain along with the associated EventList. It is now possible to iterate with a selector over the entries of this event list. The analysis time is reduced significantly. --- STEER/AliTagAnalysis.cxx | 53 ++++++++++++++++------------------------ STEER/AliTagAnalysis.h | 2 +- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/STEER/AliTagAnalysis.cxx b/STEER/AliTagAnalysis.cxx index db6272f085c..aaf76b6f8cc 100644 --- a/STEER/AliTagAnalysis.cxx +++ b/STEER/AliTagAnalysis.cxx @@ -120,16 +120,16 @@ void AliTagAnalysis::ChainGridTags(TGridResult *res) //______________________________________________________________________________ -TList *AliTagAnalysis::QueryTags(AliEventTagCuts *EvTagCuts) +TChain *AliTagAnalysis::QueryTags(AliEventTagCuts *EvTagCuts) { //Queries the tag chain using the defined //event tag cuts from the AliEventTagCuts object AliInfo(Form("Querying the tags........")); - //file info list - TList *list = new TList(); - - Int_t iAccepted = 0, evCounter = 0; + //ESD file chain + TChain *fESDchain = new TChain("esdTree"); + //Event list + TEventList *fEventList = new TEventList(); //Defining tag objects AliRunTag *tag = new AliRunTag; @@ -141,38 +141,27 @@ TList *AliTagAnalysis::QueryTags(AliEventTagCuts *EvTagCuts) const char* guid = 0; const char* turl = 0; - for(Int_t iTagFiles = 0; iTagFiles < fChain->GetEntries(); iTagFiles++) - { - TEventList *fEventList = new TEventList(); - evCounter = 0; + Int_t iAccepted = 0; + for(Int_t iTagFiles = 0; iTagFiles < fChain->GetEntries(); iTagFiles++) { fChain->GetEntry(iTagFiles); Int_t iEvents = tag->GetNEvents(); const TClonesArray *tagList = tag->GetEventTags(); - for(Int_t i = 0; i < iEvents; i++) - { - evTag = (AliEventTag *) tagList->At(i); - size = evTag->GetSize(); - md5 = evTag->GetMD5(); - guid = evTag->GetGUID(); - turl = evTag->GetTURL(); - if(EvTagCuts->IsAccepted(evTag)) - { - fEventList->Enter(i); - evCounter++; - - iAccepted++; - } - }//event loop - - //adding a TFileInfo object to the list - if(evCounter != 0) - list->Add(new TFileInfo(turl,size,guid,md5,-1,-1,-1,fEventList)); - fEventList->Clear(""); - delete fEventList; + for(Int_t i = 0; i < iEvents; i++) { + evTag = (AliEventTag *) tagList->At(i); + size = evTag->GetSize(); + md5 = evTag->GetMD5(); + guid = evTag->GetGUID(); + turl = evTag->GetTURL(); + if(EvTagCuts->IsAccepted(evTag)) fEventList->Enter(iAccepted+i); + }//event loop + iAccepted += iEvents; + + fESDchain->Add(turl); }//tag file loop - AliInfo(Form("Accepted events: %d",iAccepted)); + AliInfo(Form("Accepted events: %d",fEventList->GetN())); + fESDchain->SetEventList(fEventList); - return list; + return fESDchain; } diff --git a/STEER/AliTagAnalysis.h b/STEER/AliTagAnalysis.h index f8e0f88ac65..374533724a3 100644 --- a/STEER/AliTagAnalysis.h +++ b/STEER/AliTagAnalysis.h @@ -38,7 +38,7 @@ class AliTagAnalysis : public TObject { void ChainLocalTags(const char *dirname); void ChainGridTags(TGridResult *result); - TList *QueryTags(AliEventTagCuts *EvTagCuts); + TChain *QueryTags(AliEventTagCuts *EvTagCuts); protected: TGridResult *ftagresult; //the results from the tag grid query -- 2.39.3