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 *
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 **************************************************************************/
17 * @file AliHLTEMCALRawHistoMaker.cxx
18 * @author Federico Ronchetti
20 * @brief Online Monitoring Histogram maker for EMCAL
24 #include "AliHLTEMCALRawHistoMaker.h"
25 #include "AliHLTEMCALConstants.h"
26 #include "AliHLTEMCALMapper.h"
27 //#include "AliHLTCaloChannelDataStruct.h"
29 #include "AliHLTCaloChannelDataHeaderStruct.h"
30 #include "AliHLTCaloSharedMemoryInterfacev2.h"
32 //#include "AliCaloRawAnalyzer.h"
33 //#include "AliCaloBunchInfo.h"
34 //#include "AliCaloFitResults.h"
39 ClassImp(AliHLTEMCALRawHistoMaker);
41 AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker():
42 AliHLTCaloConstantsHandler("EMCAL"),
45 // fRawCounterMemoryPtr(0),
46 //fAltroRawStreamPtr(0),
48 //fSTURawStreamPtr(0),
50 fEMCALConstants(NULL),
52 fAmp(0), fTime(0), fAT(0), fCellVsEne(0),
56 // See header file for documentation
58 fShmPtr = new AliHLTCaloSharedMemoryInterfacev2("EMCAL");
60 //fRawCounterMemoryPtr = new AliRawReaderMemory();
62 //fAltroRawStreamPtr = new AliAltroRawStreamV3(fRawCounterMemoryPtr);
64 //fRawStreamPtr = new AliCaloRawStreamV3(fRawCounterMemoryPtr, "EMCAL");
66 //fSTURawStreamPtr = new AliEMCALTriggerSTURawStream(fRawCounterMemoryPtr);
68 fEMCALConstants = new AliHLTEMCALConstants();
70 fClusterReaderPtr = new AliHLTCaloClusterReader();
77 hList = new TObjArray;
80 fAmp = new TProfile2D *[fCaloConstants->GetNMODULES()];
81 fTime = new TProfile2D *[fCaloConstants->GetNMODULES()];
82 fAT = new TH2F *[fCaloConstants->GetNMODULES()];
85 fCellVsEne = new TH2F *[fCaloConstants->GetNMODULES()];
87 // fCellVsClus = new TH1F ("fCellVsClus","",100,0,50);
88 //hList->Add(fCellVsClus);
91 for (int i=0; i<fCaloConstants->GetNMODULES(); i++) {
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);
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);
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);
112 hList->Add(fTime[i]);
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);
120 sprintf(title, "Cell_Energy: SM %d ", i);
121 sprintf(id, "fCellVsEne%d", i);
122 fCellVsEne[i] = new TH2F(id,title,50 ,0, 50, 10, 0, 10);
124 hList->Add(fCellVsEne[i]);
131 AliHLTEMCALRawHistoMaker::~AliHLTEMCALRawHistoMaker()
133 //See header file for documentation
136 // Pointer to histograms objects
137 TObjArray* AliHLTEMCALRawHistoMaker::GetHistograms()
144 AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDataHeader,
145 AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr,
151 Short_t channelCount = 0;
155 AliHLTCaloCoordinate coord;
156 AliHLTCaloChannelDataStruct* currentchannel = 0;
160 // Pointer to Cluster struture
161 AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
164 if (!caloClusterHeaderPtr) {
168 // stuff to handle clusters here
170 fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
172 while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
176 cout << "cluster type: " << caloClusterStructPtr->fClusterType << endl;
178 cout << " COORDINATES FROM HISTOMAKER: " <<
179 " fX:" << caloClusterStructPtr->fGlobalPos[0] <<
180 " fY:" << caloClusterStructPtr->fGlobalPos[1] <<
181 " fZ:" << caloClusterStructPtr->fGlobalPos[2] <<
182 " fModule: " << caloClusterStructPtr->fModule <<
183 " fCell: " << caloClusterStructPtr->fNCells <<
184 " fEnergy " << caloClusterStructPtr->fEnergy << endl;
186 fCellVsEne[caloClusterStructPtr->fModule]->Fill(caloClusterStructPtr->fNCells, caloClusterStructPtr->fEnergy);
189 UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
190 Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
192 for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
194 fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
195 printf("EM: cellId: %d\n", idArrayPtr[index]);;
198 delete [] idArrayPtr;
199 delete [] ampFracArrayPtr;
209 // begin scan channel data and fill histograms
212 if (channelDataHeader) {
214 fShmPtr->SetMemory(channelDataHeader);
216 currentchannel = fShmPtr->NextChannel();
218 while(currentchannel != 0) {
220 fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);
222 cout << " from histo maker ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << endl;
223 cout << " fX: " << coord.fX << " fZ: " << coord.fZ << endl;
224 cout << " channel ID: " << currentchannel->fChannelID << endl;
225 cout << " channel AMPLITUDE (called energy): " << currentchannel->fEnergy << endl;
226 cout << " channel time: " << currentchannel->fTime << endl;
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);
233 currentchannel = fShmPtr->NextChannel(); // Get the next channel