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 "TClonesArray.h"
22 #include "AliHLTEveTRD.h"
23 #include "AliHLTHOMERBlockDesc.h"
25 #include "AliHLTEveBase.h"
26 #include "AliEveHLTEventManager.h"
27 #include "TEveManager.h"
28 #include "TEvePointSet.h"
32 #include "AliHLTTRDUtils.h"
33 #include "AliTRDcluster.h"
35 ClassImp(AliHLTEveTRD)
37 AliHLTEveTRD::AliHLTEveTRD() :
40 fEveColClusters(NULL),
45 fClusterArray = new TClonesArray("AliTRDcluster");
48 AliHLTEveTRD::~AliHLTEveTRD()
50 //Destructor, not implemented
52 delete fEveColClusters;
53 fEveColClusters = NULL;
59 fClusterArray->Delete();
65 void AliHLTEveTRD::ProcessBlock(AliHLTHOMERBlockDesc * block) {
66 //See header file for documentation
68 if ( ! block->GetDataType().CompareTo("CLUSTERS") ) {
71 fEveColClusters = CreatePointSetArray();
72 AddElement(fEveColClusters);
75 ProcessClusters(block, fEveColClusters);
77 } else if ( ! block->GetDataType().CompareTo("ROOTHIST") ) {
80 fCanvas = CreateCanvas("TRD QA", "TRD QA");
81 fCanvas->Divide(3, 3);
84 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
91 void AliHLTEveTRD::AddHistogramsToCanvas(AliHLTHOMERBlockDesc* block, TCanvas * canvas, Int_t &cdCount ) {
92 //See header file for documentation
93 if ( ! block->GetClassName().CompareTo("TH1F")) {
94 TH1F* histo = reinterpret_cast<TH1F*>(block->GetTObject());
97 TVirtualPad* pad = canvas->cd(cdCount);
102 if ( ! strcmp(histo->GetName(), "nscls") ) {
103 histo->GetXaxis()->SetRangeUser(0.,15.);
106 if ( ! strcmp(histo->GetName(),"sclsdist") ||
107 ! strcmp(histo->GetName(),"evSize") )
115 TEvePointSet * AliHLTEveTRD::CreatePointSet() {
116 //See header file for documentation
117 TEvePointSet * ps = new TEvePointSet("TRD Clusters");
118 ps->SetMainColor(kBlue);
119 ps->SetMarkerStyle((Style_t)kFullDotSmall);
125 TEvePointSetArray * AliHLTEveTRD::CreatePointSetArray(){
130 //See header file for documentation
131 TEvePointSetArray * cc = new TEvePointSetArray("TRD Clusters Colorized");
133 cc->SetMainColor(kRed);
135 cc->SetMarkerStyle(4); // antialiased circle
137 cc->SetMarkerSize(0.4);
139 cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*100.);
142 const Int_t nCol = TColor::GetNumberOfColors();
144 for (Int_t ii = 0; ii < fNColorBins + 1; ++ii) {
145 cc->GetBin(ii)->SetMainColor(TColor::GetColorPalette(ii * nCol / (fNColorBins+2)));
154 void AliHLTEveTRD::UpdateElements() {
155 //See header file for documentation
156 if(fCanvas) fCanvas->Update();
157 // if(fEveClusters) fEveClusters->ResetBBox();
159 if(fEveColClusters) {
160 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
161 fEveColClusters->GetBin(ib)->ResetBBox();
166 void AliHLTEveTRD::ResetElements(){
167 //See header file for documentation
168 // if(fEveClusters) fEveClusters->Reset();
171 for (Int_t ib = 0; ib <= fNColorBins + 1; ++ib) {
172 fEveColClusters->GetBin(ib)->Reset();
179 Int_t AliHLTEveTRD::ProcessClusters( AliHLTHOMERBlockDesc * block, TEvePointSetArray * contCol ){
180 //See header file for documentation
184 Int_t sm = block->GetSubDetector();
185 if ( sm == 6 ) sm = 7;
187 Float_t phi = ( sm + 0.5 ) * TMath::Pi() / 9.0;
188 Float_t cos = TMath::Cos( phi );
189 Float_t sin = TMath::Sin( phi );
191 Byte_t* ptrData = reinterpret_cast<Byte_t*>(block->GetData());
192 UInt_t ptrSize = block->GetSize();
195 AliHLTTRDUtils::ReadClusters(fClusterArray, ptrData, ptrSize, &unused);
197 for(int num=fClusterArray->GetEntriesFast(); num--;){
198 AliTRDcluster* trdCluster = (AliTRDcluster*)fClusterArray->At(num);
199 contCol->Fill(cos*trdCluster->GetX() - sin*trdCluster->GetY(),
200 sin*trdCluster->GetX() + cos*trdCluster->GetY(),
202 trdCluster->GetQ() );