Using sync TTimer instead of the a-sync one (C.Cheshkov)
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorHLT.cxx
CommitLineData
97d6eb66 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/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// This class creates and fills the monitor histograms for the HLT //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24
25#include "AliMonitorHLT.h"
26#ifdef ALI_HLT
27#include <stdlib.h>
28#include "AliL3MemHandler.h"
29#include "AliL3SpacePointData.h"
30#include "AliL3TrackArray.h"
31#include "AliL3Track.h"
32#endif
33
34//_____________________________________________________________________________
35AliMonitorHLT::AliMonitorHLT(AliTPCParam* param)
36{
37// create a HLT monitor object with the given parameters
38
39 fParam = param;
40}
41
42//_____________________________________________________________________________
43AliMonitorHLT::~AliMonitorHLT()
44{
45}
46
47
48//_____________________________________________________________________________
49void AliMonitorHLT::CreateHistos(TFolder* folder)
50{
51// create the HLT monitor histograms
52
53 fFolder = folder->AddFolder("HLT", "HLT");
54
55 fClustersCharge = CreateHisto1("ClustersCharge",
56 "charge distribution of clusters",
57 100, 0, 1000, "charge", "#Delta N/N",
58 AliMonitorHisto::kNormEvents);
59
60 Int_t nRows = fParam->GetNRowLow() + fParam->GetNRowUp();
61 fNClustersVsRow = CreateHisto1("NClustersVsRow",
62 "mean number of clusters per pad row",
63 nRows, -0.5, nRows-0.5,
64 "pad row", "<N_{clusters}>",
65 AliMonitorHisto::kNormEvents);
66
67 Int_t nSector = fParam->GetNInnerSector();
68 fNClustersVsSector = CreateHisto1("NClustersVsSector",
69 "mean number of clusters per sector",
70 nSector, -0.5, nSector-0.5,
71 "sector", "<N_{clusters}>",
72 AliMonitorHisto::kNormEvents);
73
74 fNTracks = CreateTrend("NTracks", "number of tracks per event",
75 "N_{tracks}");
76
77 fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks",
78 90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
79 AliMonitorHisto::kNormEntries);
80
81 fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks",
82 100, -2, 2, "#eta", "#Delta N/N",
83 AliMonitorHisto::kNormEntries);
84
85 fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks",
86 120, 0, 360, "#phi [#circ]", "#Delta N/N",
87 AliMonitorHisto::kNormEntries);
88}
89
90
91#include <TCanvas.h>
92//_____________________________________________________________________________
93void AliMonitorHLT::FillHistos(AliRunLoader* /*runLoader*/,
94 AliRawReader* /*rawReader*/)
95{
96// fill the HLT monitor histogrms
97
98#ifndef ALI_HLT
99 Warning("FillHistos", "the code was compiled without HLT support");
100
101#else
102 AliL3MemHandler memHandler;
103 for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
104 char fileName[256];
105 sprintf(fileName, "hlt/points_%d_-1.raw", iSector);
106 if (!memHandler.SetBinaryInput(fileName)) {
107 Warning("FillHistos", "could not open file %s", fileName);
108 continue;
109 }
110 AliL3SpacePointData* clusters =
111 (AliL3SpacePointData*) memHandler.Allocate();
112 UInt_t nClusters = 0;
113 memHandler.Binary2Memory(nClusters, clusters);
114
115 for (UInt_t iCluster = 0; iCluster < nClusters; iCluster++) {
116 AliL3SpacePointData& cluster = clusters[iCluster];
117 fClustersCharge->Fill(cluster.fCharge);
118 fNClustersVsRow->Fill(cluster.fPadRow);
119 fNClustersVsSector->Fill(iSector);
120 }
121
122 memHandler.Free();
123 memHandler.CloseBinaryInput();
124 }
125
126 fNClustersVsSector->ScaleErrorBy(10.);
127
128 if (!memHandler.SetBinaryInput("hlt/tracks.raw")) {
129 Warning("FillHistos", "could not open file hlt/tracks.raw");
130 return;
131 }
132 AliL3TrackArray* tracks = new AliL3TrackArray;
133 memHandler.Binary2TrackArray(tracks);
134
135 fNTracks->Fill(tracks->GetNTracks());
136 for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
137 AliL3Track* track = tracks->GetTrack(iTrack);
138 fTrackPt->Fill(track->GetPt());
139 fTrackEta->Fill(track->GetPseudoRapidity());
140 fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
141 }
142
143 delete tracks;
144 memHandler.CloseBinaryInput();
145#endif
146}