3 /**************************************************************************
4 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
6 * Author: Per Thomas Hille for the ALICE HLT Project. *
7 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
19 #include "AliHLTPHOSRawAnalyzerPeakFinder.h"
21 //#include "AliHLTPHOSCommonDefs.h"
22 #include "AliHLTPHOSConstant.h"
24 using namespace PhosHLTConst;
26 AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
28 //___________________________________________________________________________________________________________
29 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponentv3()
31 fAnalyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
33 if(LoadPFVector() == kFALSE)
35 // cout << "Warning, could not load PF vectors" << endl;
39 // cout << "Loaded PF vectors" << endl;
44 //___________________________________________________________________________________________________________
45 AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
56 //___________________________________________________________________________________________________________
57 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponentv3()
62 //-----------------------------------------------------------------------------------------------------------
64 AliHLTPHOSRawAnalyzerPeakFinderComponent::Deinit()
72 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSRawAnalyzerCrudeComponent Deinit");
76 //___________________________________________________________________________________________________________
78 AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
80 return "PhosRawPeakFinder";
83 //___________________________________________________________________________________________________________
85 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
87 return LoadPFVector(PFDEFAULTSTARTINDEX, PFDEFAULTNSAMPLES, DEFAULTTAU, DEFAULTFS );
91 //___________________________________________________________________________________________________________
93 AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
95 char tmpPFPath[PFMAXPATHLENGTH];
96 Double_t * tmpAVector = new Double_t[nSamples];
97 Double_t * tmpTVector = new Double_t[nSamples];
98 sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PFVECTORDIR, startIndex, nSamples, tau, fs);
100 fp = fopen(tmpPFPath, "r");
102 Int_t res = 0; //OD to get rid of warnings
105 for(int i=0; i < nSamples; i++)
107 res = fscanf(fp, "%lf", &tmpAVector[i]);
110 res = fscanf(fp, "\n");
112 for(int i=0; i < nSamples; i++)
114 res = fscanf(fp, "%lf", &tmpTVector[i]);
116 fAnalyzerPtr->SetAVector(tmpAVector, nSamples);
117 fAnalyzerPtr->SetTVector(tmpTVector, nSamples);
119 delete [] tmpAVector;
120 delete [] tmpTVector;
126 delete [] tmpAVector;
127 delete [] tmpTVector;
128 HLTFatal("ERROR: could not open PF vector file");
134 //___________________________________________________________________________________________________________
136 AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
138 return new AliHLTPHOSRawAnalyzerPeakFinderComponent;