monitoring of HLT hough transformation added
[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 AliMonitorHLTHough::~AliMonitorHLTHough()
61 {
62 }
63
64
65 //_____________________________________________________________________________
66 void AliMonitorHLTHough::CreateHistos(TFolder* folder)
67 {
68 // create the HLT Hough transform monitor histograms
69
70   fFolder = folder->AddFolder("HLTHOUGH", "HLTHOUGH");
71
72   fNTracks = CreateTrend("NTracks", "number of tracks per event", 
73                          "N_{tracks}");
74
75   fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks", 
76                           90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
77                           AliMonitorHisto::kNormNone);
78
79   fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks", 
80                            100, -2, 2, "#eta", "#Delta N/N",
81                            AliMonitorHisto::kNormEntries);
82
83   fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks", 
84                            120, 0, 360, "#phi [#circ]", "#Delta N/N",
85                            AliMonitorHisto::kNormEntries);
86
87   fTrackEtaVsPhi = CreateHisto2("TrackEtaVsPhi", "#phi vs #eta", 
88                                20, -1, 1, 25, 0, 360, 
89                                "#eta", "#phi", "#Delta N/N",
90                                AliMonitorHisto::kNormNone);
91
92   fPtEtaVsPhi = CreateHisto2("PtEtaVsPhi", "#phi vs #eta", 
93                                20, -1, 1, 25, 0, 360, 
94                                "#eta", "#phi", "#Delta N/N",
95                                AliMonitorHisto::kNormNone);
96
97 }
98
99
100 //_____________________________________________________________________________
101 void AliMonitorHLTHough::FillHistos(AliRunLoader* /*runLoader*/, 
102                                     AliRawReader* /*rawReader*/)
103 {
104 // fill the HLT Hough transform monitor histograms
105
106 #ifndef ALI_HLT
107   Warning("FillHistos", "the code was compiled without HLT support");
108
109 #else
110   AliL3MemHandler memHandler[36];
111   Int_t nHoughTracks = 0;
112   for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
113     char fileName[256];
114     sprintf(fileName, "hlt/tracks_ho_%d.raw", iSector);
115     if (!memHandler[iSector].SetBinaryInput(fileName)) {
116       Warning("FillHistos", "could not open file hlt/tracks.raw");
117       return;
118     }
119     AliL3TrackArray* tracks = new AliL3TrackArray;
120     memHandler[iSector].Binary2TrackArray(tracks);
121
122     nHoughTracks += tracks->GetNTracks();
123     for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
124       AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(iTrack);
125       if(!track) continue;
126
127       track->CalculateHelix();
128       track->Rotate(iSector);
129
130       fTrackPt->Fill(track->GetPt());
131       fTrackEta->Fill(track->GetPseudoRapidity());
132       fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
133       if(track->GetPt()>3.) {
134         fTrackEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg());
135         fPtEtaVsPhi->Fill(track->GetPseudoRapidity(),track->GetPsi() * TMath::RadToDeg(),track->GetPt());
136       }
137     }
138     fNTracks->Fill(nHoughTracks);
139
140     delete tracks;
141     memHandler[iSector].CloseBinaryInput();
142   }
143 #endif
144 }