Coding conventions
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 May 2007 19:38:05 +0000 (19:38 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 May 2007 19:38:05 +0000 (19:38 +0000)
14 files changed:
HLT/PHOS/AliHLTPHOSClusterDataStruct.h
HLT/PHOS/AliHLTPHOSClusterizer.cxx
HLT/PHOS/AliHLTPHOSClusterizer.h
HLT/PHOS/AliHLTPHOSClusterizerComponent.cxx
HLT/PHOS/AliHLTPHOSClusterizerComponent.h
HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.cxx
HLT/PHOS/AliHLTPHOSPhysicsAnalyzer.h
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.cxx
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrum.h
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.cxx
HLT/PHOS/AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h
HLT/PHOS/AliHLTPHOSPhysicsDefinitions.h
HLT/PHOS/AliHLTPHOSRecPointDataStruct.h
HLT/PHOS/AliHLTPHOSRecPointListDataStruct.h

index 8e647c4f55f0b4cdadad86328bd89772b783aa24..fce3d773c9b12eb89f3468d87111118ff20f2283 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ALIHLTPHOSCLUSTERDATASTRUCT
-#define ALIHLTPHOSCLUSTERDATASTRUCT
+#ifndef ALIHLTPHOSCLUSTERDATASTRUCT_H
+#define ALIHLTPHOSCLUSTERDATASTRUCT_H
 
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
@@ -17,7 +17,6 @@
 
 
 #include "Rtypes.h"
-#include "AliHLTPHOSCommonDefs.h"
 #include "AliHLTDataTypes.h"
 
 struct AliHLTPHOSClusterDataStruct
index 4281f3161de343fa4ab6004f6f34b254c81ea1af..32f826425a0a52b0e349807a4dbe752f3cbafc7a 100644 (file)
@@ -1,6 +1,3 @@
-
-
-
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
 #include "AliHLTPHOSClusterizer.h"
 #include "AliHLTPHOSCommonDefs.h"
 #include "TVector3.h"
-#include <iostream>
 #include "TMath.h"
+#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
+#include "AliHLTPHOSRecPointListDataStruct.h"
+#include "AliHLTPHOSValidCellDataStruct.h"
+#include "AliHLTPHOSRecPointDataStruct.h"
+#include "AliHLTPHOSClusterDataStruct.h"
 
 
 ClassImp(AliHLTPHOSClusterizer);
@@ -37,23 +38,24 @@ ClassImp(AliHLTPHOSClusterizer);
 /**
 * Main constructor
 **/
-AliHLTPHOSClusterizer::AliHLTPHOSClusterizer():fStructArray(NULL), fPHOSModule(-1), fThreshold(0),
-                                              fClusterThreshold(0), fHighGainFactor(0.005), fLowGainFactor(0.08),
+AliHLTPHOSClusterizer::AliHLTPHOSClusterizer():fPHOSModule(-1), fThreshold(0), fClusterThreshold(0), 
+                                              fHighGainFactor(0.005), fLowGainFactor(0.08),
                                               fArraySize(3), fMultiplicity(fArraySize*fArraySize)
 {
+  //Main constructor
   
 }//end
 
-AliHLTPHOSClusterizer::AliHLTPHOSClusterizer(const AliHLTPHOSClusterizer &):fStructArray(NULL), fPHOSModule(-1), fThreshold(0),
-                                                                           fClusterThreshold(0), fHighGainFactor(0.005), fLowGainFactor(0.08),
+AliHLTPHOSClusterizer::AliHLTPHOSClusterizer(const AliHLTPHOSClusterizer &):fPHOSModule(-1), fThreshold(0), fClusterThreshold(0), 
+                                                                           fHighGainFactor(0.005), fLowGainFactor(0.08),
                                                                            fArraySize(3), fMultiplicity(fArraySize*fArraySize)
 {
-
+  //Copy constructor, not implemented
 }//end
 
 AliHLTPHOSClusterizer:: ~AliHLTPHOSClusterizer()  
 {
-  
+  //Destructor
 }
 
 /**
@@ -66,6 +68,7 @@ Int_t
 AliHLTPHOSClusterizer::BuildCellEnergyArray(AliHLTPHOSRcuCellEnergyDataStruct* cellData, 
                                            AliHLTPHOSRecPointListDataStruct* recPointList)
 {
+  //Build the cell energy array of the detector
 
   Int_t x = 0;
   Int_t z = 0;
@@ -138,6 +141,8 @@ AliHLTPHOSClusterizer::CreateRecPointStructArray(AliHLTPHOSRecPointDataStruct* r
                                                 Int_t nPoints) 
 
 {
+  //Create the rec point struct array
+
   Int_t flag = 0;
   Int_t edgeFlagRows = 0;
   Int_t edgeFlagCols = 0;
@@ -217,6 +222,8 @@ AliHLTPHOSClusterizer::CreateRecPointStructArray(AliHLTPHOSRecPointDataStruct* r
 Int_t
 AliHLTPHOSClusterizer::CalculateCenterOfGravity(AliHLTPHOSRecPointDataStruct* recPointPtr)
 {
+  //Calculate the center of gravity
+
   Float_t xt = 0;
   Float_t zt = 0;
   Float_t xi = 0;
@@ -262,6 +269,7 @@ AliHLTPHOSClusterizer::CalculateCenterOfGravity(AliHLTPHOSRecPointDataStruct* re
 Int_t
 AliHLTPHOSClusterizer::ClusterizeStruct(AliHLTPHOSRecPointDataStruct* recPointPtr, AliHLTPHOSClusterDataStruct* clusterStructPtr)
 {
+  //Simplify the rec points
 
   Float_t clusterEnergy = 0;
   Float_t* energiesListPtr = recPointPtr->fEnergiesListPtr;
@@ -290,6 +298,8 @@ Int_t
 AliHLTPHOSClusterizer::ResetCellEnergyArray()
 
 {
+  //Reset the cell energy array
+
   for(Int_t x = 0; x < N_ROWS_MOD; x++)
     {
       for(Int_t z = 0; z < N_COLUMNS_MOD; z++)
index 0a7e40540d0bcec35236c9b57842120d14f6e3c0..59b0697594efe7556ba8030e7fa8441ee3b461e5 100644 (file)
@@ -1,8 +1,3 @@
-
-
-#ifndef ALIHLTPHOSCLUSTERIZER
-#define ALIHLTPHOSCLUSTERIZER
-
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
     @brief  A temporary clusterizer for PHOS
 */
 
+#ifndef ALIHLTPHOSCLUSTERIZER_H
+#define ALIHLTPHOSCLUSTERIZER_H
 
 #include "AliHLTPHOSCommonDefs.h"
-#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
-#include "AliHLTPHOSClusterDataStruct.h"
-#include "AliHLTPHOSRecPointDataStruct.h"
-#include "AliHLTPHOSValidCellDataStruct.h"
-#include "AliHLTPHOSRecPointListDataStruct.h"
+
+struct AliHLTPHOSClusterDataStruct;
+struct AliHLTPHOSRecPointDataStruct;
+struct AliHLTPHOSValidCellDataStruct;
+struct AliHLTPHOSRecPointListDataStruct;
+struct AliHLTPHOSRcuCellEnergyDataStruct;
 
 class AliHLTPHOSClusterizer
 {
   
- public:
+ public: 
   
   AliHLTPHOSClusterizer();
   virtual ~AliHLTPHOSClusterizer();
@@ -43,7 +41,7 @@ class AliHLTPHOSClusterizer
   
   Float_t GetHighGainFactor() {return fHighGainFactor;}
   Float_t GetLowGainFactor() {return fLowGainFactor;}
+  
   Int_t   BuildCellEnergyArray(AliHLTPHOSRcuCellEnergyDataStruct *structPtr, AliHLTPHOSRecPointListDataStruct* recPointList);
   Int_t   CreateRecPointStructArray(AliHLTPHOSRecPointDataStruct* rectStructsPtr, AliHLTPHOSRecPointListDataStruct* list, Int_t nPoints);
   Int_t   CalculateCenterOfGravity(AliHLTPHOSRecPointDataStruct* recPointPtr);
@@ -53,13 +51,12 @@ class AliHLTPHOSClusterizer
   
  private:
 
-  AliHLTPHOSRcuCellEnergyDataStruct* fStructArray;               /**<Array containing the cell data struct*/
   AliHLTUInt8_t fPHOSModule;                                     /**<Number of the PHOSModule*/
   Float_t fEnergyArray[N_COLUMNS_MOD][N_ROWS_MOD];               /**<2D array of cell energies*/
   Float_t fThreshold;                                            /**<Energy threshold*/
   Float_t fClusterThreshold;                                     /**<Cluster threshold*/
-  Float_t fHighGainFactor;                                       
-  Float_t fLowGainFactor;
+  Float_t fHighGainFactor;                                       /**<High gain factor*/
+  Float_t fLowGainFactor;                                        /**<Low gain factor*/
   Int_t   fArraySize;                                            /**<Size of the array which the energies are summed*/
   Int_t   fMultiplicity;                                         /**<Number of crystals the energies are summed for*/
 
index 845d7fe1cae3911c2ce3f7d1cd07b85e4ed54f77..ae4a2a13967c1d568656ce3adc00f22a8748cd50 100644 (file)
@@ -1,27 +1,62 @@
+/**************************************************************************
+ * 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 "AliHLTPHOSClusterizerComponent.h"
 
+#include "AliHLTPHOSClusterizerComponent.h"
 #include "AliHLTPHOSClusterizer.h"
 #include "AliHLTPHOSPhysicsDefinitions.h"
 #include "AliHLTPHOSDefinitions.h"
-#include <iostream>
-#include "stdio.h"
-#include <cstdlib>
+#include "AliHLTPHOSRecPointDataStruct.h"
+#include "AliHLTPHOSClusterDataStruct.h"
+#include "AliHLTPHOSRecPointListDataStruct.h"
+
+using namespace std;
 
 
-const AliHLTComponentDataType AliHLTPHOSClusterizerComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
-int AliHLTPHOSClusterizerComponent::fEventCount = 0; 
+const AliHLTComponentDataType AliHLTPHOSClusterizerComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
 
 AliHLTPHOSClusterizerComponent gAliHLTPHOSClusterizerComponent;
 
 AliHLTPHOSClusterizerComponent::AliHLTPHOSClusterizerComponent():AliHLTProcessor(), fClusterizerPtr(0), fOutPtr(0), 
                                                                 fRecPointStructArrayPtr(0), fRecPointListPtr(0)
 {
+  //Constructor
 
 }
 
 AliHLTPHOSClusterizerComponent::~AliHLTPHOSClusterizerComponent()
 {
+  //Destructor
+
+  if(fClusterizerPtr)
+    {
+      delete fClusterizerPtr;
+      fClusterizerPtr = 0;
+    }
+  
+  if(fRecPointListPtr)
+    {
+      delete fRecPointListPtr;
+      fRecPointListPtr = 0;
+    }
+
+  if(fRecPointStructArrayPtr)
+    {
+      delete fRecPointStructArrayPtr;
+      fRecPointStructArrayPtr = 0;
+    }
+
 }
 
 AliHLTPHOSClusterizerComponent::AliHLTPHOSClusterizerComponent(const AliHLTPHOSClusterizerComponent &):AliHLTProcessor(), 
@@ -30,18 +65,39 @@ AliHLTPHOSClusterizerComponent::AliHLTPHOSClusterizerComponent(const AliHLTPHOSC
                                                                                                       fRecPointStructArrayPtr(0),
                                                                                                       fRecPointListPtr(0)
 {
-
+  //Copy constructor, not implemented
 }
 
 Int_t
 AliHLTPHOSClusterizerComponent::Deinit()
 {
+  //Deinitialization
+
+  if(fClusterizerPtr)
+    {
+      delete fClusterizerPtr;
+      fClusterizerPtr = 0;
+    }
+  
+  if(fRecPointListPtr)
+    {
+      delete fRecPointListPtr;
+      fRecPointListPtr = 0;
+    }
+
+  if(fRecPointStructArrayPtr)
+    {
+      delete fRecPointStructArrayPtr;
+      fRecPointStructArrayPtr = 0;
+    }
+
   return 0;
 }
 
 Int_t
 AliHLTPHOSClusterizerComponent::DoDeinit()
 {
+  //Do deinitialization
   Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSClusterizerComponent DoDeinit");
 
   return 0;
@@ -57,7 +113,8 @@ AliHLTPHOSClusterizerComponent::GetComponentID()
 void
 AliHLTPHOSClusterizerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
 {
-  const AliHLTComponentDataType* pType=inputDataTypes;
+  //Get datatypes for input
+  const AliHLTComponentDataType* pType=fgkInputDataTypes;
   while (pType->fID!=0) {
     list.push_back(*pType);
     pType++;
@@ -80,9 +137,10 @@ AliHLTPHOSClusterizerComponent::GetOutputDataSize(unsigned long& constBase, doub
 
 Int_t 
 AliHLTPHOSClusterizerComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
-                                       AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
+                                       AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
                                        std::vector<AliHLTComponentBlockData>& outputBlocks)
 {
+  //Do event
    
   UInt_t tSize            = 0;
   UInt_t offset           = 0; 
@@ -142,8 +200,6 @@ AliHLTPHOSClusterizerComponent::DoEvent(const AliHLTComponentEventData& evtData,
        }
     }
 
-  fEventCount++; 
-  if(fEventCount%100==0) cout << "Analyzing event: " << fEventCount << endl;
   size = tSize;
   fClusterizerPtr->ResetCellEnergyArray();
 
@@ -154,6 +210,7 @@ AliHLTPHOSClusterizerComponent::DoEvent(const AliHLTComponentEventData& evtData,
 Int_t
 AliHLTPHOSClusterizerComponent::DoInit(Int_t argc, const Char_t** argv )
 {
+  //Do initialization
   
   fClusterizerPtr = new AliHLTPHOSClusterizer();
   fClusterizerPtr->SetThreshold(atof(argv[0]));
@@ -175,5 +232,6 @@ AliHLTPHOSClusterizerComponent::DoInit(Int_t argc, const Char_t** argv )
 AliHLTComponent*
 AliHLTPHOSClusterizerComponent::Spawn()
 {
+  //Spawn a new AliHLTPHOSClusterizerComponent, for HLT framework
   return new AliHLTPHOSClusterizerComponent();
 }
index 6736bd35849ae83d72a1fb01da5dd49a0e14fe4e..9c1b798799616876973b0b699348fb4f63c96100 100644 (file)
@@ -1,13 +1,25 @@
-#ifndef ALIHLTPHOSCLUSTERIZERCOMPONENT
-#define ALIHLTPHOSCLUSTERIZERCOMPONENT
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTPHOSClusterizer.h
+    @author Øystein Djuvsland
+    @date   
+    @brief  A clusterizer component for PHOS HLT
+*/
+
+
+#ifndef ALIHLTPHOSCLUSTERIZERCOMPONENT_H
+#define ALIHLTPHOSCLUSTERIZERCOMPONENT_H
 
 #include "AliHLTProcessor.h"
 
-#include "AliHLTPHOSClusterizer.h"
-#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
-#include "AliHLTPHOSClusterDataStruct.h"
-#include "AliHLTPHOSRecPointDataStruct.h"
-#include "Rtypes.h"
+
+class AliHLTPHOSClusterizer;
+class Rtypes;
+struct AliHLTPHOSRcuCellEnergyDataStruct;
+struct AliHLTPHOSClusterDataStruct;
+struct AliHLTPHOSRecPointDataStruct;
+struct AliHLTPHOSRecPointListDataStruct;
 
 
 class AliHLTPHOSClusterizerComponent: public AliHLTProcessor
@@ -41,12 +53,11 @@ class AliHLTPHOSClusterizerComponent: public AliHLTProcessor
   Int_t DoDeinit();
 
  private:
-  AliHLTPHOSClusterizer* fClusterizerPtr;
-  AliHLTPHOSClusterDataStruct* fOutPtr;
-  AliHLTPHOSRecPointDataStruct* fRecPointStructArrayPtr;
-  AliHLTPHOSRecPointListDataStruct* fRecPointListPtr;
-  static const AliHLTComponentDataType inputDataTypes[];
-  static int fEventCount;
+  AliHLTPHOSClusterizer* fClusterizerPtr;                       //Pointer to the clusterizer
+  AliHLTPHOSClusterDataStruct* fOutPtr;                         //Pointer to the struct of output clusters
+  AliHLTPHOSRecPointDataStruct* fRecPointStructArrayPtr;        //Pointer to the struct of output recpoints
+  AliHLTPHOSRecPointListDataStruct* fRecPointListPtr;           //Pointer to the struct of list of output recpoints
+  static const AliHLTComponentDataType fgkInputDataTypes[];     //HLT input data type
 
 };
 
index 88eb37a95f1dfe7b975bf0939da6e9ee36868089..8ba116756a5e67b586f23c25d60dd701760f4377 100644 (file)
 #include "TVector3.h"
 #include "TFile.h"
 #include "TMath.h"
-#include <cmath>
+#include "TH1F.h"
 #include "AliPHOSGeometry.h"
-#include <iostream>
+#include "Rtypes.h"
+#include "AliHLTPHOSCommonDefs.h"
+#include "AliHLTPHOSClusterDataStruct.h"
 
 ClassImp(AliHLTPHOSPhysicsAnalyzer);
 
@@ -28,6 +31,7 @@ AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():fClustersPtr(NULL)
                                                    
                                                       
 {
+  //Constructor
 
   AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
 
@@ -44,6 +48,8 @@ AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer():fClustersPtr(NULL)
 AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnalyzer &):fClustersPtr(NULL)
 
 {
+  //Cooy constructor
+
   AliPHOSGeometry *geom=AliPHOSGeometry::GetInstance("noCPV");
 
   fPHOSRadius = geom->GetIPtoCrystalSurface();
@@ -54,18 +60,22 @@ AliHLTPHOSPhysicsAnalyzer::AliHLTPHOSPhysicsAnalyzer(const AliHLTPHOSPhysicsAnal
       
       fRotParametersSin[i] = sin((geom->GetPHOSAngle(i+1))*2*TMath::Pi()/360);
     }
-  cout << "Copy constructor not tested!\n";
+
 }
 
 
 AliHLTPHOSPhysicsAnalyzer::~AliHLTPHOSPhysicsAnalyzer()
 {
+  //Destructor
 
+  fClustersPtr = 0;
+  fRootHistPtr = 0;
 }
 
 void
 AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* locPositionPtr)
 {
+  //Get local position for a cluster
 
   locPositionPtr[0] = clusterPtr->fLocalPositionPtr[0];
   locPositionPtr[1] = clusterPtr->fLocalPositionPtr[1];
@@ -75,41 +85,48 @@ AliHLTPHOSPhysicsAnalyzer::LocalPosition(AliHLTPHOSClusterDataStruct* clusterPtr
 void
 AliHLTPHOSPhysicsAnalyzer::GlobalPosition(AliHLTPHOSClusterDataStruct* clusterPtr, Float_t* positionPtr)
 {
+  //Get global position for a cluster
   
   Float_t tempPosX = 0;
 
   Int_t module = clusterPtr->fPHOSModule;
 
-  tempPosX = CRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[0]-N_COLUMNS_MOD/2) + CRYSTAL_SIZE/2;
+  tempPosX = kCRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[0]-N_COLUMNS_MOD/2) + kCRYSTAL_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;
+  positionPtr[2] = kCRYSTAL_SIZE*(clusterPtr->fLocalPositionPtr[1]-N_ROWS_MOD/2) + kCRYSTAL_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];
+  //Get global position from local postion and module number
 
-  positionPtr[1] = CRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersSin[module-1] - fPHOSRadius*fRotParametersCos[module-1];
+  positionPtr[0] = kCRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersCos[module-1] + fPHOSRadius*fRotParametersSin[module-1];
+
+  positionPtr[1] = kCRYSTAL_SIZE*(locPositionPtr[0]-N_COLUMNS_MOD/2)*fRotParametersSin[module-1] - fPHOSRadius*fRotParametersCos[module-1];
   
-  positionPtr[2] = CRYSTAL_SIZE*(locPositionPtr[1]-N_ROWS_MOD);
+  positionPtr[2] = kCRYSTAL_SIZE*(locPositionPtr[1]-N_ROWS_MOD);
 
 }
 
 void
 AliHLTPHOSPhysicsAnalyzer::WriteHistogram(Char_t* fileName)
 {
+  //Write the histogram
+
   TFile *outfile = new TFile(fileName,"recreate");  
   
   fRootHistPtr->Write();
   
   outfile->Close();
+  
+  delete outfile;
+  outfile = 0;
 
 }
 
index 9ec54d02e5dde35f4a9ce20c2449c2eadda345d4..a1ffd6c945217b06887943ac37119c4325502a67 100644 (file)
@@ -5,16 +5,18 @@
 /* Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                          */
 
+//Intended to be a base class for analysis
 
-#include <TObjArray.h>
-#include <TH1F.h>
-#include "TH2F.h"
-#include "AliHLTPHOSClusterDataStruct.h"
+#include "Rtypes.h"
 
-const Float_t CRYSTAL_SIZE = 2.25;
+class TObjArray;
+class TH1F;
+class AliHLTPHOSClusterDataStruct;
+
+const Float_t kCRYSTAL_SIZE = 2.25;
 
 class AliHLTPHOSPhysicsAnalyzer
-{
+{ 
  public:
   AliHLTPHOSPhysicsAnalyzer();
   virtual ~AliHLTPHOSPhysicsAnalyzer();
@@ -33,13 +35,13 @@ class AliHLTPHOSPhysicsAnalyzer
 
  protected:
   
-  TObjArray* fClustersPtr;
-  TH1F* fRootHistPtr;
+  TObjArray* fClustersPtr;                         //! /**<Pointer to the clusters to be analyzed*/
+  TH1F* fRootHistPtr;                              //! /**<Pointer to the histograms which is to be filled*/
 
  private:
-  Float_t fRotParametersCos[5];
-  Float_t fRotParametersSin[5];
-  Float_t fPHOSRadius;
+  Float_t fRotParametersCos[5];                        /**<Parameters for calculating global position*/
+  Float_t fRotParametersSin[5];                        /**<Parameters for calculating global position*/
+  Float_t fPHOSRadius;                                 /**<Distance from the IP to the crystals*/
 
   ClassDef(AliHLTPHOSPhysicsAnalyzer,1);
 };
index 693a4ee5b0d13abe79d811b089f1923389918b29..935cd9b05b669e29d6041fd4ce2238b36330cad6 100644 (file)
@@ -1,8 +1,7 @@
-
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
- * Authors: Ã\83ystein Djuvsland <oysteind@ift.uib.no>                       *
+ * Authors: Ã\98ystein 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   *
 #include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
 #include "AliHLTPHOSClusterDataStruct.h"
 #include <cmath>
-#include <iostream>
+#include "math.h"
+#include "TH1F.h"
+
 
 ClassImp(AliHLTPHOSPhysicsAnalyzerSpectrum);
 
+
+
 AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum():AliHLTPHOSPhysicsAnalyzer()
 {
+  //Constructor
 
   fEnergyPtr = new Float_t[2];
   fPos0Ptr = new Float_t[3];
@@ -35,13 +39,12 @@ AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum():AliHLTPHO
 
 AliHLTPHOSPhysicsAnalyzerSpectrum::AliHLTPHOSPhysicsAnalyzerSpectrum(const AliHLTPHOSPhysicsAnalyzerSpectrum &):AliHLTPHOSPhysicsAnalyzer()
 {
-
-  cout << "AliHLTPHOSPhysicsAnalyzerSpectrum: Copy constructor not implemented yet!" << endl;
-
+  //Copy constructor not implemented
 }
 
 AliHLTPHOSPhysicsAnalyzerSpectrum::~AliHLTPHOSPhysicsAnalyzerSpectrum()
 {
+  //Destructor
 
   if(fClustersPtr) fClustersPtr = 0;
 
@@ -73,11 +76,10 @@ AliHLTPHOSPhysicsAnalyzerSpectrum::~AliHLTPHOSPhysicsAnalyzerSpectrum()
 void
 AliHLTPHOSPhysicsAnalyzerSpectrum::Analyze(AliHLTPHOSClusterDataStruct* clustersPtr[10000], Int_t nClusters)
 {
+  //Analyzing a set of clusters
 
   Float_t cosOpeningAngle = 0;
 
-  cout << "number of clusters: " << nClusters << endl;
-
   if(nClusters > 1)
     {
       for(Int_t i = 0; i < nClusters-1; i++)
@@ -122,27 +124,19 @@ AliHLTPHOSPhysicsAnalyzerSpectrum::Analyze(AliHLTPHOSClusterDataStruct* clusters
 Float_t 
 AliHLTPHOSPhysicsAnalyzerSpectrum::EvalDistance()
 {
-  
-  return sqrt(pow(fPos1Ptr[0]-fPos0Ptr[0],2) + pow(fPos1Ptr[1]-fPos0Ptr[1],2) + pow(fPos1Ptr[2]-fPos0Ptr[2],2));
+  //Evaluate the distance between the two clusters
 
-}
+  if(fPos0Ptr && fPos1Ptr)
+    return sqrt(pow(fPos1Ptr[0]-fPos0Ptr[0],2) + pow(fPos1Ptr[1]-fPos0Ptr[1],2) + pow(fPos1Ptr[2]-fPos0Ptr[2],2));
+  return -1;
 
-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)
 {
-  
+  //Setting the cut thresholds
+
   if(!fThresholdPtr) fThresholdPtr = new Float_t[2];
 
   fThresholdPtr[0] = photonEnergy0;
index 314a8f6a72aeb4f352e627b9942c0d48cefff5c9..537ef70c71370e85eb7a4ea60635c0753ca47211 100644 (file)
@@ -1,16 +1,14 @@
-#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H
-#define ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H
-
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
 
+#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H
+#define ALIHLTPHOSPHYSICSANALYZERSPECTRUM_H
 
 #include "AliHLTPHOSPhysicsAnalyzer.h"
+#include "Rtypes.h"
 
 
-const Int_t USE_DISTANCE_CUT = 0;
-
 class AliHLTPHOSPhysicsAnalyzerSpectrum : public AliHLTPHOSPhysicsAnalyzer
 {
  public:
@@ -25,20 +23,18 @@ class AliHLTPHOSPhysicsAnalyzerSpectrum : public AliHLTPHOSPhysicsAnalyzer
 
   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;
+  Float_t* fPos0Ptr;                        //! /**<Position of the first cluster*/
+  Float_t* fPos1Ptr;                        //! /**</Position of the second cluster*/
+  Float_t* fThresholdPtr;                   //! /**<Cut thresholds*/
+  Float_t* fEnergyPtr;                      //! /**<Energy of the clusters*/
 
   ClassDef(AliHLTPHOSPhysicsAnalyzerSpectrum, 1);
   
 };
 
-
 #endif
index 1344e278ab25e213c292a64efc0a528509101721..2923edcda4995e9e57918b15f04cf8250fabca02 100644 (file)
@@ -1,4 +1,3 @@
-
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * 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>
+#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
+#include "AliHLTPHOSPhysicsAnalyzerSpectrumComponent.h"
+#include "Rtypes.h"
+
+class AliHLTPHOSDefinitions;
 
-const AliHLTComponentDataType AliHLTPHOSPhysicsAnalyzerSpectrumComponent::inputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
-int AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fEventCount = 0; 
+const AliHLTComponentDataType AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}};
+UInt_t AliHLTPHOSPhysicsAnalyzerSpectrumComponent::fgCount = 0; 
 
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent gAliHLTPHOSPhysicsAnalyzerSpectrumComponent;
 
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent():AliHLTProcessor(), fAnalyzerPtr(0), 
                                                                                               fRootHistPtr(0)
 {
+  //Constructor
 }
 
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::~AliHLTPHOSPhysicsAnalyzerSpectrumComponent()
 {
+  //Destructor
+  if(fPeakFitter)
+    {
+      delete fPeakFitter;
+      fPeakFitter = 0;
+    }
+
+  if(fAnalyzerPtr)
+    {
+      delete fAnalyzerPtr;
+      fAnalyzerPtr = 0;
+    }
+  
+  if(fRootHistPtr)
+    {
+      delete fRootHistPtr;
+      fRootHistPtr = 0;
+    }
+      
 }
 
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::AliHLTPHOSPhysicsAnalyzerSpectrumComponent(const AliHLTPHOSPhysicsAnalyzerSpectrumComponent &):AliHLTProcessor(),
                                                                                                                                                    fAnalyzerPtr(0),
                                                                                                                                                    fRootHistPtr(0)
 {
-  
-  cout << "AliHLTPHOSPhysicsAnalyzerSpectrumComponent: Copy constructor not implemented yet!" << endl;
-  
+  //Copy constructor not implemented 
 }
 
 Int_t
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Deinit()
 {
+  //Deinitialize the component
+  if(fPeakFitter)
+    {
+      fPeakFitter->SetHistogram(fRootHistPtr);
+      fPeakFitter->FitLorentzian();
+      delete fPeakFitter;
+      fPeakFitter = 0;
+    }
 
-  fPeakFitter->SetHistogram(fRootHistPtr);
-  cout << "Fitting..." << endl;
-  //pf->FitGaussian();
-  fPeakFitter->FitLorentzian();
-
+  if(fAnalyzerPtr)
+    {
+      delete fAnalyzerPtr;
+      fAnalyzerPtr = 0;
+    }
+  
+  if(fRootHistPtr)
+    {
+      delete fRootHistPtr;
+      fRootHistPtr = 0;
+    }
+      
   return 0;
 }
 
 Int_t
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoDeinit()
 {
+  //Deinitialize the component
   Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSPhysicsAnalyzerSpectrumComponent DoDeinit");
 
   return 0;
@@ -79,7 +108,8 @@ AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetComponentID()
 void
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
 {
-  const AliHLTComponentDataType* pType=inputDataTypes;
+  //Get the input data types
+  const AliHLTComponentDataType* pType=fgkInputDataTypes;
   while (pType->fID!=0) {
     list.push_back(*pType);
     pType++;
@@ -96,6 +126,7 @@ void
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
   
 {
+  //Get the data size of the output
   constBase = 30;
   inputMultiplier = 1;
 }
@@ -103,10 +134,10 @@ AliHLTPHOSPhysicsAnalyzerSpectrumComponent::GetOutputDataSize(unsigned long& con
 
 Int_t 
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
-                                       AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size,
-                                       std::vector<AliHLTComponentBlockData>& outputBlocks)
+                                                   AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/,
+                                                   std::vector<AliHLTComponentBlockData>& /*outputBlocks*/)
 {
-
+  //Do event
   const AliHLTComponentBlockData* iter = NULL; 
   unsigned long ndx; 
   
@@ -126,12 +157,12 @@ AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoEvent(const AliHLTComponentEventDa
   
   fAnalyzerPtr->Analyze(fClusterArrayPtr, ndx);
 
-  if(fEventCount%fWriteInterval == 0 && fEventCount != 0)
+  if(fgCount%fWriteInterval == 0 && fgCount != 0)
     {
       PushBack(fRootHistPtr, kAliHLTAnyDataType, (AliHLTUInt32_t)0);
     }
 
-  fEventCount++; 
+  fgCount++; 
   
   return 0;
   
@@ -140,7 +171,7 @@ AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoEvent(const AliHLTComponentEventDa
 Int_t
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoInit(Int_t argc, const Char_t** argv )
 {
-
+  //Initialize the component
   Float_t firstThreshold = atof(argv[0]);
   Float_t secondThreshold = atof(argv[1]);
   fWriteInterval = atoi(argv[2]);
@@ -164,5 +195,6 @@ AliHLTPHOSPhysicsAnalyzerSpectrumComponent::DoInit(Int_t argc, const Char_t** ar
 AliHLTComponent*
 AliHLTPHOSPhysicsAnalyzerSpectrumComponent::Spawn()
 {
+  //Spawn a new AliHLTPHOSPhysicsAnalyzerSpectrumComponent, for the HLT framework
   return new AliHLTPHOSPhysicsAnalyzerSpectrumComponent();
 }
index f64c8b0b74320685d7115b61bb452c47f909c6f4..15491441853cc8b74bfbe4fcc20e8864a5f7fc09 100644 (file)
@@ -1,18 +1,21 @@
-
-#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT
-#define ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT
-
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
+ * See cxx source for full Copyright notice                              */
+//Component for create an invariant mass spectrum for pi0's
 
+#ifndef ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT_H
+#define ALIHLTPHOSPHYSICSANALYZERSPECTRUMCOMPONENT_H
 
 #include "AliHLTProcessor.h"
-#include "AliHLTPHOSPhysicsAnalyzerPeakFitter.h"
-#include "AliHLTPHOSPhysicsAnalyzerSpectrum.h"
-#include "AliHLTPHOSClusterDataStruct.h"
-#include "TH1F.h"
-#include "TH2F.h"
-#include "Rtypes.h"
+
+class TH1F;
+class AliHLTPHOSPhysicsAnalyzerSpectrum;
+class AliHLTPHOSPhysicsAnalyzerPeakFitter;
+class Rtypes;
+class AliHLTPHOSDefinitions;
+class AliHLTPHOSPhysicsDefinitions;
+class TFile;
+
+struct AliHLTPHOSClusterDataStruct;
 
 
 class AliHLTPHOSPhysicsAnalyzerSpectrumComponent: public AliHLTProcessor
@@ -49,15 +52,14 @@ class AliHLTPHOSPhysicsAnalyzerSpectrumComponent: public AliHLTProcessor
   
  private:
   
-  AliHLTPHOSPhysicsAnalyzerSpectrum* fAnalyzerPtr;
-  AliHLTPHOSPhysicsAnalyzerPeakFitter* fPeakFitter;
-  TH1F* fRootHistPtr;
-  AliHLTPHOSClusterDataStruct* fClusterArrayPtr[10000];
-  Int_t fWriteInterval;
-
-  static const AliHLTComponentDataType inputDataTypes[];
-  static int fEventCount;
-
+  AliHLTPHOSPhysicsAnalyzerSpectrum* fAnalyzerPtr;                //! /**<Pointer to spectrum analyzer*
+  AliHLTPHOSPhysicsAnalyzerPeakFitter* fPeakFitter;               //! /**<Pointer to peak fitter*/
+  TH1F* fRootHistPtr;                                             //! /**<Pointer to histogram*/
+  AliHLTPHOSClusterDataStruct* fClusterArrayPtr[10000];           //! /**<Pointer to array of clusters*/
+  Int_t fWriteInterval;                                               /**<Interval for writing to disk*/
+
+  static const AliHLTComponentDataType fgkInputDataTypes[];           /**<Data types*/                          
+  static UInt_t fgCount;                                              /**<Event count*/
 };
 
 #endif
index 7d575718cb61b43828e88cccba72d65b92eddf2f..7bddeb02b289174631e5b8ffbe7fed9182d5ac35 100644 (file)
@@ -9,15 +9,13 @@
 
 #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;
+      static const AliHLTComponentDataType fgkAliHLTClusterDataType;  //Cluster data type
+      static const AliHLTComponentDataType fgkAliHLTHistDataType;     //hist data type
+      static const AliHLTComponentDataType fgkAliHLTSpectrumDataType; //spectrum data type
     };
 
 #endif
index 655f36f63ef8e919ad7d07b58fc926d7b660890a..d6ea6587c4ee774f4d515c5610ed2522f4f09ccd 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ALIHLTPHOSRECPOINTDATASTRUCT
-#define ALIHLTPHOSRECPOINTDATASTRUCT
+#ifndef ALIHLTPHOSRECPOINTDATASTRUCT_H
+#define ALIHLTPHOSRECPOINTDATASTRUCT_H
 
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
index d20f9426278e1778d25973e734519961a833e1d5..2a7c0b32eb11004f4a8cba3fe60f217f1c8156ea 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef ALIHLTPHOSRECPOINTLISTDATASTRUCT
-#define ALIHLTPHOSRECPOINTLISTDATASTRUCT
+#ifndef ALIHLTPHOSRECPOINTLISTDATASTRUCT_H
+#define ALIHLTPHOSRECPOINTLISTDATASTRUCT_H
 
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *