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), fAOD(0), fMC(0), fAnalysisType("ESD"),
39 fList(0), fAnalysis(0),
40 fElectronFunction(0), fMuonFunction(0),
41 fPionFunction(0), fKaonFunction(0), fProtonFunction(0),
42 fFunctionUsed(kFALSE) {
45 // Define input and output slots here
46 // Input slot #0 works with a TChain
47 DefineInput(0, TChain::Class());
48 // Output slot #0 writes into a TList container
49 DefineOutput(0, TList::Class());
52 //________________________________________________________________________
53 void AliAnalysisTaskProtonsQA::ConnectInputData(Option_t *) {
54 // Connect ESD or AOD here
57 TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
59 Printf("ERROR: Could not read chain from input slot 0");
61 //tree->SetBranchStatus("*", kFALSE);
62 //tree->SetBranchStatus("Tracks.*", kTRUE);
64 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
67 Printf("ERROR: Could not get ESDInputHandler");
69 fESD = esdH->GetEvent();
72 AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
74 Printf("ERROR: Could not retrieve MC event handler");
80 //________________________________________________________________________
81 void AliAnalysisTaskProtonsQA::CreateOutputObjects() {
85 Double_t partFrac[5] = {0.01, 0.01, 0.85, 0.10, 0.05};
87 //proton analysis object
88 fAnalysis = new AliProtonAnalysis();
91 //Use of TPConly tracks
92 fAnalysis->SetQAYPtBins(10, -0.5, 0.5, 12, 0.5, 0.9); //TPC only
93 fAnalysis->UseTPCOnly();
94 fAnalysis->SetMinTPCClusters(50);
95 fAnalysis->SetMaxChi2PerTPCCluster(3.5);
96 fAnalysis->SetMaxCov11(2.0);
97 fAnalysis->SetMaxCov22(2.0);
98 fAnalysis->SetMaxCov33(0.5);
99 fAnalysis->SetMaxCov44(0.5);
100 fAnalysis->SetMaxCov55(2.0);
101 fAnalysis->SetMaxSigmaToVertexTPC(2.5);
102 fAnalysis->SetTPCRefit();
103 fAnalysis->SetTPCpid();
106 /*fAnalysis->SetQAYPtBins(20, -1.0, 1.0, 27, 0.4, 3.1); //combined tracking
107 fAnalysis->SetMinTPCClusters(50);
108 fAnalysis->SetMaxChi2PerTPCCluster(3.5);
109 fAnalysis->SetMaxCov11(2.0);
110 fAnalysis->SetMaxCov22(2.0);
111 fAnalysis->SetMaxCov33(0.5);
112 fAnalysis->SetMaxCov44(0.5);
113 fAnalysis->SetMaxCov55(2.0);
114 fAnalysis->SetMaxSigmaToVertexTPC(2.5);
115 fAnalysis->SetTPCRefit();
116 //ITS related cuts - to be used in the case of the analysis of global tracks
117 fAnalysis->SetMinITSClusters(5);
118 fAnalysis->SetITSRefit();
119 fAnalysis->SetESDpid();*/
121 fAnalysis->SetPriorProbabilities(partFrac);
124 fList = GetGlobalQAList();
127 //________________________________________________________________________
128 void AliAnalysisTaskProtonsQA::Exec(Option_t *) {
130 // Called for each event
133 Printf("ERROR: fESD not available");
138 Printf("ERROR: Could not retrieve MC event");
142 AliStack* stack = fMC->Stack();
144 Printf("ERROR: Could not retrieve the stack");
148 fAnalysis->RunQA(stack, fESD);
154 //________________________________________________________________________
155 void AliAnalysisTaskProtonsQA::Terminate(Option_t *) {
156 // Draw result to the screen
157 // Called once at the end of the query
159 fList = dynamic_cast<TList*> (GetOutputData(0));
161 Printf("ERROR: fList not available");