Corrected copy constructor (Alessandro)
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorHLTHough.cxx
CommitLineData
c6ba6205 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
17///////////////////////////////////////////////////////////////////////////////
18// //
19// This class creates and fills monitor histograms for HLT Hough transform //
20// //
21///////////////////////////////////////////////////////////////////////////////
22
23
24#include "AliMonitorHLTHough.h"
25#include "AliMonitorHisto.h"
26#include "AliMonitorTrend.h"
27#include "AliTPCParam.h"
7ba8900c 28#include "AliLog.h"
c6ba6205 29#include <TFolder.h>
c6ba6205 30#include <stdlib.h>
31#include <AliL3MemHandler.h>
32#include <AliL3TrackArray.h>
4a69f9c7 33#include <AliL3SpacePointData.h>
c6ba6205 34#include <AliL3HoughTrack.h>
4a69f9c7 35#include <AliL3Transform.h>
c6ba6205 36
37//_____________________________________________________________________________
38AliMonitorHLTHough::AliMonitorHLTHough(AliTPCParam* param)
39{
40// create a HLT monitor object with the given parameters
41
42 fParam = param;
43}
44
45//_____________________________________________________________________________
46AliMonitorHLTHough::AliMonitorHLTHough(const AliMonitorHLTHough& monitor) :
47 AliMonitor(monitor)
48{
7ba8900c 49 AliFatal("copy constructor not implemented");
c6ba6205 50}
51
52//_____________________________________________________________________________
53AliMonitorHLTHough& AliMonitorHLTHough::operator = (const AliMonitorHLTHough&
54 /*monitor*/)
55{
7ba8900c 56 AliFatal("assignment operator not implemented");
c6ba6205 57 return *this;
58}
59
c6ba6205 60
61//_____________________________________________________________________________
62void AliMonitorHLTHough::CreateHistos(TFolder* folder)
63{
64// create the HLT Hough transform monitor histograms
65
66 fFolder = folder->AddFolder("HLTHOUGH", "HLTHOUGH");
67
4a69f9c7 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
c6ba6205 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::kNormNone);
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);
101
4a69f9c7 102 fTrackNHits = CreateHisto1("TrackNHits", "Number of hits per track",
103 200, 0, 200, "N_{hits}", "#Delta N/N",
104 AliMonitorHisto::kNormNone);
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 fTrackDEdx = CreateHisto1("TrackDEdx", "dE/dx for tracks with 0.4<p<1.0 GeV/c",
112 50, 0, 300,
113 "dE/dx", "#Delta N/N",
114 AliMonitorHisto::kNormEntries);
115
c6ba6205 116 fTrackEtaVsPhi = CreateHisto2("TrackEtaVsPhi", "#phi vs #eta",
117 20, -1, 1, 25, 0, 360,
118 "#eta", "#phi", "#Delta N/N",
119 AliMonitorHisto::kNormNone);
120
121 fPtEtaVsPhi = CreateHisto2("PtEtaVsPhi", "#phi vs #eta",
122 20, -1, 1, 25, 0, 360,
123 "#eta", "#phi", "#Delta N/N",
124 AliMonitorHisto::kNormNone);
125
126}
127
128
129//_____________________________________________________________________________
130void AliMonitorHLTHough::FillHistos(AliRunLoader* /*runLoader*/,
b6a3610d 131 AliRawReader* /*rawReader*/,
132 AliESD* /*esd*/)
c6ba6205 133{
134// fill the HLT Hough transform monitor histograms
135
4a69f9c7 136 AliL3MemHandler clusterHandler[36][6];
137 AliL3SpacePointData *clusters[36][6];
c6ba6205 138 for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
4a69f9c7 139 for (Int_t iPatch = 0; iPatch < 6; iPatch++) {
140 char fileName[256];
141 sprintf(fileName, "hlt/fitter/points_%d_%d.raw", iSector,iPatch);
142 if (!clusterHandler[iSector][iPatch].SetBinaryInput(fileName)) {
7ba8900c 143 AliWarning(Form("could not open file %s", fileName));
4a69f9c7 144 continue;
c6ba6205 145 }
4a69f9c7 146 clusters[iSector][iPatch] = (AliL3SpacePointData*) clusterHandler[iSector][iPatch].Allocate();
147 UInt_t nClusters = 0;
148 clusterHandler[iSector][iPatch].Binary2Memory(nClusters, clusters[iSector][iPatch]);
149
150 for (UInt_t iCluster = 0; iCluster < nClusters; iCluster++) {
151 AliL3SpacePointData& cluster = clusters[iSector][iPatch][iCluster];
152 fClustersCharge->Fill(cluster.fCharge);
153 fNClustersVsRow->Fill(cluster.fPadRow);
154 fNClustersVsSector->Fill(iSector);
155 }
156
157 clusterHandler[iSector][iPatch].CloseBinaryInput();
158 }
159 }
160
161 fNClustersVsSector->ScaleErrorBy(10.);
162
163
164 AliL3MemHandler memHandler;
165 Int_t nHoughTracks = 0;
166
167 char fileName[256];
168 sprintf(fileName, "hlt/fitter/tracks.raw");
169 if (!memHandler.SetBinaryInput(fileName)) {
7ba8900c 170 AliWarning("could not open file hlt/fitter/tracks.raw");
4a69f9c7 171 return;
172 }
173 AliL3TrackArray* tracks = new AliL3TrackArray;
174 memHandler.Binary2TrackArray(tracks);
175
176 nHoughTracks += tracks->GetNTracks();
177 for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
178 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(iTrack);
179 if(!track) continue;
180
181 track->CalculateHelix();
182 // track->Rotate(iSector);
183
184 fTrackPt->Fill(track->GetPt());
185 fTrackEta->Fill(track->GetPseudoRapidity());
186 fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
187 if(track->GetPt()>3.) {
188 fTrackEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg());
189 fPtEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg(),track->GetPt());
190 }
191 fTrackNHits->Fill(track->GetNHits());
192
193 // Track dEdx
194 Int_t nc=track->GetNHits();
195 UInt_t *hits = track->GetHitNumbers();
196 Float_t sampleDEdx[159];
197 for (Int_t iHit = 0; iHit < nc; iHit++) {
198 UInt_t hitID = hits[iHit];
199 Int_t iSector = (hitID>>25) & 0x7f;
200 Int_t iPatch = (hitID>>22) & 0x7;
201 UInt_t position = hitID&0x3fffff;
202 UChar_t padrow = clusters[iSector][iPatch][position].fPadRow;
203 Float_t pWidth = AliL3Transform::GetPadPitchWidthLow();
204 if (padrow>63)
205 pWidth = AliL3Transform::GetPadPitchWidthUp();
206 Float_t corr=1.; if (padrow>63) corr=0.67;
207 sampleDEdx[iHit] = clusters[iSector][iPatch][position].fCharge/pWidth*corr;
208 Double_t crossingangle = track->GetCrossingAngle(padrow,iSector);
209 Double_t s = sin(crossingangle);
210 Double_t t = track->GetTgl();
211 sampleDEdx[iHit] *= TMath::Sqrt((1-s*s)/(1+t*t));
c6ba6205 212 }
c6ba6205 213
4a69f9c7 214 /* Cook dEdx */
215 Int_t i;
216 Int_t swap;//stupid sorting
217 do {
218 swap=0;
219 for (i=0; i<nc-1; i++) {
220 if (sampleDEdx[i]<=sampleDEdx[i+1]) continue;
221 Float_t tmp=sampleDEdx[i];
222 sampleDEdx[i]=sampleDEdx[i+1]; sampleDEdx[i+1]=tmp;
223 swap++;
224 }
225 } while (swap);
226
227 Double_t low=0.05; Double_t up=0.7;
228 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
229 Float_t trackDEdx=0;
230 for (i=nl; i<=nu; i++) trackDEdx += sampleDEdx[i];
231 trackDEdx /= (nu-nl+1);
232
233 fTrackDEdxVsP->Fill(track->GetP(),trackDEdx);
234 if(track->GetP()>0.4 && track->GetP()<1.0)
235 fTrackDEdx->Fill(trackDEdx);
c6ba6205 236 }
4a69f9c7 237 fNTracks->Fill(nHoughTracks);
238
239 delete tracks;
240 memHandler.CloseBinaryInput();
c6ba6205 241}