HLT hough transformation updated
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorHLTHough.cxx
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"
28 #include <TFolder.h>
29 #ifdef ALI_HLT
30 #include <stdlib.h>
31 #include <AliL3MemHandler.h>
32 #include <AliL3TrackArray.h>
33 #include <AliL3HoughTrack.h>
34 #endif
35
36 //_____________________________________________________________________________
37 AliMonitorHLTHough::AliMonitorHLTHough(AliTPCParam* param)
38 {
39 // create a HLT monitor object with the given parameters
40
41   fParam = param;
42 }
43
44 //_____________________________________________________________________________
45 AliMonitorHLTHough::AliMonitorHLTHough(const AliMonitorHLTHough& monitor) :
46   AliMonitor(monitor)
47 {
48   Fatal("AliMonitorHLTHough", "copy constructor not implemented");
49 }
50
51 //_____________________________________________________________________________
52 AliMonitorHLTHough& AliMonitorHLTHough::operator = (const AliMonitorHLTHough& 
53                                                     /*monitor*/)
54 {
55   Fatal("operator =", "assignment operator not implemented");
56   return *this;
57 }
58
59
60 //_____________________________________________________________________________
61 void AliMonitorHLTHough::CreateHistos(TFolder* folder)
62 {
63 // create the HLT Hough transform monitor histograms
64
65   fFolder = folder->AddFolder("HLTHOUGH", "HLTHOUGH");
66
67   fNTracks = CreateTrend("NTracks", "number of tracks per event", 
68                          "N_{tracks}");
69
70   fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks", 
71                           90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
72                           AliMonitorHisto::kNormNone);
73
74   fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks", 
75                            100, -2, 2, "#eta", "#Delta N/N",
76                            AliMonitorHisto::kNormEntries);
77
78   fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks", 
79                            120, 0, 360, "#phi [#circ]", "#Delta N/N",
80                            AliMonitorHisto::kNormEntries);
81
82   fTrackEtaVsPhi = CreateHisto2("TrackEtaVsPhi", "#phi vs #eta", 
83                                20, -1, 1, 25, 0, 360, 
84                                "#eta", "#phi", "#Delta N/N",
85                                AliMonitorHisto::kNormNone);
86
87   fPtEtaVsPhi = CreateHisto2("PtEtaVsPhi", "#phi vs #eta", 
88                                20, -1, 1, 25, 0, 360, 
89                                "#eta", "#phi", "#Delta N/N",
90                                AliMonitorHisto::kNormNone);
91
92 }
93
94
95 //_____________________________________________________________________________
96 void AliMonitorHLTHough::FillHistos(AliRunLoader* /*runLoader*/, 
97                                     AliRawReader* /*rawReader*/)
98 {
99 // fill the HLT Hough transform monitor histograms
100
101 #ifndef ALI_HLT
102   Warning("FillHistos", "the code was compiled without HLT support");
103
104 #else
105   AliL3MemHandler memHandler[36];
106   Int_t nHoughTracks = 0;
107   for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
108     char fileName[256];
109     sprintf(fileName, "hlt/tracks_ho_%d.raw", iSector);
110     if (!memHandler[iSector].SetBinaryInput(fileName)) {
111       Warning("FillHistos", "could not open file hlt/tracks.raw");
112       return;
113     }
114     AliL3TrackArray* tracks = new AliL3TrackArray;
115     memHandler[iSector].Binary2TrackArray(tracks);
116
117     nHoughTracks += tracks->GetNTracks();
118     for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
119       AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(iTrack);
120       if(!track) continue;
121
122       track->CalculateHelix();
123       track->Rotate(iSector);
124
125       fTrackPt->Fill(track->GetPt());
126       fTrackEta->Fill(track->GetPseudoRapidity());
127       fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
128       if(track->GetPt()>3.) {
129         fTrackEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg());
130         fPtEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg(),track->GetPt());
131       }
132     }
133     fNTracks->Fill(nHoughTracks);
134
135     delete tracks;
136     memHandler[iSector].CloseBinaryInput();
137   }
138 #endif
139 }