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: AliTRDqaEnergyDeposit.cxx $ */
19 // This class is a part of a package of high level QA monitoring for TRD.
20 // In this class the dEdX is analyzed as a function of the particle type,
21 // momentum and chamber.
24 // radomski@physi.uni-heidelberg.de
28 #include "AliTRDqaEnergyDeposit.h"
37 #include "AliESDEvent.h"
38 #include "AliESDtrack.h"
39 #include "AliKalmanTrack.h"
41 //______________________________________________________________________________
43 AliTRDqaEnergyDeposit::AliTRDqaEnergyDeposit()
44 : AliAnalysisTask("",""),
49 // Dummy default constructor
51 //______________________________________________________________________________
53 AliTRDqaEnergyDeposit:: AliTRDqaEnergyDeposit(AliTRDqaEnergyDeposit& /*trd*/)
54 : AliAnalysisTask("",""),
59 // Dummy copy constructor
64 //______________________________________________________________________________
65 AliTRDqaEnergyDeposit::AliTRDqaEnergyDeposit(const char *name)
66 : AliAnalysisTask(name,""),
72 // Input slot #0 works with an Ntuple
73 DefineInput(0, TChain::Class());
74 // Output slot #0 writes into a TH1 container
75 DefineOutput(0, TObjArray::Class()) ;
78 //______________________________________________________________________________
79 void AliTRDqaEnergyDeposit::ConnectInputData(const Option_t *)
81 // Initialisation of branch container and histograms
83 //AliInfo(Form("*** Initialization of %s", GetName())) ;
85 fChain = (TChain*)GetInputData(0);
86 fESD = new AliESDEvent();
87 fESD->ReadFromTree(fChain);
90 //________________________________________________________________________
91 void AliTRDqaEnergyDeposit::CreateOutputObjects()
95 // prepare the scale from 0.5 to 10 GeV
96 const Int_t knbinsx = 50;
97 Double_t scalex[knbinsx+1];
98 Double_t dd = (TMath::Log(10) - TMath::Log(0.5)) / knbinsx;
99 for(Int_t ix=0; ix<knbinsx+1; ix++) {
100 scalex[ix] = 0.5 * TMath::Exp(dd * ix);
103 const Int_t knbinsy = 50;
104 Double_t scaley[knbinsy+1];
105 for(Int_t iy=0; iy<knbinsy+1; iy++) {
106 scaley[iy] = iy * (3e3/100.);
109 const char *title = ";p_{T};dEdX (a. u.)";
110 const char *charge[2] = {"Pos", "Neg"};
113 fOutputContainer = new TObjArray(50);
116 for(Int_t i=0; i<2; i++) {
118 fSignalPtSum[i] = new TH2D(Form("ptSig%s", charge[i]), title, knbinsx, scalex, knbinsy, scaley);
119 fOutputContainer->AddAt(fSignalPtSum[i], c++);
121 for(Int_t j=0; j<AliPID::kSPECIES; j++) {
122 Int_t idx = AliPID::kSPECIES*i+j;
124 new TH2D(Form("ptSig%s%d", charge[i], j), title, knbinsx, scalex, knbinsy, scaley);
125 fOutputContainer->AddAt(fSignalPtType[idx], c++);
127 fProb[idx] = new TH1D(Form("prob%s%d", charge[i], j), ";LQ", 100, 0, 1);
128 fOutputContainer->AddAt(fProb[idx], c++);
132 printf("n hist = %d\n", c);
134 //______________________________________________________________________________
135 void AliTRDqaEnergyDeposit::Exec(Option_t *)
139 // Long64_t entry = fChain->GetReadEntry() ;
141 // Processing of one event
144 //AliError("fESD is not connected to the input!") ;
148 Int_t nTracks = fESD->GetNumberOfTracks();
149 //fNTracks->Fill(nTracks);
152 for(Int_t i=0; i<nTracks; i++) {
158 // TRDrefit and TRDPid bit
161 AliESDtrack *track = fESD->GetTrack(i);
162 const AliExternalTrackParam *paramOut = track->GetOuterParam();
163 const AliExternalTrackParam *paramIn = track->GetInnerParam();
166 if (!paramIn) continue;
167 if (!paramOut) continue;
169 UInt_t status = track->GetStatus();
170 if (!(status & AliESDtrack::kTRDrefit)) continue;
171 if (!(status & AliESDtrack::kTRDpid)) continue;
172 if (track->GetTRDpidQuality() < 6) continue;
174 // standard selection
176 Int_t idx = (track->GetSign() > 0) ? 0 : 1;
177 Double_t pt = paramOut->Pt();
180 for(Int_t i=0; i<6; i++)
181 signal += track->GetTRDsignals(i, -1);
184 fSignalPtSum[idx]->Fill(pt, signal);
186 for(Int_t i=0; i<AliPID::kSPECIES; i++) {
188 Double_t lq = track->GetTRDpid(i);
189 fProb[AliPID::kSPECIES*idx+i]->Fill(lq);
190 fSignalPtType[AliPID::kSPECIES*idx+i]->Fill(pt, signal, lq);
194 PostData(0, fOutputContainer);
197 //______________________________________________________________________________
198 void AliTRDqaEnergyDeposit::Terminate(Option_t *)
200 // retrieve histograms
201 fOutputContainer = (TObjArray*)GetOutputData(0);
207 TFile *file = new TFile("outEnergyDeposit.root", "RECREATE");
208 fOutputContainer->Write();
214 //for(Int_t i=0; i<fOutputContainer->GetEntries(); i++) {
215 // TObject *obj = fOu
219 //______________________________________________________________________________