]>
Commit | Line | Data |
---|---|---|
e97ddc0e | 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 "AliESDCentrality.h" | |
8 | #include "AliESDEvent.h" | |
9 | #include "AliLog.h" | |
10 | #include <iostream> | |
11 | ||
12 | ClassImp(AliAnalysisTaskTransverseEnergy) | |
13 | ||
14 | AliAnalysisTaskTransverseEnergy::AliAnalysisTaskTransverseEnergy(const char* name, Bool_t isMc) : | |
15 | AliAnalysisTaskSE(name) | |
16 | ,fESDEvent(0) | |
17 | ,fMCConfigFile("ConfigEtMonteCarlo.C") | |
18 | ,fRecoConfigFile("ConfigEtReconstructed.C") | |
19 | ,fHistEtRecvsEtMC(0) | |
20 | ,fEsdtrackCutsITSTPC(0) | |
21 | ,fEsdtrackCutsTPC(0) | |
22 | ,fEsdtrackCutsITS(0) | |
23 | ,fOutputList(0) | |
24 | ,fPhysSelTaskName("selctionTask") | |
25 | ,fCentSelTaskName("centralityTask") | |
26 | ,fIsMc(isMc) | |
27 | ,fUsingDefaultSelection(true) | |
28 | ,fCurrentRunNumber(-1) | |
29 | ,fSelectionHandler(0) | |
30 | { | |
31 | // Constructor | |
32 | LoadPhysicsSelection("physicsSelections.root"); | |
33 | } | |
34 | ||
35 | AliAnalysisTaskTransverseEnergy::~AliAnalysisTaskTransverseEnergy() | |
36 | { | |
37 | // destructor | |
38 | } | |
39 | ||
40 | Int_t AliAnalysisTaskTransverseEnergy::CheckPhysicsSelection(Int_t runNumber) | |
41 | { | |
42 | // Check if the physics selection is valid, if not load a new one | |
43 | if (runNumber == fCurrentRunNumber || fIsMc) | |
44 | { | |
45 | return 0; | |
46 | } | |
47 | else | |
48 | { | |
49 | AliPhysicsSelection *selection = 0; | |
50 | AliPhysicsSelectionTask *physSelTask = dynamic_cast<AliPhysicsSelectionTask*>(AliAnalysisManager::GetAnalysisManager()->GetTasks()->At(0)); | |
51 | if (physSelTask) | |
52 | { | |
53 | ||
54 | if ((selection = fSelectionHandler->GetPhysicsSelection(runNumber))) | |
55 | { | |
56 | } | |
57 | else if ((selection = fSelectionHandler->GetDefaultPhysicsSelection())) | |
58 | { | |
59 | fUsingDefaultSelection = true; | |
60 | } | |
61 | else if ((selection = new AliPhysicsSelection())) | |
62 | { | |
63 | fUsingDefaultSelection = true; | |
64 | } | |
65 | else | |
66 | { | |
67 | AliError("Something went very wrong, not able to load/create new physics selection"); | |
68 | return -1; | |
69 | } | |
70 | } | |
71 | else | |
72 | { | |
73 | AliError("Could not get physics selection task from manager, undefined or no selection will be used"); | |
74 | return -1; | |
75 | } | |
76 | AliInfo("Changing the physics selection"); | |
77 | // The physics selection task has a bit weird implementation, setting the the physics selection will not update the handler, so we do it manually | |
78 | AliInputEventHandler* handler = dynamic_cast<AliInputEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
79 | physSelTask->SetPhysicsSelection(selection); | |
80 | handler->SetEventSelection(selection); | |
81 | fCurrentRunNumber = runNumber; | |
82 | ||
83 | } | |
84 | ||
85 | return 1; | |
86 | } | |
87 | ||
88 | Bool_t AliAnalysisTaskTransverseEnergy::IsPhysicsSelected() const | |
89 | { | |
90 | // See header file for class documentation | |
91 | if(fIsMc) return true; | |
92 | if(!fUsingDefaultSelection) return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kUserDefined); | |
93 | return (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); | |
94 | } | |
95 | ||
96 | Int_t AliAnalysisTaskTransverseEnergy::LoadPhysicsSelection(TString name) | |
97 | { | |
98 | // See header file for class documentation | |
99 | if(fIsMc) return 0; | |
100 | fSelectionHandler = new AliAnalysisEtSelectionHandler(name); | |
101 | if (!fSelectionHandler) return -1; | |
102 | return 0; | |
103 | } | |
104 | ||
105 | AliESDCentrality* AliAnalysisTaskTransverseEnergy::GetCentralityObject() | |
106 | { | |
107 | // See header file for class documentation | |
108 | if (fESDEvent)return fESDEvent->GetCentrality(); | |
109 | else return 0; | |
110 | } | |
111 | ||
112 |