]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSDigitMaker.cxx
Removed obsolete files
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSDigitMaker.cxx
CommitLineData
2374af72 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
4 * *
5 * Primary Authors: Oystein Djuvsland *
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 * @file AliHLTPHOSClusterizer.cxx
17 * @author Oystein Djuvsland
18 * @date
d949e02e 19 * @brief Digit maker for PHOS HLT
2374af72 20 */
21
22
23// see header file for class documentation
24// or
25// refer to README to build package
26// or
27// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
209a4703 28
29#include "AliHLTPHOSDigitMaker.h"
30#include "AliHLTPHOSDigit.h"
31#include "AliHLTPHOSConstants.h"
32#include "AliHLTPHOSBaseline.h"
33#include "TTree.h"
34#include "TBranch.h"
35#include "TClonesArray.h"
36#include "TFile.h"
d949e02e 37#include "TH2F.h"
209a4703 38
39#include "AliHLTPHOSValidCellDataStruct.h"
40#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
209a4703 41#include "AliHLTPHOSDigitDataStruct.h"
42#include "AliHLTPHOSDigitContainerDataStruct.h"
14ff16ed 43#include "AliHLTPHOSSharedMemoryInterface.h" // added by PTH
2374af72 44
45ClassImp(AliHLTPHOSDigitMaker);
209a4703 46
47using namespace PhosHLTConst;
48
49AliHLTPHOSDigitMaker::AliHLTPHOSDigitMaker() :
50 AliHLTPHOSBase(),
51 fCellDataPtr(0),
d949e02e 52 fDigitContainerStructPtr(0),
209a4703 53 fDigitArrayPtr(0),
d949e02e 54 fDigitStructPtr(0),
55 fDigitCount(0)
209a4703 56{
2374af72 57 // See header file for documentation
25b7f84c 58 for(UInt_t x = 0; x < N_XCOLUMNS_MOD; x++)
59 {
60 for(UInt_t z = 0; z < N_ZROWS_MOD; z++)
61 {
62 fHighGainFactors[x][z] = 0.005;
63 fLowGainFactors[x][z] = 0.08;
64 }
65 }
66
209a4703 67}
68
69AliHLTPHOSDigitMaker::~AliHLTPHOSDigitMaker()
70{
2374af72 71 //See header file for documentation
209a4703 72}
73
74Int_t
75AliHLTPHOSDigitMaker::MakeDigits(AliHLTPHOSRcuCellEnergyDataStruct* rcuData)
76{
2374af72 77 //See header file for documentation
25b7f84c 78
209a4703 79 Int_t j = 0;
d949e02e 80 Int_t xMod = -1;
81 Int_t zMod = -1;
209a4703 82 Float_t amplitude = 0;
d949e02e 83
25b7f84c 84 for(UInt_t x = 0; x < N_XCOLUMNS_RCU; x++)
14ff16ed 85 {
25b7f84c 86 for(UInt_t z = 0; z < N_ZROWS_RCU; z++)
14ff16ed 87 {
d949e02e 88 fCellDataPtr = &(rcuData->fValidData[x][z][HIGH_GAIN]);
89 xMod = x + rcuData->fRcuX * N_XCOLUMNS_RCU;
90 zMod = z + rcuData->fRcuZ * N_ZROWS_RCU;
91 amplitude = fCellDataPtr->fEnergy;
92 if(amplitude > fDigitThresholds[xMod][zMod][HIGH_GAIN] && amplitude < MAX_BIN_VALUE)
93 {
94 fDigitStructPtr = &(fDigitContainerStructPtr->fDigitDataStruct[j+fDigitCount]);
95 fDigitStructPtr->fX = xMod;
96 fDigitStructPtr->fZ = zMod;
97 fDigitStructPtr->fAmplitude = amplitude;
98 fDigitStructPtr->fEnergy = amplitude * fHighGainFactors[xMod][zMod];
99 // cout << "Amplitude in GeVs: " << fDigitStructPtr->fEnergy << endl;
100 //TODO: fix time
101 fDigitStructPtr->fTime = fCellDataPtr->fTime * 0.0000001;
102 fDigitStructPtr->fCrazyness = fCellDataPtr->fCrazyness;
25b7f84c 103 fDigitStructPtr->fModule = rcuData->fModuleID;
d949e02e 104 j++;
105 }
106 else if(amplitude >= MAX_BIN_VALUE)
107 {
108 fCellDataPtr = & (rcuData->fValidData[x][z][LOW_GAIN]);
109 amplitude = fCellDataPtr->fEnergy;
110 if(amplitude > fDigitThresholds[xMod][zMod][LOW_GAIN])
111 {
112 fDigitStructPtr = &(fDigitContainerStructPtr->fDigitDataStruct[j+fDigitCount]);
113 fDigitStructPtr->fX = xMod;
114 fDigitStructPtr->fZ = zMod;
115 fDigitStructPtr->fAmplitude = amplitude;
116 fDigitStructPtr->fEnergy = amplitude * fLowGainFactors[xMod][zMod];
117 //TODO: fix time
118 fDigitStructPtr->fTime = fCellDataPtr->fTime * 0.0000001;;
119 fDigitStructPtr->fCrazyness = fCellDataPtr->fCrazyness;
25b7f84c 120 fDigitStructPtr->fModule = rcuData->fModuleID;
d949e02e 121 j++;
122 }
123 }
14ff16ed 124 }
14ff16ed 125 }
d949e02e 126
14ff16ed 127 fDigitCount += j;
d949e02e 128 fDigitContainerStructPtr->fNDigits = fDigitCount;
14ff16ed 129 return fDigitCount;
130}
131
132
d949e02e 133void
134AliHLTPHOSDigitMaker::Reset()
135{
14ff16ed 136 //See header file for documentation
d949e02e 137 fDigitCount = 0;
209a4703 138}
14ff16ed 139
d949e02e 140void
141AliHLTPHOSDigitMaker::SetGlobalHighGainFactor(Float_t factor)
209a4703 142{
d949e02e 143 //See header file for documentation
25b7f84c 144 for(UInt_t x = 0; x < N_XCOLUMNS_MOD; x++)
d949e02e 145 {
25b7f84c 146 for(UInt_t z = 0; z < N_ZROWS_MOD; z++)
d949e02e 147 {
148 fHighGainFactors[x][z] = factor;
149 }
150 }
209a4703 151}
209a4703 152
153void
d949e02e 154AliHLTPHOSDigitMaker::SetGlobalLowGainFactor(Float_t factor)
155{
156 //See header file for documentation
25b7f84c 157 for(UInt_t x = 0; x < N_XCOLUMNS_MOD; x++)
d949e02e 158 {
25b7f84c 159 for(UInt_t z = 0; z < N_ZROWS_MOD; z++)
d949e02e 160 {
161 fLowGainFactors[x][z] = factor;
162 }
163 }
209a4703 164}
165
d949e02e 166void
167AliHLTPHOSDigitMaker::SetDigitThresholds(const char* filepath, Int_t nSigmas)
168{
169 //See header file for documentation
170
171 TFile *histFile = new TFile(filepath);
209a4703 172
d949e02e 173 TH2F *lgHist = (TH2F*)histFile->Get("RMSLGMapHist");
174 TH2F *hgHist = (TH2F*)histFile->Get("RMSHGMapHist");
209a4703 175
25b7f84c 176 for(UInt_t x = 0; x < N_XCOLUMNS_MOD; x++)
d949e02e 177 {
25b7f84c 178 for(UInt_t z = 0; z < N_ZROWS_MOD; z++)
d949e02e 179 {
180 fDigitThresholds[x][z][LOW_GAIN] = lgHist->GetBinContent(x, z) * nSigmas;
181 fDigitThresholds[x][z][HIGH_GAIN] = hgHist->GetBinContent(x, z) * nSigmas;
182 }
183 }
184}