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"
9 //_________________________________________________________________________
10 // Utility Class for transverse energy studies
11 // Base class for Et tasks
12 // - reconstruction and MonteCarlo output
14 //*-- Authors: Oystein Djuvsland (Bergen)
15 //_________________________________________________________________________//
16 #include "AliESDtrackCuts.h"
21 ClassImp(AliAnalysisTaskTransverseEnergy)
23 AliAnalysisTaskTransverseEnergy::AliAnalysisTaskTransverseEnergy(const char* name, Bool_t isMc) :
24 AliAnalysisTaskSE(name)
26 ,fMCConfigFile("ConfigEtMonteCarlo.C")
27 ,fRecoConfigFile("ConfigEtReconstructed.C")
29 ,fEsdtrackCutsITSTPC(0)
33 ,fPhysSelTaskName("selctionTask")
34 ,fCentSelTaskName("centralityTask")
36 ,fUsingDefaultSelection(true)
41 LoadPhysicsSelection("physicsSelections.root");
44 AliAnalysisTaskTransverseEnergy::~AliAnalysisTaskTransverseEnergy()
46 delete fHistEtRecvsEtMC;
47 delete fEsdtrackCutsITSTPC;
48 delete fEsdtrackCutsTPC;
49 delete fEsdtrackCutsITS;
51 delete fSelectionHandler;
54 Int_t AliAnalysisTaskTransverseEnergy::CheckPhysicsSelection(Int_t runNumber)
56 // Check if the physics selection is valid, if not load a new one
57 if (runNumber == fCurrentRunNum || fIsMc)
63 AliPhysicsSelection *selection = 0;
64 AliPhysicsSelectionTask *physSelTask = dynamic_cast<AliPhysicsSelectionTask*>(AliAnalysisManager::GetAnalysisManager()->GetTasks()->At(0));
68 if ((selection = fSelectionHandler->GetPhysicsSelection(runNumber)))
71 else if ((selection = fSelectionHandler->GetDefaultPhysicsSelection()))
73 fUsingDefaultSelection = true;
75 else if ((selection = new AliPhysicsSelection()))
77 fUsingDefaultSelection = true;
81 AliError("Something went very wrong, not able to load/create new physics selection");
87 AliError("Could not get physics selection task from manager, undefined or no selection will be used");
90 AliInfo("Changing the physics selection");
91 // The physics selection task has a bit weird implementation, setting the the physics selection will not update the handler, so we do it manually
92 if(!AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()){
93 AliError("Analysis manager does not exist!");
96 AliInputEventHandler* handler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
97 physSelTask->SetPhysicsSelection(selection);
98 handler->SetEventSelection(selection);
99 fCurrentRunNum = runNumber;
106 Bool_t AliAnalysisTaskTransverseEnergy::IsPhysicsSelected() const
108 // See header file for class documentation
109 if(fIsMc) return true;
110 if(!fUsingDefaultSelection) return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kUserDefined);
111 return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
114 Int_t AliAnalysisTaskTransverseEnergy::LoadPhysicsSelection(TString name)
116 // See header file for class documentation
118 fSelectionHandler = new AliAnalysisEtSelectionHandler(name);
119 if (!fSelectionHandler) return -1;
123 AliCentrality* AliAnalysisTaskTransverseEnergy::GetCentralityObject()
125 // See header file for class documentation
126 if (fESDEvent)return fESDEvent->GetCentrality();