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 **************************************************************************/
17 #include "AliAnaESDSpectraQA.h"
24 #include "TDirectory.h"
26 #include "AliAnalysisManager.h"
28 #include "AliESDInputHandler.h"
29 #include "AliESDEvent.h"
30 #include "AliESDVertex.h"
31 #include "AliESDtrack.h"
32 #include "AliESDtrackCuts.h"
35 const Int_t AliAnaESDSpectraQA::fgkNPtBins=38;
36 const Float_t AliAnaESDSpectraQA::fgkPtMin=2;
37 const Float_t AliAnaESDSpectraQA::fgkPtMax=40;
38 const Int_t AliAnaESDSpectraQA::fgkNPhiBins=18;
40 ClassImp(AliAnaESDSpectraQA)
42 AliAnaESDSpectraQA::AliAnaESDSpectraQA(): AliAnalysisTask("AliAnaESDSpectraQA", ""),
45 fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
53 AliAnaESDSpectraQA::AliAnaESDSpectraQA(const char *name):
54 AliAnalysisTask(name, ""),
56 fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
60 // Input slot #0 works with a TChain ESD
61 DefineInput(0, TChain::Class());
62 // Output slot #0 writes into a TList
63 DefineOutput(0, TList::Class());
65 fTrackCuts = new AliESDtrackCuts;
66 fTrackCuts->SetAcceptKingDaughters(kFALSE);
67 fTrackCuts->SetRequireTPCRefit(kTRUE);
68 fTrackCuts->SetEtaRange(-1,1);
69 // Add chisq criterium to reject 'bad' tracks that might not make it as prim
72 //________________________________________________________________________
73 void AliAnaESDSpectraQA::ConnectInputData(Option_t *)
77 TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
79 if( handler && handler->InheritsFrom("AliESDInputHandler") ) {
80 fESD = ((AliESDInputHandler*)handler)->GetEvent();
83 AliFatal("I can't get any ESD Event Handler");
87 void AliAnaESDSpectraQA::InitHistPointers() {
91 for (Int_t i=0; i< 4; i++) {
92 fHists[i].PhiPtNPointTPC = 0;
93 fHists[i].PhiPtNPointITS = 0;
94 fHists[i].PhiPtChisqC = 0;
95 fHists[i].PhiPtChisqTPC = 0;
96 fHists[i].PhiPtDCAR = 0;
97 fHists[i].PhiPtDCAZ = 0;
101 void AliAnaESDSpectraQA::CreateOutputObjects() {
102 fHistList = new TList();
103 //fDirectory = new TDirectory("trig_hists","Trigger histos");
106 labels[kNegA]="NegA";
107 labels[kPosA]="PosA";
108 labels[kNegC]="NegC";
109 labels[kPosC]="PosC";
111 static const Float_t kMinPhi = 0;
112 static const Float_t kMaxPhi = 2*TMath::Pi();
113 fNEvent = new TH1F("NEvent","NEvent",1,-0.5,0.5);
114 fHistList->Add(fNEvent);
115 fPtAll = new TH1F("PtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
116 fHistList->Add(fPtAll);
117 fPtSel = new TH1F("PtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
118 fHistList->Add(fPtSel);
119 for (Int_t iSide = 0; iSide < 4; iSide++) {
120 TString hname="PhiPtNpointTPC";
121 hname += labels[iSide];
122 fHists[iSide].PhiPtNPointTPC = new TH3F(hname,hname+";#phi;p_{T} (GeV);N_{point,TPC}",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,160,0.5,160.5);
123 fHistList->Add(fHists[iSide].PhiPtNPointTPC);
125 hname="PhiPtNpointITS";
126 hname += labels[iSide];
127 fHists[iSide].PhiPtNPointITS = new TH3F(hname,hname+";#phi;p_{T} (GeV);N_{point,ITS}",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,9,-0.5,8.5);
128 fHistList->Add(fHists[iSide].PhiPtNPointITS);
131 hname += labels[iSide];
132 fHists[iSide].PhiPtChisqC = new TH3F(hname,hname+";#phi;p_{T} (GeV);#Chi^{2}/NDF",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,160,0,80);
133 fHistList->Add(fHists[iSide].PhiPtChisqC);
135 hname="PhiPtChisqTPC";
136 hname += labels[iSide];
137 fHists[iSide].PhiPtChisqTPC = new TH3F(hname,hname+";#phi;p_{T} (GeV);#Chi^{2}/NDF",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,50,0,5);
138 fHistList->Add(fHists[iSide].PhiPtChisqTPC);
141 hname += labels[iSide];
142 fHists[iSide].PhiPtDCAR = new TH3F(hname,hname+";#phi;p_{T} (GeV);DCAR",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,200,-1,1);
143 fHistList->Add(fHists[iSide].PhiPtDCAR);
146 hname += labels[iSide];
147 fHists[iSide].PhiPtDCAZ = new TH3F(hname,hname+";#phi;p_{T} (GeV);DCAZ",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,200,-2,2);
148 fHistList->Add(fHists[iSide].PhiPtDCAZ);
150 hname="PhiPtSigmaToVertex";
151 hname += labels[iSide];
152 fHists[iSide].PhiPtSigmaToVertex = new TH3F(hname,hname+";#phi;p_{T} (GeV);n#sigma to vtx",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,50,0,5);
153 fHistList->Add(fHists[iSide].PhiPtSigmaToVertex);
157 void AliAnaESDSpectraQA::Exec(Option_t *) {
159 // Called for each event
162 Printf("ERROR: fESD not available");
166 const AliESDVertex *vtx = fESD->GetPrimaryVertex();
169 if (vtx->GetNContributors() < 2)
172 printf("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors());
173 // Need to keep track of evts without vertex
175 Int_t nTracks = fESD->GetNumberOfTracks();
176 AliDebug(2,Form("nTracks %d", nTracks));
177 printf("nTracks %d\n", nTracks);
178 static Int_t Mult = 0;
179 Mult = 0; // Need extra init bc of static
180 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
181 AliESDtrack *track = fESD->GetTrack(iTrack);
182 hists *curTypeHists = 0;
184 if (fTrackCuts->AcceptTrack(track)) {
188 track->GetImpactParameters(dca2D,dcaZ);
189 fPtAll->Fill(track->Pt());
191 if (track->Eta() > 0) { // A side (crude for now)
192 if (track->Charge() > 0)
193 curTypeHists = &fHists[kPosA];
195 curTypeHists = &fHists[kNegA];
198 if (track->Charge() > 0)
199 curTypeHists = &fHists[kPosC];
201 curTypeHists = &fHists[kNegC];
204 Float_t phi = track->Phi();
205 Float_t pt = track->Pt();
207 UChar_t itsMap = track->GetITSClusterMap();
209 for (Int_t i=0; i < 6; i++) {
210 if (itsMap & (1 << i))
214 Float_t sigToVertex = fTrackCuts->GetSigmaToVertex(track);
215 Float_t chisqC = 1000;
216 if (track->GetConstrainedParam())
217 chisqC = track->GetConstrainedChi2();
219 curTypeHists->PhiPtNPointTPC->Fill(phi,pt,track->GetTPCNcls());
220 curTypeHists->PhiPtNPointITS->Fill(phi,pt,nPointITS);
221 curTypeHists->PhiPtChisqC->Fill(phi,pt,chisqC);
222 curTypeHists->PhiPtChisqTPC->Fill(phi,pt,track->GetTPCchi2()/(track->GetTPCNclsF()-5));
223 curTypeHists->PhiPtDCAR->Fill(phi,pt,dca2D);
224 curTypeHists->PhiPtDCAZ->Fill(phi,pt,dcaZ);
225 curTypeHists->PhiPtSigmaToVertex->Fill(phi,pt,sigToVertex);
230 PostData(0, fHistList);