]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/EVE/AliHLTEveEmcal.cxx
- adding the use of the histogram merger
[u/mrichter/AliRoot.git] / HLT / EVE / AliHLTEveEmcal.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  EMCAL class for the HLT EVE display
20 // Author:  Svein Lindal <slindal@fys.uio.no>
21
22 #include "AliHLTEveEmcal.h"
23 #include "AliHLTHOMERBlockDesc.h"
24 #include "TCanvas.h"
25 #include "AliHLTEveBase.h"
26 #include "TEveBoxSet.h"
27 #include "TVector3.h"
28 #include "AliEveHLTEventManager.h"
29 #include "TEveManager.h"
30 #include "AliHLTCaloDigitDataStruct.h"
31 #include "AliHLTCaloClusterDataStruct.h"
32 #include "AliHLTCaloClusterReader.h"
33 #include "TEveTrans.h"
34 #include "TGeoNode.h"
35 #include "AliEMCALGeoUtils.h"
36 #include "TGeoManager.h"
37
38 #include "TEveGeoShapeExtract.h"
39 #include "TEveGeoNode.h"
40
41 ClassImp(AliHLTEveEmcal)
42
43 AliHLTEveEmcal::AliHLTEveEmcal() : 
44 AliHLTEveCalo(12, "EMCAL"),
45 fGeoUtils(NULL)
46 {
47   //Constructor
48   fGeoUtils = new AliEMCALGeoUtils("EMCAL_COMPLETE","EMCAL");
49   CreateElementList();
50
51 }
52
53
54 AliHLTEveEmcal::~AliHLTEveEmcal()
55 {
56   //Destructor, not implemented
57 }
58
59 void AliHLTEveEmcal::CreateElementList() {
60   
61   TGeoNode * gEMCALNode = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
62   
63   //gStyle->SetPalette(1, 0);
64   TEveRGBAPalette* pal = new TEveRGBAPalette(0, 512);
65   pal->SetLimits(0, 15);
66   
67   fBoxSetDigits = new TEveBoxSet[fNModules];
68   fBoxSetClusters = new TEveBoxSet[fNModules];
69   
70   for (Int_t sm=0; sm<fNModules; ++sm) {
71     
72     //Digits box set
73     fBoxSetDigits[sm].SetTitle(Form("Digits Module %d", sm));
74     fBoxSetDigits[sm].SetName(Form("Digits Module %d", sm));
75     fBoxSetDigits[sm].SetOwnIds(kTRUE);
76     
77     fBoxSetDigits[sm].Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
78     fBoxSetDigits[sm].RefMainTrans().SetFrom(*gEMCALNode->GetDaughter(sm)->GetMatrix());
79     fBoxSetDigits[sm].SetPalette(pal);
80     
81     AddElement(&fBoxSetDigits[sm]);
82  
83     //Clusters
84     fBoxSetClusters[sm].SetTitle(Form("Clusters Module %d", sm));
85     fBoxSetClusters[sm].SetName(Form("Clusters Module %d", sm));
86     fBoxSetClusters[sm].SetOwnIds(kTRUE);
87     
88     fBoxSetClusters[sm].Reset(TEveBoxSet::kBT_AABox, kFALSE, 64);
89     fBoxSetClusters[sm].RefMainTrans().SetFrom(*gEMCALNode->GetDaughter(sm)->GetMatrix());
90     fBoxSetClusters[sm].SetPalette(pal);
91     
92     AddElement(&fBoxSetClusters[sm]);
93
94
95   }
96 }
97
98 void AliHLTEveEmcal::AddClusters(Float_t * pos, Int_t module, Float_t energy) {
99   //See header file for documentation
100
101   TVector3 vec(pos);
102   Int_t absId = -1;
103   fGeoUtils->GetAbsCellIdFromEtaPhi(vec.Eta(), vec.Phi(), absId);
104   
105   TVector3 localVec;
106   fGeoUtils->RelPosCellInSModule(absId, localVec);
107   fBoxSetClusters[module].AddBox(15, localVec[0],  localVec[2], energy, 6.0, 6.0);
108   fBoxSetClusters[module].DigitValue(static_cast<Int_t>(energy));
109
110   //cout << "Cluster " << pos[0] << " " << pos[1] << " " << pos[2] << endl;
111
112
113 }
114
115 void AliHLTEveEmcal::AddDigits(UShort_t fX, UShort_t fZ, Int_t module, Float_t energy) {
116   //See header file for documentation
117   //Float_t x = (fX - 24)* 6.0;         
118   //Float_t z = (fZ - 48) * 6.0;
119         
120   Int_t absid = fGeoUtils->GetAbsCellIdFromCellIndexes(module, fX, fZ);
121   Double_t posX, posY, posZ;
122   if(fGeoUtils->RelPosCellInSModule(absid, posX, posY, posZ)) {
123     
124     cout << "digits " << posX << "  " << posY << "  " << posZ << endl;
125     fBoxSetDigits[module].AddBox(15, posY, posZ, energy*10, 6.0, 6.0);
126
127     fBoxSetDigits[module].DigitValue(static_cast<Int_t>(energy));
128   } else  {
129     cout <<"AliHLTEveEmcal::AddClusters:  fail"<<endl;
130   }
131 }