]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EVE/AliHLTEvePhos.cxx
Merge branch 'devel'
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEvePhos.cxx
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"
25 #include "AliPHOSGeoUtils.h"
26 #include "AliPHOSGeometry.h"
27 #include "TVector3.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"
34
35 ClassImp(AliHLTEvePhos)
36
37 AliHLTEvePhos::AliHLTEvePhos() : 
38 AliHLTEveCalo(5, "PHOS"),
39 fGeoUtils(NULL)
40 {
41   // Constructor.
42   fGeoUtils = new AliPHOSGeoUtils("PHOS", "noCPV");
43 }
44
45 AliHLTEvePhos::~AliHLTEvePhos()
46 {
47   //Destructor
48   if(fGeoUtils)
49     delete fGeoUtils;
50   fGeoUtils = NULL;
51 }
52
53
54 TEveElementList * AliHLTEvePhos::CreateElementList() {
55   //See header file for documentation
56
57   TEveElementList * elementList  = new TEveElementList("PHOS ");
58   fBoxSet = new TEveBoxSet[fNModules];
59
60   AliPHOSGeometry * geo = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
61   
62   TVector3 center;
63   Float_t angle;
64   
65   // -- Create boxsets
66   for(int im = 0; im < fNModules; im++) {
67     
68     TEveRGBAPalette* pal = new TEveRGBAPalette(0,512);
69     pal->SetLimits(-1, 6);
70     fBoxSet[im].SetTitle(Form("Clusters Module %d", im));
71     fBoxSet[im].SetName(Form("Clusters Module %d", im));
72     fBoxSet[im].SetPalette(pal);
73     fBoxSet[im].Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
74     fBoxSet[im].SetOwnIds(kTRUE);
75     
76     
77     geo->GetModuleCenter(center, "CPV", im+1);
78     angle = geo->GetPHOSAngle(im+1)*TMath::Pi()/180;
79     
80     fBoxSet[im].RefitPlex();
81     TEveTrans& t = fBoxSet[im].RefMainTrans();
82     t.SetupRotation(1, 2, angle );
83     t.SetPos(center.X(), center.Y(), center.Z());
84     
85     elementList->AddElement(&fBoxSet[im]);
86   }
87   return elementList;
88 }
89
90 void AliHLTEvePhos::AddDigits(UShort_t fX, UShort_t fZ, Int_t module, Float_t energy) {
91   //See header file for documentation
92   Float_t x = (fX - 32)* 2.2;
93   Float_t z = (fZ - 28) * 2.2;
94   fBoxSet[4-module].AddBox(x, 0, z, 2.2, energy*20, 2.2);
95   fBoxSet[4-module].DigitValue(static_cast<Int_t>(energy));
96 }
97
98
99 void AliHLTEvePhos::AddClusters(Float_t * pos, Int_t module, Float_t energy) {
100
101   
102
103   TVector3 localVector;
104   TVector3 globalVector(pos);
105
106   cout << "mod"  << module << endl;
107
108   fGeoUtils->Global2Local(localVector, globalVector, 5-module);
109   
110
111  //See header file for documentation
112   fBoxSet[4-module].AddBox(localVector.X(), -70, localVector.Z(), 2.2, -energy*20, 2.2);
113   fBoxSet[4-module].DigitValue(static_cast<Int_t>(energy));
114 }
115