]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSCpvRecPoint.cxx
Moving from base to calib, and adding packing interface (a packed value is simply...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSCpvRecPoint.cxx
index b3ee63a8601f405eb11db5a41118d248b9c1961d..cb8593f9173743f41ab00d1dd3197af77d1f35f0 100644 (file)
 
 /* $Id$ */
 
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.24  2006/08/28 10:01:56  kharlov
+ * Effective C++ warnings fixed (Timur Pocheptsov)
+ *
+ * Revision 1.23  2005/12/20 14:28:47  hristov
+ * Additional protection
+ *
+ * Revision 1.22  2005/05/28 14:19:04  schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
 //_________________________________________________________________________
 //  RecPoint implementation for PHOS-CPV
 //  An CpvRecPoint is a cluster of digits   
 //  30 October 2000 
 
 // --- ROOT system ---
-#include "TPad.h"
-#include "TH2.h"
+
 #include "TMath.h" 
-#include "TCanvas.h" 
 #include "TClonesArray.h" 
-#include "AliPHOSGetter.h" 
 
 // --- Standard library ---
 
-#include <iostream.h> 
-
 // --- AliRoot header files ---
-
+#include "AliLog.h"
+#include "AliPHOSGeometry.h" 
+#include "AliPHOSDigit.h"
 #include "AliPHOSCpvRecPoint.h"
-#include "AliPHOSPpsdRecPoint.h"
+#include "AliPHOSLoader.h"
 
 ClassImp(AliPHOSCpvRecPoint)
 
 //____________________________________________________________________________
-AliPHOSCpvRecPoint::AliPHOSCpvRecPoint() : AliPHOSEmcRecPoint()
+AliPHOSCpvRecPoint::AliPHOSCpvRecPoint() : 
+  AliPHOSEmcRecPoint(),
+  fLengX(-1),
+  fLengZ(-1)
 {
   // ctor
+}
 
-  fLengX = -1;
-  fLengZ = -1;
+//____________________________________________________________________________
+AliPHOSCpvRecPoint::AliPHOSCpvRecPoint(const char * opt) : 
+  AliPHOSEmcRecPoint(opt),
+  fLengX(-1),
+  fLengZ(-1)
+{
+   // ctor
 }
 
 //____________________________________________________________________________
@@ -56,7 +76,6 @@ AliPHOSCpvRecPoint::~AliPHOSCpvRecPoint()
   // dtor
 }
 
-
 //____________________________________________________________________________
 Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
 {
@@ -64,8 +83,7 @@ Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * d
   
   Bool_t aren = kFALSE ;
   
-  AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ; 
-  AliPHOSGeometry * phosgeom =  (AliPHOSGeometry*)gime->PHOSGeometry();
+  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
 
   Int_t relid1[4] ; 
   phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; 
@@ -93,52 +111,41 @@ Int_t AliPHOSCpvRecPoint::Compare(const TObject * obj) const
 
   Int_t rv ; 
 
-  if( (strcmp(obj->ClassName() , "AliPHOSPpsdRecPoint" )) == 0)  // PPSD Rec Point
-    {
-      AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ; 
-      if(this->GetPHOSMod()  < clu->GetPHOSMod() ) 
-       rv = -1 ;
-      else 
-       rv = 1 ;
-      return rv ;
-    }
-  else
-    {
-      AliPHOSCpvRecPoint * clu  = (AliPHOSCpvRecPoint *) obj ; 
-      
-      Int_t phosmod1 = GetPHOSMod() ;
-      Int_t phosmod2 = clu->GetPHOSMod() ;
-      
-      TVector3 locpos1; 
-      GetLocalPosition(locpos1) ;
-      TVector3 locpos2;  
-      clu->GetLocalPosition(locpos2) ;  
-      
-      if(phosmod1 == phosmod2 ) {
-       Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
-       if (rowdif> 0) 
-         rv = 1 ;
-       else if(rowdif < 0) 
-         rv = -1 ;
-       else if(locpos1.Z()>locpos2.Z()) 
-         rv = -1 ;
-       else 
-         rv = 1 ; 
-      }
-      
-      else {
-       if(phosmod1 < phosmod2 ) 
-         rv = -1 ;
-       else 
-         rv = 1 ;
-      }
-      
-      return rv ; 
-    }
+  AliPHOSCpvRecPoint * clu  = (AliPHOSCpvRecPoint *) obj ; 
+  
+  Int_t phosmod1 = GetPHOSMod() ;
+  Int_t phosmod2 = clu->GetPHOSMod() ;
+  
+  TVector3 locpos1; 
+  GetLocalPosition(locpos1) ;
+  TVector3 locpos2;  
+  clu->GetLocalPosition(locpos2) ;  
+  
+  if(phosmod1 == phosmod2 ) {
+    Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
+    if (rowdif> 0) 
+      rv = 1 ;
+    else if(rowdif < 0) 
+      rv = -1 ;
+    else if(locpos1.Z()>locpos2.Z()) 
+      rv = -1 ;
+    else 
+      rv = 1 ; 
+  }
+  
+  else {
+    if(phosmod1 < phosmod2 ) 
+      rv = -1 ;
+    else 
+      rv = 1 ;
+  }
+  
+  return rv ; 
+
 }
 
 //______________________________________________________________________________
-void AliPHOSCpvRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
+void AliPHOSCpvRecPoint::ExecuteEvent(Int_t, Int_t, Int_t ) /*const*/
 {
 //   // Execute action corresponding to one event
 //   //  This member function is called when a AliPHOSRecPoint is clicked with the locator
@@ -149,7 +156,7 @@ void AliPHOSCpvRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
 
 //   //   static Int_t pxold, pyold;
 
-//   AliPHOSGetter * gime =  AliPHOSGetter::GetInstance() ; 
+//   AliPHOSLoader * gime =  AliPHOSLoader::GetInstance() ; 
   
 //   static TGraph *  digitgraph = 0 ;
   
@@ -246,14 +253,19 @@ void AliPHOSCpvRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
 }
 
 //____________________________________________________________________________
-void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits)
+void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits)
 {
-  // wraps other methods
   AliPHOSEmcRecPoint::EvalAll(logWeight,digits) ;
   EvalClusterLengths(digits) ;
 }
 //____________________________________________________________________________
-void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits)
+void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight, TVector3 &vtx, TClonesArray * digits)
+{
+  // wraps other methods
+  AliPHOSEmcRecPoint::EvalAll(logWeight,vtx,digits) ;
+}
+//____________________________________________________________________________
+void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight, TVector3 & /*vtx */, TClonesArray * digits)
 {
   // Calculates the center of gravity in the local PHOS-module coordinates 
 
@@ -266,8 +278,8 @@ void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digi
   
   AliPHOSDigit * digit ;
 
-  AliPHOSGeometry * phosgeom =  (AliPHOSGeometry *) fGeom ;
-
+  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
+  
   Int_t iDigit;
 
   for(iDigit=0; iDigit<fMulDigit; iDigit++) {
@@ -277,10 +289,14 @@ void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digi
     Float_t zi ;
     phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
     phosgeom->RelPosInModule(relid, xi, zi);
-    Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
-    x    += xi * w ;
-    z    += zi * w ;
-    wtot += w ;
+    if (fAmp>0 && fEnergyList[iDigit]>0) {
+      Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
+      x    += xi * w ;
+      z    += zi * w ;
+      wtot += w ;
+    }
+    else
+      AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
   }
 
   if (wtot != 0) {
@@ -289,12 +305,13 @@ void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digi
   } else {
     x = -1e6 ;
     z = -1e6 ;
-    if (fMulDigit != 0) cout << "AliPHOSCpvRecPoint: too low log weight factor "
-                            << "to evaluate cluster's center\n";
+    if (fMulDigit != 0) 
+      AliWarning(Form("Too low log weight factor to evaluate cluster's center" )) ;
   }
   fLocPos.SetX(x)  ;
   fLocPos.SetY(0.) ;
   fLocPos.SetZ(z)  ;
+  fLocPosM = 0 ;
 
 }
 
@@ -312,7 +329,7 @@ void AliPHOSCpvRecPoint::EvalClusterLengths(TClonesArray * digits)
 
   AliPHOSDigit * digit ;
 
-  AliPHOSGeometry * phosgeom =  (AliPHOSGeometry *) fGeom ;
+  AliPHOSGeometry * phosgeom =  AliPHOSLoader::GetPHOSGeometry();
 
   const Int_t kMaxLeng=20;
   Int_t idX[kMaxLeng], idZ[kMaxLeng];
@@ -344,29 +361,29 @@ void AliPHOSCpvRecPoint::EvalClusterLengths(TClonesArray * digits)
   }
 }
 
-
-
 //____________________________________________________________________________
-void AliPHOSCpvRecPoint::Print(Option_t * option) 
+void AliPHOSCpvRecPoint::Print(const Option_t *) const
 {
   // Print the list of digits belonging to the cluster
   
-  cout << "AliPHOSCpvRecPoint: " << endl ;
-
+  TString message ; 
+  message  =  "AliPHOSCpvRecPoint: " ;
+  message +=  "Digits #   " ;
+  AliInfo(Form(message.Data())) ; 
+  
   Int_t iDigit;
 
-  cout << "Digits #   "  ;
   for(iDigit=0; iDigit<fMulDigit; iDigit++) 
-    cout << fDigitsList[iDigit] << "  "  ; 
-  cout << endl ;
+    printf(" %d \n", fDigitsList[iDigit]) ; 
 
-  cout << "Energies: "  ;
+  printf("Energies: \n")  ;
   for(iDigit=0; iDigit<fMulDigit; iDigit++) 
-    cout << fEnergyList[iDigit] << "  "  ; 
-  cout << endl ;
+    printf(" %f ", fEnergyList[iDigit]) ; 
   
-  cout << "       Multiplicity    = " << fMulDigit  << endl ;
-  cout << "       Cluster Energy  = " << fAmp << endl ;
-  cout << "       Stored at position " << GetIndexInList() << endl ; 
+  message  = "       Multiplicity    = %d\n" ;
+  message += "       Cluster Energy  = %f\n" ;
+  message += "       Stored at position %d\n" ; 
  
+  printf(message.Data(), fMulDigit, fAmp, GetIndexInList() ) ; 
+
 }