1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
5 * Primary Authors: Svein Lindal <slindal@fys.uio.no > *
6 * for The ALICE HLT Project. *
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 **************************************************************************/
17 /// @file AliHLTEvePhos.cxx
18 /// @author Svein Lindal <slindal@fys.uio.no>
19 /// @brief TPC processor for the HLT EVE display
21 #include "AliHLTEveTPC.h"
22 #include "AliHLTHOMERBlockDesc.h"
24 #include "AliHLTEveBase.h"
25 #include "AliEveHLTEventManager.h"
26 #include "TEveManager.h"
27 #include "TEvePointSet.h"
30 #include "AliHLTTPCClusterDataFormat.h"
33 ClassImp(AliHLTEveTPC)
35 AliHLTEveTPC::AliHLTEveTPC() :
36 AliHLTEveBase("TPC Clusters"),
38 fEveColClusters(NULL),
42 fHistQMaxOverCharge(NULL)
47 AliHLTEveTPC::~AliHLTEveTPC()
51 delete fEveColClusters;
52 fEveColClusters = NULL;
58 if(fHistQMaxOverCharge)
59 delete fHistQMaxOverCharge;
60 fHistQMaxOverCharge = NULL;
73 void AliHLTEveTPC::ProcessBlock(AliHLTHOMERBlockDesc * block) {
74 //See header file for documentation
76 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
79 fEveClusters = CreatePointSet();
80 //fEventManager->GetEveManager()->AddElement(fEveClusters);
84 fEveColClusters = CreatePointSetArray();
85 AddElement(fEveColClusters);
88 ProcessClusters(block, fEveClusters, fEveColClusters);
92 // else if ( ! block->GetDataType().CompareTo("HWCL_ALT") ) {
93 // if(!gTPCTestClusters){
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);
102 // processTPCClusters(block, gTPCTestClusters);
103 // gTPCTestClusters->ElementChanged();
109 TEvePointSet * AliHLTEveTPC::CreatePointSet() {
110 //See header file for documentation
112 TEvePointSet * ps = new TEvePointSet("TPC Clusters");
113 ps->SetMainColor(kRed);
114 ps->SetMarkerStyle((Style_t)kFullDotSmall);
120 TEvePointSetArray * AliHLTEveTPC::CreatePointSetArray(){
121 //See header file for documentation
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.);
129 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)));
140 void AliHLTEveTPC::UpdateElements() {
141 //See header file for documentation
143 if(fEveClusters) fEveClusters->ResetBBox();
145 if (fHistQMax || fHistQMaxOverCharge || fHistCharge )
148 if(fCanvas) fCanvas->Update();
150 // if(fEveColClusters){
151 // for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
152 // fEveColClusters->GetBin(ib)->ResetBBox();
158 void AliHLTEveTPC::ResetElements(){
159 //See header file for documentation
161 if(fEveClusters) fEveClusters->Reset();
163 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
164 fEveColClusters->GetBin(ib)->Reset();
170 Int_t AliHLTEveTPC::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSet * cont, TEvePointSetArray * contCol ){
171 //See header file for documentation
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);
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 );
184 AliHLTTPCClusterData *cd = reinterpret_cast<AliHLTTPCClusterData*> (block->GetData());
185 UChar_t *data = reinterpret_cast<UChar_t*> (cd->fSpacePoints);
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);
192 contCol->Fill(cos*sp->fX - sin*sp->fY, sin*sp->fX + cos*sp->fY, sp->fZ, sp->fCharge);
195 // fHistCharge->Fill(sp->fCharge);
196 // fHistQMax->Fill(sp->fQMax);
197 // fHistQMaxOverCharge->Fill(((Float_t)sp->fQMax)/((Float_t)sp->fCharge));
202 cont->ElementChanged();
203 contCol->ElementChanged();
210 void AliHLTEveTPC::DrawHistograms() {
211 //See header file for documentation
213 fCanvas = CreateCanvas("TPC Cl QA", "TPC Cluster QA");
214 fCanvas->Divide(2, 2);
223 fHistQMaxOverCharge->Draw();