]>
Commit | Line | Data |
---|---|---|
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 "AliHLTEveTPC.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 "AliHLTTPCClusterDataFormat.h" | |
31 | #include "TH1F.h" | |
32 | ||
33 | ClassImp(AliHLTEveTPC) | |
34 | ||
35 | AliHLTEveTPC::AliHLTEveTPC() : | |
36 | AliHLTEveBase(), | |
37 | fEveClusters(NULL), | |
38 | fEveColClusters(NULL), | |
39 | fNColorBins(15), | |
40 | fHistCharge(NULL), | |
41 | fHistQMax(NULL), | |
42 | fHistQMaxOverCharge(NULL) | |
43 | { | |
44 | // Constructor. | |
45 | } | |
46 | ||
47 | AliHLTEveTPC::~AliHLTEveTPC() | |
48 | { | |
49 | //Destructor | |
50 | if(fEveColClusters) | |
51 | delete fEveColClusters; | |
52 | fEveColClusters = NULL; | |
53 | ||
54 | if(fEveClusters) | |
55 | delete fEveClusters; | |
56 | fEveClusters = NULL; | |
57 | ||
58 | if(fHistQMaxOverCharge) | |
59 | delete fHistQMaxOverCharge; | |
60 | fHistQMaxOverCharge = NULL; | |
61 | ||
62 | if(fHistQMax) | |
63 | delete fHistQMax; | |
64 | fHistQMax = NULL; | |
65 | ||
66 | if(fHistCharge) | |
67 | delete fHistCharge; | |
68 | fHistCharge = NULL; | |
69 | ||
70 | } | |
71 | ||
72 | ||
73 | void AliHLTEveTPC::ProcessBlock(AliHLTHOMERBlockDesc * block) { | |
74 | //See header file for documentation | |
75 | ||
76 | if ( ! block->GetDataType().CompareTo("CLUSTERS") ) { | |
77 | ||
78 | if(!fEveClusters){ | |
79 | fEveClusters = CreatePointSet(); | |
80 | //fEventManager->GetEveManager()->AddElement(fEveClusters); | |
81 | } | |
82 | ||
83 | if(!fEveColClusters){ | |
84 | fEveColClusters = CreatePointSetArray(); | |
85 | fEventManager->GetEveManager()->AddElement(fEveColClusters); | |
86 | } | |
87 | ||
88 | ProcessClusters(block, fEveClusters, fEveColClusters); | |
89 | ||
90 | } | |
91 | ||
92 | // else if ( ! block->GetDataType().CompareTo("HWCL_ALT") ) { | |
93 | // if(!gTPCTestClusters){ | |
94 | ||
95 | // gTPCTestClusters = new TEvePointSet("TPC Clusters Test"); | |
96 | // //ggTPCTestClusters->ApplyVizTag("TPC Clusters"); | |
97 | // gTPCTestClusters->SetMainColor(kBlue); | |
98 | // gTPCTestClusters->SetMarkerStyle((Style_t)kFullDotSmall); | |
99 | // gEve->AddElement(gTPCTestClusters); | |
100 | // } | |
101 | ||
102 | // processTPCClusters(block, gTPCTestClusters); | |
103 | // gTPCTestClusters->ElementChanged(); | |
104 | // } | |
105 | ||
106 | ||
107 | } | |
108 | ||
109 | TEvePointSet * AliHLTEveTPC::CreatePointSet() { | |
110 | //See header file for documentation | |
111 | ||
112 | TEvePointSet * ps = new TEvePointSet("TPC Clusters"); | |
113 | ps->SetMainColor(kRed); | |
114 | ps->SetMarkerStyle((Style_t)kFullDotSmall); | |
115 | ||
116 | return ps; | |
117 | ||
118 | } | |
119 | ||
120 | TEvePointSetArray * AliHLTEveTPC::CreatePointSetArray(){ | |
121 | //See header file for documentation | |
122 | ||
123 | TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized"); | |
124 | cc->SetMainColor(kRed); | |
125 | cc->SetMarkerStyle(4); // antialiased circle | |
126 | cc->SetMarkerSize(0.4); | |
127 | cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*20.); | |
128 | ||
129 | const Int_t nCol = TColor::GetNumberOfColors(); | |
130 | ||
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 | ||
140 | void AliHLTEveTPC::UpdateElements() { | |
141 | //See header file for documentation | |
142 | ||
33791895 | 143 | if(fEveClusters) fEveClusters->ResetBBox(); |
dd407e8c | 144 | |
145 | if (fHistQMax || fHistQMaxOverCharge || fHistCharge ) | |
146 | DrawHistograms(); | |
147 | ||
148 | if(fCanvas) fCanvas->Update(); | |
33791895 | 149 | |
150 | // if(fEveColClusters){ | |
151 | // for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) { | |
152 | // fEveColClusters->GetBin(ib)->ResetBBox(); | |
153 | // } | |
154 | // } | |
155 | ||
156 | } | |
157 | ||
158 | void AliHLTEveTPC::ResetElements(){ | |
159 | //See header file for documentation | |
160 | ||
161 | if(fEveClusters) fEveClusters->Reset(); | |
162 | if(fEveColClusters){ | |
163 | for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) { | |
164 | fEveColClusters->GetBin(ib)->Reset(); | |
165 | } | |
166 | } | |
167 | ||
168 | } | |
169 | ||
170 | Int_t AliHLTEveTPC::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSet * cont, TEvePointSetArray * contCol ){ | |
171 | //See header file for documentation | |
172 | ||
173 | ||
dd407e8c | 174 | if(!fHistCharge) fHistCharge = new TH1F("ClusterCharge","ClusterCharge",100,0,500); |
175 | if(!fHistQMax) fHistQMax = new TH1F("QMax","QMax",50,0,250); | |
176 | if(!fHistQMaxOverCharge) fHistQMaxOverCharge = new TH1F("QMaxOverCharge","QMaxOverCharge",50,0,1); | |
33791895 | 177 | |
178 | ||
179 | Int_t slice = block->GetSubDetector(); | |
180 | Float_t phi = ( slice + 0.5 ) * TMath::Pi() / 9.0; | |
181 | Float_t cos = TMath::Cos( phi ); | |
182 | Float_t sin = TMath::Sin( phi ); | |
183 | ||
184 | AliHLTTPCClusterData *cd = reinterpret_cast<AliHLTTPCClusterData*> (block->GetData()); | |
185 | UChar_t *data = reinterpret_cast<UChar_t*> (cd->fSpacePoints); | |
186 | ||
187 | if ( cd->fSpacePointCnt != 0 ) { | |
188 | for (UInt_t iter = 0; iter < cd->fSpacePointCnt; ++iter, data += sizeof(AliHLTTPCSpacePointData)) { | |
189 | AliHLTTPCSpacePointData *sp = reinterpret_cast<AliHLTTPCSpacePointData*> (data); | |
190 | cont->SetNextPoint(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ); | |
191 | if (contCol) | |
192 | contCol->Fill(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ, sp->fCharge); | |
193 | ||
dd407e8c | 194 | |
33791895 | 195 | fHistCharge->Fill(sp->fCharge); |
196 | fHistQMax->Fill(sp->fQMax); | |
197 | fHistQMaxOverCharge->Fill(((Float_t)sp->fQMax)/((Float_t)sp->fCharge)); | |
198 | } | |
199 | } | |
200 | ||
33791895 | 201 | |
202 | cont->ElementChanged(); | |
203 | contCol->ElementChanged(); | |
204 | ||
205 | return 0; | |
206 | ||
207 | ||
208 | } | |
209 | ||
dd407e8c | 210 | void AliHLTEveTPC::DrawHistograms() { |
211 | //See header file for documentation | |
212 | if (!fCanvas) { | |
353f10b3 | 213 | fCanvas = CreateCanvas("TPC Cl QA", "TPC Cluster QA"); |
dd407e8c | 214 | fCanvas->Divide(2, 2); |
215 | } | |
216 | ||
217 | Int_t icd = 1; | |
218 | fCanvas->cd(icd++); | |
219 | fHistCharge->Draw(); | |
220 | fCanvas->cd(icd++); | |
221 | fHistQMax->Draw(); | |
222 | fCanvas->cd(icd++); | |
223 | fHistQMaxOverCharge->Draw(); | |
224 | fCanvas->cd(); | |
225 | ||
33791895 | 226 | |
dd407e8c | 227 | } |