]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
New class structure
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
CommitLineData
cbab66dd 1/**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
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#include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
ee7849e6 17#include "AliHLTPHOSRawAnalyzerPeakFinder.h"
06c4998b 18#include <cstdlib>
19#include "AliHLTPHOSCommonDefs.h"
cbab66dd 20
c18e69e0 21
d504c864 22
23
ee7849e6 24AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
cbab66dd 25
d504c864 26//___________________________________________________________________________________________________________
ee7849e6 27AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponent()
cbab66dd 28{
146c463a 29 fAnalyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
06c4998b 30
fb27c8ca 31 if(LoadPFVector() == kFALSE)
32 {
33 // cout << "Warning, could not load PF vectors" << endl;
34 }
35 else
36 {
37 // cout << "Loaded PF vectors" << endl;
38 }
fb27c8ca 39}
40
05be0766 41
d504c864 42//___________________________________________________________________________________________________________
fb27c8ca 43AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
44{
45
46}
47
48
d504c864 49//___________________________________________________________________________________________________________
fb27c8ca 50AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
51{
52
53}
54
55
d504c864 56//___________________________________________________________________________________________________________
fb27c8ca 57const char*
58AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
59{
60 return "PhosRawPeakFinder";
61}
62
d504c864 63//___________________________________________________________________________________________________________
fb27c8ca 64Bool_t
65AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
66{
67 return LoadPFVector(PF_DEFAULT_STARTINDEX, PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS );
68}
06c4998b 69
fb27c8ca 70
d504c864 71//___________________________________________________________________________________________________________
fb27c8ca 72Bool_t
73AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
74{
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);
68d9caee 79 FILE *fp;
06c4998b 80 fp = fopen(tmpPFPath, "r");
68d9caee 81
82 if(fp != 0)
83 {
fb27c8ca 84 for(int i=0; i < nSamples; i++)
68d9caee 85 {
86 fscanf(fp, "%lf", &tmpAVector[i]);
87 }
88
89 fscanf(fp, "\n");
90
fb27c8ca 91 for(int i=0; i < nSamples; i++)
68d9caee 92 {
93 fscanf(fp, "%lf", &tmpTVector[i]);
94 }
146c463a 95 fAnalyzerPtr->SetAVector(tmpAVector, nSamples);
96 fAnalyzerPtr->SetTVector(tmpTVector, nSamples);
68d9caee 97 fclose(fp);
fb27c8ca 98 return kTRUE;
68d9caee 99 }
100
101 else
102 {
06c4998b 103 HLTFatal("ERROR: could not open PF vector file");
fb27c8ca 104 return kFALSE;
68d9caee 105 }
cbab66dd 106}
107
108
d504c864 109//___________________________________________________________________________________________________________
ee7849e6 110AliHLTComponent*
111AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
112{
113 return new AliHLTPHOSRawAnalyzerPeakFinderComponent;
114}
68d9caee 115