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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // This class creates and fills the monitor histograms for the TPC //
22 ///////////////////////////////////////////////////////////////////////////////
25 #include "AliMonitorTPC.h"
26 #include "AliMonitorDataTPC.h"
27 #include "AliMonitorHisto.h"
28 #include "AliMonitorTrend.h"
29 #include "AliTPCParam.h"
30 #include "AliTPCRawStream.h"
31 #include "AliTPCClustersRow.h"
32 #include "AliTPCclusterMI.h"
33 #include "AliTPCtrack.h"
34 #include "AliRunLoader.h"
39 ClassImp(AliMonitorTPC)
42 //_____________________________________________________________________________
43 AliMonitorTPC::AliMonitorTPC(AliTPCParam* param)
45 // create a TPC monitor object with the given parameters
48 fData = new AliMonitorDataTPC(10000);
51 //_____________________________________________________________________________
52 AliMonitorTPC::AliMonitorTPC(const AliMonitorTPC& monitor) :
55 Fatal("AliMonitorTPC", "copy constructor not implemented");
58 //_____________________________________________________________________________
59 AliMonitorTPC& AliMonitorTPC::operator = (const AliMonitorTPC& /*monitor*/)
61 Fatal("operator =", "assignment operator not implemented");
65 //_____________________________________________________________________________
66 AliMonitorTPC::~AliMonitorTPC()
72 //_____________________________________________________________________________
73 void AliMonitorTPC::CreateHistos(TFolder* folder)
75 // create the TPC monitor histograms
77 fFolder = folder->AddFolder("TPC", "TPC");
79 fPadsCharge = CreateHisto1("PadsCharge", "charge distribution of pads",
80 100, 0, 200, "charge", "#Delta N/N",
81 AliMonitorHisto::kNormEvents);
83 fClustersCharge = CreateHisto1("ClustersCharge",
84 "charge distribution of clusters",
85 100, 0, 1000, "charge", "#Delta N/N",
86 AliMonitorHisto::kNormEvents);
88 Int_t nRows = fParam->GetNRowLow() + fParam->GetNRowUp();
89 fNClustersVsRow = CreateHisto1("NClustersVsRow",
90 "mean number of clusters per pad row",
91 nRows, -0.5, nRows-0.5,
92 "pad row", "<N_{clusters}>",
93 AliMonitorHisto::kNormEvents);
95 Int_t nSector = fParam->GetNInnerSector();
96 fNClustersVsSector = CreateHisto1("NClustersVsSector",
97 "mean number of clusters per sector",
98 nSector, -0.5, nSector-0.5,
99 "sector", "<N_{clusters}>",
100 AliMonitorHisto::kNormEvents);
102 fNTracks = CreateTrend("NTracks", "number of tracks per event",
105 fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks",
106 90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
107 AliMonitorHisto::kNormEntries);
109 fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks",
110 100, -2, 2, "#eta", "#Delta N/N",
111 AliMonitorHisto::kNormEntries);
113 fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks",
114 120, 0, 360, "#phi [#circ]", "#Delta N/N",
115 AliMonitorHisto::kNormEntries);
116 fTrackPhi->SetDescription("The phi distribution should be flat on average.\nIf it is not flat check for dead TPC sectors.");
118 fTrackNCl = CreateHisto1("TrackNCl", "Number of clusters per track",
119 200, 0, 200, "N_{clusters}", "#Delta N/N",
120 AliMonitorHisto::kNormEntries);
122 fTrackDEdxVsP = CreateHisto2("TrackDEdxVsP", "dE/dx of tracks",
123 100, 0, 3, 100, 0, 200,
124 "p [GeV/c]", "dE/dx", "#Delta N/N",
125 AliMonitorHisto::kNormEntries);
129 //_____________________________________________________________________________
130 void AliMonitorTPC::CreateBranches(TTree* tree)
132 // create a branch with TPC variables
134 tree->Branch("TPC", "AliMonitorDataTPC", &fData);
138 //_____________________________________________________________________________
139 void AliMonitorTPC::FillHistos(AliRunLoader* runLoader,
140 AliRawReader* rawReader)
142 // fill the TPC monitor histogrms
145 AliTPCRawStream input(rawReader);
146 while (input.Next()) {
147 fPadsCharge->Fill(input.GetSignal());
150 AliLoader* tpcLoader = runLoader->GetLoader("TPCLoader");
151 if (!tpcLoader) return;
154 tpcLoader->LoadRecPoints();
155 TTree* clusters = tpcLoader->TreeR();
156 if (!clusters) return;
157 AliTPCClustersRow* clustersRow = new AliTPCClustersRow;
158 clustersRow->SetClass("AliTPCclusterMI");
159 clusters->SetBranchAddress("Segment", &clustersRow);
161 for (Int_t i = 0; i < clusters->GetEntries(); i++) {
162 clusters->GetEntry(i);
164 fParam->AdjustSectorRow(clustersRow->GetID(), iSector, iRow);
165 if (iSector >= fParam->GetNInnerSector()) {
166 iRow += fParam->GetNRowLow();
167 iSector -= fParam->GetNInnerSector();
170 TObjArray* array = clustersRow->GetArray();
171 for (Int_t j = 0; j < array->GetEntriesFast(); j++) {
172 AliTPCclusterMI* cluster = (AliTPCclusterMI*) array->At(j);
173 fClustersCharge->Fill(cluster->GetQ());
174 fNClustersVsRow->Fill(iRow);
175 fNClustersVsSector->Fill(iSector);
178 fNClustersVsSector->ScaleErrorBy(10.);
181 tpcLoader->UnloadRecPoints();
184 tpcLoader->LoadTracks();
185 TTree* tracks = tpcLoader->TreeT();
187 AliTPCtrack* track = new AliTPCtrack;
188 tracks->SetBranchAddress("tracks", &track);
190 Int_t nTracks = (Int_t) tracks->GetEntries();
191 fNTracks->Fill(nTracks);
192 fData->SetNTracks(nTracks);
193 for (Int_t i = 0; i < nTracks; i++) {
195 fTrackPt->Fill(track->Pt());
196 fTrackEta->Fill(track->Eta());
197 fTrackPhi->Fill(track->Phi() * TMath::RadToDeg());
198 fTrackNCl->Fill(track->GetNumberOfClusters());
199 fTrackDEdxVsP->Fill(track->P(), track->GetdEdx());
201 fData->SetData(i, track->Pt(), track->Eta(),
202 track->Phi() * TMath::RadToDeg());
206 tpcLoader->UnloadTracks();