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 AliHLTEveCalo.cxx
18 /// @author Svein Lindal <slindal@fys.uio.no>
19 /// @brief Calorimeter base class for the HLT EVE display
21 #include "AliHLTEveCalo.h"
22 #include "AliHLTHOMERBlockDesc.h"
24 #include "AliHLTEveBase.h"
25 #include "TEveBoxSet.h"
26 #include "AliPHOSGeometry.h"
28 #include "AliEveHOMERManager.h"
29 #include "TEveManager.h"
30 #include "AliHLTCaloDigitDataStruct.h"
31 #include "AliHLTCaloClusterDataStruct.h"
32 #include "AliHLTCaloClusterReader.h"
33 #include "TEveTrans.h"
36 ClassImp(AliHLTEveCalo);
38 AliHLTEveCalo::AliHLTEveCalo(Int_t nm, TString name) :
48 AliHLTEveCalo::~AliHLTEveCalo()
61 void AliHLTEveCalo::ProcessBlock(AliHLTHOMERBlockDesc * block) {
62 //See header file for documentation
64 if ( block->GetDataType().CompareTo("ROOTHIST") == 0 ) {
65 ProcessHistogram(block);
70 fElementList = CreateElementList();
71 fEventManager->GetEveManager()->AddElement(fElementList);
74 if ( block->GetDataType().CompareTo("CALOCLUS") == 0 ){
75 //cout <<"Skipping calo clusters"<<endl;
76 ProcessClusters( block );
78 else if ( block->GetDataType().CompareTo("DIGITTYP") == 0 )
79 ProcessDigits( block);
81 else if ( block->GetDataType().CompareTo("CHANNELT") == 0 )
82 ProcessClusters( block );
86 void AliHLTEveCalo::ProcessHistogram(AliHLTHOMERBlockDesc * block ) {
87 //See header file for documentation
90 fCanvas = CreateCanvas(Form("%s QA", fName.Data()), Form("%s QA", fName.Data()));
91 fCanvas->Divide(3, 2);
94 AddHistogramsToCanvas(block, fCanvas, fHistoCount);
100 void AliHLTEveCalo::ProcessDigits(AliHLTHOMERBlockDesc* block) {
101 //See header file for documentation
103 AliHLTCaloDigitDataStruct *ds = reinterpret_cast<AliHLTCaloDigitDataStruct*> (block->GetData());
104 UInt_t nDigits = block->GetSize()/sizeof(AliHLTCaloDigitDataStruct);
107 for(UInt_t i = 0; i < nDigits; i++, ds++) {
109 Float_t x = (ds->fX - 32)* 2.2;
110 Float_t z = (ds->fZ - 28) * 2.2;
112 cout << "MODULE DIGITTYP :" << ds->fModule;
114 fBoxSet[4-ds->fModule].AddBox(x, 0, z, 2.2, ds->fEnergy*200, 2.2);
115 fBoxSet[4-ds->fModule].DigitValue(static_cast<Int_t>(ds->fEnergy*10));
121 void AliHLTEveCalo::ProcessClusters(AliHLTHOMERBlockDesc* block) {
122 //See header file for documentation
125 AliHLTCaloClusterHeaderStruct *dh = reinterpret_cast<AliHLTCaloClusterHeaderStruct*> (block->GetData());
126 AliHLTCaloClusterReader * clusterReader = new AliHLTCaloClusterReader();
127 clusterReader->SetMemory(dh);
129 AliHLTCaloClusterDataStruct * ds;
133 while( (ds = clusterReader->NextCluster()) ){
134 // AddClusters(ds->fGlobalPos, ds->fModule, ds->fEnergy);
137 AliHLTCaloDigitDataStruct *dg = clusterReader->GetDigits();
138 UInt_t nDigits = clusterReader->GetNDigits();;
139 for(UInt_t i = 0; i < nDigits; i++, dg++) {
140 AddDigits(dg->fX, dg->fZ, dg->fModule, dg->fEnergy);
144 void AliHLTEveCalo::UpdateElements() {
145 //See header file for documentation
146 if(fCanvas) fCanvas->Update();
149 for(int im = 0; im < fNModules; im++) {
150 fBoxSet[im].ElementChanged();
155 void AliHLTEveCalo::ResetElements(){
156 //See header file for documentation
160 for(int im = 0; im < fNModules; im++){
161 cout<<"Resetting"<<endl;