]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDv0Monitor.cxx
fixed bugs with the rule checker.
[u/mrichter/AliRoot.git] / PWG1 / TRD / AliTRDv0Monitor.cxx
CommitLineData
0ed6f095 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercialf purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16/////////////////////////////////////////////////////
17//
18// Monitor V0 for TRD
19//
20// Authors:
21// Markus Heide <mheide@uni-muenster.de>
22//////////////////////////////////////////////////////
dea861a3 23
24//#include "TPDGCode.h"
25/*#include "TFile.h"
0ed6f095 26#include "TTree.h"
dea861a3 27#include "TEventList.h"*/
0ed6f095 28#include "TObjArray.h"
29#include "TH2.h"
30#include "TH2F.h"
31#include "TH1I.h"
fa6441b5 32#include "TCanvas.h"
dea861a3 33// #include "TPad.h"
34// #include "TLegend.h"
0ed6f095 35
36#include "AliLog.h"
37#include "AliESDtrack.h"
38#include "AliPID.h"
39#include "AliTRDv0Monitor.h"
40#include "info/AliTRDv0Info.h"
41
42
43ClassImp(AliTRDv0Monitor)
44
45//________________________________________________________________________
46AliTRDv0Monitor::AliTRDv0Monitor()
47 :AliTRDrecoTask()
dea861a3 48 ,fhQualityReductions(NULL)
49 ,fV0s(NULL)
50 ,fData(NULL)
51 ,fInfo(NULL)
52 ,fP(-1.)
0ed6f095 53{
54 //
55 // Default constructor
56 //
4fa7d600 57 SetNameTitle("TRDv0Monitor", "V0 Monitor for TRD PID");
0ed6f095 58}
59
60//________________________________________________________________________
4fa7d600 61AliTRDv0Monitor::AliTRDv0Monitor(const char *name)
62 :AliTRDrecoTask(name, "V0 Monitor for TRD PID")
dea861a3 63 ,fhQualityReductions(NULL)
64 ,fV0s(NULL)
65 ,fData(NULL)
66 ,fInfo(NULL)
67 ,fP(-1.)
0ed6f095 68{
69 //
70 // Default constructor
71 //
72 DefineInput(2, TObjArray::Class()); // v0 list
73 DefineInput(3, TObjArray::Class()); // pid info list
0ed6f095 74}
75
76
dea861a3 77
fa6441b5 78//____________________________________________________________________
79void AliTRDv0Monitor::MakeSummary(){
80 TCanvas *cOut = new TCanvas("v0MonitorSummary1", "Summary 1 for task V0Monitor", 1024, 768);
81 cOut->cd();
82 //GetRefFigure(4);
83 cOut->SaveAs("V0MonitorSummary.gif");
84
85 cOut = new TCanvas("v0MonitorSummary2","Summary 2 for task V0Monitor", 1024, 768);
86 cOut->cd();
87 //GetRefFigure(5);
88 cOut->SaveAs("V0MonitorSummary2.gif");
89}
129a3fe2 90
91//________________________________________________________________________
92Bool_t AliTRDv0Monitor::GetRefFigure(Int_t /*ifig*/)
93{
dea861a3 94
129a3fe2 95 AliInfo("Implementation on going ...");
96 return kTRUE;
97}
98
0ed6f095 99//________________________________________________________________________
068e2c00 100TObjArray* AliTRDv0Monitor::Histos()
0ed6f095 101{
102 // Create histograms
103 // Called once
104
068e2c00 105 if(fContainer) return fContainer;
0ed6f095 106
068e2c00 107 fContainer = new TObjArray(kNPlots);
108 fContainer->SetName("V0Monitoring");
109
110 const char *samplename[AliPID::kSPECIES] = {"electrons","muons","pions","kaons","protons"};
111 const char *decayname[AliTRDv0Info::kNDecays] = {"gamma","K0s","Lambda","AntiLambda"};
112 const char *detectorname[kNDets] = {"ITS","TPC","TOF"};
113
114 fhQualityReductions = new TH1I(Form("fhQualityReductions"),Form("Number of tracks cut out by different quality cut steps"),11,-9,2);
115 fContainer->Add(fhQualityReductions);
116
117 for(Int_t ipart = 0;ipart < AliPID::kSPECIES; ipart++){
118 fhCutReductions[ipart] = new TH1I(Form("fhCutReductions_%s",samplename[ipart]),Form("Number of tracks cut out by different cut steps for %s",samplename[ipart]),19,-17,2);
119 fContainer->Add(fhCutReductions[ipart]);
120 for(Int_t idetector = 0; idetector < kNDets; idetector++){
121 fhDetPID[idetector][ipart] = new TH2F(Form("fhDetector_%s_%s",detectorname[idetector],samplename[ipart]),Form("%s Likelihood for %s vs. momentum",detectorname[idetector], samplename[ipart]),100,0.,10.,100, 0., 1.);
122
123 fContainer->Add(fhDetPID[idetector][ipart]);
124 }
125 fhComPID[ipart] = new TH2F(Form("fhComPID_%s",samplename[ipart]),Form("Combined TPC/TOF PID: Likelihood for %s",samplename[ipart]),100,0.,10.,100,0.,1.);
126
dea861a3 127 fContainer->Add(fhComPID[ipart]);
128
129 for(Int_t cutstep = 0; cutstep < kNCutSteps; cutstep++){
130 fhTPCdEdx[ipart][cutstep] = new TH2F(Form("fhTPCdEdx_%s_[%d]",samplename[ipart],cutstep),Form("TPC dE/dx for %s [%d]",samplename[ipart],cutstep),100,0.,10.,300,0.,300.);
131
132 fContainer->Add(fhTPCdEdx[ipart][cutstep]);
133 }
dea861a3 134 }
068e2c00 135
136 for(Int_t iDecay = 0; iDecay < AliTRDv0Info::kNDecays; iDecay++){
137 for(Int_t cutstep =0; cutstep < kNCutSteps; cutstep++){
138 fhV0Chi2ndf[iDecay][cutstep] = new TH2F(Form("fhV0Chi2ndf_%s_[%d]",decayname[iDecay],cutstep),Form("Chi2/NDF vs. momentum"),100,0.,10.,500, 0., 500.);
139
140 fContainer->Add(fhV0Chi2ndf[iDecay][cutstep]);
141
142 fhPsiPair[iDecay][cutstep] = new TH2F(Form("fhV0PsiPair_%s_[%d]",decayname[iDecay],cutstep),Form("Psi_pair vs. momentum"),100,0.,10.,200, 0., 1.6);
143
144 fContainer->Add(fhPsiPair[iDecay][cutstep]);
145
146 fhPointAngle[iDecay][cutstep] = new TH2F(Form("fhPointAngle_%s_[%d]",decayname[iDecay],cutstep),Form("Pointing Angle vs. momentum"),100,0.,10.,500, 0., 1.6);
147 fContainer->Add(fhPointAngle[iDecay][cutstep]);
148
149 fhDCA[iDecay][cutstep] = new TH2F(Form("fhDCA_%s_[%d]",decayname[iDecay],cutstep),Form("V0 Daughter DCA vs. momentum"),100,0.,10.,500, 0., 1.);
150
151 fContainer->Add(fhDCA[iDecay][cutstep]);
152
153 fhOpenAngle[iDecay][cutstep] = new TH2F(Form("fhOpenAngle_%s_[%d]",decayname[iDecay],cutstep),Form("Opening Angle vs. momentum"),100,0.,10.,500, 0., 1.6);
154
155 fContainer->Add(fhOpenAngle[iDecay][cutstep]);
156
157 fhRadius[iDecay][cutstep] = new TH2F(Form("fhRadius_%s_[%d]",decayname[iDecay],cutstep),Form("V0 Generation Radius vs. momentum"),100,0.,10.,500, 0., 150.);
158
159 fContainer->Add(fhRadius[iDecay][cutstep]);
160 }
161
162 fhInvMass[iDecay] = new TH2F(Form("fhInvMass_%s",decayname[iDecay]),Form("Invariant Mass vs. momentum"),100,0.,10.,500, 0., 2.);
163
164 fContainer->Add(fhInvMass[iDecay]);
165 }
dea861a3 166
167/*TH1F *hV0mcPID[AliPID::kSPECIES][AliPID::kSPECIES];
168 Int_t nPBins = 200;
169
170
171
172 for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++){
173 for(Int_t iSample = 0; iSample < AliPID::kSPECIES; iSample++){
174
175 fhV0mcPID[iSample][iSpecies] = new TH1F(Form("fhV0mcPID_%s_is_%s",name[iSample],name[iSpecies]),Form("%s contained in %s sample",name[iSpecies],name[iSample]), nPBins, 0.2, 13.);
176 }
177 }*/
068e2c00 178
179 return fContainer;
0ed6f095 180}
068e2c00 181
182
0ed6f095 183//________________________________________________________________________
184void AliTRDv0Monitor::UserExec(Option_t *)
185{
186 // Main loop
187 // Called for each event
188
189 if(!(fTracks = dynamic_cast<TObjArray*>(GetInputData(1)))) return;
190 if(!(fV0s = dynamic_cast<TObjArray*>(GetInputData(2)))) return;
191 if(!(fInfo = dynamic_cast<TObjArray*>(GetInputData(3)))) return;
192
193
194 AliTRDtrackInfo *track = NULL;
195 AliTRDv0Info *v0(NULL);
196
dea861a3 197
0ed6f095 198
199 for(Int_t itrk=0; itrk<fTracks->GetEntriesFast(); itrk++){
200 track = (AliTRDtrackInfo*)fTracks->UncheckedAt(itrk);
201 for(Int_t iv(0); iv<fV0s->GetEntriesFast(); iv++){
202 if(!(v0 = (AliTRDv0Info*)fV0s->At(iv))) continue;
203 if(!v0->HasTrack(track)) continue;
204 ULong_t status = track->GetStatus();
205 if(!(status&AliESDtrack::kTRDpid)) continue;
206
fa6441b5 207 fhQualityReductions->Fill(v0->fQuality);//fills integer codes for tracks cut out by track/V0 quality cuts
0ed6f095 208
068e2c00 209 if(!(v0->fQuality == 1)) continue;
0ed6f095 210
211 for(Int_t part = 0; part < AliPID::kSPECIES; part++){
068e2c00 212 fhCutReductions[part]->Fill(v0->GetPID(part,track));//fill in numbers of tracks eliminated by different PID cuts
0ed6f095 213 }
214
dea861a3 215
0ed6f095 216 for(Int_t idecay(0), part(-1); idecay < AliTRDv0Info::kNDecays; idecay++){//loop over decay types considered for reference data
068e2c00 217 if(idecay == AliTRDv0Info::kLambda){ //protons and pions from Lambda
218 part = AliPID::kProton;
219 } else if(idecay == AliTRDv0Info::kAntiLambda) { //antiprotons and pions from Anti-Lambda
220 part = AliPID::kProton;
221 } else if(idecay == AliTRDv0Info::kK0s) {//pions from K0s
222 part = AliPID::kPion;
223 } else if(idecay == AliTRDv0Info::kGamma) {//electrons from conversions
224 part = AliPID::kElectron;
225 }
226
227 //fill histograms with track/V0 quality cuts only
228 fhPsiPair[idecay][0]->Fill(v0->fV0Momentum,v0->fPsiPair);//Angle between daughter momentum plane and plane perpendicular to magnetic field
229 fhInvMass[idecay]->Fill(v0->fV0Momentum,v0->fInvMass[idecay]);//Invariant mass
230 fhPointAngle[idecay][0]->Fill(v0->fV0Momentum,v0->fPointingAngle);// = TMath::ACos(esdv0->GetV0CosineOfPointingAngle()); // Cosine of pointing angle
231 fhOpenAngle[idecay][0]->Fill(v0->fV0Momentum,v0->fOpenAngle);// opening angle between daughters
232 fhDCA[idecay][0]->Fill(v0->fV0Momentum,v0->fDCA);// Distance of closest approach of daughter tracks
233 fhV0Chi2ndf[idecay][0]->Fill(v0->fV0Momentum,v0->fChi2ndf[idecay]);//Kalman Filter Chi2/NDF
234 fhRadius[idecay][0]->Fill(v0->fV0Momentum,v0->fRadius);//distance of decay/conversion from primary vertex in x-y plane
235
236 if(v0->HasTrack(track) == -1){
237 fhTPCdEdx[part][0]->Fill(v0->fTrackN->P(),v0->fTPCdEdx[AliTRDv0Info::kNeg]);//TPC dE/dx for negative track
238 } else if(v0->HasTrack(track) == 1){
239 fhTPCdEdx[part][0]->Fill(v0->fTrackP->P(),v0->fTPCdEdx[AliTRDv0Info::kPos]);//TPC dE/dx for positive track
240 }
241
242 //fill histograms after invariant mass cuts
243 if((v0->fInvMass[idecay] < v0->fUpInvMass[idecay][0])&&(v0->fInvMass[idecay]> v0->fDownInvMass[idecay])){
244 fhV0Chi2ndf[idecay][1]->Fill(v0->fV0Momentum,v0->fChi2ndf[idecay]);
245 fhPsiPair[idecay][1]->Fill(v0->fV0Momentum,v0->fPsiPair);
246 fhPointAngle[idecay][1]->Fill(v0->fV0Momentum,v0->fPointingAngle);
247 fhOpenAngle[idecay][1]->Fill(v0->fV0Momentum,v0->fOpenAngle);
248 fhDCA[idecay][1]->Fill(v0->fV0Momentum,v0->fDCA);
249 fhRadius[idecay][1]->Fill(v0->fV0Momentum,v0->fRadius);
250 if(v0->HasTrack(track) == -1)
251 fhTPCdEdx[part][1]->Fill(v0->fTrackN->P(),v0->fTPCdEdx[AliTRDv0Info::kNeg]);
252 else if(v0->HasTrack(track) == 1)
253 fhTPCdEdx[part][1]->Fill(v0->fTrackP->P(),v0->fTPCdEdx[AliTRDv0Info::kPos]);
254
255 }
256
257 //fill histograms after all reference selection cuts
258 if(v0->GetPID(part,track)==1){
259 fhV0Chi2ndf[idecay][2]->Fill(v0->fV0Momentum,v0->fChi2ndf[idecay]);
260 fhPsiPair[idecay][2]->Fill(v0->fV0Momentum,v0->fPsiPair);
261 fhPointAngle[idecay][2]->Fill(v0->fV0Momentum,v0->fPointingAngle);
262 fhOpenAngle[idecay][2]->Fill(v0->fV0Momentum,v0->fOpenAngle);
263 fhDCA[idecay][2]->Fill(v0->fV0Momentum,v0->fDCA);
264 fhRadius[idecay][2]->Fill(v0->fV0Momentum,v0->fRadius);
265 if(v0->HasTrack(track) == -1)
266 fhTPCdEdx[part][2]->Fill(v0->fTrackN->P(),v0->fTPCdEdx[AliTRDv0Info::kNeg]);
267 else if(v0->HasTrack(track) == 1)
268 fhTPCdEdx[part][2]->Fill(v0->fTrackP->P(),v0->fTPCdEdx[AliTRDv0Info::kPos]);
269 }
dea861a3 270 }
271 }
272 }
dea861a3 273}