Dummy default constructor
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorHLT.cxx
CommitLineData
97d6eb66 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 HLT //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24
25#include "AliMonitorHLT.h"
c4bd737c 26#include "AliMonitorTrend.h"
27#include "AliTPCParam.h"
28#include <TFolder.h>
97d6eb66 29#ifdef ALI_HLT
30#include <stdlib.h>
31#include "AliL3MemHandler.h"
32#include "AliL3SpacePointData.h"
33#include "AliL3TrackArray.h"
34#include "AliL3Track.h"
db9d2b7f 35#include "AliL3Transform.h"
97d6eb66 36#endif
37
38//_____________________________________________________________________________
39AliMonitorHLT::AliMonitorHLT(AliTPCParam* param)
40{
41// create a HLT monitor object with the given parameters
42
43 fParam = param;
44}
45
46//_____________________________________________________________________________
c4bd737c 47AliMonitorHLT::AliMonitorHLT(const AliMonitorHLT& monitor) :
48 AliMonitor(monitor)
97d6eb66 49{
c4bd737c 50 Fatal("AliMonitorHLT", "copy constructor not implemented");
51}
52
53//_____________________________________________________________________________
54AliMonitorHLT& AliMonitorHLT::operator = (const AliMonitorHLT& /*monitor*/)
55{
56 Fatal("operator =", "assignment operator not implemented");
57 return *this;
97d6eb66 58}
59
60
61//_____________________________________________________________________________
62void AliMonitorHLT::CreateHistos(TFolder* folder)
63{
64// create the HLT monitor histograms
65
66 fFolder = folder->AddFolder("HLT", "HLT");
67
68 fClustersCharge = CreateHisto1("ClustersCharge",
69 "charge distribution of clusters",
70 100, 0, 1000, "charge", "#Delta N/N",
71 AliMonitorHisto::kNormEvents);
72
73 Int_t nRows = fParam->GetNRowLow() + fParam->GetNRowUp();
74 fNClustersVsRow = CreateHisto1("NClustersVsRow",
75 "mean number of clusters per pad row",
76 nRows, -0.5, nRows-0.5,
77 "pad row", "<N_{clusters}>",
78 AliMonitorHisto::kNormEvents);
79
80 Int_t nSector = fParam->GetNInnerSector();
81 fNClustersVsSector = CreateHisto1("NClustersVsSector",
82 "mean number of clusters per sector",
83 nSector, -0.5, nSector-0.5,
84 "sector", "<N_{clusters}>",
85 AliMonitorHisto::kNormEvents);
86
87 fNTracks = CreateTrend("NTracks", "number of tracks per event",
88 "N_{tracks}");
89
90 fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks",
91 90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
92 AliMonitorHisto::kNormEntries);
93
94 fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks",
95 100, -2, 2, "#eta", "#Delta N/N",
96 AliMonitorHisto::kNormEntries);
97
98 fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks",
99 120, 0, 360, "#phi [#circ]", "#Delta N/N",
100 AliMonitorHisto::kNormEntries);
db9d2b7f 101
102 fTrackNHits = CreateHisto1("TrackNHits", "Number of hits per track",
103 200, 0, 200, "N_{hits}", "#Delta N/N",
104 AliMonitorHisto::kNormEntries);
105
106 fTrackDEdxVsP = CreateHisto2("TrackDEdxVsP", "dE/dx of tracks",
107 100, 0, 3, 100, 0, 1000,
108 "p [GeV/c]", "dE/dx", "#Delta N/N",
109 AliMonitorHisto::kNormEntries);
110
111 fTrackDz0 = CreateHisto1("TrackDz0", "Dz0 of tracks",
112 100, -100, 100, "#Delta z0 [cm]", "#Delta N/N",
113 AliMonitorHisto::kNormEntries);
114
115 fTrackDr0 = CreateHisto1("TrackDr0", "Dr0 of tracks",
116 130, 80, 250, "#Delta r0 [cm]", "#Delta N/N",
117 AliMonitorHisto::kNormEntries);
118
119 fTrackAngle = CreateHisto1("TrackAngle", "azimutal distribution of tracks",
120 100, -4, 4, " ", "#Delta N/N",
121 AliMonitorHisto::kNormEntries);
122
97d6eb66 123}
124
125
97d6eb66 126//_____________________________________________________________________________
127void AliMonitorHLT::FillHistos(AliRunLoader* /*runLoader*/,
128 AliRawReader* /*rawReader*/)
129{
130// fill the HLT monitor histogrms
131
132#ifndef ALI_HLT
133 Warning("FillHistos", "the code was compiled without HLT support");
134
135#else
db9d2b7f 136 AliL3MemHandler clusterHandler[36];
137 AliL3SpacePointData *clusters[36];
97d6eb66 138 for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
139 char fileName[256];
140 sprintf(fileName, "hlt/points_%d_-1.raw", iSector);
db9d2b7f 141 if (!clusterHandler[iSector].SetBinaryInput(fileName)) {
97d6eb66 142 Warning("FillHistos", "could not open file %s", fileName);
143 continue;
144 }
db9d2b7f 145 clusters[iSector] = (AliL3SpacePointData*) clusterHandler[iSector].Allocate();
97d6eb66 146 UInt_t nClusters = 0;
db9d2b7f 147 clusterHandler[iSector].Binary2Memory(nClusters, clusters[iSector]);
97d6eb66 148
149 for (UInt_t iCluster = 0; iCluster < nClusters; iCluster++) {
db9d2b7f 150 AliL3SpacePointData& cluster = clusters[iSector][iCluster];
97d6eb66 151 fClustersCharge->Fill(cluster.fCharge);
152 fNClustersVsRow->Fill(cluster.fPadRow);
153 fNClustersVsSector->Fill(iSector);
154 }
155
db9d2b7f 156 clusterHandler[iSector].CloseBinaryInput();
97d6eb66 157 }
158
159 fNClustersVsSector->ScaleErrorBy(10.);
160
db9d2b7f 161 AliL3MemHandler memHandler;
97d6eb66 162 if (!memHandler.SetBinaryInput("hlt/tracks.raw")) {
163 Warning("FillHistos", "could not open file hlt/tracks.raw");
164 return;
165 }
166 AliL3TrackArray* tracks = new AliL3TrackArray;
167 memHandler.Binary2TrackArray(tracks);
168
169 fNTracks->Fill(tracks->GetNTracks());
170 for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
db9d2b7f 171 AliL3Track* track = tracks->GetCheckedTrack(iTrack);
172 if(!track) continue;
173 track->CalculateHelix();
97d6eb66 174 fTrackPt->Fill(track->GetPt());
175 fTrackEta->Fill(track->GetPseudoRapidity());
176 fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
db9d2b7f 177 fTrackDz0->Fill(track->GetZ0());
178 fTrackDr0->Fill(track->GetR0());
179 fTrackNHits->Fill(track->GetNHits());
180
181 // Track dEdx
182 Int_t nc=track->GetNHits();
183 UInt_t *hits = track->GetHitNumbers();
184 Float_t sampleDEdx[159];
185 for (Int_t iHit = 0; iHit < nc; iHit++) {
186 UInt_t hitID = hits[iHit];
187 Int_t iSector = (hitID>>25) & 0x7f;
188 UInt_t position = hitID&0x3fffff;
189 UChar_t padrow = clusters[iSector][position].fPadRow;
190 Float_t pWidth = AliL3Transform::GetPadPitchWidthLow();
191 if (padrow>63)
192 pWidth = AliL3Transform::GetPadPitchWidthUp();
193 Float_t corr=1.; if (padrow>63) corr=0.67;
194 sampleDEdx[iHit] = clusters[iSector][position].fCharge/pWidth*corr;
195 Double_t crossingangle = track->GetCrossingAngle(padrow,iSector);
196 fTrackAngle->Fill(crossingangle);
197 Double_t s = sin(crossingangle);
198 Double_t t = track->GetTgl();
199 sampleDEdx[iHit] *= TMath::Sqrt((1-s*s)/(1+t*t));
200 }
201
202 /* Cook dEdx */
203 Int_t i;
204 Int_t swap;//stupid sorting
205 do {
206 swap=0;
207 for (i=0; i<nc-1; i++) {
208 if (sampleDEdx[i]<=sampleDEdx[i+1]) continue;
209 Float_t tmp=sampleDEdx[i];
210 sampleDEdx[i]=sampleDEdx[i+1]; sampleDEdx[i+1]=tmp;
211 swap++;
212 }
213 } while (swap);
214
215 Double_t low=0.05; Double_t up=0.7;
216 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
217 Float_t trackDEdx=0;
218 for (i=nl; i<=nu; i++) trackDEdx += sampleDEdx[i];
219 trackDEdx /= (nu-nl+1);
220
221 fTrackDEdxVsP->Fill(track->GetP(),trackDEdx);
97d6eb66 222 }
223
224 delete tracks;
225 memHandler.CloseBinaryInput();
226#endif
227}