]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliTagAnalysis.cxx
Modify the QueryTags method: instead of a list of files it returns an ESD chain along...
[u/mrichter/AliRoot.git] / STEER / AliTagAnalysis.cxx
index db6272f085c9d2d2616190e67a37b7a38b462580..aaf76b6f8cc57f00fbedd5fe152f48dcb19aaf4d 100644 (file)
@@ -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;
 }