]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding the CreateXMLCollection(const char* name, AliEventTagCuts *EvTagCuts) which...
authorpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Aug 2006 11:46:53 +0000 (11:46 +0000)
committerpanos <panos@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Aug 2006 11:46:53 +0000 (11:46 +0000)
STEER/AliTagAnalysis.cxx
STEER/AliTagAnalysis.h

index d868216112c063a673a99ef40fdd8ed0795038ca..ff9eceed4ab502e1034d2dc0a8173d291d7ab3fd 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliEventTag.h"
 #include "AliTagAnalysis.h"
 #include "AliEventTagCuts.h"
+#include "AliXMLCollection.h"
 
 class TTree;
 
@@ -115,6 +116,7 @@ void AliTagAnalysis::ChainGridTags(TGridResult *res) {
 TChain *AliTagAnalysis::QueryTags(AliEventTagCuts *EvTagCuts) {
   //Queries the tag chain using the defined 
   //event tag cuts from the AliEventTagCuts object
+  //and returns a TChain along with the associated TEventList
   AliInfo(Form("Querying the tags........"));
   
   //ESD file chain
@@ -154,4 +156,40 @@ TChain *AliTagAnalysis::QueryTags(AliEventTagCuts *EvTagCuts) {
   return fESDchain;
 }
 
+//___________________________________________________________________________
+Bool_t AliTagAnalysis::CreateXMLCollection(const char* name, AliEventTagCuts *EvTagCuts) {
+  //Queries the tag chain using the defined 
+  //event tag cuts from the AliEventTagCuts object
+  //and returns a XML collection
+  AliInfo(Form("Creating the collection........"));
+
+  AliXMLCollection *collection = new AliXMLCollection();
+  collection->SetCollectionName(name);
+  collection->WriteHeader();
+
+  //Event list
+  TEventList *fEventList = new TEventList();
+  TString guid = 0x0;
+  
+  //Defining tag objects
+  AliRunTag *tag = new AliRunTag;
+  AliEventTag *evTag = new AliEventTag;
+  fChain->SetBranchAddress("AliTAG",&tag);
+
+  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);
+      guid = evTag->GetGUID(); 
+      if(EvTagCuts->IsAccepted(evTag)) fEventList->Enter(i);
+    }//event loop
+    collection->WriteBody(iTagFiles+1,guid,fEventList);
+    fEventList->Clear();
+  }//tag file loop
+  collection->Export();
+
+  return kTRUE;
+}
 
index 374533724a3db80e50d2592ad63cf14600263053..f9b32414de74b625dd0ac3b2deea5ca74a66baa4 100644 (file)
@@ -39,6 +39,7 @@ class AliTagAnalysis : public TObject {
   void ChainLocalTags(const char *dirname);
   void ChainGridTags(TGridResult *result);
   TChain *QueryTags(AliEventTagCuts *EvTagCuts);
+  Bool_t CreateXMLCollection(const char* name, AliEventTagCuts *EvTagCuts);
    
  protected:
   TGridResult *ftagresult; //the results from the tag grid query