Removing AliESDCaloTrack now obsolete
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorTPC.cxx
CommitLineData
04fa961a 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// This class creates and fills the monitor histograms for the TPC //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
5fe305fe 24#include <TFolder.h>
25#include <TTree.h>
26#include <TVector3.h>
04fa961a 27
5fe305fe 28#include "AliESD.h"
c4bd737c 29#include "AliMonitorDataTPC.h"
30#include "AliMonitorHisto.h"
5fe305fe 31#include "AliMonitorTPC.h"
c4bd737c 32#include "AliMonitorTrend.h"
5fe305fe 33#include "AliRawReader.h"
34#include "AliRunLoader.h"
35#include "AliTPCClustersRow.h"
c4bd737c 36#include "AliTPCParam.h"
04fa961a 37#include "AliTPCRawStream.h"
04fa961a 38#include "AliTPCclusterMI.h"
04fa961a 39
c4bd737c 40ClassImp(AliMonitorTPC)
04fa961a 41
42
43//_____________________________________________________________________________
c4bd737c 44AliMonitorTPC::AliMonitorTPC(AliTPCParam* param)
04fa961a 45{
c4bd737c 46// create a TPC monitor object with the given parameters
04fa961a 47
c4bd737c 48 fParam = param;
49 fData = new AliMonitorDataTPC(10000);
04fa961a 50}
51
52//_____________________________________________________________________________
c4bd737c 53AliMonitorTPC::AliMonitorTPC(const AliMonitorTPC& monitor) :
54 AliMonitor(monitor)
04fa961a 55{
c4bd737c 56 Fatal("AliMonitorTPC", "copy constructor not implemented");
04fa961a 57}
58
59//_____________________________________________________________________________
c4bd737c 60AliMonitorTPC& AliMonitorTPC::operator = (const AliMonitorTPC& /*monitor*/)
04fa961a 61{
c4bd737c 62 Fatal("operator =", "assignment operator not implemented");
63 return *this;
04fa961a 64}
65
66//_____________________________________________________________________________
67AliMonitorTPC::~AliMonitorTPC()
68{
69 delete fData;
70}
71
72
73//_____________________________________________________________________________
74void AliMonitorTPC::CreateHistos(TFolder* folder)
75{
76// create the TPC monitor histograms
77
78 fFolder = folder->AddFolder("TPC", "TPC");
79
80 fPadsCharge = CreateHisto1("PadsCharge", "charge distribution of pads",
81 100, 0, 200, "charge", "#Delta N/N",
82 AliMonitorHisto::kNormEvents);
83
84 fClustersCharge = CreateHisto1("ClustersCharge",
85 "charge distribution of clusters",
86 100, 0, 1000, "charge", "#Delta N/N",
87 AliMonitorHisto::kNormEvents);
88
89 Int_t nRows = fParam->GetNRowLow() + fParam->GetNRowUp();
90 fNClustersVsRow = CreateHisto1("NClustersVsRow",
91 "mean number of clusters per pad row",
92 nRows, -0.5, nRows-0.5,
93 "pad row", "<N_{clusters}>",
94 AliMonitorHisto::kNormEvents);
95
96 Int_t nSector = fParam->GetNInnerSector();
97 fNClustersVsSector = CreateHisto1("NClustersVsSector",
98 "mean number of clusters per sector",
99 nSector, -0.5, nSector-0.5,
100 "sector", "<N_{clusters}>",
101 AliMonitorHisto::kNormEvents);
102
103 fNTracks = CreateTrend("NTracks", "number of tracks per event",
104 "N_{tracks}");
105
106 fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks",
107 90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
524a85e8 108 AliMonitorHisto::kNormNone);
04fa961a 109
110 fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks",
111 100, -2, 2, "#eta", "#Delta N/N",
112 AliMonitorHisto::kNormEntries);
113
114 fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks",
b6a3610d 115 120, -180, 180, "#phi [#circ]", "#Delta N/N",
04fa961a 116 AliMonitorHisto::kNormEntries);
117 fTrackPhi->SetDescription("The phi distribution should be flat on average.\nIf it is not flat check for dead TPC sectors.");
118
c650b50c 119 fTrackNCl = CreateHisto1("TrackNCl", "Number of clusters per track",
120 200, 0, 200, "N_{clusters}", "#Delta N/N",
524a85e8 121 AliMonitorHisto::kNormNone);
c650b50c 122
04fa961a 123 fTrackDEdxVsP = CreateHisto2("TrackDEdxVsP", "dE/dx of tracks",
124 100, 0, 3, 100, 0, 200,
125 "p [GeV/c]", "dE/dx", "#Delta N/N",
126 AliMonitorHisto::kNormEntries);
524a85e8 127
128 fTrackDEdx = CreateHisto1("TrackDEdx", "dE/dx of tracks with 0.4<p<1.0 GeV/c",
129 50, 0, 100,
130 "dE/dx", "#Delta N/N",
131 AliMonitorHisto::kNormEntries);
132
133 fTrackEtaVsPhi = CreateHisto2("TrackEtaVsPhi", "#phi vs #eta",
134 20, -1, 1, 25, 0, 360,
135 "#eta", "#phi", "#Delta N/N",
136 AliMonitorHisto::kNormNone);
137
138 fPtEtaVsPhi = CreateHisto2("PtEtaVsPhi", "#phi vs #eta",
139 20, -1, 1, 25, 0, 360,
140 "#eta", "#phi", "#Delta N/N",
141 AliMonitorHisto::kNormNone);
142
04fa961a 143}
144
145
146//_____________________________________________________________________________
147void AliMonitorTPC::CreateBranches(TTree* tree)
148{
149// create a branch with TPC variables
150
151 tree->Branch("TPC", "AliMonitorDataTPC", &fData);
152}
153
154
155//_____________________________________________________________________________
156void AliMonitorTPC::FillHistos(AliRunLoader* runLoader,
b6a3610d 157 AliRawReader* rawReader, AliESD* esd)
04fa961a 158{
159// fill the TPC monitor histogrms
160
161 rawReader->Reset();
162 AliTPCRawStream input(rawReader);
163 while (input.Next()) {
164 fPadsCharge->Fill(input.GetSignal());
165 }
166
167 AliLoader* tpcLoader = runLoader->GetLoader("TPCLoader");
168 if (!tpcLoader) return;
169
170
171 tpcLoader->LoadRecPoints();
172 TTree* clusters = tpcLoader->TreeR();
173 if (!clusters) return;
174 AliTPCClustersRow* clustersRow = new AliTPCClustersRow;
175 clustersRow->SetClass("AliTPCclusterMI");
176 clusters->SetBranchAddress("Segment", &clustersRow);
177
178 for (Int_t i = 0; i < clusters->GetEntries(); i++) {
179 clusters->GetEntry(i);
180 Int_t iSector, iRow;
181 fParam->AdjustSectorRow(clustersRow->GetID(), iSector, iRow);
182 if (iSector >= fParam->GetNInnerSector()) {
183 iRow += fParam->GetNRowLow();
184 iSector -= fParam->GetNInnerSector();
185 }
186
187 TObjArray* array = clustersRow->GetArray();
188 for (Int_t j = 0; j < array->GetEntriesFast(); j++) {
189 AliTPCclusterMI* cluster = (AliTPCclusterMI*) array->At(j);
190 fClustersCharge->Fill(cluster->GetQ());
191 fNClustersVsRow->Fill(iRow);
192 fNClustersVsSector->Fill(iSector);
193 }
194 }
97d6eb66 195 fNClustersVsSector->ScaleErrorBy(10.);
04fa961a 196
197 delete clustersRow;
198 tpcLoader->UnloadRecPoints();
199
200
b6a3610d 201 Int_t nTracks = 0;
202 for (Int_t i = 0; i < esd->GetNumberOfTracks(); i++) {
203 AliESDtrack* track = esd->GetTrack(i);
204 if (!track || ((track->GetStatus() | AliESDtrack::kTPCin) == 0)) continue;
205 nTracks++;
206
207 Double_t pxyz[3];
208 track->GetInnerPxPyPz(pxyz);
209 TVector3 pTrack(pxyz);
210 Double_t p = pTrack.Mag();
211 Double_t pt = pTrack.Pt();
212 Double_t eta = pTrack.Eta();
213 Double_t phi = pTrack.Phi() * TMath::RadToDeg();
214
215 fTrackPt->Fill(pt);
216 fTrackEta->Fill(eta);
217 fTrackPhi->Fill(phi);
218 if (pt > 3.) {
219 fTrackEtaVsPhi->Fill(eta, phi);
220 fPtEtaVsPhi->Fill(eta, phi, pTrack.Pt());
524a85e8 221 }
b6a3610d 222 fTrackNCl->Fill(track->GetTPCclusters(NULL));
223 fTrackDEdxVsP->Fill(p, track->GetTPCsignal());
224 if(p>0.4 && p<1.0)
225 fTrackDEdx->Fill(track->GetTPCsignal());
04fa961a 226
b6a3610d 227 fData->SetData(i, pt, eta, phi);
04fa961a 228 }
b6a3610d 229 fNTracks->Fill(nTracks);
230 fData->SetNTracks(nTracks);
04fa961a 231}