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