]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
Bug fix:
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
1 /**************************************************************************
2  * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved.      *
3  *                                                                        *
4  * Author: Per Thomas Hille for the ALICE HLT Project.                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 #include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
17 #include "AliHLTPHOSRawAnalyzerPeakFinder.h"
18 #include <cstdlib>
19 #include "AliHLTPHOSCommonDefs.h"
20
21 //ClassImp(AliHLTPHOSRawAnalyzerPeakFinderComponent) 
22 AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
23
24 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponent()
25 {
26   char tmpPFPath[PF_MAX_PATH_LENGTH];
27   cout <<"ALICE_ROOT ="<<getenv("ALICE_ROOT") << endl;
28
29   Double_t tmpAVector[PF_DEFAULT_N_SAMPLES];
30   Double_t tmpTVector[PF_DEFAULT_N_SAMPLES]; 
31   analyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
32   analyzerPtr->SetStartIndex(PF_DEFAULT_STARTINDEX);
33
34   sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PF_VECTOR_DIR, PF_DEFAULT_STARTINDEX,  PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS);
35
36   cout <<"PF PATH =" << tmpPFPath << endl;
37
38   FILE *fp;
39
40   fp = fopen(tmpPFPath, "r");
41   
42   if(fp != 0)
43     {
44       for(int i=0; i <  PF_DEFAULT_N_SAMPLES; i++)
45         {
46           fscanf(fp, "%lf", &tmpAVector[i]);
47         }
48
49
50       fscanf(fp, "\n");
51
52       for(int i=0; i < PF_DEFAULT_N_SAMPLES; i++)
53         {
54                   fscanf(fp, "%lf", &tmpTVector[i]);
55         }
56
57       analyzerPtr->SetAVector(tmpAVector,  PF_DEFAULT_N_SAMPLES);
58       analyzerPtr->SetTVector(tmpTVector,  PF_DEFAULT_N_SAMPLES);
59
60       fclose(fp);
61
62     }
63   
64   else
65     {
66       HLTFatal("ERROR: could not  open PF vector file");
67        //         cout <<"AliHLTPHOSRawAnalyzerPeakFinderComponent, ERROR: could not  open PF vector file" << endl;
68     }
69   
70   
71
72
73 AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
74 {
75
76 }
77
78
79
80 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
81 {
82
83 }
84
85
86 const char* 
87 AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
88 {
89   //cout << "AliHLTPHOSRawAnalyzerPeakFinderComponent returning ID" << endl;
90   return "PhosRawPeakFinder";
91 }
92
93
94 AliHLTComponent*
95 AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
96 {
97   //  cout << "AliHLTPHOSRawAnalyzerPeakFinderComponent spawning new instance" << endl;
98   return new AliHLTPHOSRawAnalyzerPeakFinderComponent;
99 }
100