]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/AliTRDv0Monitor.cxx
new V0 Monitoring task (Markus Heide)
[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//////////////////////////////////////////////////////
23
24#include "TPDGCode.h"
25#include "TFile.h"
26#include "TTree.h"
27#include "TEventList.h"
28#include "TObjArray.h"
29#include "TH2.h"
30#include "TH2F.h"
31#include "TH1I.h"
32#include "TList.h"
33
34#include "AliLog.h"
35#include "AliESDtrack.h"
36#include "AliPID.h"
37#include "AliTRDv0Monitor.h"
38#include "info/AliTRDv0Info.h"
39
40
41ClassImp(AliTRDv0Monitor)
42
43//________________________________________________________________________
44AliTRDv0Monitor::AliTRDv0Monitor()
45 :AliTRDrecoTask()
46 ,fOutput(NULL)
47 ,hQualityReductions(NULL)
48 ,fV0s(NULL)
49 ,fData(NULL)
50 ,fInfo(NULL)
51 ,fP(-1.)
52{
53 //
54 // Default constructor
55 //
56 SetNameTitle("v0Monitor", "Reference V0 Monitor");
57}
58
59//________________________________________________________________________
60AliTRDv0Monitor::AliTRDv0Monitor(const char *name, const char *title)
61 :AliTRDrecoTask(name, title)
62 ,fOutput(NULL)
63 ,hQualityReductions(NULL)
64 ,fV0s(NULL)
65 ,fData(NULL)
66 ,fInfo(NULL)
67 ,fP(-1.)
68{
69 //
70 // Default constructor
71 //
72 DefineInput(2, TObjArray::Class()); // v0 list
73 DefineInput(3, TObjArray::Class()); // pid info list
74 DefineOutput(1, TList::Class());
75
76}
77
78
79//________________________________________________________________________
80AliTRDv0Monitor::~AliTRDv0Monitor()
81{
82 if(fOutput) delete fOutput;
83}
84//________________________________________________________________________
85void AliTRDv0Monitor::UserCreateOutputObjects()
86{
87 // Create histograms
88 // Called once
89
90
91 fOutput = new TList;
92 fOutput->SetName("V0Monitoring");
93
94
95 const char *samplename[AliPID::kSPECIES] = {"electrons","muons","pions","kaons","protons"};
96 const char *decayname[AliTRDv0Info::kNDecays] = {"gamma","K0s","Lambda","AntiLambda"};
97 const char *detectorname[kNDets] = {"ITS","TPC","TOF"};
98
99 hQualityReductions = new TH1I(Form("hQualityReductions"),Form("Number of tracks cut out by different quality cut steps"),11,-9,2);
100 fOutput->Add(hQualityReductions);
101
102 for(Int_t ipart = 0;ipart < AliPID::kSPECIES; ipart++){
103 hCutReductions[ipart] = new TH1I(Form("hCutReductions_%s",samplename[ipart]),Form("Number of tracks cut out by different cut steps for %s",samplename[ipart]),19,-17,2);
104 fOutput->Add(hCutReductions[ipart]);
105 for(Int_t idetector = 0; idetector < kNDets; idetector++){
106 hDetPID[idetector][ipart] = new TH2F(Form("hDetector_%s_%s",detectorname[idetector],samplename[ipart]),Form("%s Likelihood for %s vs. momentum",detectorname[idetector], samplename[ipart]),100,0.,10.,100, 0., 1.);
107
108 fOutput->Add(hDetPID[idetector][ipart]);
109 }
110 hComPID[ipart] = new TH2F(Form("hComPID_%s",samplename[ipart]),Form("Combined TPC/TOF PID: Likelihood for %s",samplename[ipart]),100,0.,10.,100,0.,1.);
111
112 fOutput->Add(hComPID[ipart]);
113
114 for(Int_t cutstep = 0; cutstep < kNCutSteps; cutstep++){
115 hTPCdEdx[ipart][cutstep] = new TH2F(Form("hTPCdEdx_%s_[%d]",samplename[ipart],cutstep),Form("TPC dE/dx for %s [%d]",samplename[ipart],cutstep),100,0.,10.,300,0.,300.);
116
117 fOutput->Add(hTPCdEdx[ipart][cutstep]);
118 }
119 }
120
121 for(Int_t iDecay = 0; iDecay < AliTRDv0Info::kNDecays; iDecay++){
122 for(Int_t cutstep =0; cutstep < kNCutSteps; cutstep++){
123 hV0Chi2ndf[iDecay][cutstep] = new TH2F(Form("hV0Chi2ndf_%s_[%d]",decayname[iDecay],cutstep),Form("Chi2/NDF vs. momentum"),100,0.,10.,500, 0., 500.);
124
125 fOutput->Add(hV0Chi2ndf[iDecay][cutstep]);
126
127 hPsiPair[iDecay][cutstep] = new TH2F(Form("hV0PsiPair_%s_[%d]",decayname[iDecay],cutstep),Form("Psi_pair vs. momentum"),100,0.,10.,200, 0., 1.6);
128
129 fOutput->Add(hPsiPair[iDecay][cutstep]);
130
131 hPointAngle[iDecay][cutstep] = new TH2F(Form("hPointAngle_%s_[%d]",decayname[iDecay],cutstep),Form("Pointing Angle vs. momentum"),100,0.,10.,500, 0., 1.6);
132 fOutput->Add(hPointAngle[iDecay][cutstep]);
133
134 hDCA[iDecay][cutstep] = new TH2F(Form("hDCA_%s_[%d]",decayname[iDecay],cutstep),Form("V0 Daughter DCA vs. momentum"),100,0.,10.,500, 0., 1.);
135
136 fOutput->Add(hDCA[iDecay][cutstep]);
137
138 hOpenAngle[iDecay][cutstep] = new TH2F(Form("hOpenAngle_%s_[%d]",decayname[iDecay],cutstep),Form("Opening Angle vs. momentum"),100,0.,10.,500, 0., 1.6);
139
140 fOutput->Add(hOpenAngle[iDecay][cutstep]);
141
142 hRadius[iDecay][cutstep] = new TH2F(Form("hRadius_%s_[%d]",decayname[iDecay],cutstep),Form("V0 Generation Radius vs. momentum"),100,0.,10.,500, 0., 150.);
143
144 fOutput->Add(hRadius[iDecay][cutstep]);
145
146
147
148
149 }
150
151 hInvMass[iDecay] = new TH2F(Form("hInvMass_%s",decayname[iDecay]),Form("Invariant Mass vs. momentum"),100,0.,10.,500, 0., 2.);
152
153 fOutput->Add(hInvMass[iDecay]);
154
155 }
156
157 /*TH1F *hV0mcPID[AliPID::kSPECIES][AliPID::kSPECIES];
158 Int_t nPBins = 200;
159
160
161
162 for(Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++){
163 for(Int_t iSample = 0; iSample < AliPID::kSPECIES; iSample++){
164
165 hV0mcPID[iSample][iSpecies] = new TH1F(Form("hV0mcPID_%s_is_%s",name[iSample],name[iSpecies]),Form("%s contained in %s sample",name[iSpecies],name[iSample]), nPBins, 0.2, 13.);
166 }
167 }*/
168}
169//________________________________________________________________________
170void AliTRDv0Monitor::UserExec(Option_t *)
171{
172 // Main loop
173 // Called for each event
174
175 if(!(fTracks = dynamic_cast<TObjArray*>(GetInputData(1)))) return;
176 if(!(fV0s = dynamic_cast<TObjArray*>(GetInputData(2)))) return;
177 if(!(fInfo = dynamic_cast<TObjArray*>(GetInputData(3)))) return;
178
179
180 AliTRDtrackInfo *track = NULL;
181 AliTRDv0Info *v0(NULL);
182
183
184
185 for(Int_t itrk=0; itrk<fTracks->GetEntriesFast(); itrk++){
186 track = (AliTRDtrackInfo*)fTracks->UncheckedAt(itrk);
187 for(Int_t iv(0); iv<fV0s->GetEntriesFast(); iv++){
188 if(!(v0 = (AliTRDv0Info*)fV0s->At(iv))) continue;
189 if(!v0->HasTrack(track)) continue;
190 ULong_t status = track->GetStatus();
191 if(!(status&AliESDtrack::kTRDpid)) continue;
192
193 hQualityReductions->Fill(v0->fQuality);//fills integer codes for tracks cut out by track/V0 quality cuts
194
195 if(!(v0->fQuality == 1))continue;
196
197 for(Int_t part = 0; part < AliPID::kSPECIES; part++){
198 hCutReductions[part]->Fill(v0->GetPID(part,track));//fill in numbers of tracks eliminated by different PID cuts
199 }
200
201
202 for(Int_t idecay(0), part(-1); idecay < AliTRDv0Info::kNDecays; idecay++){//loop over decay types considered for reference data
203
204 if(idecay == AliTRDv0Info::kLambda){ //protons and pions from Lambda
205 part = AliPID::kProton;
206 } else if(idecay == AliTRDv0Info::kAntiLambda) { //antiprotons and pions from Anti-Lambda
207 part = AliPID::kProton;
208 } else if(idecay == AliTRDv0Info::kK0s) {//pions from K0s
209 part = AliPID::kPion;
210 } else if(idecay == AliTRDv0Info::kGamma) {//electrons from conversions
211 part = AliPID::kElectron;
212 }
213
214 //fill histograms with track/V0 quality cuts only
215 hPsiPair[idecay][0]->Fill(v0->fV0Momentum,v0->fPsiPair);//Angle between daughter momentum plane and plane perpendicular to magnetic field
216 hInvMass[idecay]->Fill(v0->fV0Momentum,v0->fInvMass[idecay]);//Invariant mass
217 hPointAngle[idecay][0]->Fill(v0->fV0Momentum,v0->fPointingAngle);// = TMath::ACos(esdv0->GetV0CosineOfPointingAngle()); // Cosine of pointing angle
218 hOpenAngle[idecay][0]->Fill(v0->fV0Momentum,v0->fOpenAngle);// opening angle between daughters
219 hDCA[idecay][0]->Fill(v0->fV0Momentum,v0->fDCA);// Distance of closest approach of daughter tracks
220 hV0Chi2ndf[idecay][0]->Fill(v0->fV0Momentum,v0->fChi2ndf[idecay]);//Kalman Filter Chi2/NDF
221 hRadius[idecay][0]->Fill(v0->fV0Momentum,v0->fRadius);//distance of decay/conversion from primary vertex in x-y plane
222
223 if(v0->HasTrack(track) == -1){
224 hTPCdEdx[part][0]->Fill(v0->fTrackN->P(),v0->fTPCdEdx[AliTRDv0Info::kNeg]);//TPC dE/dx for negative track
225 }
226 else if(v0->HasTrack(track) == 1){
227 hTPCdEdx[part][0]->Fill(v0->fTrackP->P(),v0->fTPCdEdx[AliTRDv0Info::kPos]);//TPC dE/dx for positive track
228 }
229 //fill histograms after invariant mass cuts
230 if((v0->fInvMass[idecay] < v0->fUpInvMass[idecay][0])&&(v0->fInvMass[idecay]> v0->fDownInvMass[idecay])){
231 hV0Chi2ndf[idecay][1]->Fill(v0->fV0Momentum,v0->fChi2ndf[idecay]);
232 hPsiPair[idecay][1]->Fill(v0->fV0Momentum,v0->fPsiPair);
233 hPointAngle[idecay][1]->Fill(v0->fV0Momentum,v0->fPointingAngle);
234 hOpenAngle[idecay][1]->Fill(v0->fV0Momentum,v0->fOpenAngle);
235 hDCA[idecay][1]->Fill(v0->fV0Momentum,v0->fDCA);
236 hRadius[idecay][1]->Fill(v0->fV0Momentum,v0->fRadius);
237 if(v0->HasTrack(track) == -1)
238 hTPCdEdx[part][1]->Fill(v0->fTrackN->P(),v0->fTPCdEdx[AliTRDv0Info::kNeg]);
239 else if(v0->HasTrack(track) == 1)
240 hTPCdEdx[part][1]->Fill(v0->fTrackP->P(),v0->fTPCdEdx[AliTRDv0Info::kPos]);
241
242 }
243
244 //fill histograms after all reference selection cuts
245 if(v0->GetPID(part,track)==1){
246 hV0Chi2ndf[idecay][2]->Fill(v0->fV0Momentum,v0->fChi2ndf[idecay]);
247 hPsiPair[idecay][2]->Fill(v0->fV0Momentum,v0->fPsiPair);
248 hPointAngle[idecay][2]->Fill(v0->fV0Momentum,v0->fPointingAngle);
249 hOpenAngle[idecay][2]->Fill(v0->fV0Momentum,v0->fOpenAngle);
250 hDCA[idecay][2]->Fill(v0->fV0Momentum,v0->fDCA);
251 hRadius[idecay][2]->Fill(v0->fV0Momentum,v0->fRadius);
252 if(v0->HasTrack(track) == -1)
253 hTPCdEdx[part][2]->Fill(v0->fTrackN->P(),v0->fTPCdEdx[AliTRDv0Info::kNeg]);
254 else if(v0->HasTrack(track) == 1)
255 hTPCdEdx[part][2]->Fill(v0->fTrackP->P(),v0->fTPCdEdx[AliTRDv0Info::kPos]);
256
257 }
258 }
259 }
260 }
261 PostData(1, fOutput);
262}
263//_______________________________________________________________________
264
265/*Int_t AliTRDv0Monitor::GetPDG(Int_t index)
266{//yet to come
267
268
269
270}*/
271//_______________________________________________________________________
272