]>
Commit | Line | Data |
---|---|---|
2fbf38ac | 1 | #include "TChain.h" |
2 | #include "TTree.h" | |
3 | #include "TH1F.h" | |
4 | #include "TH2F.h" | |
5 | #include "TNtuple.h" | |
6 | #include "TCanvas.h" | |
7 | #include "TMath.h" | |
8 | #include "TObjArray.h" | |
9 | ||
10 | #include "AliAnalysisTask.h" | |
11 | #include "AliAnalysisManager.h" | |
12 | ||
13 | #include "AliESDEvent.h" | |
14 | #include "AliAODEvent.h" | |
15 | #include "AliVEvent.h" | |
16 | #include "AliVTrack.h" | |
17 | #include "AliVParticle.h" | |
18 | #include "AliESDCaloCluster.h" | |
19 | #include "AliESDCaloCells.h" | |
20 | #include "AliESDtrack.h" | |
21 | #include "AliESDInputHandler.h" | |
22 | #include "AliMCEvent.h" | |
23 | #include "AliMCParticle.h" | |
24 | #include "TDatabasePDG.h" | |
25 | #include "AliAnalysisTaskTotEt.h" | |
26 | #include "AliAnalysisEtReconstructedPhos.h" | |
27 | #include "AliAnalysisEtReconstructedEmcal.h" | |
28 | #include "AliAnalysisEtMonteCarloPhos.h" | |
29 | #include "AliAnalysisEtMonteCarloEmcal.h" | |
30 | ||
31 | #include <iostream> | |
32 | #include "AliStack.h" | |
33 | ||
34 | using namespace std; | |
35 | ||
36 | ClassImp(AliAnalysisTaskTotEt) | |
37 | ||
38 | //________________________________________________________________________ | |
39 | AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) : | |
40 | AliAnalysisTaskSE(name) | |
41 | ,fESD(0) | |
42 | ,fOutputList(0) | |
43 | ,fRecAnalysis(0) | |
44 | ,fMCAnalysis(0) | |
45 | ,fHistEtRecvsEtMC(0) | |
46 | ,fTriggerSelection(false) | |
47 | ,fCount(0) | |
48 | ,fkPhotonPdg(22) | |
49 | ,fkProtonMass(.938) | |
50 | ,fPdgDB(0) | |
51 | ,fRecEventVars(0) | |
52 | ,fSimEventVars(0) | |
53 | ,fRecParticleArray(0) | |
54 | ,fSimParticleArray(0) | |
55 | { | |
56 | // Constructor | |
57 | ||
58 | // select if we should use EMCal or PHOS class | |
59 | // PHOS by default, EMCal if name string contains EMC | |
60 | TString t(name); | |
61 | t.ToUpper(); | |
62 | if (t.Contains("EMC")) { | |
63 | fRecAnalysis = new AliAnalysisEtReconstructedEmcal(); | |
64 | fMCAnalysis = new AliAnalysisEtMonteCarloEmcal(); | |
65 | } | |
66 | else { | |
67 | fRecAnalysis = new AliAnalysisEtReconstructedPhos(); | |
68 | fMCAnalysis = new AliAnalysisEtMonteCarloPhos(); | |
69 | } | |
70 | ||
71 | fRecAnalysis->Init(); | |
72 | fMCAnalysis->Init(); | |
73 | ||
74 | fPdgDB = new TDatabasePDG(); | |
75 | ||
76 | ||
77 | // Define input and output slots here | |
78 | // Input slot #0 works with a TChain | |
79 | DefineInput(0, TChain::Class()); | |
80 | // Output slot #1 writes into a TH1 container | |
81 | ||
82 | DefineOutput(1, TList::Class()); | |
83 | ||
84 | } | |
85 | ||
86 | ||
87 | //________________________________________________________________________ | |
88 | void AliAnalysisTaskTotEt::UserCreateOutputObjects() | |
89 | { | |
90 | // Create histograms | |
91 | // Called once | |
92 | fMCAnalysis->CreateHistograms(); | |
93 | fRecAnalysis->CreateHistograms(); | |
94 | fOutputList = new TList; | |
95 | fRecAnalysis->FillOutputList(fOutputList); | |
96 | fMCAnalysis->FillOutputList(fOutputList); | |
97 | fHistEtRecvsEtMC = new TH2F("fHistEtRecvsEtMC", "Reconstructed E_{t} vs MC E_{t}", 1000, 0.000, 100, 1000, 0.0001, 100); | |
98 | fOutputList->Add(fHistEtRecvsEtMC); | |
99 | } | |
100 | ||
101 | //________________________________________________________________________ | |
102 | void AliAnalysisTaskTotEt::UserExec(Option_t *) | |
103 | { | |
104 | AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent()); | |
105 | if (!event) { | |
106 | Printf("ERROR: Could not retrieve event"); | |
107 | return; | |
108 | } | |
109 | ||
110 | fRecAnalysis->AnalyseEvent(event); | |
111 | ||
112 | AliMCEvent* mcEvent = MCEvent(); | |
113 | if (mcEvent) | |
114 | { | |
115 | fMCAnalysis->AnalyseEvent(mcEvent); | |
116 | } | |
117 | ||
118 | fHistEtRecvsEtMC->Fill(fRecAnalysis->GetTotEtAcc(), fMCAnalysis->GetTotEt()); | |
119 | ||
120 | // Post output data. | |
121 | PostData(1, fOutputList); | |
122 | ||
123 | } | |
124 | ||
125 | //________________________________________________________________________ | |
126 | void AliAnalysisTaskTotEt::Terminate(Option_t *) | |
127 | { | |
128 | // Draw result to the screen | |
129 | // Called once at the end of the query | |
130 | ||
131 | fOutputList = dynamic_cast<TList*> (GetOutputData(1)); | |
132 | if (!fOutputList) { | |
133 | printf("ERROR: Output list not available\n"); | |
134 | return; | |
135 | } | |
136 | } | |
137 | ||
138 | ||
139 |