1 /**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
17 #include "AliHLTPHOSRawAnalyzerPeakFinder.h"
19 #include "AliHLTPHOSCommonDefs.h"
24 AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
26 //___________________________________________________________________________________________________________
27 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponent()
29 fAnalyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
31 if(LoadPFVector() == kFALSE)
33 // cout << "Warning, could not load PF vectors" << endl;
37 // cout << "Loaded PF vectors" << endl;
42 //___________________________________________________________________________________________________________
43 AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
49 //___________________________________________________________________________________________________________
50 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
56 //___________________________________________________________________________________________________________
58 AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
60 return "PhosRawPeakFinder";
63 //___________________________________________________________________________________________________________
65 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
67 return LoadPFVector(PF_DEFAULT_STARTINDEX, PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS );
71 //___________________________________________________________________________________________________________
73 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
75 char tmpPFPath[PF_MAX_PATH_LENGTH];
76 Double_t tmpAVector[nSamples];
77 Double_t tmpTVector[nSamples];
78 sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PF_VECTOR_DIR, startIndex, nSamples, tau, fs);
80 fp = fopen(tmpPFPath, "r");
84 for(int i=0; i < nSamples; i++)
86 fscanf(fp, "%lf", &tmpAVector[i]);
91 for(int i=0; i < nSamples; i++)
93 fscanf(fp, "%lf", &tmpTVector[i]);
95 fAnalyzerPtr->SetAVector(tmpAVector, nSamples);
96 fAnalyzerPtr->SetTVector(tmpTVector, nSamples);
103 HLTFatal("ERROR: could not open PF vector file");
109 //___________________________________________________________________________________________________________
111 AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
113 return new AliHLTPHOSRawAnalyzerPeakFinderComponent;