]>
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 | //_________________________________________________________________________ | |
964c8159 | 9 | //Necessary to read config macros |
10 | #include <TROOT.h> | |
11 | #include <TSystem.h> | |
12 | #include <TInterpreter.h> | |
cf6522d1 | 13 | |
2fbf38ac | 14 | #include "TChain.h" |
cf6522d1 | 15 | #include "TList.h" |
2fbf38ac | 16 | #include "TH2F.h" |
2fbf38ac | 17 | |
18 | #include "AliESDEvent.h" | |
2fbf38ac | 19 | #include "AliMCEvent.h" |
b5821c13 | 20 | #include "AliESDtrackCuts.h" |
cf6522d1 | 21 | |
2fbf38ac | 22 | #include "AliAnalysisTaskTotEt.h" |
23 | #include "AliAnalysisEtReconstructedPhos.h" | |
24 | #include "AliAnalysisEtReconstructedEmcal.h" | |
25 | #include "AliAnalysisEtMonteCarloPhos.h" | |
26 | #include "AliAnalysisEtMonteCarloEmcal.h" | |
27 | ||
28 | #include <iostream> | |
2fbf38ac | 29 | |
30 | using namespace std; | |
31 | ||
32 | ClassImp(AliAnalysisTaskTotEt) | |
33 | ||
34 | //________________________________________________________________________ | |
35 | AliAnalysisTaskTotEt::AliAnalysisTaskTotEt(const char *name) : | |
36 | AliAnalysisTaskSE(name) | |
964c8159 | 37 | ,fMCConfigFile("ConfigEtMonteCarlo.C") |
38 | ,fRecoConfigFile("ConfigEtReconstructed.C") | |
2fbf38ac | 39 | ,fOutputList(0) |
40 | ,fRecAnalysis(0) | |
41 | ,fMCAnalysis(0) | |
42 | ,fHistEtRecvsEtMC(0) | |
964c8159 | 43 | ,fEsdtrackCutsITSTPC(0) |
b5821c13 | 44 | ,fEsdtrackCutsTPC(0) |
964c8159 | 45 | ,fEsdtrackCutsITS(0) |
2fbf38ac | 46 | { |
47 | // Constructor | |
48 | ||
49 | // select if we should use EMCal or PHOS class | |
50 | // PHOS by default, EMCal if name string contains EMC | |
51 | TString t(name); | |
52 | t.ToUpper(); | |
53 | if (t.Contains("EMC")) { | |
964c8159 | 54 | if (fMCConfigFile.Length()) { |
55 | cout<<"Rereading AliAnalysisEtMonteCarloEmcal configuration file..."<<endl; | |
56 | gROOT->LoadMacro(fMCConfigFile); | |
57 | fMCAnalysis = (AliAnalysisEtMonteCarloEmcal *) gInterpreter->ProcessLine("ConfigEtMonteCarlo()"); | |
58 | } | |
59 | ||
60 | if (fRecoConfigFile.Length()) { | |
61 | cout<<"Rereading AliAnalysisEtReconstructedEmcal configuration file..."<<endl; | |
62 | gROOT->LoadMacro(fRecoConfigFile); | |
63 | fRecAnalysis = (AliAnalysisEtReconstructedEmcal *) gInterpreter->ProcessLine("ConfigEtReconstructed()"); | |
64 | } | |
2fbf38ac | 65 | } |
964c8159 | 66 | else{ |
67 | if (fMCConfigFile.Length()) { | |
68 | cout<<"Rereading AliAnalysisEtMonteCarloPhos configuration file..."<<endl; | |
69 | gROOT->LoadMacro(fMCConfigFile); | |
70 | fMCAnalysis = (AliAnalysisEtMonteCarloPhos *) gInterpreter->ProcessLine("ConfigEtMonteCarlo()"); | |
71 | } | |
72 | ||
73 | if (fRecoConfigFile.Length()) { | |
74 | cout<<"Rereading AliAnalysisEtReconstructedPhos configuration file..."<<endl; | |
75 | gROOT->LoadMacro(fRecoConfigFile); | |
76 | fRecAnalysis = (AliAnalysisEtReconstructedPhos *) gInterpreter->ProcessLine("ConfigEtReconstructed()"); | |
77 | } | |
2fbf38ac | 78 | } |
2fbf38ac | 79 | // Define input and output slots here |
80 | // Input slot #0 works with a TChain | |
81 | DefineInput(0, TChain::Class()); | |
82 | // Output slot #1 writes into a TH1 container | |
83 | ||
84 | DefineOutput(1, TList::Class()); | |
85 | ||
86 | } | |
464aa50c | 87 | AliAnalysisTaskTotEt::~AliAnalysisTaskTotEt(){//Destructor |
951efd81 | 88 | fOutputList->Clear(); |
89 | delete fOutputList; | |
90 | delete fRecAnalysis; | |
91 | delete fMCAnalysis; | |
964c8159 | 92 | delete fEsdtrackCutsITSTPC; |
951efd81 | 93 | delete fEsdtrackCutsTPC; |
964c8159 | 94 | delete fEsdtrackCutsITS; |
951efd81 | 95 | } |
2fbf38ac | 96 | |
97 | //________________________________________________________________________ | |
98 | void AliAnalysisTaskTotEt::UserCreateOutputObjects() | |
99 | { | |
100 | // Create histograms | |
101 | // Called once | |
102 | fMCAnalysis->CreateHistograms(); | |
103 | fRecAnalysis->CreateHistograms(); | |
104 | fOutputList = new TList; | |
951efd81 | 105 | fOutputList->SetOwner(); |
2fbf38ac | 106 | fRecAnalysis->FillOutputList(fOutputList); |
107 | fMCAnalysis->FillOutputList(fOutputList); | |
108 | fHistEtRecvsEtMC = new TH2F("fHistEtRecvsEtMC", "Reconstructed E_{t} vs MC E_{t}", 1000, 0.000, 100, 1000, 0.0001, 100); | |
109 | fOutputList->Add(fHistEtRecvsEtMC); | |
b5821c13 | 110 | |
964c8159 | 111 | Bool_t selectPrimaries=kTRUE; |
112 | if(fRecAnalysis->DataSet()==2009){ | |
113 | cout<<"Setting track cuts for the 2009 p+p collisions at 900 GeV"<<endl; | |
114 | fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selectPrimaries); | |
115 | fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts"); | |
b5821c13 | 116 | fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); |
117 | fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly"); | |
964c8159 | 118 | //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required |
119 | fEsdtrackCutsITS = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info | |
120 | fEsdtrackCutsITS->SetName("fEsdTrackCutsITS"); | |
121 | } | |
122 | if(fRecAnalysis->DataSet()==2010){ | |
123 | //cout<<"Setting track cuts for the 2010 p+p collisions at 7 GeV"<<endl; | |
124 | cout<<"Warning: Have not set 2010 track cuts yet!!"<<endl; | |
125 | fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries); | |
126 | fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts"); | |
127 | fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
128 | fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly"); | |
129 | //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required | |
130 | fEsdtrackCutsITS = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info | |
131 | fEsdtrackCutsITS->SetName("fEsdTrackCutsITS"); | |
132 | } | |
133 | ||
134 | fOutputList->Add(fEsdtrackCutsITSTPC); | |
135 | fOutputList->Add(fEsdtrackCutsTPC); | |
136 | fOutputList->Add(fEsdtrackCutsITS); | |
137 | if(fEsdtrackCutsITSTPC && fEsdtrackCutsTPC){ | |
138 | fRecAnalysis->SetITSTrackCuts( GetITSTrackCuts()); | |
139 | fMCAnalysis->SetITSTrackCuts( GetITSTrackCuts()); | |
140 | fRecAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts()); | |
141 | fMCAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts()); | |
142 | fRecAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts()); | |
143 | fMCAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts()); | |
144 | //add ITS stuff! | |
145 | } | |
146 | else{ | |
147 | Printf("Error: no track cuts!"); | |
148 | } | |
b5821c13 | 149 | |
2fbf38ac | 150 | } |
151 | ||
152 | //________________________________________________________________________ | |
153 | void AliAnalysisTaskTotEt::UserExec(Option_t *) | |
cf6522d1 | 154 | { // execute method |
155 | AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent()); | |
2fbf38ac | 156 | if (!event) { |
157 | Printf("ERROR: Could not retrieve event"); | |
158 | return; | |
159 | } | |
160 | ||
161 | fRecAnalysis->AnalyseEvent(event); | |
162 | ||
163 | AliMCEvent* mcEvent = MCEvent(); | |
164 | if (mcEvent) | |
165 | { | |
166 | fMCAnalysis->AnalyseEvent(mcEvent); | |
167 | } | |
168 | ||
169 | fHistEtRecvsEtMC->Fill(fRecAnalysis->GetTotEtAcc(), fMCAnalysis->GetTotEt()); | |
170 | ||
171 | // Post output data. | |
172 | PostData(1, fOutputList); | |
173 | ||
174 | } | |
175 | ||
176 | //________________________________________________________________________ | |
177 | void AliAnalysisTaskTotEt::Terminate(Option_t *) | |
178 | { | |
179 | // Draw result to the screen | |
180 | // Called once at the end of the query | |
181 | ||
182 | fOutputList = dynamic_cast<TList*> (GetOutputData(1)); | |
183 | if (!fOutputList) { | |
184 | printf("ERROR: Output list not available\n"); | |
185 | return; | |
186 | } | |
187 | } | |
188 | ||
189 | ||
190 |