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