]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
Configuration script
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
... / ...
CommitLineData
1// $Id$
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 "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
19#include "AliHLTCaloRawAnalyzerPeakFinder.h"
20
21AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
22
23//___________________________________________________________________________________________________________
24AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponentv3()
25{
26 fAnalyzerPtr = new AliHLTCaloRawAnalyzerPeakFinder();
27
28 if(1)//LoadPFVector() == kFALSE)
29 {
30 // cout << "Warning, could not load PF vectors" << endl;
31 }
32 else
33 {
34 // cout << "Loaded PF vectors" << endl;
35 }
36}
37
38
39//___________________________________________________________________________________________________________
40AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
41{
42
43 if(fAnalyzerPtr)
44 {
45 delete fAnalyzerPtr;
46 fAnalyzerPtr = 0;
47 }
48}
49
50
51//___________________________________________________________________________________________________________
52AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponentv3()
53{
54
55}
56
57//-----------------------------------------------------------------------------------------------------------
58int
59AliHLTPHOSRawAnalyzerPeakFinderComponent::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}
70
71//___________________________________________________________________________________________________________
72const char*
73AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
74{
75 return "PhosRawPeakFinder";
76}
77
78//___________________________________________________________________________________________________________
79Bool_t
80AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
81{
82 return LoadPFVector(fCaloConstants->GetPFDEFAULTSTARTINDEX(), fCaloConstants->GetPFDEFAULTNSAMPLES(),
83 fCaloConstants->GetDEFAULTTAU(), fCaloConstants->GetDEFAULTFS() );
84}
85
86
87//___________________________________________________________________________________________________________
88Bool_t
89AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
90{
91
92 char tmpPFPath[fCaloConstants->GetPFMAXPATHLENGTH()];
93 Double_t * tmpAVector = new Double_t[nSamples];
94 Double_t * tmpTVector = new Double_t[nSamples];
95 sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PFVECTORDIR, startIndex, nSamples, tau, fs);
96 FILE *fp;
97 fp = fopen(tmpPFPath, "r");
98
99 Int_t res = 0; //OD to get rid of warnings
100 if(fp != 0)
101 {
102 for(int i=0; i < nSamples; i++)
103 {
104 res = fscanf(fp, "%lf", &tmpAVector[i]);
105 }
106
107 res = fscanf(fp, "\n");
108
109 for(int i=0; i < nSamples; i++)
110 {
111 res = fscanf(fp, "%lf", &tmpTVector[i]);
112 }
113 // fAnalyzerPtr->SetAVector(tmpAVector, nSamples);
114 // fAnalyzerPtr->SetTVector(tmpTVector, nSamples);
115 fclose(fp);
116 delete [] tmpAVector;
117 delete [] tmpTVector;
118 return kTRUE;
119 }
120
121 else
122 {
123 delete [] tmpAVector;
124 delete [] tmpTVector;
125 HLTFatal("ERROR: could not open PF vector file");
126 return kFALSE;
127 }
128}
129
130
131//___________________________________________________________________________________________________________
132AliHLTComponent*
133AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
134{
135 return new AliHLTPHOSRawAnalyzerPeakFinderComponent;
136}
137