]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EVE/AliHLTEveTRD.cxx
Merge branch 'devel'
[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
21#include "AliHLTEveTRD.h"
22#include "AliHLTHOMERBlockDesc.h"
23#include "TCanvas.h"
24#include "AliHLTEveBase.h"
25#include "AliEveHOMERManager.h"
26#include "TEveManager.h"
27#include "TEvePointSet.h"
28#include "TColor.h"
29#include "TMath.h"
30#include "TH1F.h"
31#include "AliHLTTRDCluster.h"
32#include "AliTRDcluster.h"
33
34ClassImp(AliHLTEveTRD)
35
36AliHLTEveTRD::AliHLTEveTRD() :
37 AliHLTEveBase(),
38 fEveClusters(NULL),
39 fEveColClusters(NULL),
40 fNColorBins(15)
41{
42 // Constructor.
43
44}
45
46AliHLTEveTRD::~AliHLTEveTRD()
47{
48 //Destructor, not implemented
49 if(fEveColClusters)
50 delete fEveColClusters;
51 fEveColClusters = NULL;
52
53 if(fEveClusters)
54 delete fEveClusters;
55 fEveClusters = NULL;
56}
57
58
59void AliHLTEveTRD::ProcessBlock(AliHLTHOMERBlockDesc * block) {
60 //See header file for documentation
61
e6b89bec 62 cout <<"TRD Clusters"<<endl;
63
33791895 64 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
65
66 if(!fEveColClusters){
67 fEveColClusters = CreatePointSetArray();
68 fEventManager->GetEveManager()->AddElement(fEveColClusters);
69 }
70
71 ProcessClusters(block, fEveClusters, fEveColClusters);
72
73 } else if ( ! block->GetDataType().CompareTo("ROOTHIST") ) {
74
2e183639 75 if(!fCanvas) {
76 fCanvas = CreateCanvas("TRD QA", "TRD QA");
77 fCanvas->Divide(3, 2);
78 }
79
33791895 80 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
81
82 }
83
84}
85
86
87void AliHLTEveTRD::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* block, TCanvas * canvas, Int_t &cdCount ) {
88 //See header file for documentation
89 if ( ! block->GetClassName().CompareTo("TH1F")) {
2e183639 90 cout<<"TH1F"<<endl;
33791895 91 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
92 ++cdCount;
93
94 TVirtualPad* pad = canvas->cd(cdCount);
95 histo->Draw();
96 pad->SetGridy();
97 pad->SetGridx();
98
99 if ( ! strcmp(histo->GetName(), "nscls") ) {
100 histo->GetXaxis()->SetRangeUser(0.,15.);
101 }
102
103 if ( ! strcmp(histo->GetName(),"sclsdist") ||
104 ! strcmp(histo->GetName(),"evSize") )
105 pad->SetLogy();
106 }
107
108}
109
110
111
112TEvePointSet * AliHLTEveTRD::CreatePointSet() {
113 //See header file for documentation
114 TEvePointSet * ps = new TEvePointSet("TRD Clusters");
115 ps->SetMainColor(kBlue);
116 ps->SetMarkerStyle((Style_t)kFullDotSmall);
117
118 return ps;
119
120}
121
122TEvePointSetArray * AliHLTEveTRD::CreatePointSetArray(){
123 //See header file for documentation
124 TEvePointSetArray * cc = new TEvePointSetArray("TRD Clusters Colorized");
125 cc->SetMainColor(kRed);
126 cc->SetMarkerStyle(4); // antialiased circle
127 cc->SetMarkerSize(0.4);
128 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*100.);
129
130 const Int_t nCol = TColor::GetNumberOfColors();
131 for (Int_t ii = 0; ii < fNColorBins + 1; ++ii) {
132 cc->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (fNColorBins+2)));
133 }
134
135 return cc;
136
137}
138
139
140void AliHLTEveTRD::UpdateElements() {
141 //See header file for documentation
142 if(fCanvas) fCanvas->Update();
143 if(fEveClusters) fEveClusters->ResetBBox();
144
e6b89bec 145 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
146 fEveColClusters->GetBin(ib)->ResetBBox();
147 }
33791895 148
149}
150
151void AliHLTEveTRD::ResetElements(){
152 //See header file for documentation
153 if(fEveClusters) fEveClusters->Reset();
154
155 if(fEveColClusters){
156 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
157 fEveColClusters->GetBin(ib)->Reset();
158 }
159 }
160
2e183639 161 fHistoCount = 0;
33791895 162}
163
164Int_t AliHLTEveTRD::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSet * cont, TEvePointSetArray * contCol ){
165 //See header file for documentation
166
e6b89bec 167 cout <<"processclusters"<<endl;
168
33791895 169 Int_t iResult = 0;
170
171 Int_t sm = block->GetSubDetector();
172 if ( sm == 6 ) sm = 7;
173
174 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
175 Float_t cos = TMath::Cos( phi );
176 Float_t sin = TMath::Sin( phi );
177
178 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
179 UInt_t ptrSize = block->GetSize();
180
181 for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) {
182 AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size]));
183
184 AliTRDcluster *trdCluster = new AliTRDcluster;
185 cluster->ExportTRDCluster( trdCluster );
186
187 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
188 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
189 trdCluster->GetZ(),
190 trdCluster->GetQ() );
e6b89bec 191
192 //cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
193 // sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ());
33791895 194 }
195
196 return iResult;
197
198
199
200
201
202
203 return 0;
204
205
206}
207
208