]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- improvements in the clusterisation process
authorodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Feb 2010 01:13:37 +0000 (01:13 +0000)
committerodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 12 Feb 2010 01:13:37 +0000 (01:13 +0000)
- still missing the cells in the final ESD cluster

HLT/CALO/AliHLTCaloClusterAnalyser.cxx
HLT/CALO/AliHLTCaloClusterAnalyser.h
HLT/CALO/AliHLTCaloClusterizerComponent.cxx
HLT/CALO/AliHLTCaloClusterizerComponent.h
HLT/CALO/AliHLTCaloGeometry.h
HLT/PHOS/AliHLTPHOSGeometry.h

index 9d5efb73eb9eaef4ec2848235a30e19a2497062d..7467f23e3639c47c1bd890c73f2e574e6ea170a7 100644 (file)
@@ -37,6 +37,8 @@
 #include "AliESDCaloCluster.h"
 #include "TMath.h"
 #include "TVector3.h"
+#include "TH1F.h"
+#include "TFile.h"
 #include "AliHLTCaloClusterizer.h"
 
 ClassImp(AliHLTCaloClusterAnalyser);
@@ -54,13 +56,19 @@ AliHLTCaloClusterAnalyser::AliHLTCaloClusterAnalyser() :
   fHaveCPVInfo(false),
   fDoPID(false),
   fHaveDistanceToBadChannel(false),
-  fGeometry(0)
+  fGeometry(0),
+  fClusterType(AliESDCaloCluster::kPHOSCluster)
 {
   //See header file for documentation
+  fHist = new TH1F("cluster_energies", "cluster_energies", 200, 0, 20);
+  
 }
 
 AliHLTCaloClusterAnalyser::~AliHLTCaloClusterAnalyser() 
 {
+   TFile *file = TFile::Open("debug.root", "RECREATE");
+   fHist->Write();
+   file->Close();
 }
 
 void 
@@ -173,11 +181,7 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
 {
   //See header file for documentation
 
-   if((totSize - availableSize)  < sizeof(AliHLTCaloClusterDataStruct))
-   {
-      HLTError("Out of buffer");
-      return -ENOBUFS;
-   }
+   
   totSize += sizeof(AliHLTCaloClusterDataStruct);
   fNRecPoints = nRecPoints;
 
@@ -191,16 +195,26 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
   //  AliHLTCaloDigitDataStruct* digitPtr = &(recPointPtr->fDigits);  
   AliHLTCaloDigitDataStruct* digitPtr = 0;
 
-  AliHLTCaloClusterDataStruct* caloClusterPtr = fCaloClusterDataPtr;
-  UShort_t* cellIDPtr = &(caloClusterPtr->fCellsAbsId);
-  Float_t* cellAmpFracPtr = &(caloClusterPtr->fCellsAmpFraction);
+  AliHLTCaloClusterDataStruct* caloClusterPtr = 0;
+  UShort_t* cellIDPtr = 0;
+  Float_t* cellAmpFracPtr = 0;;
   
   Int_t id = -1;
   TVector3 globalPos;
 
   for(Int_t i = 0; i < fNRecPoints; i++) //TODO needs fix when we start unfolding (number of clusters not necessarily same as number of recpoints gotten from the clusterizer
     {
-//      if(availableSize
+      if((availableSize - totSize)  < sizeof(AliHLTCaloClusterDataStruct))
+      {
+        HLTError("Out of buffer");
+        return -ENOBUFS;
+      }
+      
+      caloClusterPtr = fCaloClusterDataPtr;
+     
+      cellIDPtr = &(caloClusterPtr->fCellsAbsId);
+      cellAmpFracPtr = &(caloClusterPtr->fCellsAmpFraction);
+     
       AliHLTCaloRecPointDataStruct *recPointPtr = fRecPointArray[i];
       cout << "CA: rec point energy: " << recPointPtr->fAmp << ", rec point multiplicity: " << recPointPtr->fMultiplicity << endl;
       //      cout << "Local Position (x:z:module): " << recPointPtr->fX << " : "<< recPointPtr->fZ << " : " << recPointPtr->fModule << endl;
@@ -213,24 +227,36 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
       caloClusterPtr->fGlobalPos[1] = globalCoord.fY;
       caloClusterPtr->fGlobalPos[2] = globalCoord.fZ;
 
-      caloClusterPtr->fNCells = recPointPtr->fMultiplicity;
-  
-      cellIDPtr = &(caloClusterPtr->fCellsAbsId);
-      cellAmpFracPtr = &(caloClusterPtr->fCellsAmpFraction);
-     
+      caloClusterPtr->fNCells = 0;//recPointPtr->fMultiplicity;
+      
+      Int_t tmpSize = totSize + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));
+      
+      if((availableSize - totSize)  < tmpSize)
+      {
+        HLTError("Out of buffer");
+        return -ENOBUFS;
+      }
+      
       for(UInt_t j = 0; j < caloClusterPtr->fNCells; j++)
        {
-        // fPHOSGeometry->RelPosToAbsId((Int_t)(recPointPtr->fModule), (double)(digitPtr->fX), (double)(digitPtr->fZ), id);
-/*       *cellIDPtr = id;
+/*       fGeometry->GetCellAbsId(recPointPtr->fModule, digitPtr->fX, digitPtr->fZ, id);
+         *cellIDPtr = id;
          *cellAmpFracPtr = digitPtr->fEnergy/recPointPtr->fAmp;
          digitPtr++;
          cellIDPtr = reinterpret_cast<UShort_t*>(reinterpret_cast<char*>(cellAmpFracPtr) + sizeof(Float_t)); 
          cellAmpFracPtr = reinterpret_cast<Float_t*>(reinterpret_cast<char*>(cellIDPtr) + sizeof(Short_t)); */
        }
 
+      totSize += tmpSize;
+
       caloClusterPtr->fEnergy = recPointPtr->fAmp;
+
+      fHist->Fill(caloClusterPtr->fEnergy);
+
       cout << "CA: cluster energy: " << caloClusterPtr->fEnergy << endl;
       cout << "CA: recpoint energy: " << recPointPtr->fAmp << endl;
+      
+      
       if(fDoClusterFit)
        {
          FitCluster(recPointPtr);
@@ -271,16 +297,15 @@ AliHLTCaloClusterAnalyser::CreateClusters(Int_t nRecPoints, UInt_t availableSize
          caloClusterPtr->fDistanceToBadChannel = -1;
        }
 
-      caloClusterPtr->fClusterType = (AliESDCaloCluster::kPHOSCluster);
+      caloClusterPtr->fClusterType = fClusterType;
       //      totSize += sizeof(AliHLTCaloClusterDataStruct) + (caloClusterPtr->fNCells)*(sizeof(Short_t) +sizeof(Float_t)-1);   
-      totSize += sizeof(AliHLTCaloClusterDataStruct) + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));   
+      //totSize += sizeof(AliHLTCaloClusterDataStruct) + (caloClusterPtr->fNCells-1)*(sizeof(Short_t) + sizeof(Float_t));   
 
-     
       //      caloClusterPtr = reinterpret_cast<AliHLTCaloClusterDataStruct*>(cellAmpFracPtr);
       caloClusterPtr = reinterpret_cast<AliHLTCaloClusterDataStruct*>(cellIDPtr);
 
       recPointPtr = reinterpret_cast<AliHLTCaloRecPointDataStruct*>(digitPtr);
-      ///digitPtr = &(recPointPtr->fDigits);  
+      //digitPtr = &(recPointPtr->fDigits);  
     }
   //  cout << "CA: Energy End: " << fCaloClusterDataPtr->fEnergy << endl;
   //cout << "CA totSize: " << totSize << endl;
index 82d34027d76233539716165be4e26f8a343196d4..4f78b5958af00fc3bb3da0a164aac4712d66c838 100644 (file)
@@ -46,6 +46,9 @@ class AliHLTCaloClusterHeaderStruct;
 class AliHLTCaloClusterDataStruct;
 class AliHLTCaloGeometry;
 
+class TH1F; //DEBUG
+
+
 /** 
  * @class AliHLTCaloClusterAnalyser
  * ClusterAnalyser for CALO HLT. Algorithms for center of gravity
@@ -165,8 +168,11 @@ public:
   */
   void SetDigitDataArray(AliHLTCaloDigitDataStruct *digits);
 
+  /**
+  * Set the cluster type 
+  */
+  void SetClusterType(Char_t clusterType) { fClusterType = clusterType; }
   
-  void DoNothing() { printf("Do nothing\n");}
 private:
   
   /** Used for calculation of center of gravity */
@@ -200,8 +206,13 @@ private:
   Bool_t fHaveDistanceToBadChannel;                         //COMMENT
   
   /** The geometry object */
-  AliHLTCaloGeometry* fGeometry;                                   //COMMENT
-  
+  AliHLTCaloGeometry* fGeometry;                                   //! transient
+
+  /** The cluster type */
+  Char_t fClusterType;                   //COMMENT
+
+   TH1F *fHist;
+
 };
 
 #endif
index af6a9c5829b7e4968f4fd575ed6f80d5dfdda5bd..2dfbca29ca14265ef416150a466a142bd1ff448a 100644 (file)
@@ -60,7 +60,7 @@ AliHLTCaloClusterizerComponent::AliHLTCaloClusterizerComponent(TString det):
 AliHLTCaloClusterizerComponent::~AliHLTCaloClusterizerComponent()
 {
   //See headerfile for documentation
-
+delete fAnalyserPtr;
   if(fClusterizerPtr)
     {
       delete fClusterizerPtr;
@@ -74,7 +74,7 @@ AliHLTCaloClusterizerComponent::Deinit()
 {
   //See headerfile for documentation
 
-  if (fClusterizerPtr)
+if (fClusterizerPtr)
     {
       delete fClusterizerPtr;
       fClusterizerPtr = 0;
@@ -221,6 +221,8 @@ AliHLTCaloClusterizerComponent::DoEvent(const AliHLTComponentEventData& evtData,
       
       //  HLTError("Number of clusters: %d", nRecPoints);
 
+      
+      
       AliHLTComponentBlockData bd;
       FillBlockData( bd );
       bd.fOffset = offset;
index aa370a54a4423bd879d173f9958712dc2aeaf5be..9d9c323afb73228148af57718d1e9661566444e9 100644 (file)
 #include "AliHLTCaloConstantsHandler.h"
 #include "AliHLTCaloProcessor.h"
 
-
 class AliHLTCaloDigitDataStruct;
 class AliHLTCaloDigitContainerDataStruct;
 class AliHLTCaloClusterizer;
 class AliHLTCaloClusterAnalyser;
 class AliHLTCaloRecPointDataStruct;
+class AliHLTPHOSHistoProdClusterEnergy;
 
 /**
  * @class AliHLTCaloClusterizerComponent
@@ -182,6 +182,7 @@ class AliHLTCaloClusterizerComponent : public AliHLTCaloProcessor, public AliHLT
     
     /** Assignment */
     AliHLTCaloClusterizerComponent & operator = ( const AliHLTCaloClusterizerComponent &); // not implemented
+    
   };
 
 #endif
index 7ed9b224a63455fddf3eccded92a7700f6bc58a3..ec10df697e8e3f4ab9800a6eebc822bab6ccc4df 100644 (file)
@@ -21,9 +21,21 @@ class AliHLTCaloGeometry : public AliHLTCaloConstantsHandler
 
  public:
   AliHLTCaloGeometry (TString det);
+  
   virtual ~AliHLTCaloGeometry();
+  
   virtual void GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord ) = 0;
   
+  /**
+  * Get the absolute ID from the relative position in the module
+  * pure virtual - must be imlemented by child classes
+  * @param module is the module id
+  * @param x is the x position in the module
+  * @param z is the z position in the module
+  * @param AbsId is a the absolute id variable
+  */
+  virtual void GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId) const = 0;
+  
   private:
      
     
index c03c2dd288e2cd22710eb409b683185396c205cc..a8d81c434f72b58c18511f7f2b3ac2f0e8d2d0e8 100644 (file)
@@ -31,7 +31,13 @@ class AliHLTPHOSGeometry : public AliHLTCaloGeometry
       
       /** Get the ALICE global coordinates for a rec point */
       virtual void GetGlobalCoordinates ( AliHLTCaloRecPointDataStruct& recPoint,  AliHLTCaloGlobalCoordinate& globalCoord ); //COMMENT
-    
+
+      /** See base class for class documentation */
+      virtual void GetCellAbsId(UInt_t module, UInt_t x, UInt_t z, Int_t& AbsId) const { AbsId = 0; }
+      
+      
+
+      
   };
 
 #endif // ALIHLTPHOSGEOMETRY_H