1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Authors: Oystein Djuvsland *
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 **************************************************************************/
16 * @file AliHLTPHOSClusterizer.cxx
17 * @author Oystein Djuvsland
19 * @brief Clusterizer for PHOS HLT
23 // see header file for class documentation
25 // refer to README to build package
27 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
29 #include "AliHLTPHOSDigitMaker.h"
30 #include "AliHLTPHOSDigit.h"
31 #include "AliHLTPHOSConstants.h"
32 #include "AliHLTPHOSBaseline.h"
35 #include "TClonesArray.h"
38 #include "AliHLTPHOSValidCellDataStruct.h"
39 #include "AliHLTPHOSRcuCellEnergyDataStruct.h"
40 #include "AliHLTPHOSDigitDataStruct.h"
41 #include "AliHLTPHOSDigitContainerDataStruct.h"
42 #include "AliHLTPHOSSharedMemoryInterface.h" // added by PTH
44 ClassImp(AliHLTPHOSDigitMaker);
46 using namespace PhosHLTConst;
48 AliHLTPHOSDigitMaker::AliHLTPHOSDigitMaker() :
51 // fDigitContainerStructPtr(0),
54 // fDigitStructPtr(0),
60 fShmPtr = new AliHLTPHOSSharedMemoryInterface();
61 // See header file for documentation
64 AliHLTPHOSDigitMaker::~AliHLTPHOSDigitMaker()
66 //See header file for documentation
71 *modified by PTH to use new interface too shared memory
74 AliHLTPHOSDigitMaker::MakeDigits(AliHLTPHOSRcuCellEnergyDataStruct* rcuData)
76 //See header file for documentation
81 Float_t amplitude = 0;
83 fShmPtr->SetMemory(rcuData);
84 // for ( i = 0; i < rcuData->fCnt; i++ )
86 fCellDataPtr = fShmPtr->NextChannel();
88 while(fCellDataPtr != 0)
91 fCellDataPtr = & ( rcuData->fValidData[i] );
92 x = fCellDataPtr->fX + rcuData->fRcuX * N_XCOLUMNS_RCU;
93 z = fCellDataPtr->fZ + rcuData->fRcuZ * N_ZROWS_RCU;
94 amplitude = fCellDataPtr->fEnergy;
96 if ( amplitude > fDigitThreshold )
98 fDigitStructPtr = & ( fDigitContainerStructPtr->fDigitDataStruct[j + fDigitCount] );
99 fDigitStructPtr->fX = ( fCellDataPtr->fX + rcuData->fRcuX * N_XCOLUMNS_RCU );
100 fDigitStructPtr->fZ = ( fCellDataPtr->fZ + rcuData->fRcuZ * N_ZROWS_RCU );
101 fDigitStructPtr->fAmplitude = ( amplitude );
102 fDigitStructPtr->fTime = ( fCellDataPtr->fTime );
103 fDigitStructPtr->fGain = ( fCellDataPtr->fGain );
104 fDigitStructPtr->SetRawData ( fCellDataPtr->fData );
105 fDigitStructPtr->fCrazyness = ( fCellDataPtr->fCrazyness );
106 fDigitStructPtr->fBaseline = -1;
110 fCellDataPtr = fShmPtr->NextChannel();
120 AliHLTPHOSDigitMaker::MakeDigits(AliHLTPHOSRcuCellEnergyDataStruct* rcuData)
123 //See header file for documentation
128 Float_t amplitude = 0;
129 for ( i = 0; i < rcuData->fCnt; i++ )
131 fCellDataPtr = & ( rcuData->fValidData[i] );
132 x = fCellDataPtr->fX + rcuData->fRcuX * N_XCOLUMNS_RCU;
133 z = fCellDataPtr->fZ + rcuData->fRcuZ * N_ZROWS_RCU;
134 amplitude = fCellDataPtr->fEnergy;
135 if ( amplitude > fDigitThreshold )
137 fDigitStructPtr = & ( fDigitContainerStructPtr->fDigitDataStruct[j + fDigitCount] );
138 fDigitStructPtr->fX = ( fCellDataPtr->fX + rcuData->fRcuX * N_XCOLUMNS_RCU );
139 fDigitStructPtr->fZ = ( fCellDataPtr->fZ + rcuData->fRcuZ * N_ZROWS_RCU );
140 fDigitStructPtr->fAmplitude = ( amplitude );
141 fDigitStructPtr->fTime = ( fCellDataPtr->fTime );
142 fDigitStructPtr->fGain = ( fCellDataPtr->fGain );
143 fDigitStructPtr->SetRawData ( fCellDataPtr->fData );
144 fDigitStructPtr->fCrazyness = ( fCellDataPtr->fCrazyness );
145 fDigitStructPtr->fBaseline = -1;
156 AliHLTPHOSDigitMaker::SetDigitsTree(TTree *tree)
158 TBranch * digBranch = tree->Branch("digits","TClonesArray",fDebugDigitArrayPtr);
163 AliHLTPHOSDigitMaker::Reset()
165 //fDigitArrayPtr->Clear();