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 ,fHistEtRecOverEtMC(0)
30 ,fHistDiffEtRecEtMCOverEtMC(0)
31 ,fEsdtrackCutsITSTPC(0)
35 ,fPhysSelTaskName("selctionTask")
36 ,fCentSelTaskName("centralityTask")
38 ,fUsingDefaultSelection(true)
43 LoadPhysicsSelection("physicsSelections.root");
46 AliAnalysisTaskTransverseEnergy::~AliAnalysisTaskTransverseEnergy()
48 delete fHistEtRecvsEtMC;
49 delete fHistEtRecOverEtMC;
50 delete fEsdtrackCutsITSTPC;
51 delete fEsdtrackCutsTPC;
52 delete fEsdtrackCutsITS;
54 delete fSelectionHandler;
57 Int_t AliAnalysisTaskTransverseEnergy::CheckPhysicsSelection(Int_t runNumber)
59 // Check if the physics selection is valid, if not load a new one
61 if (runNumber == fCurrentRunNum || fIsMc)
67 AliPhysicsSelection *selection = 0;
68 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
70 AliError("Error: no analysis manager");
73 AliPhysicsSelectionTask *physSelTask = dynamic_cast<AliPhysicsSelectionTask*>(mgr->GetTask("AliPhysicsSelectionTask"));
77 if ((selection = fSelectionHandler->GetPhysicsSelection(runNumber)))
80 else if ((selection = fSelectionHandler->GetDefaultPhysicsSelection()))
82 fUsingDefaultSelection = true;
84 else if ((selection = new AliPhysicsSelection()))
86 fUsingDefaultSelection = true;
90 AliError("Something went very wrong, not able to load/create new physics selection");
96 AliError("Could not get physics selection task from manager, undefined or no selection will be used");
99 AliInfo("Changing the physics selection");
100 AliInputEventHandler* handler = dynamic_cast<AliInputEventHandler*> (mgr->GetInputEventHandler());
101 // The physics selection task has a bit weird implementation, setting the the physics selection will not update the handler, so we do it manually
103 AliError("Analysis manager does not exist!");
106 physSelTask->SetPhysicsSelection(selection);
107 handler->SetEventSelection(selection);
108 fCurrentRunNum = runNumber;
115 Bool_t AliAnalysisTaskTransverseEnergy::IsPhysicsSelected() const
117 // See header file for class documentation
118 if(fIsMc) return true;
119 if(!fUsingDefaultSelection) return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kUserDefined);
120 return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
123 Int_t AliAnalysisTaskTransverseEnergy::LoadPhysicsSelection(TString name)
125 // See header file for class documentation
127 fSelectionHandler = new AliAnalysisEtSelectionHandler(name);
128 if (!fSelectionHandler) return -1;
132 AliCentrality* AliAnalysisTaskTransverseEnergy::GetCentralityObject()
134 // See header file for class documentation
135 if (fESDEvent)return fESDEvent->GetCentrality();