]>
Commit | Line | Data |
---|---|---|
178dd351 | 1 | // $Id: AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx 31490 2009-03-15 16:27:11Z odjuvsla $ |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Author: Per Thomas Hille for the ALICE HLT Project. * | |
7 | * Contributors are mentioned in the code where appropriate. * | |
8 | * * | |
9 | * Permission to use, copy, modify and distribute this software and its * | |
10 | * documentation strictly for non-commercial purposes is hereby granted * | |
11 | * without fee, provided that the above copyright notice appears in all * | |
12 | * copies and that both the copyright notice and this permission notice * | |
13 | * appear in the supporting documentation. The authors make no claims * | |
14 | * about the suitability of this software for any purpose. It is * | |
15 | * provided "as is" without express or implied warranty. * | |
16 | **************************************************************************/ | |
17 | ||
18 | #include "AliHLTCaloRawAnalyzerPeakFinderComponent.h" | |
19 | #include "AliHLTCaloRawAnalyzerPeakFinder.h" | |
20 | //#include <cstdlib> | |
21 | //#include "AliHLTCaloCommonDefs.h" | |
22 | ||
23 | ||
24 | ||
25 | //AliHLTCaloRawAnalyzerPeakFinderComponent gAliHLTCaloRawAnalyzerPeakFinderComponent; | |
26 | ||
27 | //___________________________________________________________________________________________________________ | |
28 | AliHLTCaloRawAnalyzerPeakFinderComponent::AliHLTCaloRawAnalyzerPeakFinderComponent():AliHLTCaloRawAnalyzerComponentv3() | |
29 | { | |
30 | fAnalyzerPtr = new AliHLTCaloRawAnalyzerPeakFinder(); | |
31 | ||
3800a654 | 32 | if(LoadPFVector() == kFALSE) |
33 | { | |
34 | // cout << "Warning, could not load PF vectors" << endl; | |
35 | } | |
36 | else | |
37 | { | |
38 | // cout << "Loaded PF vectors" << endl; | |
39 | } | |
178dd351 | 40 | } |
41 | ||
42 | ||
43 | //___________________________________________________________________________________________________________ | |
44 | AliHLTCaloRawAnalyzerPeakFinderComponent::~AliHLTCaloRawAnalyzerPeakFinderComponent() | |
45 | { | |
46 | ||
47 | if(fAnalyzerPtr) | |
48 | { | |
49 | delete fAnalyzerPtr; | |
50 | fAnalyzerPtr = 0; | |
51 | } | |
52 | } | |
53 | ||
54 | ||
55 | //___________________________________________________________________________________________________________ | |
56 | AliHLTCaloRawAnalyzerPeakFinderComponent::AliHLTCaloRawAnalyzerPeakFinderComponent(const AliHLTCaloRawAnalyzerPeakFinderComponent & ) : AliHLTCaloRawAnalyzerComponentv3() | |
57 | { | |
58 | ||
59 | } | |
60 | ||
61 | //----------------------------------------------------------------------------------------------------------- | |
62 | int | |
63 | AliHLTCaloRawAnalyzerPeakFinderComponent::Deinit() | |
64 | { | |
65 | ||
66 | if(fAnalyzerPtr) | |
67 | { | |
68 | delete fAnalyzerPtr; | |
69 | fAnalyzerPtr = 0; | |
70 | } | |
71 | Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTCaloRawAnalyzerCrudeComponent Deinit"); | |
72 | return 0; | |
73 | } | |
74 | ||
75 | //___________________________________________________________________________________________________________ | |
76 | ||
77 | ||
78 | /* | |
79 | const char* | |
80 | AliHLTCaloRawAnalyzerPeakFinderComponent::GetComponentID() | |
81 | { | |
82 | return "PhosRawPeakFinder"; | |
83 | } | |
84 | */ | |
85 | ||
86 | ||
87 | /* | |
88 | //___________________________________________________________________________________________________________ | |
89 | Bool_t | |
90 | AliHLTCaloRawAnalyzerPeakFinderComponent::LoadPFVector() | |
91 | { | |
92 | return LoadPFVector(PFDEFAULTSTARTINDEX, PFDEFAULTNSAMPLES, DEFAULTTAU, DEFAULTFS ); | |
93 | } | |
94 | ||
95 | ||
96 | //___________________________________________________________________________________________________________ | |
97 | Bool_t | |
98 | AliHLTCaloRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs) | |
99 | { | |
100 | char tmpPFPath[PFMAXPATHLENGTH]; | |
101 | Double_t * tmpAVector = new Double_t[nSamples]; | |
102 | Double_t * tmpTVector = new Double_t[nSamples]; | |
103 | sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PFVECTORDIR, startIndex, nSamples, tau, fs); | |
104 | FILE *fp; | |
105 | fp = fopen(tmpPFPath, "r"); | |
106 | ||
107 | Int_t res = 0; //OD to get rid of warnings | |
108 | if(fp != 0) | |
109 | { | |
110 | for(int i=0; i < nSamples; i++) | |
111 | { | |
112 | res = fscanf(fp, "%lf", &tmpAVector[i]); | |
113 | } | |
114 | ||
115 | res = fscanf(fp, "\n"); | |
116 | ||
117 | for(int i=0; i < nSamples; i++) | |
118 | { | |
119 | res = fscanf(fp, "%lf", &tmpTVector[i]); | |
120 | } | |
121 | fAnalyzerPtr->SetAVector(tmpAVector, nSamples); | |
122 | fAnalyzerPtr->SetTVector(tmpTVector, nSamples); | |
123 | fclose(fp); | |
124 | delete [] tmpAVector; | |
125 | delete [] tmpTVector; | |
126 | return kTRUE; | |
127 | } | |
128 | ||
129 | else | |
130 | { | |
131 | delete [] tmpAVector; | |
132 | delete [] tmpTVector; | |
133 | HLTFatal("ERROR: could not open PF vector file"); | |
134 | return kFALSE; | |
135 | } | |
136 | } | |
137 | */ | |
138 | ||
139 | ||
140 | //___________________________________________________________________________________________________________ | |
141 | ||
142 | /* | |
143 | AliHLTComponent* | |
144 | AliHLTCaloRawAnalyzerPeakFinderComponent::Spawn() | |
145 | { | |
146 | return new AliHLTCaloRawAnalyzerPeakFinderComponent; | |
147 | } | |
148 | */ |