]>
Commit | Line | Data |
---|---|---|
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 | ||
39 | ClassImp(AliHLTEMCALRawHistoMaker); | |
40 | ||
41 | AliHLTEMCALRawHistoMaker::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), | |
4cec1df9 | 52 | fChannelEMap(0), fChannelTMap(0), fChannelETMap(0), h2DTRU(0), h2DSTU(0), |
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 | ||
79 | fChannelEMap = new TProfile2D *[fCaloConstants->GetNMODULES()]; | |
80 | fChannelTMap = new TProfile2D *[fCaloConstants->GetNMODULES()]; | |
81 | fChannelETMap = new TH2F *[fCaloConstants->GetNMODULES()]; | |
82 | ||
83 | h2DTRU = new TH2I ("h2DTRU","",24,0,24,4,0,4); | |
84 | hList->Add(h2DTRU); | |
85 | ||
86 | h2DSTU = new TH2I ("h2DSTU","",24,0,24,4,0,4); | |
87 | hList->Add(h2DSTU); | |
88 | ||
89 | ||
90 | for (int i=0; i<fCaloConstants->GetNMODULES(); i++) { | |
91 | sprintf(title, "E(X vs Z): SM %d ", i); | |
92 | sprintf(id, "fChannelEMap%d", i); | |
93 | fChannelEMap[i] = new TProfile2D(id,title,48 ,0, 47, 24, 0, 23); | |
94 | ||
95 | hList->Add(fChannelEMap[i]); | |
96 | ||
97 | sprintf(title, "T(X vs Z): SM %d ", i); | |
98 | sprintf(id, "fChannelTMap%d", i); | |
99 | fChannelTMap[i] = new TProfile2D(id,title,48 ,0, 47, 24, 0, 23); | |
100 | ||
101 | hList->Add(fChannelTMap[i]); | |
102 | ||
103 | sprintf(title, "(E vs T): SM %d ", i); | |
104 | sprintf(id, "fChannelETMap%d", i); | |
105 | fChannelETMap[i] = new TH2F(id,title,100 ,0, 50, 100, 0, 500); | |
106 | ||
107 | hList->Add(fChannelETMap[i]); | |
108 | } | |
109 | ||
110 | ||
111 | } | |
112 | ||
113 | AliHLTEMCALRawHistoMaker::~AliHLTEMCALRawHistoMaker() | |
114 | { | |
115 | //See header file for documentation | |
116 | } | |
117 | ||
118 | // Pointer to histograms objects | |
119 | TObjArray* AliHLTEMCALRawHistoMaker::GetHistograms() | |
120 | { | |
121 | return hList; | |
122 | } | |
123 | ||
124 | ||
125 | Int_t | |
126 | AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDataHeader, | |
127 | AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr, | |
128 | int beverbose) | |
129 | { | |
130 | //int tmpsize = 0; | |
131 | Int_t crazyness = 0; | |
132 | Int_t nSamples = 0; | |
133 | Short_t channelCount = 0; | |
134 | ||
135 | ||
136 | // Channel variables | |
fdf6f4e9 | 137 | AliHLTCaloCoordinate coord; |
4cec1df9 | 138 | AliHLTCaloChannelDataStruct* currentchannel = 0; |
139 | ||
140 | ||
141 | // Cluster variables | |
142 | // Pointer to Cluster struture | |
143 | AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0; | |
144 | Int_t nClusters = 0; | |
145 | ||
146 | if (!caloClusterHeaderPtr) { | |
147 | ||
148 | // NULL pointer | |
149 | cout << "FROM HISTOMAKER NO CLUSTER POINTER: " << caloClusterHeaderPtr << endl; | |
150 | ||
151 | } else { | |
152 | ||
153 | // stuff to handle clusters here | |
154 | fClusterReaderPtr->SetMemory(caloClusterHeaderPtr); | |
155 | ||
156 | cout << "FROM HISTOMAKER WE HAVE THE CLUSTER POINTER: " << caloClusterHeaderPtr << endl; | |
157 | ||
158 | ||
159 | while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0) | |
160 | { | |
161 | ||
162 | cout << "cluster type: " << caloClusterStructPtr->fClusterType << endl; | |
163 | ||
164 | cout << " COORDINATES FROM HISTOMAKER: " << | |
165 | " fX:" << caloClusterStructPtr->fGlobalPos[0] << | |
166 | " fY:" << caloClusterStructPtr->fGlobalPos[1] << | |
167 | " fZ:" << caloClusterStructPtr->fGlobalPos[2] << endl; | |
168 | ||
169 | ||
170 | UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells]; | |
171 | Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells]; | |
172 | ||
173 | for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++) | |
174 | { | |
175 | fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index); | |
176 | printf("EM: cellId: %d\n", idArrayPtr[index]);; | |
177 | } | |
178 | ||
179 | delete [] idArrayPtr; | |
180 | delete [] ampFracArrayPtr; | |
181 | ||
182 | nClusters++; | |
183 | ||
184 | } | |
185 | ||
186 | } | |
187 | ||
188 | ||
189 | ||
190 | // begin scan channel data and fill histograms | |
191 | ||
192 | fShmPtr->SetMemory(channelDataHeader); | |
193 | ||
194 | currentchannel = fShmPtr->NextChannel(); | |
195 | ||
196 | while(currentchannel != 0) { | |
197 | ||
198 | fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord); | |
199 | ||
200 | cout << " from histo maker ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << currentchannel->fEnergy << endl; | |
201 | cout << " fX: " << coord.fX << " fZ: " << coord.fZ << endl; | |
202 | ||
203 | fChannelTMap[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fTime); | |
204 | fChannelEMap[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fEnergy); | |
205 | fChannelETMap[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime); | |
206 | ||
207 | currentchannel = fShmPtr->NextChannel(); // Get the next channel | |
208 | ||
209 | } | |
210 | ||
211 | ||
212 | ||
213 | return (0); | |
fdf6f4e9 | 214 | } |