]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDv0Monitor.cxx
fix codding convention violations (Markus H & Alex B)
[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//////////////////////////////////////////////////////
64d57299 23
0ed6f095 24#include "TObjArray.h"
25#include "TH2.h"
26#include "TH2F.h"
27#include "TH1I.h"
fa6441b5 28#include "TCanvas.h"
0ed6f095 29
30#include "AliLog.h"
31#include "AliESDtrack.h"
32#include "AliPID.h"
33#include "AliTRDv0Monitor.h"
34#include "info/AliTRDv0Info.h"
35
36
37ClassImp(AliTRDv0Monitor)
38
39//________________________________________________________________________
40AliTRDv0Monitor::AliTRDv0Monitor()
41 :AliTRDrecoTask()
dea861a3 42 ,fhQualityReductions(NULL)
43 ,fV0s(NULL)
44 ,fData(NULL)
45 ,fInfo(NULL)
46 ,fP(-1.)
0ed6f095 47{
48 //
49 // Default constructor
50 //
4fa7d600 51 SetNameTitle("TRDv0Monitor", "V0 Monitor for TRD PID");
0ed6f095 52}
53
54//________________________________________________________________________
4fa7d600 55AliTRDv0Monitor::AliTRDv0Monitor(const char *name)
56 :AliTRDrecoTask(name, "V0 Monitor for TRD PID")
dea861a3 57 ,fhQualityReductions(NULL)
58 ,fV0s(NULL)
59 ,fData(NULL)
60 ,fInfo(NULL)
61 ,fP(-1.)
0ed6f095 62{
63 //
64 // Default constructor
65 //
66 DefineInput(2, TObjArray::Class()); // v0 list
67 DefineInput(3, TObjArray::Class()); // pid info list
0ed6f095 68}
69
70
dea861a3 71
fa6441b5 72//____________________________________________________________________
64d57299 73void AliTRDv0Monitor::MakeSummary(){//makes a summary with potentially nice reference figures
74 //TCanvas *cOut = new TCanvas("v0MonitorSummary1", "Summary 1 for task V0Monitor", 1024, 768);
75 //cOut->cd();
fa6441b5 76 //GetRefFigure(4);
64d57299 77 //cOut->SaveAs("V0MonitorSummary.gif");
fa6441b5 78
64d57299 79 //cOut = new TCanvas("v0MonitorSummary2","Summary 2 for task V0Monitor", 1024, 768);
80 //cOut->cd();
fa6441b5 81 //GetRefFigure(5);
64d57299 82 //cOut->SaveAs("V0MonitorSummary2.gif");
fa6441b5 83}
129a3fe2 84
85//________________________________________________________________________
86Bool_t AliTRDv0Monitor::GetRefFigure(Int_t /*ifig*/)
87{
64d57299 88 //creating reference figures
dea861a3 89
129a3fe2 90 AliInfo("Implementation on going ...");
91 return kTRUE;
92}
93
0ed6f095 94//________________________________________________________________________
068e2c00 95TObjArray* AliTRDv0Monitor::Histos()
0ed6f095 96{
97 // Create histograms
98 // Called once
068e2c00 99 if(fContainer) return fContainer;
0ed6f095 100
068e2c00 101 fContainer = new TObjArray(kNPlots);
102 fContainer->SetName("V0Monitoring");
103
104 const char *samplename[AliPID::kSPECIES] = {"electrons","muons","pions","kaons","protons"};
105 const char *decayname[AliTRDv0Info::kNDecays] = {"gamma","K0s","Lambda","AntiLambda"};
106 const char *detectorname[kNDets] = {"ITS","TPC","TOF"};
107
108 fhQualityReductions = new TH1I(Form("fhQualityReductions"),Form("Number of tracks cut out by different quality cut steps"),11,-9,2);
109 fContainer->Add(fhQualityReductions);
110
111 for(Int_t ipart = 0;ipart < AliPID::kSPECIES; ipart++){
112 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);
113 fContainer->Add(fhCutReductions[ipart]);
114 for(Int_t idetector = 0; idetector < kNDets; idetector++){
115 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.);
116
117 fContainer->Add(fhDetPID[idetector][ipart]);
118 }
119 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.);
120
dea861a3 121 fContainer->Add(fhComPID[ipart]);
122
123 for(Int_t cutstep = 0; cutstep < kNCutSteps; cutstep++){
124 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.);
125
126 fContainer->Add(fhTPCdEdx[ipart][cutstep]);
127 }
dea861a3 128 }
068e2c00 129
130 for(Int_t iDecay = 0; iDecay < AliTRDv0Info::kNDecays; iDecay++){
131 for(Int_t cutstep =0; cutstep < kNCutSteps; cutstep++){
132 fhV0Chi2ndf[iDecay][cutstep] = new TH2F(Form("fhV0Chi2ndf_%s_[%d]",decayname[iDecay],cutstep),Form("Chi2/NDF vs. momentum"),100,0.,10.,500, 0., 500.);
133
134 fContainer->Add(fhV0Chi2ndf[iDecay][cutstep]);
135
136 fhPsiPair[iDecay][cutstep] = new TH2F(Form("fhV0PsiPair_%s_[%d]",decayname[iDecay],cutstep),Form("Psi_pair vs. momentum"),100,0.,10.,200, 0., 1.6);
137
138 fContainer->Add(fhPsiPair[iDecay][cutstep]);
139
140 fhPointAngle[iDecay][cutstep] = new TH2F(Form("fhPointAngle_%s_[%d]",decayname[iDecay],cutstep),Form("Pointing Angle vs. momentum"),100,0.,10.,500, 0., 1.6);
141 fContainer->Add(fhPointAngle[iDecay][cutstep]);
142
143 fhDCA[iDecay][cutstep] = new TH2F(Form("fhDCA_%s_[%d]",decayname[iDecay],cutstep),Form("V0 Daughter DCA vs. momentum"),100,0.,10.,500, 0., 1.);
144
145 fContainer->Add(fhDCA[iDecay][cutstep]);
146
147 fhOpenAngle[iDecay][cutstep] = new TH2F(Form("fhOpenAngle_%s_[%d]",decayname[iDecay],cutstep),Form("Opening Angle vs. momentum"),100,0.,10.,500, 0., 1.6);
148
149 fContainer->Add(fhOpenAngle[iDecay][cutstep]);
150
151 fhRadius[iDecay][cutstep] = new TH2F(Form("fhRadius_%s_[%d]",decayname[iDecay],cutstep),Form("V0 Generation Radius vs. momentum"),100,0.,10.,500, 0., 150.);
152
153 fContainer->Add(fhRadius[iDecay][cutstep]);
154 }
155
156 fhInvMass[iDecay] = new TH2F(Form("fhInvMass_%s",decayname[iDecay]),Form("Invariant Mass vs. momentum"),100,0.,10.,500, 0., 2.);
157
158 fContainer->Add(fhInvMass[iDecay]);
159 }
dea861a3 160
161/*TH1F *hV0mcPID[AliPID::kSPECIES][AliPID::kSPECIES];
162 Int_t nPBins = 200;
163
164
165
166 for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++){
167 for(Int_t iSample = 0; iSample < AliPID::kSPECIES; iSample++){
168
169 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.);
170 }
171 }*/
068e2c00 172
173 return fContainer;
0ed6f095 174}
068e2c00 175
176
0ed6f095 177//________________________________________________________________________
178void AliTRDv0Monitor::UserExec(Option_t *)
179{
180 // Main loop
181 // Called for each event
0ed6f095 182 if(!(fTracks = dynamic_cast<TObjArray*>(GetInputData(1)))) return;
183 if(!(fV0s = dynamic_cast<TObjArray*>(GetInputData(2)))) return;
184 if(!(fInfo = dynamic_cast<TObjArray*>(GetInputData(3)))) return;
185
186
187 AliTRDtrackInfo *track = NULL;
188 AliTRDv0Info *v0(NULL);
189
0ed6f095 190 for(Int_t itrk=0; itrk<fTracks->GetEntriesFast(); itrk++){
191 track = (AliTRDtrackInfo*)fTracks->UncheckedAt(itrk);
192 for(Int_t iv(0); iv<fV0s->GetEntriesFast(); iv++){
193 if(!(v0 = (AliTRDv0Info*)fV0s->At(iv))) continue;
194 if(!v0->HasTrack(track)) continue;
195 ULong_t status = track->GetStatus();
196 if(!(status&AliESDtrack::kTRDpid)) continue;
197
64d57299 198 fhQualityReductions->Fill(v0->GetQuality());//fills integer codes for tracks cut out by track/V0 quality cuts
0ed6f095 199
64d57299 200 if(!(v0->GetQuality() == 1)) continue;
0ed6f095 201
202 for(Int_t part = 0; part < AliPID::kSPECIES; part++){
068e2c00 203 fhCutReductions[part]->Fill(v0->GetPID(part,track));//fill in numbers of tracks eliminated by different PID cuts
0ed6f095 204 }
205
dea861a3 206
0ed6f095 207 for(Int_t idecay(0), part(-1); idecay < AliTRDv0Info::kNDecays; idecay++){//loop over decay types considered for reference data
068e2c00 208 if(idecay == AliTRDv0Info::kLambda){ //protons and pions from Lambda
209 part = AliPID::kProton;
210 } else if(idecay == AliTRDv0Info::kAntiLambda) { //antiprotons and pions from Anti-Lambda
211 part = AliPID::kProton;
212 } else if(idecay == AliTRDv0Info::kK0s) {//pions from K0s
213 part = AliPID::kPion;
214 } else if(idecay == AliTRDv0Info::kGamma) {//electrons from conversions
215 part = AliPID::kElectron;
216 }
217
218 //fill histograms with track/V0 quality cuts only
64d57299 219 fhPsiPair[idecay][0]->Fill(v0->GetV0Momentum(),v0->GetPsiPair());//Angle between daughter momentum plane and plane perpendicular to magnetic field
220 fhInvMass[idecay]->Fill(v0->GetV0Momentum(),v0->GetInvMass(idecay));//Invariant mass
221 fhPointAngle[idecay][0]->Fill(v0->GetV0Momentum(),v0->GetPointingAngle());// = TMath::ACos(esdv0->GetV0CosineOfPointingAngle()); // Cosine of pointing angle
222 fhOpenAngle[idecay][0]->Fill(v0->GetV0Momentum(),v0->GetOpenAngle());// opening angle between daughters
223 fhDCA[idecay][0]->Fill(v0->GetV0Momentum(),v0->GetDCA());// Distance of closest approach of daughter tracks
224 fhV0Chi2ndf[idecay][0]->Fill(v0->GetV0Momentum(),v0->GetChi2ndf(idecay));//Kalman Filter Chi2/NDF
225 fhRadius[idecay][0]->Fill(v0->GetV0Momentum(),v0->GetRadius());//distance of decay/conversion from primary vertex in x-y plane
068e2c00 226
227 if(v0->HasTrack(track) == -1){
64d57299 228 fhTPCdEdx[part][0]->Fill(v0->GetV0Daughter(-1)->P(),v0->GetTPCdEdx(AliTRDv0Info::kNeg));//TPC dE/dx for negative track
068e2c00 229 } else if(v0->HasTrack(track) == 1){
64d57299 230 fhTPCdEdx[part][0]->Fill(v0->GetV0Daughter(1)->P(),v0->GetTPCdEdx(AliTRDv0Info::kPos));//TPC dE/dx for positive track
068e2c00 231 }
232
233 //fill histograms after invariant mass cuts
64d57299 234 if((v0->GetInvMass(idecay) < v0->GetUpInvMass(idecay,0))&&(v0->GetInvMass(idecay)> v0->GetDownInvMass(idecay))){
235 fhV0Chi2ndf[idecay][1]->Fill(v0->GetV0Momentum(),v0->GetChi2ndf(idecay));
236 fhPsiPair[idecay][1]->Fill(v0->GetV0Momentum(),v0->GetPsiPair());
237 fhPointAngle[idecay][1]->Fill(v0->GetV0Momentum(),v0->GetPointingAngle());
238 fhOpenAngle[idecay][1]->Fill(v0->GetV0Momentum(),v0->GetOpenAngle());
239 fhDCA[idecay][1]->Fill(v0->GetV0Momentum(),v0->GetDCA());
240 fhRadius[idecay][1]->Fill(v0->GetV0Momentum(),v0->GetRadius());
068e2c00 241 if(v0->HasTrack(track) == -1)
64d57299 242 fhTPCdEdx[part][1]->Fill(v0->GetV0Daughter(-1)->P(),v0->GetTPCdEdx(AliTRDv0Info::kNeg));
068e2c00 243 else if(v0->HasTrack(track) == 1)
64d57299 244 fhTPCdEdx[part][1]->Fill(v0->GetV0Daughter(1)->P(),v0->GetTPCdEdx(AliTRDv0Info::kPos));
068e2c00 245
246 }
247
248 //fill histograms after all reference selection cuts
249 if(v0->GetPID(part,track)==1){
64d57299 250 fhV0Chi2ndf[idecay][2]->Fill(v0->GetV0Momentum(),v0->GetChi2ndf(idecay));
251 fhPsiPair[idecay][2]->Fill(v0->GetV0Momentum(),v0->GetPsiPair());
252 fhPointAngle[idecay][2]->Fill(v0->GetV0Momentum(),v0->GetPointingAngle());
253 fhOpenAngle[idecay][2]->Fill(v0->GetV0Momentum(),v0->GetOpenAngle());
254 fhDCA[idecay][2]->Fill(v0->GetV0Momentum(),v0->GetDCA());
255 fhRadius[idecay][2]->Fill(v0->GetV0Momentum(),v0->GetRadius());
068e2c00 256 if(v0->HasTrack(track) == -1)
64d57299 257 fhTPCdEdx[part][2]->Fill(v0->GetV0Daughter(-1)->P(),v0->GetTPCdEdx(AliTRDv0Info::kNeg));
068e2c00 258 else if(v0->HasTrack(track) == 1)
64d57299 259 fhTPCdEdx[part][2]->Fill(v0->GetV0Daughter(1)->P(),v0->GetTPCdEdx(AliTRDv0Info::kPos));
068e2c00 260 }
dea861a3 261 }
262 }
263 }
dea861a3 264}