1 #include "AliAnalysisTaskTransverseEnergy.h"
2 #include "AliAnalysisEtSelectionHandler.h"
3 #include "AliAnalysisManager.h"
4 #include "AliInputEventHandler.h"
5 #include "AliPhysicsSelectionTask.h"
6 #include "AliPhysicsSelection.h"
7 #include "AliCentrality.h"
8 #include "AliESDEvent.h"
10 //_________________________________________________________________________
11 // Utility Class for transverse energy studies
12 // Base class for Et tasks
13 // - reconstruction and MonteCarlo output
15 //*-- Authors: Oystein Djuvsland (Bergen)
16 //_________________________________________________________________________//
17 #include "AliESDtrackCuts.h"
23 ClassImp(AliAnalysisTaskTransverseEnergy)
25 AliAnalysisTaskTransverseEnergy::AliAnalysisTaskTransverseEnergy(const char* name, Bool_t isMc) :
26 AliAnalysisTaskSE(name)
28 ,fMCConfigFile("ConfigEtMonteCarlo.C")
29 ,fRecoConfigFile("ConfigEtReconstructed.C")
31 ,fHistEtRecOverEtMC(0)
32 ,fHistDiffEtRecEtMCOverEtMC(0)
33 ,fEsdtrackCutsITSTPC(0)
37 ,fPhysSelTaskName("selctionTask")
38 ,fCentSelTaskName("centralityTask")
40 ,fUsingDefaultSelection(true)
45 LoadPhysicsSelection("physicsSelections.root");
48 AliAnalysisTaskTransverseEnergy::~AliAnalysisTaskTransverseEnergy()
50 delete fHistEtRecvsEtMC;
51 delete fHistEtRecOverEtMC;
52 delete fEsdtrackCutsITSTPC;
53 delete fEsdtrackCutsTPC;
54 delete fEsdtrackCutsITS;
56 delete fSelectionHandler;
59 Int_t AliAnalysisTaskTransverseEnergy::CheckPhysicsSelection(Int_t runNumber)
61 // Check if the physics selection is valid, if not load a new one
63 if (runNumber == fCurrentRunNum || fIsMc)
69 AliPhysicsSelection *selection = 0;
70 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
72 AliError("Error: no analysis manager");
75 AliPhysicsSelectionTask *physSelTask = dynamic_cast<AliPhysicsSelectionTask*>(mgr->GetTask("AliPhysicsSelectionTask"));
79 if ((selection = fSelectionHandler->GetPhysicsSelection(runNumber)))
82 else if ((selection = fSelectionHandler->GetDefaultPhysicsSelection()))
84 fUsingDefaultSelection = true;
86 else if ((selection = new AliPhysicsSelection()))
88 fUsingDefaultSelection = true;
92 AliError("Something went very wrong, not able to load/create new physics selection");
98 AliError("Could not get physics selection task from manager, undefined or no selection will be used");
101 AliInfo("Changing the physics selection");
102 AliInputEventHandler* handler = dynamic_cast<AliInputEventHandler*> (mgr->GetInputEventHandler());
103 // The physics selection task has a bit weird implementation, setting the the physics selection will not update the handler, so we do it manually
105 AliError("Analysis manager does not exist!");
108 physSelTask->SetPhysicsSelection(selection);
109 handler->SetEventSelection(selection);
110 fCurrentRunNum = runNumber;
117 Bool_t AliAnalysisTaskTransverseEnergy::IsPhysicsSelected() const
119 // See header file for class documentation
120 if(fIsMc) return true;
121 if(!fUsingDefaultSelection) return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kUserDefined);
122 return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
125 Int_t AliAnalysisTaskTransverseEnergy::LoadPhysicsSelection(TString name)
127 // See header file for class documentation
129 fSelectionHandler = new AliAnalysisEtSelectionHandler(name);
130 if (!fSelectionHandler) return -1;
134 AliCentrality* AliAnalysisTaskTransverseEnergy::GetCentralityObject()
136 // See header file for class documentation
137 if (fESDEvent)return fESDEvent->GetCentrality();