]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx
Removing obsolete macros
[u/mrichter/AliRoot.git] / HLT / EMCAL / AliHLTEMCALRawHistoMaker.cxx
CommitLineData
4cec1df9 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
4 * INFN Laboratori Nazionali di Frascati *
5 * Primary Authors: Federico Ronchetti *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/**
17 * @file AliHLTEMCALRawHistoMaker.cxx
18 * @author Federico Ronchetti
19 * @date
20 * @brief Online Monitoring Histogram maker for EMCAL
21 */
22
23
24#include "AliHLTEMCALRawHistoMaker.h"
25#include "AliHLTEMCALConstants.h"
26#include "AliHLTEMCALMapper.h"
27//#include "AliHLTCaloChannelDataStruct.h"
28
29#include "AliHLTCaloChannelDataHeaderStruct.h"
30#include "AliHLTCaloSharedMemoryInterfacev2.h"
31
32//#include "AliCaloRawAnalyzer.h"
33//#include "AliCaloBunchInfo.h"
34//#include "AliCaloFitResults.h"
35
36
37
38
39ClassImp(AliHLTEMCALRawHistoMaker);
40
41AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker():
42 AliHLTCaloConstantsHandler("EMCAL"),
43 fShmPtr(0),
44 fMapperPtr(0),
45 // fRawCounterMemoryPtr(0),
46 //fAltroRawStreamPtr(0),
47 //fRawStreamPtr(0),
48 //fSTURawStreamPtr(0),
49 //fAnalyzerPtr(0),
fdf6f4e9 50 fEMCALConstants(NULL),
51 hList(0),
2fb9aff8 52 fAmp(0), fTime(0), fAT(0), fCellVsEne(0),
4cec1df9 53 fClusterReaderPtr(0)
54
55{
56 // See header file for documentation
57
58 fShmPtr = new AliHLTCaloSharedMemoryInterfacev2("EMCAL");
59
60 //fRawCounterMemoryPtr = new AliRawReaderMemory();
61
62 //fAltroRawStreamPtr = new AliAltroRawStreamV3(fRawCounterMemoryPtr);
63
64 //fRawStreamPtr = new AliCaloRawStreamV3(fRawCounterMemoryPtr, "EMCAL");
65
66 //fSTURawStreamPtr = new AliEMCALTriggerSTURawStream(fRawCounterMemoryPtr);
67
fdf6f4e9 68 fEMCALConstants = new AliHLTEMCALConstants();
4cec1df9 69
70 fClusterReaderPtr = new AliHLTCaloClusterReader();
71
72 // Booking histograms
73
74 char id[100];
75 char title[100];
76
77 hList = new TObjArray;
78
c79ec212 79 // channel histograms
2fb9aff8 80 fAmp = new TProfile2D *[fCaloConstants->GetNMODULES()];
81 fTime = new TProfile2D *[fCaloConstants->GetNMODULES()];
82 fAT = new TH2F *[fCaloConstants->GetNMODULES()];
4cec1df9 83
c79ec212 84 // cluster histograms
85 fCellVsEne = new TH2F *[fCaloConstants->GetNMODULES()];
86
87 // fCellVsClus = new TH1F ("fCellVsClus","",100,0,50);
88 //hList->Add(fCellVsClus);
4cec1df9 89
4cec1df9 90
4cec1df9 91 for (int i=0; i<fCaloConstants->GetNMODULES(); i++) {
2fb9aff8 92
93
94
95 //sprintf(title, "Row vs Col : SM %d ", i);
96 //sprintf(id, "hAmp%d", i);
97 //hAmp[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5);
98 //sprintf(id, "hTime%d", i);
99 //hTime[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5);
100
101
102 sprintf(title, "X_Z AMP: SM %d ", i);
103 sprintf(id, "fAmp%d", i);
104 fAmp[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5);
4cec1df9 105
2fb9aff8 106 hList->Add(fAmp[i]);
4cec1df9 107
2fb9aff8 108 sprintf(title, "X_Z TIME: SM %d ", i);
109 sprintf(id, "fTime%d", i);
110 fTime[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5);
4cec1df9 111
2fb9aff8 112 hList->Add(fTime[i]);
4cec1df9 113
2fb9aff8 114 sprintf(title, "AMP_TIME: SM %d ", i);
115 sprintf(id, "fAT%d", i);
116 fAT[i] = new TH2F(id,title, 1024, -0.5, 1023.5, 200, -0.5, 199.5);
4cec1df9 117
2fb9aff8 118 hList->Add(fAT[i]);
c79ec212 119
2fb9aff8 120 sprintf(title, "Cell_Energy: SM %d ", i);
c79ec212 121 sprintf(id, "fCellVsEne%d", i);
122 fCellVsEne[i] = new TH2F(id,title,50 ,0, 50, 10, 0, 10);
123
124 hList->Add(fCellVsEne[i]);
125
4cec1df9 126 }
127
128
129}
130
131AliHLTEMCALRawHistoMaker::~AliHLTEMCALRawHistoMaker()
132{
133 //See header file for documentation
134}
135
136// Pointer to histograms objects
137TObjArray* AliHLTEMCALRawHistoMaker::GetHistograms()
138{
139 return hList;
140}
141
142
143Int_t
144AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDataHeader,
145 AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr,
146 int beverbose)
147{
148 //int tmpsize = 0;
149 Int_t crazyness = 0;
150 Int_t nSamples = 0;
151 Short_t channelCount = 0;
152
153
154 // Channel variables
fdf6f4e9 155 AliHLTCaloCoordinate coord;
4cec1df9 156 AliHLTCaloChannelDataStruct* currentchannel = 0;
157
158
159 // Cluster variables
160 // Pointer to Cluster struture
161 AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
162 Int_t nClusters = 0;
163
164 if (!caloClusterHeaderPtr) {
2fb9aff8 165
4cec1df9 166 } else {
167
168 // stuff to handle clusters here
4cec1df9 169
c79ec212 170 fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
c79ec212 171
4cec1df9 172 while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
c79ec212 173
4cec1df9 174 {
175
176 cout << "cluster type: " << caloClusterStructPtr->fClusterType << endl;
177
178 cout << " COORDINATES FROM HISTOMAKER: " <<
179 " fX:" << caloClusterStructPtr->fGlobalPos[0] <<
180 " fY:" << caloClusterStructPtr->fGlobalPos[1] <<
c79ec212 181 " fZ:" << caloClusterStructPtr->fGlobalPos[2] <<
182 " fModule: " << caloClusterStructPtr->fModule <<
183 " fCell: " << caloClusterStructPtr->fNCells <<
184 " fEnergy " << caloClusterStructPtr->fEnergy << endl;
4cec1df9 185
2fb9aff8 186 fCellVsEne[caloClusterStructPtr->fModule]->Fill(caloClusterStructPtr->fNCells, caloClusterStructPtr->fEnergy);
187
4cec1df9 188
189 UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
190 Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
191
192 for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
193 {
194 fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
195 printf("EM: cellId: %d\n", idArrayPtr[index]);;
196 }
197
198 delete [] idArrayPtr;
199 delete [] ampFracArrayPtr;
200
201 nClusters++;
202
203 }
c79ec212 204
4cec1df9 205 }
206
207
208
209 // begin scan channel data and fill histograms
210
4cec1df9 211
c79ec212 212 if (channelDataHeader) {
213
214 fShmPtr->SetMemory(channelDataHeader);
4cec1df9 215
c79ec212 216 currentchannel = fShmPtr->NextChannel();
4cec1df9 217
c79ec212 218 while(currentchannel != 0) {
4cec1df9 219
c79ec212 220 fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);
221
2fb9aff8 222 cout << " from histo maker ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << endl;
c79ec212 223 cout << " fX: " << coord.fX << " fZ: " << coord.fZ << endl;
224 cout << " channel ID: " << currentchannel->fChannelID << endl;
2fb9aff8 225 cout << " channel AMPLITUDE (called energy): " << currentchannel->fEnergy << endl;
226 cout << " channel time: " << currentchannel->fTime << endl;
227
c79ec212 228
2fb9aff8 229 fTime[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fTime);
230 fAmp[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fEnergy);
231 fAT[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime);
c79ec212 232
233 currentchannel = fShmPtr->NextChannel(); // Get the next channel
234
235 }
4cec1df9 236 }
237
4cec1df9 238
239return (0);
fdf6f4e9 240}