]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/AliAnalysisTaskProtonsQA.cxx
New check for bad SDD modules (F. Prino)
[u/mrichter/AliRoot.git] / PWG2 / AliAnalysisTaskProtonsQA.cxx
CommitLineData
7b59a00b 1#include "TChain.h"
2#include "TTree.h"
3#include "TString.h"
4#include "TList.h"
5#include "TH2F.h"
6#include "TH1I.h"
7#include "TF1.h"
8#include "TCanvas.h"
9#include "TLorentzVector.h"
10
11#include "AliAnalysisTask.h"
12#include "AliAnalysisManager.h"
13
14#include "AliESDEvent.h"
15#include "AliESDInputHandler.h"
16#include "AliMCEventHandler.h"
17#include "AliMCEvent.h"
18#include "AliStack.h"
19
20#include "PWG2spectra/SPECTRA/AliProtonAnalysis.h"
21#include "AliAnalysisTaskProtonsQA.h"
22
23// Analysis task used for the QA of the (anti)proton analysis
24// Author: Panos Cristakoglou
25
26ClassImp(AliAnalysisTaskProtonsQA)
27
28//________________________________________________________________________
29AliAnalysisTaskProtonsQA::AliAnalysisTaskProtonsQA()
30 : AliAnalysisTask(), fESD(0), fMC(0),
31 fList(0), fAnalysis(0) {
32 //Dummy constructor
33
34}
35
36//________________________________________________________________________
37AliAnalysisTaskProtonsQA::AliAnalysisTaskProtonsQA(const char *name)
f99662ca 38: AliAnalysisTask(name, ""), fESD(0), fMC(0),
39 fList(0), fAnalysis(0) {
7b59a00b 40 // Constructor
41
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());
47}
48
49//________________________________________________________________________
50void AliAnalysisTaskProtonsQA::ConnectInputData(Option_t *) {
51 // Connect ESD or AOD here
52 // Called once
53
54 TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
55 if (!tree) {
56 Printf("ERROR: Could not read chain from input slot 0");
57 } else {
58 //tree->SetBranchStatus("*", kFALSE);
59 //tree->SetBranchStatus("Tracks.*", kTRUE);
60
61 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
62
63 if (!esdH) {
64 Printf("ERROR: Could not get ESDInputHandler");
65 } else
66 fESD = esdH->GetEvent();
67 }
68
69 AliMCEventHandler* mcH = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
70 if (!mcH) {
71 Printf("ERROR: Could not retrieve MC event handler");
72 }
73 else
74 fMC = mcH->MCEvent();
75}
76
77//________________________________________________________________________
78void AliAnalysisTaskProtonsQA::CreateOutputObjects() {
79 // Create histograms
80 // Called once
81 //Prior probabilities
82 Double_t partFrac[5] = {0.01, 0.01, 0.85, 0.10, 0.05};
83
84 //proton analysis object
85 fAnalysis = new AliProtonAnalysis();
86 fAnalysis->SetQAOn();
87
3a954fe7 88 //Use of TPConly tracks
88c900f2 89 /*fAnalysis->SetQAYPtBins(10, -0.5, 0.5, 12, 0.5, 0.9); //TPC only
7b59a00b 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();
88c900f2 100 fAnalysis->SetTPCpid();*/
7b59a00b 101
102 //Combined tracking
88c900f2 103 fAnalysis->SetQAYPtBins(20, -1.0, 1.0, 27, 0.4, 3.1); //combined tracking
7b59a00b 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();
88c900f2 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();
7b59a00b 117
24421eb6 118 fAnalysis->InitQA();
7b59a00b 119 fAnalysis->SetPriorProbabilities(partFrac);
120
121 fList = new TList();
f99662ca 122 fList = fAnalysis->GetGlobalQAList();
7b59a00b 123}
124
125//________________________________________________________________________
126void AliAnalysisTaskProtonsQA::Exec(Option_t *) {
127 // Main loop
128 // Called for each event
129
130 if (!fESD) {
131 Printf("ERROR: fESD not available");
132 return;
133 }
134
135 if (!fMC) {
136 Printf("ERROR: Could not retrieve MC event");
137 return;
138 }
139
140 AliStack* stack = fMC->Stack();
141 if (!stack) {
142 Printf("ERROR: Could not retrieve the stack");
143 return;
144 }
145
146 fAnalysis->RunQA(stack, fESD);
147
148 // Post output data.
149 PostData(0, fList);
150}
151
152//________________________________________________________________________
153void AliAnalysisTaskProtonsQA::Terminate(Option_t *) {
154 // Draw result to the screen
155 // Called once at the end of the query
156
157 fList = dynamic_cast<TList*> (GetOutputData(0));
158 if (!fList) {
159 Printf("ERROR: fList not available");
160 return;
161 }
162}
163
164