]>
Commit | Line | Data |
---|---|---|
1b41ab20 | 1 | // $Id$ |
2 | ||
cbab66dd | 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 "AliHLTPHOSRawAnalyzerPeakFinderComponent.h" | |
f137c3c5 | 19 | #include "AliHLTCaloRawAnalyzerPeakFinder.h" |
d504c864 | 20 | |
ee7849e6 | 21 | AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent; |
cbab66dd | 22 | |
d504c864 | 23 | //___________________________________________________________________________________________________________ |
0bba8357 | 24 | AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponentv3() |
cbab66dd | 25 | { |
f137c3c5 | 26 | fAnalyzerPtr = new AliHLTCaloRawAnalyzerPeakFinder(); |
06c4998b | 27 | |
44175a17 | 28 | if(1)//LoadPFVector() == kFALSE) |
fb27c8ca | 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 | |
d504c864 | 39 | //___________________________________________________________________________________________________________ |
fb27c8ca | 40 | AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent() |
41 | { | |
42 | ||
d949e02e | 43 | if(fAnalyzerPtr) |
44 | { | |
45 | delete fAnalyzerPtr; | |
46 | fAnalyzerPtr = 0; | |
47 | } | |
fb27c8ca | 48 | } |
49 | ||
50 | ||
d504c864 | 51 | //___________________________________________________________________________________________________________ |
0bba8357 | 52 | AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponentv3() |
fb27c8ca | 53 | { |
54 | ||
55 | } | |
56 | ||
d949e02e | 57 | //----------------------------------------------------------------------------------------------------------- |
58 | int | |
59 | AliHLTPHOSRawAnalyzerPeakFinderComponent::Deinit() | |
60 | { | |
61 | ||
62 | if(fAnalyzerPtr) | |
63 | { | |
64 | delete fAnalyzerPtr; | |
65 | fAnalyzerPtr = 0; | |
66 | } | |
67 | Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerCrudeComponent Deinit"); | |
68 | return 0; | |
69 | } | |
fb27c8ca | 70 | |
d504c864 | 71 | //___________________________________________________________________________________________________________ |
fb27c8ca | 72 | const char* |
73 | AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID() | |
74 | { | |
75 | return "PhosRawPeakFinder"; | |
76 | } | |
77 | ||
d504c864 | 78 | //___________________________________________________________________________________________________________ |
fb27c8ca | 79 | Bool_t |
80 | AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector() | |
81 | { | |
44175a17 | 82 | return LoadPFVector(fCaloConstants->GetPFDEFAULTSTARTINDEX(), fCaloConstants->GetPFDEFAULTNSAMPLES(), |
83 | fCaloConstants->GetDEFAULTTAU(), fCaloConstants->GetDEFAULTFS() ); | |
fb27c8ca | 84 | } |
06c4998b | 85 | |
fb27c8ca | 86 | |
d504c864 | 87 | //___________________________________________________________________________________________________________ |
fb27c8ca | 88 | Bool_t |
89 | AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs) | |
90 | { | |
44175a17 | 91 | |
92 | char tmpPFPath[fCaloConstants->GetPFMAXPATHLENGTH()]; | |
e83e889b | 93 | Double_t * tmpAVector = new Double_t[nSamples]; |
94 | Double_t * tmpTVector = new Double_t[nSamples]; | |
27029341 | 95 | sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PFVECTORDIR, startIndex, nSamples, tau, fs); |
68d9caee | 96 | FILE *fp; |
06c4998b | 97 | fp = fopen(tmpPFPath, "r"); |
68d9caee | 98 | |
e304ea31 | 99 | Int_t res = 0; //OD to get rid of warnings |
68d9caee | 100 | if(fp != 0) |
101 | { | |
fb27c8ca | 102 | for(int i=0; i < nSamples; i++) |
68d9caee | 103 | { |
e304ea31 | 104 | res = fscanf(fp, "%lf", &tmpAVector[i]); |
68d9caee | 105 | } |
106 | ||
e304ea31 | 107 | res = fscanf(fp, "\n"); |
68d9caee | 108 | |
fb27c8ca | 109 | for(int i=0; i < nSamples; i++) |
68d9caee | 110 | { |
e304ea31 | 111 | res = fscanf(fp, "%lf", &tmpTVector[i]); |
68d9caee | 112 | } |
f137c3c5 | 113 | // fAnalyzerPtr->SetAVector(tmpAVector, nSamples); |
114 | // fAnalyzerPtr->SetTVector(tmpTVector, nSamples); | |
68d9caee | 115 | fclose(fp); |
e83e889b | 116 | delete [] tmpAVector; |
117 | delete [] tmpTVector; | |
fb27c8ca | 118 | return kTRUE; |
68d9caee | 119 | } |
120 | ||
121 | else | |
122 | { | |
e83e889b | 123 | delete [] tmpAVector; |
124 | delete [] tmpTVector; | |
06c4998b | 125 | HLTFatal("ERROR: could not open PF vector file"); |
fb27c8ca | 126 | return kFALSE; |
68d9caee | 127 | } |
cbab66dd | 128 | } |
129 | ||
130 | ||
d504c864 | 131 | //___________________________________________________________________________________________________________ |
ee7849e6 | 132 | AliHLTComponent* |
133 | AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn() | |
134 | { | |
135 | return new AliHLTPHOSRawAnalyzerPeakFinderComponent; | |
136 | } | |
68d9caee | 137 |