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