compiler warnings
[u/mrichter/AliRoot.git] / TRD / qaAnalysis / AliTRDqaESDFriends.cxx
CommitLineData
917559ee 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-commercial 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/* $Id: AliTRDqaESDFriends.cxx $ */
17
18//
19// This class is a part of a package of high level QA monitoring for TRD.
20// The residuals of cluster with respect to tracklets are analyzed
21// in this class. This class needs ESDfriends.root
22//
23// S. Radomski
24// radomski@physi.uni-heidelberg.de
25// March 2008
26//
27
28#include "AliTRDqaESDFriends.h"
29
30#include "TMath.h"
31#include "TH1D.h"
32#include "TH2D.h"
33#include "TFile.h"
34#include "TTree.h"
35#include "TChain.h"
36
37#include "AliESDEvent.h"
38#include "AliESDtrack.h"
39#include "AliKalmanTrack.h"
40#include "AliESDfriend.h"
41
42//______________________________________________________________________________
43
44AliTRDqaESDFriends::AliTRDqaESDFriends()
45 : AliAnalysisTask("",""),
46 fChain(0),
47 fESD(0),
48 fOutputContainer(0),
49 fResiduals(0),
50 fResidualsAngle(0)
51{
52 // Dummy default constructor
53}
54//______________________________________________________________________________
55
56AliTRDqaESDFriends:: AliTRDqaESDFriends(AliTRDqaESDFriends& /*trd*/)
57 : AliAnalysisTask("",""),
58 fChain(0),
59 fESD(0),
60 fOutputContainer(0),
61 fResiduals(0),
62 fResidualsAngle(0)
63{
64 // dummy copy constructor
65
66 //return *this;
67}
68
69
70//______________________________________________________________________________
71AliTRDqaESDFriends::AliTRDqaESDFriends(const char *name)
72 : AliAnalysisTask(name,""),
73 fChain(0),
74 fESD(0),
75 fOutputContainer(0),
76 fResiduals(0),
77 fResidualsAngle(0)
78{
79 // Constructor.
80 // Input slot #0 works with an Ntuple
81 DefineInput(0, TChain::Class());
82 // Output slot #0 writes into a TH1 container
83 DefineOutput(0, TObjArray::Class()) ;
84}
85
86//______________________________________________________________________________
87void AliTRDqaESDFriends::ConnectInputData(const Option_t *)
88{
89 // Initialisation of branch container and histograms
90
91 //AliInfo(Form("*** Initialization of %s", GetName())) ;
92
93 fChain = (TChain*)GetInputData(0);
94 fESD = new AliESDEvent();
95 fESD->ReadFromTree(fChain);
96}
97
98//________________________________________________________________________
99void AliTRDqaESDFriends::CreateOutputObjects()
100{
101 // build histograms
102
103 fResiduals = new TH1D("residuals", ";residuals (cm)", 1000, -1, 1);
104 fResidualsAngle = new TH2D("residualsAngle", ";angle (rad);residuals (cm)", 100, -1, 1, 100, -1, 1);
105
106 Int_t c = 0;
107 fOutputContainer = new TObjArray(50);
108
109 fOutputContainer->AddAt(fResiduals, c++);
110 fOutputContainer->AddAt(fResidualsAngle, c++);
111
112 printf("n hist = %d\n", c);
113}
114//______________________________________________________________________________
115void AliTRDqaESDFriends::Exec(Option_t *)
116{
117 // Process one event
118
9bff9978 119 Long64_t entry = fChain->GetReadEntry() ;
20a6e9c2 120 if (!(entry%100)) Info("Exec", "Entry = %lld", entry);
917559ee 121
122 // Processing of one event
123
124 if (!fESD) {
125 //AliError("fESD is not connected to the input!") ;
126 return ;
127 }
128
129 Int_t nTracks = fESD->GetNumberOfTracks();
130 //fNTracks->Fill(nTracks);
131
132 // track loop
133 for(Int_t i=0; i<nTracks; i++) {
134
135 //
136 // track selection
137 //
138 // param in and Out
139 // TRDrefit and TRDPid bit
140 //
141
142 AliESDtrack *track = fESD->GetTrack(i);
143 const AliExternalTrackParam *paramOut = track->GetOuterParam();
144 const AliExternalTrackParam *paramIn = track->GetInnerParam();
145
146 // long track ..
147 if (!paramIn) continue;
148 if (!paramOut) continue;
149
150 UInt_t status = track->GetStatus();
151 if (!(status & AliESDtrack::kTRDrefit)) continue;
152 if (!(status & AliESDtrack::kTRDpid)) continue;
ed15ef4f 153 if (track->GetTRDntrackletsPID() < 6) continue;
917559ee 154
155 // standard selection
9bff9978 156 AliESDfriend *fr = (AliESDfriend*)fESD->FindListObject("AliESDfriend");
157 if (fr) fESD->SetESDfriend(fr);
158
159 AliESDfriendTrack *f = (AliESDfriendTrack*)track->GetFriendTrack();
917559ee 160
9bff9978 161 if (!f) continue;
162
163 //AliKalmanTrack *trdTrack = 0;
164 //if (f) trdTrack = f->GetTRDtrack();
165 //if (trdTrack) trdTrack->Print();
166
167 //if (f) f->Dump();
168 //if (f) f->Print();
169
917559ee 170 // fESD->GetList()->Print();
171 //AliESDfriend *f = (AliESDfriend*)fESD->FindListObject("ESDfriend");
172 //if (f) f->Print();
173 // AliKalmanTrack *trdTrack = track->GetTRDtrack();
174 //if (trdTrack) trdTrack->Print();
175 }
176
177 PostData(0, fOutputContainer);
178}
179
180//______________________________________________________________________________
181void AliTRDqaESDFriends::Terminate(Option_t *)
182{
183 // retrieve histograms
184 fOutputContainer = (TObjArray*)GetOutputData(0);
185
186 // post processing
187
188
189 // save the results
190 TFile *file = new TFile("outESDFriends.root", "RECREATE");
191 fOutputContainer->Write();
192
193 file->Flush();
194 file->Close();
195 delete file;
196
197 //for(Int_t i=0; i<fOutputContainer->GetEntries(); i++) {
198 // TObject *obj = fOu
199 // }
200}
201
202//______________________________________________________________________________