init mag. field for ESDs, not necessary in maker, needed in counter not clear why
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 1 Dec 2013 09:43:47 +0000 (09:43 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 1 Dec 2013 09:43:47 +0000 (09:43 +0000)
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.cxx
PWG/CaloTrackCorrBase/AliAnalysisTaskCounter.cxx

index 2e5f6e4..ce93783 100755 (executable)
 #include <cstdlib>
 
 // --- ROOT system ---
-#include "TClonesArray.h"
-#include "TList.h"
-#include "TH1F.h"
+#include <TClonesArray.h>
+#include <TList.h>
+#include <TH1F.h>
 //#include <TObjectTable.h>
+#include <TGeoGlobalMagField.h>
 
 //---- AliRoot system ----
 #include "AliAnalysisManager.h"
@@ -950,6 +951,10 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(Int_t iEntry, const char * currentFi
     isTrigger   = inputHandler->IsEventSelected() & fReader->GetEventTriggerMask();
   }
   
+  // Init mag field for tracks in case of ESDs, not really necessary
+  if (!TGeoGlobalMagField::Instance()->GetField() && ((AliESDEvent*) fReader->GetInputEvent()))
+    ((AliESDEvent*)fReader->GetInputEvent())->InitMagneticField();
+  
   //Loop on analysis algorithms
   
   if(fAnaDebug > 0 ) printf("*** Begin analysis *** \n");
index 332b79e..a9badc5 100644 (file)
@@ -46,6 +46,7 @@
 #include <TProfile2D.h>
 #include <TList.h>
 #include <TClonesArray.h>
+#include <TGeoGlobalMagField.h>
 #include "AliAODHeader.h"
 #include "AliTriggerAnalysis.h"
 #include "AliESDEvent.h"
@@ -216,6 +217,9 @@ void AliAnalysisTaskCounter::UserExec(Option_t *)
   AliESDEvent * esdevent = dynamic_cast<AliESDEvent*> (event);
   AliAODEvent * aodevent = dynamic_cast<AliAODEvent*> (event);
   
+  // Init mag field for tracks in case of ESDs, needed, not clear why
+  if (!TGeoGlobalMagField::Instance()->GetField() && esdevent) esdevent->InitMagneticField();
+
   TString triggerclasses = event->GetFiredTriggerClasses();
 
   //printf("Trigger class fired: %s \n",event->GetFiredTriggerClasses().Data());