totEt updates from Christine
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisTaskHadEt.cxx
CommitLineData
641e1e0c 1//Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2//University of Tennessee at Knoxville
3#include "TChain.h"
4#include "TTree.h"
5#include "TH1F.h"
6#include "TH2F.h"
7#include "TNtuple.h"
8#include "TCanvas.h"
9#include "TMath.h"
10#include "TObjArray.h"
11
12#include "AliAnalysisTask.h"
13#include "AliAnalysisManager.h"
14
15#include "AliESDEvent.h"
16#include "AliAODEvent.h"
17#include "AliVEvent.h"
18#include "AliVTrack.h"
19#include "AliVParticle.h"
20#include "AliESDtrack.h"
21#include "AliESDInputHandler.h"
22#include "AliMCEvent.h"
23#include "AliMCParticle.h"
24#include "TDatabasePDG.h"
25#include "AliAnalysisTaskHadEt.h"
26
27#include <iostream>
28#include "AliStack.h"
29
30using namespace std;
31
32ClassImp(AliAnalysisTaskHadEt)
33
34
35
36//________________________________________________________________________
37AliAnalysisTaskHadEt::AliAnalysisTaskHadEt(const char *name) :
38 AliAnalysisTaskSE(name)
39 ,fESD(0)
40 ,fOutputList(0)
41 ,fRecAnalysis(0)
42 ,fMCAnalysis(0)
43 ,fHistEtRecvsEtMC(0)
44 ,fTriggerSelection(false)
45 ,fCount(0)
46 ,fkPhotonPdg(22)
47 ,fkProtonMass(.938)
48 ,fPdgDB(0)
49 ,fRecEventVars(0)
50 ,fSimEventVars(0)
51 ,esdtrackCutsITSTPC(0)
52 ,esdtrackCutsTPC(0)
53 ,esdtrackCutsITS(0)
54{
55 // Constructor
56
57 fRecAnalysis = new AliAnalysisHadEtReconstructed();
58 fRecAnalysis->Init();
59 fMCAnalysis = new AliAnalysisHadEtMonteCarlo();
60 fMCAnalysis->Init();
61 if(!fPdgDB) fPdgDB = new TDatabasePDG();
62
63 fTriggerSelection = false;
64 fCount = 0;
65
66 // Define input and output slots here
67 // Input slot #0 works with a TChain
68 DefineInput(0, TChain::Class());
69 // Output slot #1 writes into a TH1 container
70
71 DefineOutput(1, TList::Class());
72
73}
74
75
76//________________________________________________________________________
77void AliAnalysisTaskHadEt::UserCreateOutputObjects()
78{
79 // Create histograms
80 // Called once
81 fOutputList = new TList;
82 fMCAnalysis->SetHistoList(fOutputList);
83 fRecAnalysis->SetHistoList(fOutputList);
84 fMCAnalysis->CreateHistograms();
85 fRecAnalysis->CreateHistograms();
86 fRecAnalysis->FillOutputList();
87 fMCAnalysis->FillOutputList();
88
89
90 Bool_t selectPrimaries=kTRUE;
91 esdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selectPrimaries);
92 esdtrackCutsITSTPC->SetName("fEsdTrackCuts");
93 esdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
94 esdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly");
95 //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required
96 esdtrackCutsITS = new AliESDtrackCuts;
97 esdtrackCutsITS->SetName("fEsdTrackCutsITS");
98 esdtrackCutsITS->SetRequireITSRefit(kTRUE);
99 esdtrackCutsITS->SetRequireITSStandAlone(kTRUE);
100 esdtrackCutsITS->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
101 esdtrackCutsITS->SetMaxDCAToVertexXYPtDep("0.0350+0.0420/pt^0.9");
102 esdtrackCutsITS->SetMaxDCAToVertexZ(1.e6);
103 esdtrackCutsITS->SetDCAToVertex2D(kFALSE);
104 esdtrackCutsITS->SetRequireSigmaToVertex(kFALSE);
105 esdtrackCutsITS->SetAcceptKinkDaughters(kFALSE);
106
107 fOutputList->Add(esdtrackCutsITSTPC);
108 fOutputList->Add(esdtrackCutsTPC);
109 fOutputList->Add(esdtrackCutsITS);
110 if(esdtrackCutsITSTPC && esdtrackCutsTPC){
111 fRecAnalysis->SetITSTrackCuts( GetITSTrackCuts());
112 fMCAnalysis->SetITSTrackCuts( GetITSTrackCuts());
113 fRecAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
114 fMCAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
115 fRecAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
116 fMCAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
117 //add ITS stuff!
118 }
119 else{
120 Printf("Error: no track cuts!");
121 }
122
123}
124
125//________________________________________________________________________
126void AliAnalysisTaskHadEt::UserExec(Option_t *)
127{
128 AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
129if (!event) {
130 Printf("ERROR: Could not retrieve event");
131 return;
132 }
133
134fRecAnalysis->AnalyseEvent(event);
135
136AliMCEvent* mcEvent = MCEvent();
137if (mcEvent)
138 {
139 ((AliAnalysisHadEtMonteCarlo*)fMCAnalysis)->AnalyseEvent((AliVEvent*)mcEvent,(AliVEvent*)event);
140 }
141
142// Post output data.
143PostData(1, fOutputList);
144
145}
146
147//________________________________________________________________________
148void AliAnalysisTaskHadEt::Terminate(Option_t *)
149{
150 // Draw result to the screen
151 // Called once at the end of the query
152
153 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
154 if (!fOutputList) {
155 printf("ERROR: Output list not available\n");
156 return;
157 }
158}
159
160