Added method to compare two cuts objects
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisTaskHadEt.cxx
CommitLineData
cf6522d1 1//_________________________________________________________________________
2// Utility Class for transverse energy studies; charged hadrons
3// Task for analysis
4// - reconstruction and MC output
5// implementation file
6//
7//Created by Christine Nattrass, Rebecca Scott, Irakli Martashvili
641e1e0c 8//University of Tennessee at Knoxville
cf6522d1 9//_________________________________________________________________________
10
641e1e0c 11#include "TChain.h"
cf6522d1 12#include "TList.h"
641e1e0c 13#include "TH2F.h"
641e1e0c 14
15#include "AliESDEvent.h"
641e1e0c 16#include "AliMCEvent.h"
cf6522d1 17#include "AliESDtrackCuts.h"
18
641e1e0c 19#include "AliAnalysisTaskHadEt.h"
cf6522d1 20#include "AliAnalysisHadEtReconstructed.h"
21#include "AliAnalysisHadEtMonteCarlo.h"
641e1e0c 22
23#include <iostream>
641e1e0c 24
25using namespace std;
26
27ClassImp(AliAnalysisTaskHadEt)
28
29
30
31//________________________________________________________________________
32AliAnalysisTaskHadEt::AliAnalysisTaskHadEt(const char *name) :
33 AliAnalysisTaskSE(name)
641e1e0c 34 ,fOutputList(0)
35 ,fRecAnalysis(0)
36 ,fMCAnalysis(0)
37 ,fHistEtRecvsEtMC(0)
cf6522d1 38 ,fEsdtrackCutsITSTPC(0)
39 ,fEsdtrackCutsTPC(0)
40 ,fEsdtrackCutsITS(0)
641e1e0c 41{
42 // Constructor
43
44 fRecAnalysis = new AliAnalysisHadEtReconstructed();
45 fRecAnalysis->Init();
46 fMCAnalysis = new AliAnalysisHadEtMonteCarlo();
47 fMCAnalysis->Init();
641e1e0c 48
49 // Define input and output slots here
50 // Input slot #0 works with a TChain
51 DefineInput(0, TChain::Class());
52 // Output slot #1 writes into a TH1 container
53
54 DefineOutput(1, TList::Class());
55
56}
57
58
59//________________________________________________________________________
60void AliAnalysisTaskHadEt::UserCreateOutputObjects()
61{
62 // Create histograms
63 // Called once
64 fOutputList = new TList;
65 fMCAnalysis->SetHistoList(fOutputList);
66 fRecAnalysis->SetHistoList(fOutputList);
67 fMCAnalysis->CreateHistograms();
68 fRecAnalysis->CreateHistograms();
69 fRecAnalysis->FillOutputList();
70 fMCAnalysis->FillOutputList();
71
72
73 Bool_t selectPrimaries=kTRUE;
cf6522d1 74 fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2009(selectPrimaries);
75 fEsdtrackCutsITSTPC->SetName("fEsdTrackCuts");
76 fEsdtrackCutsTPC = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
77 fEsdtrackCutsTPC->SetName("fEsdTrackCutsTPCOnly");
641e1e0c 78 //ITS stand alone cuts - similar to 2009 cuts but with only ITS hits required
b64de20c 79 fEsdtrackCutsITS = AliESDtrackCuts::GetStandardITSPureSATrackCuts2009(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info
cf6522d1 80 fEsdtrackCutsITS->SetName("fEsdTrackCutsITS");
cf6522d1 81
82 fOutputList->Add(fEsdtrackCutsITSTPC);
83 fOutputList->Add(fEsdtrackCutsTPC);
84 fOutputList->Add(fEsdtrackCutsITS);
85 if(fEsdtrackCutsITSTPC && fEsdtrackCutsTPC){
641e1e0c 86 fRecAnalysis->SetITSTrackCuts( GetITSTrackCuts());
87 fMCAnalysis->SetITSTrackCuts( GetITSTrackCuts());
88 fRecAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
89 fMCAnalysis->SetTPCITSTrackCuts( GetTPCITSTrackCuts());
90 fRecAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
91 fMCAnalysis->SetTPCOnlyTrackCuts( GetTPCOnlyTrackCuts());
92 //add ITS stuff!
93 }
94 else{
95 Printf("Error: no track cuts!");
96 }
97
98}
99
100//________________________________________________________________________
101void AliAnalysisTaskHadEt::UserExec(Option_t *)
cf6522d1 102{ // execute method
641e1e0c 103 AliESDEvent *event = dynamic_cast<AliESDEvent*>(InputEvent());
104if (!event) {
105 Printf("ERROR: Could not retrieve event");
106 return;
107 }
108
109fRecAnalysis->AnalyseEvent(event);
110
111AliMCEvent* mcEvent = MCEvent();
112if (mcEvent)
113 {
114 ((AliAnalysisHadEtMonteCarlo*)fMCAnalysis)->AnalyseEvent((AliVEvent*)mcEvent,(AliVEvent*)event);
115 }
116
117// Post output data.
118PostData(1, fOutputList);
119
120}
121
122//________________________________________________________________________
123void AliAnalysisTaskHadEt::Terminate(Option_t *)
124{
125 // Draw result to the screen
126 // Called once at the end of the query
127
128 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
129 if (!fOutputList) {
130 printf("ERROR: Output list not available\n");
131 return;
132 }
133}
134
135