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 "AliHLTEveTRD.h"
22 #include "AliHLTHOMERBlockDesc.h"
24 #include "AliHLTEveBase.h"
25 #include "AliEveHOMERManager.h"
26 #include "TEveManager.h"
27 #include "TEvePointSet.h"
31 #include "AliHLTTRDCluster.h"
32 #include "AliTRDcluster.h"
34 ClassImp(AliHLTEveTRD)
36 AliHLTEveTRD::AliHLTEveTRD() :
39 fEveColClusters(NULL),
45 AliHLTEveTRD::~AliHLTEveTRD()
47 //Destructor, not implemented
49 delete fEveColClusters;
50 fEveColClusters = NULL;
58 void AliHLTEveTRD::ProcessBlock(AliHLTHOMERBlockDesc * block) {
59 //See header file for documentation
61 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
64 fEveColClusters = CreatePointSetArray();
65 fEventManager->GetEveManager()->AddElement(fEveColClusters);
68 ProcessClusters(block, fEveColClusters);
70 } else if ( ! block->GetDataType().CompareTo("ROOTHIST") ) {
73 fCanvas = CreateCanvas("TRD QA", "TRD QA");
74 fCanvas->Divide(3, 3);
77 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
84 void AliHLTEveTRD::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* block, TCanvas * canvas, Int_t &cdCount ) {
85 //See header file for documentation
86 if ( ! block->GetClassName().CompareTo("TH1F")) {
87 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
90 TVirtualPad* pad = canvas->cd(cdCount);
95 if ( ! strcmp(histo->GetName(), "nscls") ) {
96 histo->GetXaxis()->SetRangeUser(0.,15.);
99 if ( ! strcmp(histo->GetName(),"sclsdist") ||
100 ! strcmp(histo->GetName(),"evSize") )
108 TEvePointSet * AliHLTEveTRD::CreatePointSet() {
109 //See header file for documentation
110 TEvePointSet * ps = new TEvePointSet("TRD Clusters");
111 ps->SetMainColor(kBlue);
112 ps->SetMarkerStyle((Style_t)kFullDotSmall);
118 TEvePointSetArray * AliHLTEveTRD::CreatePointSetArray(){
123 //See header file for documentation
124 TEvePointSetArray * cc = new TEvePointSetArray("TRD Clusters Colorized");
126 cc->SetMainColor(kRed);
128 cc->SetMarkerStyle(4); // antialiased circle
130 cc->SetMarkerSize(0.4);
132 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*100.);
135 const Int_t nCol = TColor::GetNumberOfColors();
137 for (Int_t ii = 0; ii < fNColorBins + 1; ++ii) {
138 cc->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (fNColorBins+2)));
147 void AliHLTEveTRD::UpdateElements() {
148 //See header file for documentation
149 if(fCanvas) fCanvas->Update();
150 // if(fEveClusters) fEveClusters->ResetBBox();
152 if(fEveColClusters) {
153 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
154 fEveColClusters->GetBin(ib)->ResetBBox();
159 void AliHLTEveTRD::ResetElements(){
160 //See header file for documentation
161 // if(fEveClusters) fEveClusters->Reset();
164 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
165 fEveColClusters->GetBin(ib)->Reset();
172 Int_t AliHLTEveTRD::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSetArray * contCol ){
173 //See header file for documentation
177 Int_t sm = block->GetSubDetector();
178 if ( sm == 6 ) sm = 7;
180 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
181 Float_t cos = TMath::Cos( phi );
182 Float_t sin = TMath::Sin( phi );
184 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
185 UInt_t ptrSize = block->GetSize();
187 for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) {
188 AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size]));
190 AliTRDcluster *trdCluster = new AliTRDcluster;
191 cluster->ExportTRDCluster( trdCluster );
193 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
194 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
196 trdCluster->GetQ() );
198 //cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
199 // sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ());