1 /**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
17 #include "AliHLTPHOSRawAnalyzerPeakFinder.h"
19 //#include "AliHLTPHOSCommonDefs.h"
22 AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
24 //___________________________________________________________________________________________________________
25 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponent()
27 fAnalyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
29 if(LoadPFVector() == kFALSE)
31 // cout << "Warning, could not load PF vectors" << endl;
35 // cout << "Loaded PF vectors" << endl;
40 //___________________________________________________________________________________________________________
41 AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
47 //___________________________________________________________________________________________________________
48 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
54 //___________________________________________________________________________________________________________
56 AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
58 return "PhosRawPeakFinder";
61 //___________________________________________________________________________________________________________
63 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
65 return LoadPFVector(PF_DEFAULT_STARTINDEX, PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS );
69 //___________________________________________________________________________________________________________
71 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
73 char tmpPFPath[PF_MAX_PATH_LENGTH];
74 Double_t * tmpAVector = new Double_t[nSamples];
75 Double_t * tmpTVector = new Double_t[nSamples];
76 sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PF_VECTOR_DIR, startIndex, nSamples, tau, fs);
78 fp = fopen(tmpPFPath, "r");
82 for(int i=0; i < nSamples; i++)
84 fscanf(fp, "%lf", &tmpAVector[i]);
89 for(int i=0; i < nSamples; i++)
91 fscanf(fp, "%lf", &tmpTVector[i]);
93 fAnalyzerPtr->SetAVector(tmpAVector, nSamples);
94 fAnalyzerPtr->SetTVector(tmpTVector, nSamples);
103 delete [] tmpAVector;
104 delete [] tmpTVector;
105 HLTFatal("ERROR: could not open PF vector file");
111 //___________________________________________________________________________________________________________
113 AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
115 return new AliHLTPHOSRawAnalyzerPeakFinderComponent;