1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliTRDqaESDFriends.cxx $ */
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
24 // radomski@physi.uni-heidelberg.de
28 #include "AliTRDqaESDFriends.h"
37 #include "AliESDEvent.h"
38 #include "AliESDtrack.h"
39 #include "AliKalmanTrack.h"
40 #include "AliESDfriend.h"
42 //______________________________________________________________________________
44 AliTRDqaESDFriends::AliTRDqaESDFriends()
45 : AliAnalysisTask("",""),
52 // Dummy default constructor
54 //______________________________________________________________________________
56 AliTRDqaESDFriends:: AliTRDqaESDFriends(AliTRDqaESDFriends& /*trd*/)
57 : AliAnalysisTask("",""),
64 // dummy copy constructor
70 //______________________________________________________________________________
71 AliTRDqaESDFriends::AliTRDqaESDFriends(const char *name)
72 : AliAnalysisTask(name,""),
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()) ;
86 //______________________________________________________________________________
87 void AliTRDqaESDFriends::ConnectInputData(const Option_t *)
89 // Initialisation of branch container and histograms
91 //AliInfo(Form("*** Initialization of %s", GetName())) ;
93 fChain = (TChain*)GetInputData(0);
94 fESD = new AliESDEvent();
95 fESD->ReadFromTree(fChain);
98 //________________________________________________________________________
99 void AliTRDqaESDFriends::CreateOutputObjects()
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);
107 fOutputContainer = new TObjArray(50);
109 fOutputContainer->AddAt(fResiduals, c++);
110 fOutputContainer->AddAt(fResidualsAngle, c++);
112 printf("n hist = %d\n", c);
114 //______________________________________________________________________________
115 void AliTRDqaESDFriends::Exec(Option_t *)
119 Long64_t entry = fChain->GetReadEntry() ;
120 if (!(entry%100)) Info("Exec", "Entry = %ld", entry);
122 // Processing of one event
125 //AliError("fESD is not connected to the input!") ;
129 Int_t nTracks = fESD->GetNumberOfTracks();
130 //fNTracks->Fill(nTracks);
133 for(Int_t i=0; i<nTracks; i++) {
139 // TRDrefit and TRDPid bit
142 AliESDtrack *track = fESD->GetTrack(i);
143 const AliExternalTrackParam *paramOut = track->GetOuterParam();
144 const AliExternalTrackParam *paramIn = track->GetInnerParam();
147 if (!paramIn) continue;
148 if (!paramOut) continue;
150 UInt_t status = track->GetStatus();
151 if (!(status & AliESDtrack::kTRDrefit)) continue;
152 if (!(status & AliESDtrack::kTRDpid)) continue;
153 if (track->GetTRDpidQuality() < 6) continue;
155 // standard selection
156 AliESDfriend *fr = (AliESDfriend*)fESD->FindListObject("AliESDfriend");
157 if (fr) fESD->SetESDfriend(fr);
159 AliESDfriendTrack *f = (AliESDfriendTrack*)track->GetFriendTrack();
163 //AliKalmanTrack *trdTrack = 0;
164 //if (f) trdTrack = f->GetTRDtrack();
165 //if (trdTrack) trdTrack->Print();
170 // fESD->GetList()->Print();
171 //AliESDfriend *f = (AliESDfriend*)fESD->FindListObject("ESDfriend");
173 // AliKalmanTrack *trdTrack = track->GetTRDtrack();
174 //if (trdTrack) trdTrack->Print();
177 PostData(0, fOutputContainer);
180 //______________________________________________________________________________
181 void AliTRDqaESDFriends::Terminate(Option_t *)
183 // retrieve histograms
184 fOutputContainer = (TObjArray*)GetOutputData(0);
190 TFile *file = new TFile("outESDFriends.root", "RECREATE");
191 fOutputContainer->Write();
197 //for(Int_t i=0; i<fOutputContainer->GetEntries(); i++) {
198 // TObject *obj = fOu
202 //______________________________________________________________________________