]>
Commit | Line | Data |
---|---|---|
cf6522d1 | 1 | //_________________________________________________________________________ |
2 | // Utility Class for transverse energy studies | |
3 | // Task for analysis | |
4 | // - reconstruction and MC output | |
5 | // implementation file | |
6 | // | |
7 | //*-- Authors: Oystein Djuvsland (Bergen), David Silvermyr (ORNL) | |
8 | //_________________________________________________________________________ | |
9 | ||
2fbf38ac | 10 | #include "TChain.h" |
cf6522d1 | 11 | #include "TList.h" |
2fbf38ac | 12 | #include "TH2F.h" |
2fbf38ac | 13 | |
14 | #include "AliESDEvent.h" | |
2fbf38ac | 15 | #include "AliMCEvent.h" |
b5821c13 | 16 | #include "AliESDtrackCuts.h" |
cf6522d1 | 17 | |
2fbf38ac | 18 | #include "AliAnalysisTaskTotEt.h" |
19 | #include "AliAnalysisEtReconstructedPhos.h" | |
20 | #include "AliAnalysisEtReconstructedEmcal.h" | |
21 | #include "AliAnalysisEtMonteCarloPhos.h" | |
22 | #include "AliAnalysisEtMonteCarloEmcal.h" | |
23 | ||
24 | #include <iostream> | |
2fbf38ac | 25 | |
26 | using namespace std; | |
27 | ||
28 | ClassImp(AliAnalysisTaskTotEt) | |
29 | ||
30 | //________________________________________________________________________ | |
31 | AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) : | |
32 | AliAnalysisTaskSE(name) | |
2fbf38ac | 33 | ,fOutputList(0) |
34 | ,fRecAnalysis(0) | |
35 | ,fMCAnalysis(0) | |
36 | ,fHistEtRecvsEtMC(0) | |
b5821c13 | 37 | ,fEsdtrackCutsTPC(0) |
2fbf38ac | 38 | { |
39 | // Constructor | |
40 | ||
41 | // select if we should use EMCal or PHOS class | |
42 | // PHOS by default, EMCal if name string contains EMC | |
43 | TString t(name); | |
44 | t.ToUpper(); | |
45 | if (t.Contains("EMC")) { | |
46 | fRecAnalysis = new AliAnalysisEtReconstructedEmcal(); | |
47 | fMCAnalysis = new AliAnalysisEtMonteCarloEmcal(); | |
48 | } | |
49 | else { | |
50 | fRecAnalysis = new AliAnalysisEtReconstructedPhos(); | |
51 | fMCAnalysis = new AliAnalysisEtMonteCarloPhos(); | |
52 | } | |
53 | ||
54 | fRecAnalysis->Init(); | |
55 | fMCAnalysis->Init(); | |
56 | ||
2fbf38ac | 57 | // Define input and output slots here |
58 | // Input slot #0 works with a TChain | |
59 | DefineInput(0, TChain::Class()); | |
60 | // Output slot #1 writes into a TH1 container | |
61 | ||
62 | DefineOutput(1, TList::Class()); | |
63 | ||
64 | } | |
65 | ||
66 | ||
67 | //________________________________________________________________________ | |
68 | void AliAnalysisTaskTotEt::UserCreateOutputObjects() | |
69 | { | |
70 | // Create histograms | |
71 | // Called once | |
72 | fMCAnalysis->CreateHistograms(); | |
73 | fRecAnalysis->CreateHistograms(); | |
74 | fOutputList = new TList; | |
75 | fRecAnalysis->FillOutputList(fOutputList); | |
76 | fMCAnalysis->FillOutputList(fOutputList); | |
77 | fHistEtRecvsEtMC = new TH2F("fHistEtRecvsEtMC", "Reconstructed E_{t} vs MC E_{t}", 1000, 0.000, 100, 1000, 0.0001, 100); | |
78 | fOutputList->Add(fHistEtRecvsEtMC); | |
b5821c13 | 79 | |
80 | ||
81 | fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
82 | fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly"); | |
83 | fOutputList->Add(fEsdtrackCutsTPC); | |
84 | if(fEsdtrackCutsTPC){ | |
85 | fRecAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts()); | |
86 | fMCAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts()); | |
87 | } | |
88 | else{ | |
89 | Printf("Error: no track cuts!"); | |
90 | } | |
91 | ||
2fbf38ac | 92 | } |
93 | ||
94 | //________________________________________________________________________ | |
95 | void AliAnalysisTaskTotEt::UserExec(Option_t *) | |
cf6522d1 | 96 | { // execute method |
97 | AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent()); | |
2fbf38ac | 98 | if (!event) { |
99 | Printf("ERROR: Could not retrieve event"); | |
100 | return; | |
101 | } | |
102 | ||
103 | fRecAnalysis->AnalyseEvent(event); | |
104 | ||
105 | AliMCEvent* mcEvent = MCEvent(); | |
106 | if (mcEvent) | |
107 | { | |
108 | fMCAnalysis->AnalyseEvent(mcEvent); | |
109 | } | |
110 | ||
111 | fHistEtRecvsEtMC->Fill(fRecAnalysis->GetTotEtAcc(), fMCAnalysis->GetTotEt()); | |
112 | ||
113 | // Post output data. | |
114 | PostData(1, fOutputList); | |
115 | ||
116 | } | |
117 | ||
118 | //________________________________________________________________________ | |
119 | void AliAnalysisTaskTotEt::Terminate(Option_t *) | |
120 | { | |
121 | // Draw result to the screen | |
122 | // Called once at the end of the query | |
123 | ||
124 | fOutputList = dynamic_cast<TList*> (GetOutputData(1)); | |
125 | if (!fOutputList) { | |
126 | printf("ERROR: Output list not available\n"); | |
127 | return; | |
128 | } | |
129 | } | |
130 | ||
131 | ||
132 |