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*/)
134 // fill the HLT Hough transform monitor histograms
137 Warning("FillHistos", "the code was compiled without HLT support");
140 AliL3MemHandler clusterHandler[36][6];
141 AliL3SpacePointData *clusters[36][6];
142 for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
143 for (Int_t iPatch = 0; iPatch < 6; iPatch++) {
145 sprintf(fileName, "hlt/fitter/points_%d_%d.raw", iSector,iPatch);
146 if (!clusterHandler[iSector][iPatch].SetBinaryInput(fileName)) {
147 Warning("FillHistos", "could not open file %s", fileName);
150 clusters[iSector][iPatch] = (AliL3SpacePointData*) clusterHandler[iSector][iPatch].Allocate();
151 UInt_t nClusters = 0;
152 clusterHandler[iSector][iPatch].Binary2Memory(nClusters, clusters[iSector][iPatch]);
154 for (UInt_t iCluster = 0; iCluster < nClusters; iCluster++) {
155 AliL3SpacePointData& cluster = clusters[iSector][iPatch][iCluster];
156 fClustersCharge->Fill(cluster.fCharge);
157 fNClustersVsRow->Fill(cluster.fPadRow);
158 fNClustersVsSector->Fill(iSector);
161 clusterHandler[iSector][iPatch].CloseBinaryInput();
165 fNClustersVsSector->ScaleErrorBy(10.);
168 AliL3MemHandler memHandler;
169 Int_t nHoughTracks = 0;
172 sprintf(fileName, "hlt/fitter/tracks.raw");
173 if (!memHandler.SetBinaryInput(fileName)) {
174 Warning("FillHistos", "could not open file hlt/fitter/tracks.raw");
177 AliL3TrackArray* tracks = new AliL3TrackArray;
178 memHandler.Binary2TrackArray(tracks);
180 nHoughTracks += tracks->GetNTracks();
181 for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
182 AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(iTrack);
185 track->CalculateHelix();
186 // track->Rotate(iSector);
188 fTrackPt->Fill(track->GetPt());
189 fTrackEta->Fill(track->GetPseudoRapidity());
190 fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
191 if(track->GetPt()>3.) {
192 fTrackEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg());
193 fPtEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg(),track->GetPt());
195 fTrackNHits->Fill(track->GetNHits());
198 Int_t nc=track->GetNHits();
199 UInt_t *hits = track->GetHitNumbers();
200 Float_t sampleDEdx[159];
201 for (Int_t iHit = 0; iHit < nc; iHit++) {
202 UInt_t hitID = hits[iHit];
203 Int_t iSector = (hitID>>25) & 0x7f;
204 Int_t iPatch = (hitID>>22) & 0x7;
205 UInt_t position = hitID&0x3fffff;
206 UChar_t padrow = clusters[iSector][iPatch][position].fPadRow;
207 Float_t pWidth = AliL3Transform::GetPadPitchWidthLow();
209 pWidth = AliL3Transform::GetPadPitchWidthUp();
210 Float_t corr=1.; if (padrow>63) corr=0.67;
211 sampleDEdx[iHit] = clusters[iSector][iPatch][position].fCharge/pWidth*corr;
212 Double_t crossingangle = track->GetCrossingAngle(padrow,iSector);
213 Double_t s = sin(crossingangle);
214 Double_t t = track->GetTgl();
215 sampleDEdx[iHit] *= TMath::Sqrt((1-s*s)/(1+t*t));
220 Int_t swap;//stupid sorting
223 for (i=0; i<nc-1; i++) {
224 if (sampleDEdx[i]<=sampleDEdx[i+1]) continue;
225 Float_t tmp=sampleDEdx[i];
226 sampleDEdx[i]=sampleDEdx[i+1]; sampleDEdx[i+1]=tmp;
231 Double_t low=0.05; Double_t up=0.7;
232 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
234 for (i=nl; i<=nu; i++) trackDEdx += sampleDEdx[i];
235 trackDEdx /= (nu-nl+1);
237 fTrackDEdxVsP->Fill(track->GetP(),trackDEdx);
238 if(track->GetP()>0.4 && track->GetP()<1.0)
239 fTrackDEdx->Fill(trackDEdx);
241 fNTracks->Fill(nHoughTracks);
244 memHandler.CloseBinaryInput();