2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 /* $Id: AliTRDqaEnergyDeposit.cxx $ */
20 // This class is a part of a package of high level QA monitoring for TRD.
21 // In this class the dEdX is analyzed as a function of the particle type,
22 // momentum and chamber.
25 // radomski@physi.uni-heidelberg.de
29 #include "AliTRDqaEnergyDeposit.h"
37 #include "AliESDEvent.h"
38 #include "AliESDtrack.h"
40 //______________________________________________________________________________
42 AliTRDqaEnergyDeposit::AliTRDqaEnergyDeposit()
43 : AliAnalysisTask("",""),
49 // Default constructor
54 //______________________________________________________________________________
56 AliTRDqaEnergyDeposit:: AliTRDqaEnergyDeposit(const AliTRDqaEnergyDeposit & /*trd*/)
57 : AliAnalysisTask("",""),
68 //______________________________________________________________________________
69 AliTRDqaEnergyDeposit::AliTRDqaEnergyDeposit(const char *name)
70 : AliAnalysisTask(name,""),
79 // Input slot #0 works with an Ntuple
80 DefineInput(0, TChain::Class());
81 // Output slot #0 writes into a TH1 container
82 DefineOutput(0, TObjArray::Class()) ;
86 //______________________________________________________________________________
87 void AliTRDqaEnergyDeposit::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 AliTRDqaEnergyDeposit::CreateOutputObjects()
103 // prepare the scale from 0.5 to 10 GeV
104 const Int_t knbinsx = 50;
105 Double_t scalex[knbinsx+1];
106 Double_t dd = (TMath::Log(10) - TMath::Log(0.5)) / knbinsx;
107 for(Int_t ix=0; ix<knbinsx+1; ix++) {
108 scalex[ix] = 0.5 * TMath::Exp(dd * ix);
111 const Int_t knbinsy = 50;
112 Double_t scaley[knbinsy+1];
113 for(Int_t iy=0; iy<knbinsy+1; iy++) {
114 scaley[iy] = iy * (3e3/100.);
117 const char *title = ";p_{T};dEdX (a. u.)";
118 const char *charge[2] = {"Pos", "Neg"};
121 fOutputContainer = new TObjArray(50);
124 for(Int_t i=0; i<2; i++) {
126 fSignalPtSum[i] = new TH2D(Form("ptSig%s", charge[i]), title, knbinsx, scalex, knbinsy, scaley);
127 fOutputContainer->AddAt(fSignalPtSum[i], c++);
129 for(Int_t j=0; j<AliPID::kSPECIES; j++) {
130 Int_t idx = AliPID::kSPECIES*i+j;
134 new TH2D(Form("ptSig%s%d", charge[i], j), title, knbinsx, scalex, knbinsy, scaley);
135 fOutputContainer->AddAt(fSignalPtType[idx], c++);
139 new TH2D(Form("ptSigPure%s%d", charge[i], j), title, knbinsx, scalex, knbinsy, scaley);
140 fOutputContainer->AddAt(fSignalPtPure[idx], c++);
142 fProb[idx] = new TH1D(Form("prob%s%d", charge[i], j), ";LQ", 100, 0, 1);
143 fOutputContainer->AddAt(fProb[idx], c++);
147 printf("n hist = %d\n", c);
150 //______________________________________________________________________________
151 void AliTRDqaEnergyDeposit::Exec(Option_t *)
157 // Long64_t entry = fChain->GetReadEntry() ;
159 // Processing of one event
162 //AliError("fESD is not connected to the input!") ;
166 Int_t nTracks = fESD->GetNumberOfTracks();
167 //fNTracks->Fill(nTracks);
170 for(Int_t i=0; i<nTracks; i++) {
176 // TRDrefit and TRDPid bit
179 AliESDtrack *track = fESD->GetTrack(i);
180 const AliExternalTrackParam *paramOut = track->GetOuterParam();
181 const AliExternalTrackParam *paramIn = track->GetInnerParam();
184 if (!paramIn) continue;
185 if (!paramOut) continue;
187 UInt_t status = track->GetStatus();
188 if (!(status & AliESDtrack::kTRDrefit)) continue;
189 if (!(status & AliESDtrack::kTRDpid)) continue;
190 if (track->GetTRDntrackletsPID() < 6) continue;
192 // standard selection
194 Int_t idx = (track->GetSign() > 0) ? 0 : 1;
195 Double_t pt = paramOut->Pt();
198 for(Int_t k=0; k<6; ++k)
199 signal += track->GetTRDslice(k, -1);
202 fSignalPtSum[idx]->Fill(pt, signal);
204 for(Int_t k=0; k<AliPID::kSPECIES; ++k) {
206 Double_t lq = track->GetTRDpid(k);
207 fProb[AliPID::kSPECIES*idx+k]->Fill(lq);
208 if (lq > 0.8) fSignalPtType[AliPID::kSPECIES*idx+k]->Fill(pt, signal);
212 PostData(0, fOutputContainer);
215 //______________________________________________________________________________
216 void AliTRDqaEnergyDeposit::FillElectrons() const
219 // Fill the electrons
224 //______________________________________________________________________________
225 void AliTRDqaEnergyDeposit::Terminate(Option_t *)
228 // Retrieve histograms
231 fOutputContainer = (TObjArray*)GetOutputData(0);
237 TFile *file = new TFile("outEnergyDeposit.root", "RECREATE");
238 fOutputContainer->Write();
244 //for(Int_t i=0; i<fOutputContainer->GetEntries(); i++) {
245 // TObject *obj = fOu
249 //______________________________________________________________________________