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 fTrackCuts(new AliESDtrackCuts),
57 fNEvent(0), // just to avoid warnings, inititialized in InitPointers too
61 // Input slot #0 works with a TChain ESD
62 DefineInput(0, TChain::Class());
63 // Output slot #0 writes into a TList
64 DefineOutput(0, TList::Class());
66 //fTrackCuts = new AliESDtrackCuts;
67 fTrackCuts->SetAcceptKingDaughters(kFALSE);
68 fTrackCuts->SetRequireTPCRefit(kTRUE);
69 fTrackCuts->SetEtaRange(-1,1);
70 // Add chisq criterium to reject 'bad' tracks that might not make it as prim
73 //________________________________________________________________________
74 void AliAnaESDSpectraQA::ConnectInputData(Option_t *)
78 TObject* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
80 if( handler && handler->InheritsFrom("AliESDInputHandler") ) {
81 fESD = ((AliESDInputHandler*)handler)->GetEvent();
84 AliFatal("I can't get any ESD Event Handler");
88 void AliAnaESDSpectraQA::InitHistPointers() {
92 for (Int_t i=0; i< 4; i++) {
93 fHists[i].PhiPtNPointTPC = 0;
94 fHists[i].PhiPtNPointITS = 0;
95 fHists[i].PhiPtChisqC = 0;
96 fHists[i].PhiPtChisqTPC = 0;
97 fHists[i].PhiPtDCAR = 0;
98 fHists[i].PhiPtDCAZ = 0;
102 void AliAnaESDSpectraQA::CreateOutputObjects() {
103 fHistList = new TList();
104 //fDirectory = new TDirectory("trig_hists","Trigger histos");
107 labels[kNegA]="NegA";
108 labels[kPosA]="PosA";
109 labels[kNegC]="NegC";
110 labels[kPosC]="PosC";
112 static const Float_t kMinPhi = 0;
113 static const Float_t kMaxPhi = 2*TMath::Pi();
114 fNEvent = new TH1F("NEvent","NEvent",1,-0.5,0.5);
115 fHistList->Add(fNEvent);
116 fPtAll = new TH1F("PtAll","PtAll",fgkNPtBins, fgkPtMin, fgkPtMax);
117 fHistList->Add(fPtAll);
118 fPtSel = new TH1F("PtSel","PtSel",fgkNPtBins, fgkPtMin, fgkPtMax);
119 fHistList->Add(fPtSel);
120 for (Int_t iSide = 0; iSide < 4; iSide++) {
121 TString hname="PhiPtNpointTPC";
122 hname += labels[iSide];
123 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);
124 fHistList->Add(fHists[iSide].PhiPtNPointTPC);
126 hname="PhiPtNpointITS";
127 hname += labels[iSide];
128 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);
129 fHistList->Add(fHists[iSide].PhiPtNPointITS);
132 hname += labels[iSide];
133 fHists[iSide].PhiPtChisqC = new TH3F(hname,hname+";#phi;p_{T} (GeV);#Chi^{2}/NDF",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,160,0,80);
134 fHistList->Add(fHists[iSide].PhiPtChisqC);
136 hname="PhiPtChisqTPC";
137 hname += labels[iSide];
138 fHists[iSide].PhiPtChisqTPC = new TH3F(hname,hname+";#phi;p_{T} (GeV);#Chi^{2}/NDF",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,50,0,5);
139 fHistList->Add(fHists[iSide].PhiPtChisqTPC);
142 hname += labels[iSide];
143 fHists[iSide].PhiPtDCAR = new TH3F(hname,hname+";#phi;p_{T} (GeV);DCAR",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,200,-1,1);
144 fHistList->Add(fHists[iSide].PhiPtDCAR);
147 hname += labels[iSide];
148 fHists[iSide].PhiPtDCAZ = new TH3F(hname,hname+";#phi;p_{T} (GeV);DCAZ",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,200,-2,2);
149 fHistList->Add(fHists[iSide].PhiPtDCAZ);
151 hname="PhiPtSigmaToVertex";
152 hname += labels[iSide];
153 fHists[iSide].PhiPtSigmaToVertex = new TH3F(hname,hname+";#phi;p_{T} (GeV);n#sigma to vtx",fgkNPhiBins,kMinPhi,kMaxPhi,fgkNPtBins,fgkPtMin,fgkPtMax,50,0,5);
154 fHistList->Add(fHists[iSide].PhiPtSigmaToVertex);
158 void AliAnaESDSpectraQA::Exec(Option_t *) {
160 // Called for each event
163 Printf("ERROR: fESD not available");
167 const AliESDVertex *vtx = fESD->GetPrimaryVertex();
170 if (vtx->GetNContributors() < 2)
173 printf("Vertex title %s, status %d, nCont %d\n",vtx->GetTitle(), vtx->GetStatus(), vtx->GetNContributors());
174 // Need to keep track of evts without vertex
176 Int_t nTracks = fESD->GetNumberOfTracks();
177 AliDebug(2,Form("nTracks %d", nTracks));
178 printf("nTracks %d\n", nTracks);
179 static Int_t Mult = 0;
180 Mult = 0; // Need extra init bc of static
181 for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
182 AliESDtrack *track = fESD->GetTrack(iTrack);
183 hists *curTypeHists = 0;
185 if (fTrackCuts->AcceptTrack(track)) {
189 track->GetImpactParameters(dca2D,dcaZ);
190 fPtAll->Fill(track->Pt());
192 if (track->Eta() > 0) { // A side (crude for now)
193 if (track->Charge() > 0)
194 curTypeHists = &fHists[kPosA];
196 curTypeHists = &fHists[kNegA];
199 if (track->Charge() > 0)
200 curTypeHists = &fHists[kPosC];
202 curTypeHists = &fHists[kNegC];
205 Float_t phi = track->Phi();
206 Float_t pt = track->Pt();
208 UChar_t itsMap = track->GetITSClusterMap();
210 for (Int_t i=0; i < 6; i++) {
211 if (itsMap & (1 << i))
215 Float_t sigToVertex = fTrackCuts->GetSigmaToVertex(track);
216 Float_t chisqC = 1000;
217 if (track->GetConstrainedParam())
218 chisqC = track->GetConstrainedChi2();
220 curTypeHists->PhiPtNPointTPC->Fill(phi,pt,track->GetTPCNcls());
221 curTypeHists->PhiPtNPointITS->Fill(phi,pt,nPointITS);
222 curTypeHists->PhiPtChisqC->Fill(phi,pt,chisqC);
223 if(track->GetTPCNclsF()>5){
224 curTypeHists->PhiPtChisqTPC->Fill(phi,pt,track->GetTPCchi2()/(track->GetTPCNclsF()-5));
226 curTypeHists->PhiPtDCAR->Fill(phi,pt,dca2D);
227 curTypeHists->PhiPtDCAZ->Fill(phi,pt,dcaZ);
228 curTypeHists->PhiPtSigmaToVertex->Fill(phi,pt,sigToVertex);
233 PostData(0, fHistList);