1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Authors: Øystein 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 "AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h"
16 #include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h"
17 #include "AliHLTPHOSPhysicsDefinitions.h"
18 #include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
19 #include "AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h"
22 class AliHLTPHOSDefinitions;
24 const AliHLTComponentDataType AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
25 UInt_t AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fgCount = 0;
27 AliHLTPHOSPhysicsAnalyzerSpectrumComponent gAliHLTPHOSPhysicsAnalyzerSpectrumComponent;
29 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent():AliHLTProcessor(), fAnalyzerPtr(0),
35 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::~AliHLTPHOSPhysicsAnalyzerSpectrumComponent()
58 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent(const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &):AliHLTProcessor(),
62 //Copy constructor not implemented
66 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Deinit()
68 //Deinitialize the component
71 fPeakFitter->SetHistogram(fRootHistPtr);
72 fPeakFitter->FitLorentzian();
93 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoDeinit()
95 //Deinitialize the component
96 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSPhysicsAnalyzerSpectrumComponent DoDeinit");
103 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetComponentID()
105 return "AliHltPhosPhysicsAnalyzerSpectrum";
109 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
111 //Get the input data types
112 const AliHLTComponentDataType* pType=fgkInputDataTypes;
113 while (pType->fID!=0) {
114 list.push_back(*pType);
119 AliHLTComponentDataType
120 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataType()
122 return AliHLTPHOSPhysicsDefinitions::fgkAliHLTSpectrumDataType;
126 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
129 //Get the data size of the output
136 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
137 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/,
138 std::vector<AliHLTComponentBlockData>& /*outputBlocks*/)
141 const AliHLTComponentBlockData* iter = NULL;
144 for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
148 if(iter->fDataType != AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType)
150 cout << "Warning: data type is not fgkAliHLTClusterDataType " << endl;
154 fClusterArrayPtr[ndx] = reinterpret_cast<AliHLTPHOSClusterDataStruct*>(iter->fPtr);
158 fAnalyzerPtr->Analyze(fClusterArrayPtr, ndx);
160 if(fgCount%fWriteInterval == 0 && fgCount != 0)
162 PushBack(fRootHistPtr, kAliHLTAnyDataType, (AliHLTUInt32_t)0);
172 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoInit(Int_t argc, const Char_t** argv )
174 //Initialize the component
175 Float_t firstThreshold = atof(argv[0]);
176 Float_t secondThreshold = atof(argv[1]);
177 fWriteInterval = atoi(argv[2]);
178 Int_t nBins = atoi(argv[3]);
179 Float_t lowLimit = atof(argv[4]);
180 Float_t highLimit = atof(argv[5]);
182 fPeakFitter = new AliHLTPHOSPhysicsAnalyzerPeakFitter();
183 fRootHistPtr = new TH1F("hist", "hist", nBins, lowLimit, highLimit);
184 fAnalyzerPtr = new AliHLTPHOSPhysicsAnalyzerSpectrum();
185 fAnalyzerPtr->SetThreshold(firstThreshold,secondThreshold);
186 fAnalyzerPtr->SetHistogram(fRootHistPtr);
188 if (argc==0 && argv==NULL) {
189 // this is currently just to get rid of the warning "unused parameter"
196 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Spawn()
198 //Spawn a new AliHLTPHOSPhysicsAnalyzerSpectrumComponent, for the HLT framework
199 return new AliHLTPHOSPhysicsAnalyzerSpectrumComponent();