9 #include "TLorentzVector.h"
11 #include "AliAnalysisTask.h"
12 #include "AliAnalysisManager.h"
14 #include "AliESDEvent.h"
15 #include "AliESDInputHandler.h"
16 #include "AliMCEventHandler.h"
17 #include "AliMCEvent.h"
20 #include "PWG2spectra/SPECTRA/AliProtonAnalysis.h"
21 #include "AliAnalysisTaskProtonsQA.h"
23 // Analysis task used for the QA of the (anti)proton analysis
24 // Author: Panos Cristakoglou
26 ClassImp(AliAnalysisTaskProtonsQA)
28 //________________________________________________________________________
29 AliAnalysisTaskProtonsQA::AliAnalysisTaskProtonsQA()
30 : AliAnalysisTask(), fESD(0), fMC(0),
31 fList(0), fAnalysis(0) {
36 //________________________________________________________________________
37 AliAnalysisTaskProtonsQA::AliAnalysisTaskProtonsQA(const char *name)
38 : AliAnalysisTask(name, ""), fESD(0), fMC(0),
39 fList(0), fAnalysis(0) {
42 // Define input and output slots here
43 // Input slot #0 works with a TChain
44 DefineInput(0, TChain::Class());
45 // Output slot #0 writes into a TList container
46 DefineOutput(0, TList::Class());
49 //________________________________________________________________________
50 void AliAnalysisTaskProtonsQA::ConnectInputData(Option_t *) {
51 // Connect ESD or AOD here
54 TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
56 Printf("ERROR: Could not read chain from input slot 0");
58 //tree->SetBranchStatus("*", kFALSE);
59 //tree->SetBranchStatus("Tracks.*", kTRUE);
61 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
64 Printf("ERROR: Could not get ESDInputHandler");
66 fESD = esdH->GetEvent();
69 AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
71 Printf("ERROR: Could not retrieve MC event handler");
77 //________________________________________________________________________
78 void AliAnalysisTaskProtonsQA::CreateOutputObjects() {
82 Double_t partFrac[5] = {0.01, 0.01, 0.85, 0.10, 0.05};
84 //proton analysis object
85 fAnalysis = new AliProtonAnalysis();
88 //Use of TPConly tracks
89 fAnalysis->SetQAYPtBins(10, -0.5, 0.5, 12, 0.5, 0.9); //TPC only
90 fAnalysis->UseTPCOnly();
91 fAnalysis->SetMinTPCClusters(50);
92 fAnalysis->SetMaxChi2PerTPCCluster(3.5);
93 fAnalysis->SetMaxCov11(2.0);
94 fAnalysis->SetMaxCov22(2.0);
95 fAnalysis->SetMaxCov33(0.5);
96 fAnalysis->SetMaxCov44(0.5);
97 fAnalysis->SetMaxCov55(2.0);
98 fAnalysis->SetMaxSigmaToVertexTPC(2.5);
99 fAnalysis->SetTPCRefit();
100 fAnalysis->SetTPCpid();
103 /*fAnalysis->SetQAYPtBins(20, -1.0, 1.0, 27, 0.4, 3.1); //combined tracking
104 fAnalysis->SetMinTPCClusters(50);
105 fAnalysis->SetMaxChi2PerTPCCluster(3.5);
106 fAnalysis->SetMaxCov11(2.0);
107 fAnalysis->SetMaxCov22(2.0);
108 fAnalysis->SetMaxCov33(0.5);
109 fAnalysis->SetMaxCov44(0.5);
110 fAnalysis->SetMaxCov55(2.0);
111 fAnalysis->SetMaxSigmaToVertexTPC(2.5);
112 fAnalysis->SetTPCRefit();
113 //ITS related cuts - to be used in the case of the analysis of global tracks
114 fAnalysis->SetMinITSClusters(5);
115 fAnalysis->SetITSRefit();
116 fAnalysis->SetESDpid();*/
118 fAnalysis->SetPriorProbabilities(partFrac);
121 fList = fAnalysis->GetGlobalQAList();
124 //________________________________________________________________________
125 void AliAnalysisTaskProtonsQA::Exec(Option_t *) {
127 // Called for each event
130 Printf("ERROR: fESD not available");
135 Printf("ERROR: Could not retrieve MC event");
139 AliStack* stack = fMC->Stack();
141 Printf("ERROR: Could not retrieve the stack");
145 fAnalysis->RunQA(stack, fESD);
151 //________________________________________________________________________
152 void AliAnalysisTaskProtonsQA::Terminate(Option_t *) {
153 // Draw result to the screen
154 // Called once at the end of the query
156 fList = dynamic_cast<TList*> (GetOutputData(0));
158 Printf("ERROR: fList not available");