Skip to content

Commit

Permalink
ALIROOT-6275 add protection in cluster momentum calculation in case o…
Browse files Browse the repository at this point in the history
…f null radius case, due to large bad/noise clusters
  • Loading branch information
gconesab authored and hristov committed Sep 4, 2015
1 parent a1742c3 commit 29dc3e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions STEER/AOD/AliAODCaloCluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
//-------------------------------------------------------------------------

#include <TLorentzVector.h>
#include "AliLog.h"
#include "AliAODCaloCluster.h"

ClassImp(AliAODCaloCluster)
Expand Down Expand Up @@ -238,9 +239,11 @@ void AliAODCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) const
Double_t r = TMath::Sqrt(pos[0]*pos[0]+
pos[1]*pos[1]+
pos[2]*pos[2] ) ;

p.SetPxPyPzE( energy*pos[0]/r, energy*pos[1]/r, energy*pos[2]/r, energy) ;


if ( r > 0 )
p.SetPxPyPzE( energy*pos[0]/r, energy*pos[1]/r, energy*pos[2]/r, energy) ;
else
AliInfo("Null cluster radius, momentum calculation not possible");
}


Expand Down
6 changes: 5 additions & 1 deletion STEER/ESD/AliESDCaloCluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//-----------------------------------------------------------------

#include <TLorentzVector.h>
#include "AliLog.h"
#include "AliESDCaloCluster.h"

ClassImp(AliESDCaloCluster)
Expand Down Expand Up @@ -278,7 +279,10 @@ void AliESDCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) const

Double_t r = TMath::Sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2] ) ;

p.SetPxPyPzE( fEnergy*pos[0]/r, fEnergy*pos[1]/r, fEnergy*pos[2]/r, fEnergy) ;
if ( r > 0 )
p.SetPxPyPzE( fEnergy*pos[0]/r, fEnergy*pos[1]/r, fEnergy*pos[2]/r, fEnergy) ;
else
AliInfo("Null cluster radius, momentum calculation not possible");
}

//_______________________________________________________________________
Expand Down

0 comments on commit 29dc3e0

Please sign in to comment.