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),
46 AliHLTEveTRD::~AliHLTEveTRD()
48 //Destructor, not implemented
50 delete fEveColClusters;
51 fEveColClusters = NULL;
59 void AliHLTEveTRD::ProcessBlock(AliHLTHOMERBlockDesc * block) {
60 //See header file for documentation
62 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
65 fEveColClusters = CreatePointSetArray();
66 fEventManager->GetEveManager()->AddElement(fEveColClusters);
69 ProcessClusters(block, fEveColClusters);
71 } else if ( ! block->GetDataType().CompareTo("ROOTHIST") ) {
74 fCanvas = CreateCanvas("TRD QA", "TRD QA");
75 fCanvas->Divide(3, 2);
78 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
85 void AliHLTEveTRD::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* block, TCanvas * canvas, Int_t &cdCount ) {
86 //See header file for documentation
87 if ( ! block->GetClassName().CompareTo("TH1F")) {
88 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
91 TVirtualPad* pad = canvas->cd(cdCount);
96 if ( ! strcmp(histo->GetName(), "nscls") ) {
97 histo->GetXaxis()->SetRangeUser(0.,15.);
100 if ( ! strcmp(histo->GetName(),"sclsdist") ||
101 ! strcmp(histo->GetName(),"evSize") )
109 TEvePointSet * AliHLTEveTRD::CreatePointSet() {
110 //See header file for documentation
111 TEvePointSet * ps = new TEvePointSet("TRD Clusters");
112 ps->SetMainColor(kBlue);
113 ps->SetMarkerStyle((Style_t)kFullDotSmall);
119 TEvePointSetArray * AliHLTEveTRD::CreatePointSetArray(){
120 //See header file for documentation
121 TEvePointSetArray * cc = new TEvePointSetArray("TRD Clusters Colorized");
122 cc->SetMainColor(kRed);
123 cc->SetMarkerStyle(4); // antialiased circle
124 cc->SetMarkerSize(0.4);
125 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*100.);
127 const Int_t nCol = TColor::GetNumberOfColors();
128 for (Int_t ii = 0; ii < fNColorBins + 1; ++ii) {
129 cc->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (fNColorBins+2)));
137 void AliHLTEveTRD::UpdateElements() {
138 //See header file for documentation
139 if(fCanvas) fCanvas->Update();
140 // if(fEveClusters) fEveClusters->ResetBBox();
142 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
143 fEveColClusters->GetBin(ib)->ResetBBox();
148 void AliHLTEveTRD::ResetElements(){
149 //See header file for documentation
150 // if(fEveClusters) fEveClusters->Reset();
153 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
154 fEveColClusters->GetBin(ib)->Reset();
161 Int_t AliHLTEveTRD::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSetArray * contCol ){
162 //See header file for documentation
166 Int_t sm = block->GetSubDetector();
167 if ( sm == 6 ) sm = 7;
169 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
170 Float_t cos = TMath::Cos( phi );
171 Float_t sin = TMath::Sin( phi );
173 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
174 UInt_t ptrSize = block->GetSize();
176 for (UInt_t size = 0; size+sizeof(AliHLTTRDCluster) <= ptrSize; size+=sizeof(AliHLTTRDCluster) ) {
177 AliHLTTRDCluster *cluster = reinterpret_cast<AliHLTTRDCluster*>(&(ptrData[size]));
179 AliTRDcluster *trdCluster = new AliTRDcluster;
180 cluster->ExportTRDCluster( trdCluster );
182 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
183 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
185 trdCluster->GetQ() );
187 //cont->SetNextPoint(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
188 // sin*trdCluster->GetX() + cos*trdCluster->GetY(), trdCluster->GetZ());