1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
6 * Permission to use, copy, modify and distribute this software and its *
7 * documentation strictly for non-commercial purposes is hereby granted *
8 * without fee, provided that the above copyright notice appears in all *
9 * copies and that both the copyright notice and this permission notice *
10 * appear in the supporting documentation. The authors make no claims *
11 * about the suitability of this software for any purpose. It is *
12 * provided "as is" without express or implied warranty. *
13 **************************************************************************/
15 #include "AliHLTPHOSClusterAnalyserComponent.h"
16 #include "AliHLTPHOSClusterAnalyser.h"
17 #include "AliHLTPHOSRecPointContainerStruct.h"
18 #include "AliHLTPHOSCaloClusterContainerStruct.h"
20 /** @file AliHLTPHOSClusterAnalyserComponent.cxx
21 @author Oystein Djuvsland
23 @brief A cluster analyser component for PHOS HLT
26 // see header file for class documentation
28 // refer to README to build package
30 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
36 const AliHLTComponentDataType AliHLTPHOSClusterAnalyserComponent::fgkInputDataTypes[]=
38 kAliHLTVoidDataType,{0,"",""}
41 AliHLTPHOSClusterAnalyserComponent gAliHLTPHOSClusterAnalyserComponent;
44 AliHLTPHOSClusterAnalyserComponent::AliHLTPHOSClusterAnalyserComponent():
45 AliHLTPHOSProcessor(),
46 fClusterAnalyserPtr(0)
48 //See headerfile for documentation
51 AliHLTPHOSClusterAnalyserComponent::~AliHLTPHOSClusterAnalyserComponent()
53 //See headerfile for documentation
55 if (fClusterAnalyserPtr)
57 delete fClusterAnalyserPtr;
58 fClusterAnalyserPtr = 0;
63 AliHLTPHOSClusterAnalyserComponent::Deinit()
65 //See headerfile for documentation
67 if (fClusterAnalyserPtr)
69 delete fClusterAnalyserPtr;
70 fClusterAnalyserPtr = 0;
76 AliHLTPHOSClusterAnalyserComponent::GetComponentID()
78 //See headerfile for documentation
80 return "PhosClusterAnalyser";
84 AliHLTPHOSClusterAnalyserComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
86 //See headerfile for documentation
88 const AliHLTComponentDataType* pType=fgkInputDataTypes;
91 list.push_back(*pType);
96 AliHLTComponentDataType
97 AliHLTPHOSClusterAnalyserComponent::GetOutputDataType()
99 //See headerfile for documentation
101 return AliHLTPHOSDefinitions::fgkAliHLTClusterDataType;
105 AliHLTPHOSClusterAnalyserComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
108 //See headerfile for documentation
115 AliHLTPHOSClusterAnalyserComponent::Spawn()
117 //See headerfile for documentation
119 return new AliHLTPHOSClusterAnalyserComponent();
123 AliHLTPHOSClusterAnalyserComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
124 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
125 std::vector<AliHLTComponentBlockData>& outputBlocks)
127 //See headerfile for documentation
132 Int_t nRecPoints = 0;
136 AliHLTUInt8_t* outBPtr;
138 const AliHLTComponentBlockData* iter = 0;
141 UInt_t specification = 0;
143 AliHLTPHOSRecPointContainerStruct* recPointContainerPtr = 0;
144 fClusterAnalyserPtr->SetCaloClusterContainer((AliHLTPHOSCaloClusterContainerStruct*)outBPtr);
145 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
148 if (iter->fDataType != AliHLTPHOSDefinitions::fgkAliHLTRecPointDataType)
152 specification = specification|iter->fSpecification;
153 recPointContainerPtr = reinterpret_cast<AliHLTPHOSRecPointContainerStruct*>(iter->fPtr);
154 fClusterAnalyserPtr->SetRecPointContainer(recPointContainerPtr);
157 fClusterAnalyserPtr->DeconvoluteClusters();
159 fClusterAnalyserPtr->CalculateCenterOfGravity();
160 if(fDoCalculateMoments)
162 fClusterAnalyserPtr->CalculateRecPointMoments();
164 fClusterAnalyserPtr->CreateClusters();
171 mysize += sizeof(AliHLTPHOSCaloClusterContainerStruct);
172 //cout << "Size of calo cluster container: " << mysize << endl;
173 AliHLTComponentBlockData bd;
177 bd.fDataType = AliHLTPHOSDefinitions::fgkCaloClusterDataType;
178 bd.fSpecification = specification;
179 outputBlocks.push_back( bd );
186 Logging( kHLTLogFatal, "HLT::AliHLTPHOSClusterAnalyserComponent::DoEvent", "Too much data",
187 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu."
197 AliHLTPHOSClusterAnalyserComponent::DoInit(int argc, const char** argv )
199 //See headerfile for documentation
201 fClusterAnalyserPtr = new AliHLTPHOSClusterAnalyser();
202 for (int i = 0; i < argc; i++)
204 if(!strcmp("-dodeconvolution", argv[i]))
206 fDoDeconvolution = true;
208 if(!strcmp("-doclusterfit", argv[i]))
210 fClusterAnalyserPtr->SetDoClusterFit();
211 fDoCalculateMoments = true;
213 if(!strcmp("-haveCPV", argv[i]))
215 fClusterAnalyserPtr->SetHaveCPVInfo();
217 if(!strcmp("-doPID", argv[i]))
219 fClusterAnalyserPtr->SetDoPID();
221 if(!strcmp("-havedistbadchannel", argv[i]))
223 fClusterAnalyserPtr->SetHaveDistanceToBadChannel();