]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EVE/AliHLTEvePhos.cxx
- adding the use of the histogram merger
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEvePhos.cxx
CommitLineData
33791895 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Primary Authors: Svein Lindal <slindal@fys.uio.no > *
6 * for The ALICE HLT Project. *
7 * *
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 **************************************************************************/
16
17/// @file AliHLTEvePhos.cxx
18/// @author Svein Lindal <slindal@fys.uio.no>
19/// @brief PHOS class for the HLT EVE display
20
21#include "AliHLTEvePhos.h"
22#include "AliHLTHOMERBlockDesc.h"
23#include "TCanvas.h"
24#include "TEveBoxSet.h"
67ae95c3 25#include "AliPHOSGeoUtils.h"
33791895 26#include "AliPHOSGeometry.h"
27#include "TVector3.h"
fd2adb88 28#include "AliEveHLTEventManager.h"
33791895 29#include "TEveManager.h"
30#include "AliHLTCaloDigitDataStruct.h"
31#include "AliHLTCaloClusterDataStruct.h"
32#include "AliHLTCaloClusterReader.h"
33#include "TEveTrans.h"
34
35ClassImp(AliHLTEvePhos)
36
37AliHLTEvePhos::AliHLTEvePhos() :
67ae95c3 38AliHLTEveCalo(5, "PHOS"),
39fGeoUtils(NULL)
33791895 40{
41 // Constructor.
67ae95c3 42 fGeoUtils = new AliPHOSGeoUtils("PHOS", "noCPV");
fd2adb88 43 CreateElementList();
44
33791895 45}
46
47AliHLTEvePhos::~AliHLTEvePhos()
48{
49 //Destructor
67ae95c3 50 if(fGeoUtils)
51 delete fGeoUtils;
52 fGeoUtils = NULL;
33791895 53}
54
fd2adb88 55void AliHLTEvePhos::CreateElementList() {
33791895 56 //See header file for documentation
57
9374a7f9 58 fBoxSetClusters = new TEveBoxSet[fNModules];
59 fBoxSetDigits = new TEveBoxSet[fNModules];
33791895 60
61 AliPHOSGeometry * geo = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
62
63 TVector3 center;
64 Float_t angle;
65
66 // -- Create boxsets
67 for(int im = 0; im < fNModules; im++) {
68
69 TEveRGBAPalette* pal = new TEveRGBAPalette(0,512);
fd2adb88 70 pal->SetLimits(-1, 45);
9374a7f9 71
72 //Create clusters box set
73 fBoxSetClusters[im].SetTitle(Form("Clusters Module %d", im));
74 fBoxSetClusters[im].SetName(Form("Clusters Module %d", im));
75 fBoxSetClusters[im].SetPalette(pal);
76 fBoxSetClusters[im].Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
77 fBoxSetClusters[im].SetOwnIds(kTRUE);
33791895 78
79
80 geo->GetModuleCenter(center, "CPV", im+1);
81 angle = geo->GetPHOSAngle(im+1)*TMath::Pi()/180;
82
9374a7f9 83 fBoxSetClusters[im].RefitPlex();
84 TEveTrans& t = fBoxSetClusters[im].RefMainTrans();
33791895 85 t.SetupRotation(1, 2, angle );
86 t.SetPos(center.X(), center.Y(), center.Z());
87
fd2adb88 88 AddElement(&fBoxSetClusters[im]);
9374a7f9 89
90
91 //Create digits box set
92 fBoxSetDigits[im].SetTitle(Form("Digits Module %d", im));
93 fBoxSetDigits[im].SetName(Form("Digits Module %d", im));
94 fBoxSetDigits[im].SetPalette(pal);
95 fBoxSetDigits[im].Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
96 fBoxSetDigits[im].SetOwnIds(kTRUE);
97
98
99 geo->GetModuleCenter(center, "CPV", im+1);
100 angle = geo->GetPHOSAngle(im+1)*TMath::Pi()/180;
101
102 fBoxSetDigits[im].RefitPlex();
103 TEveTrans& t2 = fBoxSetDigits[im].RefMainTrans();
104 t2.SetupRotation(1, 2, angle );
105 t2.SetPos(center.X(), center.Y(), center.Z());
106
fd2adb88 107 AddElement(&fBoxSetDigits[im]);
9374a7f9 108
109
33791895 110 }
9374a7f9 111
33791895 112}
113
114void AliHLTEvePhos::AddDigits(UShort_t fX, UShort_t fZ, Int_t module, Float_t energy) {
115 //See header file for documentation
116 Float_t x = (fX - 32)* 2.2;
117 Float_t z = (fZ - 28) * 2.2;
9374a7f9 118 fBoxSetDigits[4-module].AddBox(x, 0, z, 2.2, energy*20, 2.2);
119 fBoxSetDigits[4-module].DigitValue(static_cast<Int_t>(energy));
33791895 120}
121
fd2adb88 122void AliHLTEvePhos::ProcessESDCluster(AliESDCaloCluster * cluster) {
123
124 Float_t pos[3];
125 cluster->GetPosition(pos);
126 TVector3 vec = TVector3(pos);
127 Float_t phi = vec.Phi() *180 / TMath::Pi();
128 if(phi < 0) phi += 360;
129
130 Int_t mid = 0;
131 if(phi > 320) return;
132 else if(phi > 300) mid = 4;
133 else if(phi > 280) mid = 3;
134 else if(phi > 260) mid = 2;
135 else return;
136
137 Int_t nCells = cluster->GetNCells();
138 AddClusters(pos, mid, cluster->E(), nCells);
139
140}
33791895 141
fd7a3071 142///____________________________________________________________________________________
33791895 143void AliHLTEvePhos::AddClusters(Float_t * pos, Int_t module, Float_t energy) {
67ae95c3 144
67ae95c3 145 TVector3 localVector;
146 TVector3 globalVector(pos);
147
67ae95c3 148 fGeoUtils->Global2Local(localVector, globalVector, 5-module);
67ae95c3 149
150 //See header file for documentation
fd2adb88 151 fBoxSetClusters[4-module].AddBox(localVector.X(), 0, localVector.Z(), 2.2, energy*40, 2.2 );
152 fBoxSetClusters[4-module].DigitValue(static_cast<Int_t>(energy*10));
153}
fd7a3071 154
155
156///_____________________________________________________________________________
fd2adb88 157void AliHLTEvePhos::AddClusters(Float_t * pos, Int_t module, Float_t energy, Int_t nCells) {
158
159 TVector3 localVector;
160 TVector3 globalVector(pos);
161
162 fGeoUtils->Global2Local(localVector, globalVector, 5-module);
163
164 Float_t cf = 2.2*TMath::Sqrt(nCells);
165 //See header file for documentation
166 fBoxSetClusters[4-module].AddBox(localVector.X(), 0, localVector.Z(), cf, energy*40, cf );
167 fBoxSetClusters[4-module].DigitValue(static_cast<Int_t>(energy*10));
33791895 168}
169