coding conventions
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Feb 2007 15:41:31 +0000 (15:41 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Feb 2007 15:41:31 +0000 (15:41 +0000)
HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinderComponent.cxx
HLT/PHOS/AliHLTPHOSRawAnalyzerPeakFinderComponent.h

index 4f0fba1..e317dfd 100644 (file)
 
 
 AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
+//AliHLTPHOSRawAnalyzerPeakFinderComponen    
+//AliHLTPHOSRawAnalyzerPeakFinderComponent AliHLTPHOSRawAnalyzerPeakFinderComponent::gAliHLTPHOSRawAnalyzerPeakFinderComponent;
+
 
 AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent():AliHLTPHOSRawAnalyzerComponent()
 {
-  char tmpPFPath[PF_MAX_PATH_LENGTH];
-  //  cout <<"ALICE_ROOT ="<<getenv("ALICE_ROOT") << endl;
-
-  Double_t tmpAVector[PF_DEFAULT_N_SAMPLES];
-  Double_t tmpTVector[PF_DEFAULT_N_SAMPLES]; 
   analyzerPtr = new AliHLTPHOSRawAnalyzerPeakFinder();
-  analyzerPtr->SetStartIndex(PF_DEFAULT_STARTINDEX);
 
-  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);
+  if(LoadPFVector() == kFALSE)
+    {
+      //      cout << "Warning, could not load PF vectors" << endl;
+    }
+  else 
+    {
+      //    cout << "Loaded PF vectors" << endl;
+    }
+
+} 
+
+AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
+{
+
+}
+
+
+
+AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
+{
+
+}
+
+
+const char* 
+AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
+{
+  return "PhosRawPeakFinder";
+}
+
+Bool_t 
+AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector()
+{
+  return LoadPFVector(PF_DEFAULT_STARTINDEX,  PF_DEFAULT_N_SAMPLES, DEFAULT_TAU, DEFAULT_FS );
+}
 
-  cout <<"PF PATH =" << tmpPFPath << endl;
+
+Bool_t 
+AliHLTPHOSRawAnalyzerPeakFinderComponent::LoadPFVector(int startIndex, int nSamples, int tau, int fs)
+{
+  char tmpPFPath[PF_MAX_PATH_LENGTH];
+  Double_t tmpAVector[nSamples];
+  Double_t tmpTVector[nSamples]; 
+  sprintf(tmpPFPath,"%s%s/start%dN%dtau%dfs%d.txt", getenv("ALICE_ROOT"), PF_VECTOR_DIR, startIndex, nSamples, tau, fs);
+  //  cout <<"PF PATH =" << tmpPFPath << endl;
 
   FILE *fp;
 
@@ -41,7 +80,7 @@ AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderCompone
   
   if(fp != 0)
     {
-      for(int i=0; i <  PF_DEFAULT_N_SAMPLES; i++)
+      for(int i=0; i <  nSamples; i++)
        {
          fscanf(fp, "%lf", &tmpAVector[i]);
        }
@@ -49,46 +88,28 @@ AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderCompone
 
       fscanf(fp, "\n");
 
-      for(int i=0; i < PF_DEFAULT_N_SAMPLES; i++)
+      for(int i=0; i < nSamples; i++)
        {
                  fscanf(fp, "%lf", &tmpTVector[i]);
        }
 
-      analyzerPtr->SetAVector(tmpAVector,  PF_DEFAULT_N_SAMPLES);
-      analyzerPtr->SetTVector(tmpTVector,  PF_DEFAULT_N_SAMPLES);
+      analyzerPtr->SetAVector(tmpAVector,  nSamples);
+      analyzerPtr->SetTVector(tmpTVector,  nSamples);
 
       fclose(fp);
+      return kTRUE;
 
     }
   
   else
     {
       HLTFatal("ERROR: could not  open PF vector file");
+      return kFALSE;
     }
-  
-  
-} 
-
-AliHLTPHOSRawAnalyzerPeakFinderComponent::~AliHLTPHOSRawAnalyzerPeakFinderComponent()
-{
-
 }
 
 
 
-AliHLTPHOSRawAnalyzerPeakFinderComponent::AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ) : AliHLTPHOSRawAnalyzerComponent()
-{
-
-}
-
-
-const char* 
-AliHLTPHOSRawAnalyzerPeakFinderComponent::GetComponentID()
-{
-  return "PhosRawPeakFinder";
-}
-
-
 AliHLTComponent*
 AliHLTPHOSRawAnalyzerPeakFinderComponent::Spawn()
 {
index ed64b45..2fcd2dc 100644 (file)
@@ -13,8 +13,10 @@ class AliHLTPHOSRawAnalyzerPeakFinderComponent: public AliHLTPHOSRawAnalyzerComp
   ~AliHLTPHOSRawAnalyzerPeakFinderComponent();
   virtual const char* GetComponentID();
   virtual AliHLTComponent* Spawn();
-
+  static AliHLTPHOSRawAnalyzerPeakFinderComponent gAliHLTPHOSRawAnalyzerPeakFinderComponent;
  private:
+  Bool_t LoadPFVector(); 
+  Bool_t LoadPFVector(int startindex, int Nsamples, int tau, int fs);
   AliHLTPHOSRawAnalyzerPeakFinderComponent(const AliHLTPHOSRawAnalyzerPeakFinderComponent & ); 
   AliHLTPHOSRawAnalyzerPeakFinderComponent & operator = (const AliHLTPHOSRawAnalyzerPeakFinderComponent)
     {