]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskEfficiencyBF.cxx
changes for Vertex and Tracks classes
[u/mrichter/AliRoot.git] / PWGCF / EBYE / BalanceFunctions / AliAnalysisTaskEfficiencyBF.cxx
index 5623f5181c5c63e1bf8017280f7a14925416b2fb..dbd02a48f00c2a3fd7e02a783376c2174861bee6 100644 (file)
@@ -16,6 +16,7 @@
 #include "AliESDInputHandler.h"
 #include "AliESDtrackCuts.h"
 #include "AliCentrality.h"
+#include "AliLog.h"
 
 #include "AliAnalysisTaskEfficiencyBF.h"
 
@@ -73,6 +74,11 @@ void AliAnalysisTaskEfficiencyBF::UserCreateOutputObjects() {
   // Create histograms
   // Called once
 
+  // global switch disabling the reference 
+  // (to avoid "Replacing existing TH1" if several wagons are created in train)
+  Bool_t oldStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+
   fQAList = new TList();
   fQAList->SetName("QAList");
   fQAList->SetOwner();
@@ -291,6 +297,9 @@ void AliAnalysisTaskEfficiencyBF::UserCreateOutputObjects() {
 
   PostData(1, fQAList);
   PostData(2, fOutputList);
+
+  TH1::AddDirectory(oldStatus);
+
 }
 
 //________________________________________________________________________
@@ -308,12 +317,12 @@ void AliAnalysisTaskEfficiencyBF::UserExec(Option_t *) {
   
   AliMCEvent* mcEvent = MCEvent();
   if (!mcEvent) {
-    Printf("ERROR: Could not retrieve MC event");
+    AliError("ERROR: Could not retrieve MC event");
     return;
   }
   AliStack* stack = mcEvent->Stack();
   if (!stack) {
-    Printf("ERROR: Could not retrieve MC stack");
+    AliError("ERROR: Could not retrieve MC stack");
     return;
   }
 
@@ -351,9 +360,9 @@ void AliAnalysisTaskEfficiencyBF::UserExec(Option_t *) {
        if(vertex->GetNContributors() > 0) {
          if(vertex->GetZRes() != 0) {
            fHistEventStats->Fill(3); //events with a proper vertex
-           if(TMath::Abs(vertex->GetXv()) < fVxMax) {
-             if(TMath::Abs(vertex->GetYv()) < fVyMax) {
-               if(TMath::Abs(vertex->GetZv()) < fVzMax) {
+           if(TMath::Abs(vertex->GetX()) < fVxMax) {
+             if(TMath::Abs(vertex->GetY()) < fVyMax) {
+               if(TMath::Abs(vertex->GetZ()) < fVzMax) {
                  fHistEventStats->Fill(4); //analyzed events
                  
                  Int_t nMCParticles = mcEvent->GetNumberOfTracks();
@@ -362,7 +371,7 @@ void AliAnalysisTaskEfficiencyBF::UserExec(Option_t *) {
                  for (Int_t iTracks = 0; iTracks < mcEvent->GetNumberOfTracks(); iTracks++) {
                    AliMCParticle *mcTrack = (AliMCParticle*) mcEvent->GetTrack(iTracks);
                    if (!mcTrack) {
-                     Printf("ERROR: Could not receive track %d (mc loop)", iTracks);
+                     AliError(Form("ERROR: Could not receive track %d (mc loop)", iTracks));
                      continue;
                    }
                    
@@ -472,11 +481,9 @@ void AliAnalysisTaskEfficiencyBF::UserExec(Option_t *) {
                    labelArray.AddAt(label,labelCounter);
                    labelCounter += 1;
 
-                   Bool_t iFound = kFALSE;
                    Int_t mcGoods = nMCLabelCounter;
                    for (Int_t k = 0; k < mcGoods; k++) {
                      Int_t mcLabel = labelMCArray.At(k);
-                     iFound = kFALSE;
                                              
                      if (mcLabel != TMath::Abs(label)) continue;
                      if(mcLabel != label) continue;