]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
The ANALYSIS one is a modification of the AliXMLCollection which adds
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Nov 2009 11:32:36 +0000 (11:32 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Nov 2009 11:32:36 +0000 (11:32 +0000)
support for empty event lists (with the current code it crashes for an
empty evlist).
  The STEER one is to add two new functions to the ESDInputHandler, one
to calculate the cut summary for the given list, the other to count
"empty" files, that is files with no events selected.
(A. Kisiel)

ANALYSIS/AliXMLCollection.cxx
STEER/AliESDInputHandler.cxx
STEER/AliESDInputHandler.h

index 356bb08758ae293740ba06c55d2eec6b1950c6bf..539de387889b9f0e1f6f3cc696a88cecc47c513d 100644 (file)
@@ -444,19 +444,28 @@ void AliXMLCollection::ParseXML() {
        TObjString *oturl = new TObjString(xml.GetAttr(xfile,"turl"));
        TObjString *olfn  = new TObjString(xml.GetAttr(xfile,"lfn"));
        TObjString *oguid = new TObjString(xml.GetAttr(xfile,"guid"));
-       TObjString *oevlist = new TObjString(xml.GetAttr(xfile, "evlist"));
+
+       TObjString *oevlist;
+       if (xml.GetAttr(xfile, "evlist"))
+         oevlist = new TObjString(xml.GetAttr(xfile, "evlist"));
+       else
+         oevlist = 0;
+
        TObjString *otagsumm;
        if (xml.GetAttr(xfile, "cutsumm"))
          otagsumm = new TObjString(xml.GetAttr(xfile, "cutsumm"));
        else 
          otagsumm = 0;
-       Info("ParseXML","Collection: %s - turl: %s eventlist: %s",
-            fXmlFile.Data(),oturl->GetName(),oevlist->GetName());
-       if (strcmp(oevlist->GetName(),"") != 0) {
+
+       if (oevlist) {
+         Info("ParseXML","Collection: %s - turl: %s eventlist: %s",
+              fXmlFile.Data(),oturl->GetName(),oevlist->GetName());
          TEntryList *xmlevlist = new TEntryList(oturl->GetName(), oguid->GetName());
-         TString stringevlist = oevlist->GetName();
-         TObjArray *evlist = stringevlist.Tokenize(",");
-         for (Int_t n = 0; n < evlist->GetEntries(); n++)  xmlevlist->Enter(atol(((TObjString *) evlist->At(n))->GetName()));
+         if (strcmp(oevlist->GetName(),"") != 0) {
+           TString stringevlist = oevlist->GetName();
+           TObjArray *evlist = stringevlist.Tokenize(",");
+           for (Int_t n = 0; n < evlist->GetEntries(); n++)  xmlevlist->Enter(atol(((TObjString *) evlist->At(n))->GetName()));
+         }
          attributes->Add(new TObjString("evlist"), xmlevlist);
        }
        
index f36a94a32b8beb72757c9f57a989380dd481e0b8..3a6a1988253a32633f863b3340f84464a2a54639 100644 (file)
@@ -311,3 +311,94 @@ Int_t AliESDInputHandler::GetNEventRejectedInFile()
 
   return iRej;
 }
+Bool_t AliESDInputHandler::GetCutSummaryForChain(Int_t *aTotal, Int_t *aAccepted, Int_t *aRejected)
+{
+  // Get number of events in the full chain
+  // Count accepted and rejected events
+  // return kFALSE if no info is available
+  if (!fTagCutSumm) {
+    TList *luo = fTree->GetUserInfo();
+    if (!luo) {
+      AliInfo(Form("No user info in input tree - no tag cut summary\n"));
+      return kFALSE;
+    }
+    for (int iluo=0; iluo<luo->GetEntries(); iluo++) {
+      fTagCutSumm = dynamic_cast<TMap *>(luo->At(iluo));
+      if (fTagCutSumm) break;
+    }
+    if (!fTagCutSumm) {
+      AliInfo(Form("No tag summary map in input tree\n"));
+      return kFALSE;
+    }
+  }
+  
+  TMapIter *tIter = new TMapIter(fTagCutSumm);
+  
+  Int_t iTotList=0, iAccList=0, iRejList=0;
+
+  TObject *cobj;
+  while (cobj = tIter->Next()) {
+    TObjString *kstr = (TObjString *) cobj;
+    TObjString *vstr = (TObjString *) fTagCutSumm->GetValue(kstr->GetString().Data());
+    //    printf("Got object value %s %s\n", kstr->GetString().Data(), vstr->GetString().Data());
+    char *iTagInfo;
+    iTagInfo = strdup(vstr->GetString().Data());
+    
+    Int_t iAcc = atoi(strtok(iTagInfo, ","));
+    Int_t iRej = atoi(strtok(NULL, ","));
+    
+    iAccList += iAcc;
+    iRejList += iRej;
+    iTotList += (iAcc+iRej);
+  }
+
+  *aTotal = iTotList;
+  *aAccepted = iAccList;
+  *aRejected = iRejList;
+
+  return kTRUE;
+}
+
+Int_t AliESDInputHandler::GetNFilesEmpty()
+{
+  // Count number of files in which all events were de-selected
+  // For such files Notify() will NOT be called
+  // return -1 if no info is available
+  if (!fTagCutSumm) {
+    TList *luo = fTree->GetUserInfo();
+    if (!luo) {
+      AliInfo(Form("No user info in input tree - no tag cut summary\n"));
+      return -1;
+    }
+    for (int iluo=0; iluo<luo->GetEntries(); iluo++) {
+      fTagCutSumm = dynamic_cast<TMap *>(luo->At(iluo));
+      if (fTagCutSumm) break;
+    }
+    if (!fTagCutSumm) {
+      AliInfo(Form("No tag summary map in input tree\n"));
+      return -1;
+    }
+  }
+  
+  TMapIter *tIter = new TMapIter(fTagCutSumm);
+  
+  Int_t iFilesEmpty = 0;
+
+  TObject *cobj;
+  while (cobj = tIter->Next()) {
+    TObjString *kstr = (TObjString *) cobj;
+    TObjString *vstr = (TObjString *) fTagCutSumm->GetValue(kstr->GetString().Data());
+    //    printf("Got object value %s %s\n", kstr->GetString().Data(), vstr->GetString().Data());
+    char *iTagInfo;
+    iTagInfo = strdup(vstr->GetString().Data());
+    
+    Int_t iAcc = atoi(strtok(iTagInfo, ","));
+    Int_t iRej = atoi(strtok(NULL, ","));
+    
+    if ((iAcc == 0) && ((iRej+iAcc)>0))
+      iFilesEmpty++;
+  }
+
+  return iFilesEmpty;
+  
+}
index 07db470a1381b9c8110fba1b5843e7f6bf72b996..66f88f8eb2022b32ece071961d4de9165a74d8a1 100644 (file)
@@ -35,6 +35,8 @@ class AliESDInputHandler : public AliInputEventHandler {
     // Tag cut summary analysis
     Int_t                GetNEventAcceptedInFile();
     Int_t                GetNEventRejectedInFile();
+    Bool_t               GetCutSummaryForChain(Int_t *aTotal, Int_t *aAccepted, Int_t *aRejected);
+    Int_t                GetNFilesEmpty();
     // HLT analysis
     AliESDEvent         *GetHLTEvent()     const {return fHLTEvent;}
     TTree               *GetHLTTree()      const {return fHLTTree;}