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()
52 //___________________________________________________________________________________________________________
53 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
58 //-----------------------------------------------------------------------------------------------------------
60 AliHLTPHOSRawAnalyzerPeakFinderComponent::Deinit()
68 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerCrudeComponent Deinit");
72 //___________________________________________________________________________________________________________
74 AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
76 return "PhosRawPeakFinder";
79 //___________________________________________________________________________________________________________
81 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
83 return LoadPFVector(PF_DEFAULT_STARTINDEX, PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS );
87 //___________________________________________________________________________________________________________
89 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
91 char tmpPFPath[PF_MAX_PATH_LENGTH];
92 Double_t * tmpAVector = new Double_t[nSamples];
93 Double_t * tmpTVector = new Double_t[nSamples];
94 sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PF_VECTOR_DIR, startIndex, nSamples, tau, fs);
96 fp = fopen(tmpPFPath, "r");
100 for(int i=0; i < nSamples; i++)
102 fscanf(fp, "%lf", &tmpAVector[i]);
107 for(int i=0; i < nSamples; i++)
109 fscanf(fp, "%lf", &tmpTVector[i]);
111 fAnalyzerPtr->SetAVector(tmpAVector, nSamples);
112 fAnalyzerPtr->SetTVector(tmpTVector, nSamples);
114 delete [] tmpAVector;
115 delete [] tmpTVector;
121 delete [] tmpAVector;
122 delete [] tmpTVector;
123 HLTFatal("ERROR: could not open PF vector file");
129 //___________________________________________________________________________________________________________
131 AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
133 return new AliHLTPHOSRawAnalyzerPeakFinderComponent;