]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EVE/AliHLTEveTRD.cxx
coverity warning fix
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEveTRD.cxx
CommitLineData
33791895 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Primary Authors: Svein Lindal <slindal@fys.uio.no > *
6 * for The ALICE HLT Project. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17/// @file AliHLTEvePhos.cxx
18/// @author Svein Lindal <slindal@fys.uio.no>
19/// @brief TPC processor for the HLT EVE display
20
fd2adb88 21#include "TClonesArray.h"
33791895 22#include "AliHLTEveTRD.h"
23#include "AliHLTHOMERBlockDesc.h"
24#include "TCanvas.h"
25#include "AliHLTEveBase.h"
fd2adb88 26#include "AliEveHLTEventManager.h"
33791895 27#include "TEveManager.h"
28#include "TEvePointSet.h"
29#include "TColor.h"
30#include "TMath.h"
31#include "TH1F.h"
b05582c2 32#include "AliHLTTRDUtils.h"
33791895 33#include "AliTRDcluster.h"
34
35ClassImp(AliHLTEveTRD)
36
37AliHLTEveTRD::AliHLTEveTRD() :
fd2adb88 38 AliHLTEveBase("TRD"),
33791895 39 fEveClusters(NULL),
40 fEveColClusters(NULL),
b05582c2 41 fNColorBins(15),
42 fClusterArray(NULL)
33791895 43{
44 // Constructor.
b05582c2 45 fClusterArray = new TClonesArray("AliTRDcluster");
33791895 46}
47
48AliHLTEveTRD::~AliHLTEveTRD()
49{
50 //Destructor, not implemented
51 if(fEveColClusters)
52 delete fEveColClusters;
53 fEveColClusters = NULL;
54
55 if(fEveClusters)
56 delete fEveClusters;
57 fEveClusters = NULL;
b05582c2 58
59 fClusterArray->Delete();
60 delete fClusterArray;
61 fClusterArray = NULL;
33791895 62}
63
64
65void AliHLTEveTRD::ProcessBlock(AliHLTHOMERBlockDesc * block) {
66 //See header file for documentation
67
68 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
69
70 if(!fEveColClusters){
71 fEveColClusters = CreatePointSetArray();
fd2adb88 72 AddElement(fEveColClusters);
33791895 73 }
74
cfbfd71f 75 ProcessClusters(block, fEveColClusters);
33791895 76
77 } else if ( ! block->GetDataType().CompareTo("ROOTHIST") ) {
78
2e183639 79 if(!fCanvas) {
80 fCanvas = CreateCanvas("TRD QA", "TRD QA");
85c7b780 81 fCanvas->Divide(3, 3);
2e183639 82 }
83
33791895 84 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
85
86 }
87
88}
89
90
91void AliHLTEveTRD::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* block, TCanvas * canvas, Int_t &cdCount ) {
92 //See header file for documentation
93 if ( ! block->GetClassName().CompareTo("TH1F")) {
94 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
95 ++cdCount;
96
97 TVirtualPad* pad = canvas->cd(cdCount);
98 histo->Draw();
99 pad->SetGridy();
100 pad->SetGridx();
101
102 if ( ! strcmp(histo->GetName(), "nscls") ) {
103 histo->GetXaxis()->SetRangeUser(0.,15.);
104 }
105
106 if ( ! strcmp(histo->GetName(),"sclsdist") ||
107 ! strcmp(histo->GetName(),"evSize") )
108 pad->SetLogy();
109 }
110
111}
112
113
114
115TEvePointSet * AliHLTEveTRD::CreatePointSet() {
116 //See header file for documentation
117 TEvePointSet * ps = new TEvePointSet("TRD Clusters");
118 ps->SetMainColor(kBlue);
119 ps->SetMarkerStyle((Style_t)kFullDotSmall);
120
121 return ps;
122
123}
124
125TEvePointSetArray * AliHLTEveTRD::CreatePointSetArray(){
f7b376b6 126
127 Int_t i = 0;
128
129 cout << i++ << endl;
33791895 130 //See header file for documentation
131 TEvePointSetArray * cc = new TEvePointSetArray("TRD Clusters Colorized");
f7b376b6 132 cout << i++ << endl;
33791895 133 cc->SetMainColor(kRed);
f7b376b6 134 cout << i++ << endl;
33791895 135 cc->SetMarkerStyle(4); // antialiased circle
f7b376b6 136 cout << i++ << endl;
33791895 137 cc->SetMarkerSize(0.4);
f7b376b6 138 cout << i++ << endl;
33791895 139 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*100.);
f7b376b6 140 cout << i++ << endl;
33791895 141
142 const Int_t nCol = TColor::GetNumberOfColors();
f7b376b6 143 cout << i++ << endl;
33791895 144 for (Int_t ii = 0; ii < fNColorBins + 1; ++ii) {
145 cc->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (fNColorBins+2)));
146 }
f7b376b6 147 cout << i++ << endl;
33791895 148
149 return cc;
150
151}
152
153
154void AliHLTEveTRD::UpdateElements() {
155 //See header file for documentation
156 if(fCanvas) fCanvas->Update();
c79c1652 157 // if(fEveClusters) fEveClusters->ResetBBox();
33791895 158
0fca96b6 159 if(fEveColClusters) {
160 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
161 fEveColClusters->GetBin(ib)->ResetBBox();
162 }
e6b89bec 163 }
33791895 164}
165
166void AliHLTEveTRD::ResetElements(){
167 //See header file for documentation
c79c1652 168 // if(fEveClusters) fEveClusters->Reset();
33791895 169
170 if(fEveColClusters){
171 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
172 fEveColClusters->GetBin(ib)->Reset();
173 }
174 }
175
2e183639 176 fHistoCount = 0;
33791895 177}
178
cfbfd71f 179Int_t AliHLTEveTRD::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSetArray * contCol ){
33791895 180 //See header file for documentation
e6b89bec 181
33791895 182 Int_t iResult = 0;
183
184 Int_t sm = block->GetSubDetector();
185 if ( sm == 6 ) sm = 7;
186
187 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
188 Float_t cos = TMath::Cos( phi );
189 Float_t sin = TMath::Sin( phi );
190
191 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
192 UInt_t ptrSize = block->GetSize();
b05582c2 193 Int_t unused;
33791895 194
b05582c2 195 AliHLTTRDUtils::ReadClusters(fClusterArray, ptrData, ptrSize, &unused);
196
197 for(int num=fClusterArray->GetEntriesFast(); num--;){
198 AliTRDcluster* trdCluster = (AliTRDcluster*)fClusterArray->At(num);
33791895 199 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
b05582c2 200 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
201 trdCluster->GetZ(),
202 trdCluster->GetQ() );
33791895 203 }
204
205 return iResult;
33791895 206}
207
208