]>
Commit | Line | Data |
---|---|---|
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" |
43dd7c5e | 18 | //#include <cstdlib> |
19 | //#include "AliHLTPHOSCommonDefs.h" | |
d504c864 | 20 | |
21 | ||
ee7849e6 | 22 | AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent; |
cbab66dd | 23 | |
d504c864 | 24 | //___________________________________________________________________________________________________________ |
ee7849e6 | 25 | AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponent() |
cbab66dd | 26 | { |
146c463a | 27 | fAnalyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder(); |
06c4998b | 28 | |
fb27c8ca | 29 | if(LoadPFVector() == kFALSE) |
30 | { | |
31 | // cout << "Warning, could not load PF vectors" << endl; | |
32 | } | |
33 | else | |
34 | { | |
35 | // cout << "Loaded PF vectors" << endl; | |
36 | } | |
fb27c8ca | 37 | } |
38 | ||
05be0766 | 39 | |
d504c864 | 40 | //___________________________________________________________________________________________________________ |
fb27c8ca | 41 | AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent() |
42 | { | |
43 | ||
44 | } | |
45 | ||
46 | ||
d504c864 | 47 | //___________________________________________________________________________________________________________ |
fb27c8ca | 48 | AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent() |
49 | { | |
50 | ||
51 | } | |
52 | ||
53 | ||
d504c864 | 54 | //___________________________________________________________________________________________________________ |
fb27c8ca | 55 | const char* |
56 | AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID() | |
57 | { | |
58 | return "PhosRawPeakFinder"; | |
59 | } | |
60 | ||
d504c864 | 61 | //___________________________________________________________________________________________________________ |
fb27c8ca | 62 | Bool_t |
63 | AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector() | |
64 | { | |
65 | return LoadPFVector(PF_DEFAULT_STARTINDEX, PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS ); | |
66 | } | |
06c4998b | 67 | |
fb27c8ca | 68 | |
d504c864 | 69 | //___________________________________________________________________________________________________________ |
fb27c8ca | 70 | Bool_t |
71 | AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs) | |
72 | { | |
73 | char tmpPFPath[PF_MAX_PATH_LENGTH]; | |
e83e889b | 74 | Double_t * tmpAVector = new Double_t[nSamples]; |
75 | Double_t * tmpTVector = new Double_t[nSamples]; | |
fb27c8ca | 76 | sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PF_VECTOR_DIR, startIndex, nSamples, tau, fs); |
68d9caee | 77 | FILE *fp; |
06c4998b | 78 | fp = fopen(tmpPFPath, "r"); |
68d9caee | 79 | |
80 | if(fp != 0) | |
81 | { | |
fb27c8ca | 82 | for(int i=0; i < nSamples; i++) |
68d9caee | 83 | { |
84 | fscanf(fp, "%lf", &tmpAVector[i]); | |
85 | } | |
86 | ||
87 | fscanf(fp, "\n"); | |
88 | ||
fb27c8ca | 89 | for(int i=0; i < nSamples; i++) |
68d9caee | 90 | { |
91 | fscanf(fp, "%lf", &tmpTVector[i]); | |
92 | } | |
146c463a | 93 | fAnalyzerPtr->SetAVector(tmpAVector, nSamples); |
94 | fAnalyzerPtr->SetTVector(tmpTVector, nSamples); | |
68d9caee | 95 | fclose(fp); |
e83e889b | 96 | delete [] tmpAVector; |
97 | delete [] tmpTVector; | |
fb27c8ca | 98 | return kTRUE; |
68d9caee | 99 | } |
100 | ||
101 | else | |
102 | { | |
e83e889b | 103 | delete [] tmpAVector; |
104 | delete [] tmpTVector; | |
06c4998b | 105 | HLTFatal("ERROR: could not open PF vector file"); |
fb27c8ca | 106 | return kFALSE; |
68d9caee | 107 | } |
cbab66dd | 108 | } |
109 | ||
110 | ||
d504c864 | 111 | //___________________________________________________________________________________________________________ |
ee7849e6 | 112 | AliHLTComponent* |
113 | AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn() | |
114 | { | |
115 | return new AliHLTPHOSRawAnalyzerPeakFinderComponent; | |
116 | } | |
68d9caee | 117 |