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 ///////////////////////////////////////////////////////////////////////////////
19 // This class creates and fills monitor histograms for HLT Hough transform //
21 ///////////////////////////////////////////////////////////////////////////////
24 #include "AliMonitorHLTHough.h"
25 #include "AliMonitorHisto.h"
26 #include "AliMonitorTrend.h"
27 #include "AliTPCParam.h"
31 #include <AliL3MemHandler.h>
32 #include <AliL3TrackArray.h>
33 #include <AliL3SpacePointData.h>
34 #include <AliL3HoughTrack.h>
35 #include <AliL3Transform.h>
38 //_____________________________________________________________________________
39 AliMonitorHLTHough::AliMonitorHLTHough(AliTPCParam* param)
41 // create a HLT monitor object with the given parameters
46 //_____________________________________________________________________________
47 AliMonitorHLTHough::AliMonitorHLTHough(const AliMonitorHLTHough& monitor) :
50 Fatal("AliMonitorHLTHough", "copy constructor not implemented");
53 //_____________________________________________________________________________
54 AliMonitorHLTHough& AliMonitorHLTHough::operator = (const AliMonitorHLTHough&
57 Fatal("operator =", "assignment operator not implemented");
62 //_____________________________________________________________________________
63 void AliMonitorHLTHough::CreateHistos(TFolder* folder)
65 // create the HLT Hough transform monitor histograms
67 fFolder = folder->AddFolder("HLTHOUGH", "HLTHOUGH");
69 fClustersCharge = CreateHisto1("ClustersCharge",
70 "charge distribution of clusters",
71 100, 0, 1000, "charge", "#Delta N/N",
72 AliMonitorHisto::kNormEvents);
74 Int_t nRows = fParam->GetNRowLow() + fParam->GetNRowUp();
75 fNClustersVsRow = CreateHisto1("NClustersVsRow",
76 "mean number of clusters per pad row",
77 nRows, -0.5, nRows-0.5,
78 "pad row", "<N_{clusters}>",
79 AliMonitorHisto::kNormEvents);
81 Int_t nSector = fParam->GetNInnerSector();
82 fNClustersVsSector = CreateHisto1("NClustersVsSector",
83 "mean number of clusters per sector",
84 nSector, -0.5, nSector-0.5,
85 "sector", "<N_{clusters}>",
86 AliMonitorHisto::kNormEvents);
88 fNTracks = CreateTrend("NTracks", "number of tracks per event",
91 fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks",
92 90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
93 AliMonitorHisto::kNormNone);
95 fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks",
96 100, -2, 2, "#eta", "#Delta N/N",
97 AliMonitorHisto::kNormEntries);
99 fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks",
100 120, 0, 360, "#phi [#circ]", "#Delta N/N",
101 AliMonitorHisto::kNormEntries);
103 fTrackNHits = CreateHisto1("TrackNHits", "Number of hits per track",
104 200, 0, 200, "N_{hits}", "#Delta N/N",
105 AliMonitorHisto::kNormNone);
107 fTrackDEdxVsP = CreateHisto2("TrackDEdxVsP", "dE/dx of tracks",
108 100, 0, 3, 100, 0, 1000,
109 "p [GeV/c]", "dE/dx", "#Delta N/N",
110 AliMonitorHisto::kNormEntries);
112 fTrackDEdx = CreateHisto1("TrackDEdx", "dE/dx for tracks with 0.4<p<1.0 GeV/c",
114 "dE/dx", "#Delta N/N",
115 AliMonitorHisto::kNormEntries);
117 fTrackEtaVsPhi = CreateHisto2("TrackEtaVsPhi", "#phi vs #eta",
118 20, -1, 1, 25, 0, 360,
119 "#eta", "#phi", "#Delta N/N",
120 AliMonitorHisto::kNormNone);
122 fPtEtaVsPhi = CreateHisto2("PtEtaVsPhi", "#phi vs #eta",
123 20, -1, 1, 25, 0, 360,
124 "#eta", "#phi", "#Delta N/N",
125 AliMonitorHisto::kNormNone);
130 //_____________________________________________________________________________
131 void AliMonitorHLTHough::FillHistos(AliRunLoader* /*runLoader*/,
132 AliRawReader* /*rawReader*/,
135 // fill the HLT Hough transform monitor histograms
138 Warning("FillHistos", "the code was compiled without HLT support");
141 AliL3MemHandler clusterHandler[36][6];
142 AliL3SpacePointData *clusters[36][6];
143 for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
144 for (Int_t iPatch = 0; iPatch < 6; iPatch++) {
146 sprintf(fileName, "hlt/fitter/points_%d_%d.raw", iSector,iPatch);
147 if (!clusterHandler[iSector][iPatch].SetBinaryInput(fileName)) {
148 Warning("FillHistos", "could not open file %s", fileName);
151 clusters[iSector][iPatch] = (AliL3SpacePointData*) clusterHandler[iSector][iPatch].Allocate();
152 UInt_t nClusters = 0;
153 clusterHandler[iSector][iPatch].Binary2Memory(nClusters, clusters[iSector][iPatch]);
155 for (UInt_t iCluster = 0; iCluster < nClusters; iCluster++) {
156 AliL3SpacePointData& cluster = clusters[iSector][iPatch][iCluster];
157 fClustersCharge->Fill(cluster.fCharge);
158 fNClustersVsRow->Fill(cluster.fPadRow);
159 fNClustersVsSector->Fill(iSector);
162 clusterHandler[iSector][iPatch].CloseBinaryInput();
166 fNClustersVsSector->ScaleErrorBy(10.);
169 AliL3MemHandler memHandler;
170 Int_t nHoughTracks = 0;
173 sprintf(fileName, "hlt/fitter/tracks.raw");
174 if (!memHandler.SetBinaryInput(fileName)) {
175 Warning("FillHistos", "could not open file hlt/fitter/tracks.raw");
178 AliL3TrackArray* tracks = new AliL3TrackArray;
179 memHandler.Binary2TrackArray(tracks);
181 nHoughTracks += tracks->GetNTracks();
182 for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
183 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(iTrack);
186 track->CalculateHelix();
187 // track->Rotate(iSector);
189 fTrackPt->Fill(track->GetPt());
190 fTrackEta->Fill(track->GetPseudoRapidity());
191 fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
192 if(track->GetPt()>3.) {
193 fTrackEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg());
194 fPtEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg(),track->GetPt());
196 fTrackNHits->Fill(track->GetNHits());
199 Int_t nc=track->GetNHits();
200 UInt_t *hits = track->GetHitNumbers();
201 Float_t sampleDEdx[159];
202 for (Int_t iHit = 0; iHit < nc; iHit++) {
203 UInt_t hitID = hits[iHit];
204 Int_t iSector = (hitID>>25) & 0x7f;
205 Int_t iPatch = (hitID>>22) & 0x7;
206 UInt_t position = hitID&0x3fffff;
207 UChar_t padrow = clusters[iSector][iPatch][position].fPadRow;
208 Float_t pWidth = AliL3Transform::GetPadPitchWidthLow();
210 pWidth = AliL3Transform::GetPadPitchWidthUp();
211 Float_t corr=1.; if (padrow>63) corr=0.67;
212 sampleDEdx[iHit] = clusters[iSector][iPatch][position].fCharge/pWidth*corr;
213 Double_t crossingangle = track->GetCrossingAngle(padrow,iSector);
214 Double_t s = sin(crossingangle);
215 Double_t t = track->GetTgl();
216 sampleDEdx[iHit] *= TMath::Sqrt((1-s*s)/(1+t*t));
221 Int_t swap;//stupid sorting
224 for (i=0; i<nc-1; i++) {
225 if (sampleDEdx[i]<=sampleDEdx[i+1]) continue;
226 Float_t tmp=sampleDEdx[i];
227 sampleDEdx[i]=sampleDEdx[i+1]; sampleDEdx[i+1]=tmp;
232 Double_t low=0.05; Double_t up=0.7;
233 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
235 for (i=nl; i<=nu; i++) trackDEdx += sampleDEdx[i];
236 trackDEdx /= (nu-nl+1);
238 fTrackDEdxVsP->Fill(track->GetP(),trackDEdx);
239 if(track->GetP()>0.4 && track->GetP()<1.0)
240 fTrackDEdx->Fill(trackDEdx);
242 fNTracks->Fill(nHoughTracks);
245 memHandler.CloseBinaryInput();