]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New classes for online analyis
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 May 2007 02:09:08 +0000 (02:09 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 May 2007 02:09:08 +0000 (02:09 +0000)
HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.cxx [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsDefinitions.cxx [new file with mode: 0644]
HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h [new file with mode: 0644]

diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.cxx
new file mode 100644 (file)
index 0000000..85ef70c
--- /dev/null
@@ -0,0 +1,116 @@
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: Øystein Djuvsland <oysteind@ift.uib.no>                        *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+#include "AliHLTPHOSPhysicsAnalyzer.h"
+#include "TVector3.h"
+#include "TFile.h"
+#include "TMath.h"
+#include <cmath>
+#include "../../PHOS/AliPHOSGeometry.h"
+#include <iostream>
+
+ClassImp(AliHLTPHOSPhysicsAnalyzer);
+
+AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():fClustersPtr(NULL)
+                                                   
+                                                      
+{
+
+  AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
+
+  fPHOSRadius = geom->GetIPtoCrystalSurface();
+  
+  for(Int_t i = 0; i < N_MODULES; i++)
+    {
+      fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
+
+      fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
+    }
+}
+
+AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(NULL)
+
+{
+  AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
+
+  fPHOSRadius = geom->GetIPtoCrystalSurface();
+  
+  for(Int_t i = 0; i < N_MODULES; i++)
+    {
+      fRotParametersCos[i] = cos((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
+      
+      fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
+    }
+  cout << "Copy constructor not tested!\n";
+}
+
+
+AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer()
+{
+
+}
+
+void
+AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr)
+{
+
+  locPositionPtr[0] = clusterPtr->fLocalPositionPtr[0];
+  locPositionPtr[1] = clusterPtr->fLocalPositionPtr[1];
+
+}
+
+void
+AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr)
+{
+  
+  Float_t tempPosX = 0;
+
+  Int_t module = clusterPtr->fPHOSModule;
+
+  tempPosX = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[0]-N_COLUMNS_MOD/2) + CRYSTAL_SIZE/2;
+
+  positionPtr[0] = tempPosX*fRotParametersSin[module] + fPHOSRadius*fRotParametersCos[module];
+
+  positionPtr[1] = tempPosX*fRotParametersCos[module] - fPHOSRadius*fRotParametersSin[module];
+
+  positionPtr[2] = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[1]-N_ROWS_MOD/2) + CRYSTAL_SIZE/2;
+
+}
+
+void
+AliHLTPHOSPhysicsAnalyzer::GlobalPosition(Float_t* locPositionPtr, Float_t* positionPtr, Int_t module)
+{ 
+  
+  positionPtr[0] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersCos[module-1] + fPHOSRadius*fRotParametersSin[module-1];
+
+  positionPtr[1] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersSin[module-1] - fPHOSRadius*fRotParametersCos[module-1];
+  
+  positionPtr[2] = CRYSTAL_SIZE*(locPositionPtr[1]-N_ROWS_MOD);
+
+}
+
+void
+AliHLTPHOSPhysicsAnalyzer::WriteHistogram(Char_t* fileName)
+{
+  TFile *outfile = new TFile(fileName,"recreate");  
+  
+  fRootHistPtr->Write();
+  
+  outfile->Close();
+
+}
+
+
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h
new file mode 100644 (file)
index 0000000..9ec54d0
--- /dev/null
@@ -0,0 +1,47 @@
+
+#ifndef ALIHLTPHOSPHYSICSANALYZER_H
+#define ALIHLTPHOSPHYSICSANALYZER_H
+
+/* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                          */
+
+
+#include <TObjArray.h>
+#include <TH1F.h>
+#include "TH2F.h"
+#include "AliHLTPHOSClusterDataStruct.h"
+
+const Float_t CRYSTAL_SIZE = 2.25;
+
+class AliHLTPHOSPhysicsAnalyzer
+{
+ public:
+  AliHLTPHOSPhysicsAnalyzer();
+  virtual ~AliHLTPHOSPhysicsAnalyzer();
+
+  AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer & );
+  AliHLTPHOSPhysicsAnalyzer & operator = (const AliHLTPHOSPhysicsAnalyzer &) {return *this;}
+
+  void SetHistogram(TH1F* histPtr) {fRootHistPtr = histPtr;}
+
+  void LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr);
+  void GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr);
+  void GlobalPosition(Float_t* locPositionPtr , Float_t* positionPtr, Int_t module);
+
+  virtual void WriteHistogram(Char_t* fileName = "histogram.root");
+  virtual void Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters) = 0;
+
+ protected:
+  
+  TObjArray* fClustersPtr;
+  TH1F* fRootHistPtr;
+
+ private:
+  Float_t fRotParametersCos[5];
+  Float_t fRotParametersSin[5];
+  Float_t fPHOSRadius;
+
+  ClassDef(AliHLTPHOSPhysicsAnalyzer,1);
+};
+
+#endif
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.cxx
new file mode 100644 (file)
index 0000000..f9f1ffb
--- /dev/null
@@ -0,0 +1,84 @@
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Øystein Djuvsland <oysteind@ift.uib.no>                       *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+
+#include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h"
+#include "TMath.h"
+#include "TF1.h"
+#include "TFile.h"
+
+
+ClassImp(AliHLTPHOSPhysicsAnalyzerPeakFitter);
+
+AliHLTPHOSPhysicsAnalyzerPeakFitter::AliHLTPHOSPhysicsAnalyzerPeakFitter() : fGainLow(80), fGainHigh(5),
+                                                                            fRootHistPtr(0)
+{
+}
+
+AliHLTPHOSPhysicsAnalyzerPeakFitter::~AliHLTPHOSPhysicsAnalyzerPeakFitter()
+{
+}
+
+Int_t
+AliHLTPHOSPhysicsAnalyzerPeakFitter::FitGaussian()
+{
+  Int_t maxBin = fRootHistPtr->GetMaximumBin();
+  Float_t binWidth = fRootHistPtr->GetBinWidth(maxBin);
+  Float_t maxBinValue = (Float_t)(maxBin * binWidth);
+  Float_t lowRange = maxBinValue - 0.03;
+  Float_t highRange = maxBinValue + 0.03;
+
+  TF1* gaussian = new TF1("gaussian", "gaus", 0.1, 0.2);
+  Double_t params[3] = {maxBinValue, 0};
+  
+  
+  fRootHistPtr->Fit(gaussian->GetName(), "", "",lowRange, highRange);
+  
+  return 0;
+
+}
+
+Int_t
+AliHLTPHOSPhysicsAnalyzerPeakFitter::FitLorentzian()
+{
+
+
+  Int_t maxBin = fRootHistPtr->GetMaximumBin();
+  Float_t binWidth = fRootHistPtr->GetBinWidth(maxBin);
+  Float_t maxBinValue = (Float_t)(maxBin * binWidth);
+  Double_t lowRange = maxBinValue - 0.03;
+  Double_t highRange = maxBinValue + 0.03;
+
+  Int_t npar = 3;
+
+  char* name = "lorentzian";
+  
+  TF1* lorentzian = new TF1(name, "([0]*1/TMath::Pi())*[1]/((x[0]-[2])*(x[0]-[2])+[1]*[1])", lowRange, highRange);
+
+  Double_t params[3] = {fRootHistPtr->GetBinContent(maxBin)/20, 0.01, 0.135};
+  lorentzian->SetParameters(params);
+
+  fRootHistPtr->Fit(lorentzian->GetName(), "", "", lowRange, highRange);
+
+  lorentzian->GetParameters(params);
+
+  TFile *outfile = new TFile("/home/odjuvsla/pi0HistFit.root","recreate");  
+  fRootHistPtr->Write();
+  outfile->Close();
+
+  return 0;
+}
+
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerPeakFitter.h
new file mode 100644 (file)
index 0000000..06fad9d
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALIHLTPHOSPHYSICSANALYZERPEAKFITTER_H
+#define ALIHLTPHOSPHYSICSANALYZERPEAKFITTER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+#include "Rtypes.h"
+#include "AliHLTPHOSClusterDataStruct.h"
+#include "AliHLTDataTypes.h"
+#include "TH1F.h"
+#include "TMath.h"
+
+
+class AliHLTPHOSPhysicsAnalyzerPeakFitter
+{
+
+ public:
+
+  AliHLTPHOSPhysicsAnalyzerPeakFitter();
+  virtual ~AliHLTPHOSPhysicsAnalyzerPeakFitter();
+
+  void    SetHistogram(TH1F* histPtr)            { fRootHistPtr = histPtr; }
+
+  Int_t   FitGaussian();
+  Int_t   FitLorentzian();
+  
+
+ private:
+  
+  Float_t fGainLow;
+  Float_t fGainHigh;
+  TH1F* fRootHistPtr;
+  ClassDef(AliHLTPHOSPhysicsAnalyzerPeakFitter, 1);
+
+};
+
+
+
+
+
+
+#endif
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx
new file mode 100644 (file)
index 0000000..5755471
--- /dev/null
@@ -0,0 +1,155 @@
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Øystein Djuvsland <oysteind@ift.uib.no>                       *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
+#include "AliHLTPHOSClusterDataStruct.h"
+#include <cmath>
+#include "math.h"
+#include <iostream>
+
+ClassImp(AliHLTPHOSPhysicsAnalyzerSpectrum);
+
+AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum():AliHLTPHOSPhysicsAnalyzer()
+{
+
+  fEnergyPtr = new Float_t[2];
+  fPos0Ptr = new Float_t[3];
+  fPos1Ptr = new Float_t[3];
+  fThresholdPtr = new Float_t[2];
+  fThresholdPtr[0] = 0;
+  fThresholdPtr[1] = 0;
+  
+}
+
+AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &):AliHLTPHOSPhysicsAnalyzer()
+{
+
+  cout << "AliHLTPHOSPhysicsAnalyzerSpectrum: Copy constructor not implemented yet!" << endl;
+
+}
+
+AliHLTPHOSPhysicsAnalyzerSpectrum::~AliHLTPHOSPhysicsAnalyzerSpectrum()
+{
+
+  if(fClustersPtr) fClustersPtr = 0;
+
+  if(fRootHistPtr) fRootHistPtr = 0;
+
+  if(fThresholdPtr)
+    {
+      delete [] fThresholdPtr;
+      fThresholdPtr = 0;
+    }
+  if(fEnergyPtr)
+    {
+      delete [] fEnergyPtr;
+      fEnergyPtr = 0;
+    }
+  if(fPos0Ptr)
+    {
+      delete [] fPos0Ptr;
+      fPos0Ptr = 0;
+    }
+  if(fPos1Ptr)
+    {
+      delete [] fPos1Ptr;
+      fPos1Ptr = 0;
+    }
+
+}
+
+void
+AliHLTPHOSPhysicsAnalyzerSpectrum::Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters)
+{
+
+  Float_t cosOpeningAngle = 0;
+
+  cout << "number of clusters: " << nClusters << endl;
+
+  if(nClusters > 1)
+    {
+      for(Int_t i = 0; i < nClusters-1; i++)
+       {
+         
+         fEnergyPtr[0] = clustersPtr[i]->fClusterEnergy;
+
+         if(fEnergyPtr[0] > fThresholdPtr[0])
+           {
+             
+             for(Int_t j = i+1; j < nClusters; j++)
+               {
+                 
+                 fEnergyPtr[1] = clustersPtr[j]->fClusterEnergy;
+
+                 if(fEnergyPtr[1] > fThresholdPtr[1])
+                   {
+                     GlobalPosition(clustersPtr[i], fPos0Ptr);
+
+                     GlobalPosition(clustersPtr[j], fPos1Ptr);
+                     
+                     cosOpeningAngle = (fPos0Ptr[0]*fPos1Ptr[0] + fPos0Ptr[1]*fPos1Ptr[1] + fPos0Ptr[2]*fPos1Ptr[2])/
+                       (sqrt(fPos0Ptr[0]*fPos0Ptr[0] + fPos0Ptr[1]*fPos0Ptr[1] + fPos0Ptr[2]*fPos0Ptr[2])*
+                        sqrt(fPos1Ptr[0]*fPos1Ptr[0] + fPos1Ptr[1]*fPos1Ptr[1] + fPos1Ptr[2]*fPos1Ptr[2]));
+                     
+                     fRootHistPtr->Fill(sqrt(2*fEnergyPtr[0]*fEnergyPtr[1]*(1 - cosOpeningAngle)));
+                     
+                     
+                   }
+                 
+               }                 
+             
+           }
+         
+       }
+      
+    }
+  
+}
+
+
+Float_t 
+AliHLTPHOSPhysicsAnalyzerSpectrum::EvalDistance()
+{
+  
+  return sqrt(pow(fPos1Ptr[0]-fPos0Ptr[0],2) + pow(fPos1Ptr[1]-fPos0Ptr[1],2) + pow(fPos1Ptr[2]-fPos0Ptr[2],2));
+
+}
+
+Float_t 
+AliHLTPHOSPhysicsAnalyzerSpectrum::EvalCutDistance(Float_t cutMass)
+{
+
+  Float_t cosCutOpeningAngle = 0;
+  
+  cosCutOpeningAngle = 1 - cutMass*cutMass/(2*fEnergyPtr[0]*fEnergyPtr[1]);
+
+  return 1.5*2*sin(acos(cosCutOpeningAngle));
+  
+}
+
+Int_t
+AliHLTPHOSPhysicsAnalyzerSpectrum::SetThreshold(Float_t photonEnergy0, Float_t photonEnergy1)
+{
+  
+  if(!fThresholdPtr) fThresholdPtr = new Float_t[2];
+
+  fThresholdPtr[0] = photonEnergy0;
+
+  fThresholdPtr[1] = photonEnergy1;
+
+  return 0;
+
+}
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h
new file mode 100644 (file)
index 0000000..314a8f6
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H
+#define ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+
+#include "AliHLTPHOSPhysicsAnalyzer.h"
+
+
+const Int_t USE_DISTANCE_CUT = 0;
+
+class AliHLTPHOSPhysicsAnalyzerSpectrum : public AliHLTPHOSPhysicsAnalyzer
+{
+ public:
+  AliHLTPHOSPhysicsAnalyzerSpectrum();
+  AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &);
+  AliHLTPHOSPhysicsAnalyzerSpectrum & operator = (const AliHLTPHOSPhysicsAnalyzerSpectrum)
+    {
+      return *this; 
+    }
+
+  virtual ~AliHLTPHOSPhysicsAnalyzerSpectrum();
+
+  Int_t SetThreshold(Float_t photonEnergy0, Float_t photonEnergy1);
+  Float_t EvalDistance();
+  Float_t EvalCutDistance(Float_t cutMass);
+  virtual void Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters);
+
+ private:
+  Float_t* fPos0Ptr;
+  Float_t* fPos1Ptr;
+  Float_t* fThresholdPtr;
+  Float_t* fEnergyPtr;
+  Bool_t fUseDistanceCut;
+
+  ClassDef(AliHLTPHOSPhysicsAnalyzerSpectrum, 1);
+  
+};
+
+
+#endif
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx
new file mode 100644 (file)
index 0000000..1344e27
--- /dev/null
@@ -0,0 +1,168 @@
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Øystein Djuvsland <oysteind@ift.uib.no>                       *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+#include "AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h"
+#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
+#include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h"
+#include "AliHLTPHOSPhysicsDefinitions.h"
+#include "AliHLTPHOSDefinitions.h"
+#include "TCanvas.h"
+#include "TFile.h"
+#include <iostream>
+#include "stdio.h"                         
+#include <cstdlib>
+
+const AliHLTComponentDataType AliHLTPHOSPhysicsAnalyzerSpectrumComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
+int AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fEventCount = 0; 
+
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent gAliHLTPHOSPhysicsAnalyzerSpectrumComponent;
+
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent():AliHLTProcessor(), fAnalyzerPtr(0), 
+                                                                                              fRootHistPtr(0)
+{
+}
+
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::~AliHLTPHOSPhysicsAnalyzerSpectrumComponent()
+{
+}
+
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent(const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &):AliHLTProcessor(),
+                                                                                                                                                   fAnalyzerPtr(0),
+                                                                                                                                                   fRootHistPtr(0)
+{
+  
+  cout << "AliHLTPHOSPhysicsAnalyzerSpectrumComponent: Copy constructor not implemented yet!" << endl;
+  
+}
+
+Int_t
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Deinit()
+{
+
+  fPeakFitter->SetHistogram(fRootHistPtr);
+  cout << "Fitting..." << endl;
+  //pf->FitGaussian();
+  fPeakFitter->FitLorentzian();
+
+  return 0;
+}
+
+Int_t
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoDeinit()
+{
+  Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSPhysicsAnalyzerSpectrumComponent DoDeinit");
+
+  return 0;
+}
+
+
+const Char_t* 
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetComponentID()
+{
+  return "AliHltPhosPhysicsAnalyzerSpectrum";
+}
+
+void
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  const AliHLTComponentDataType* pType=inputDataTypes;
+  while (pType->fID!=0) {
+    list.push_back(*pType);
+    pType++;
+  }
+}
+
+AliHLTComponentDataType 
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataType()
+{
+  return AliHLTPHOSPhysicsDefinitions::fgkAliHLTSpectrumDataType;
+}
+
+void
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
+  
+{
+  constBase = 30;
+  inputMultiplier = 1;
+}
+
+
+Int_t 
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+                                       AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
+                                       std::vector<AliHLTComponentBlockData>& outputBlocks)
+{
+
+  const AliHLTComponentBlockData* iter = NULL; 
+  unsigned long ndx; 
+  
+  for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
+    {
+      iter = blocks+ndx;
+      
+      if(iter->fDataType != AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType)
+       {
+         cout << "Warning: data type is not fgkAliHLTClusterDataType " << endl;
+         continue;
+       }
+      
+      fClusterArrayPtr[ndx] = reinterpret_cast<AliHLTPHOSClusterDataStruct*>(iter->fPtr);
+      
+    } 
+  
+  fAnalyzerPtr->Analyze(fClusterArrayPtr, ndx);
+
+  if(fEventCount%fWriteInterval == 0 && fEventCount != 0)
+    {
+      PushBack(fRootHistPtr, kAliHLTAnyDataType, (AliHLTUInt32_t)0);
+    }
+
+  fEventCount++; 
+  
+  return 0;
+  
+}
+
+Int_t
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoInit(Int_t argc, const Char_t** argv )
+{
+
+  Float_t firstThreshold = atof(argv[0]);
+  Float_t secondThreshold = atof(argv[1]);
+  fWriteInterval = atoi(argv[2]);
+  Int_t nBins = atoi(argv[3]);
+  Float_t lowLimit  = atof(argv[4]);
+  Float_t highLimit = atof(argv[5]);
+
+  fPeakFitter = new AliHLTPHOSPhysicsAnalyzerPeakFitter();
+  fRootHistPtr = new TH1F("hist", "hist", nBins, lowLimit, highLimit);
+  fAnalyzerPtr = new AliHLTPHOSPhysicsAnalyzerSpectrum();
+  fAnalyzerPtr->SetThreshold(firstThreshold,secondThreshold);
+  fAnalyzerPtr->SetHistogram(fRootHistPtr);
+
+  if (argc==0 && argv==NULL) {
+    // this is currently just to get rid of the warning "unused parameter"
+  }
+  
+  return 0;
+}
+
+AliHLTComponent*
+AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Spawn()
+{
+  return new AliHLTPHOSPhysicsAnalyzerSpectrumComponent();
+}
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h b/HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h
new file mode 100644 (file)
index 0000000..f64c8b0
--- /dev/null
@@ -0,0 +1,63 @@
+
+#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT
+#define ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+#include "AliHLTProcessor.h"
+#include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h"
+#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
+#include "AliHLTPHOSClusterDataStruct.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "Rtypes.h"
+
+
+class AliHLTPHOSPhysicsAnalyzerSpectrumComponent: public AliHLTProcessor
+{
+ public:
+
+  AliHLTPHOSPhysicsAnalyzerSpectrumComponent();
+  ~AliHLTPHOSPhysicsAnalyzerSpectrumComponent();
+  AliHLTPHOSPhysicsAnalyzerSpectrumComponent(const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &);
+  AliHLTPHOSPhysicsAnalyzerSpectrumComponent & operator = (const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &)
+    {
+      return *this;
+    }
+  const char* GetComponentID();
+  void GetInputDataTypes(std::vector<AliHLTComponentDataType, std::allocator<AliHLTComponentDataType> >&);
+
+  AliHLTComponentDataType GetOutputDataType();
+
+  void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
+
+
+  Int_t DoEvent(const AliHLTComponentEventData&, const AliHLTComponentBlockData*,
+               AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&,
+               std::vector<AliHLTComponentBlockData>&);
+  
+
+  AliHLTComponent* Spawn();
+
+ protected:
+
+  Int_t DoInit(int argc, const char** argv);
+  Int_t Deinit();
+  Int_t DoDeinit();
+  
+ private:
+  
+  AliHLTPHOSPhysicsAnalyzerSpectrum* fAnalyzerPtr;
+  AliHLTPHOSPhysicsAnalyzerPeakFitter* fPeakFitter;
+  TH1F* fRootHistPtr;
+  AliHLTPHOSClusterDataStruct* fClusterArrayPtr[10000];
+  Int_t fWriteInterval;
+
+  static const AliHLTComponentDataType inputDataTypes[];
+  static int fEventCount;
+
+};
+
+#endif
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.cxx b/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.cxx
new file mode 100644 (file)
index 0000000..2240d80
--- /dev/null
@@ -0,0 +1,22 @@
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Øystein Djuvsland <oysteind@ift.uib.no>                       *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+#include "AliHLTPHOSPhysicsDefinitions.h"
+
+
+const AliHLTComponentDataType AliHLTPHOSPhysicsDefinitions::fgkAliHLTClusterDataType = { sizeof(AliHLTComponentDataType), {'C','L','U','S','T','R','T','Y'},{'P','H','O','S'}};;
+const AliHLTComponentDataType AliHLTPHOSPhysicsDefinitions::fgkAliHLTHistDataType = { sizeof(AliHLTComponentDataType), {'H','I','S','T','T','Y','P','E'},{'P','H','O','S'}};;
+const AliHLTComponentDataType AliHLTPHOSPhysicsDefinitions::fgkAliHLTSpectrumDataType = { sizeof(AliHLTComponentDataType), {'S','P','E','C','T','Y','P','E'},{'P','H','O','S'}};;
diff --git a/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h b/HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h
new file mode 100644 (file)
index 0000000..7d57571
--- /dev/null
@@ -0,0 +1,24 @@
+
+#ifndef ALIHLTPHOSPHYSICSDEFINITIONS_H
+#define ALIHLTPHOSPHYSICSDEFINITIONS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* AliHLTPHOSPhysicsDefinitions
+ */
+
+#include "AliHLTDataTypes.h"
+#include "Rtypes.h"
+#include "TROOT.h"
+#include "TH1F.h"
+
+class AliHLTPHOSPhysicsDefinitions
+    {
+    public:
+      static const AliHLTComponentDataType fgkAliHLTClusterDataType;  
+      static const AliHLTComponentDataType fgkAliHLTHistDataType;
+      static const AliHLTComponentDataType fgkAliHLTSpectrumDataType;
+    };
+
+#endif
+