]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliAODJet.cxx
fix
[u/mrichter/AliRoot.git] / STEER / AliAODJet.cxx
index 226326846b0400ea5dfad871dde9552f188ddc3c..7083c5044a047b73c8b7f36832a19d81b3c181c1 100644 (file)
@@ -140,3 +140,33 @@ void  AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){
     fMomentum->SetPxPyPzE(px,py,pz,e);
   }
 }
+
+Double_t AliAODJet::DeltaR(const AliVParticle* part){
+
+  // Helper function to calculate the distance between two jets
+  // or a jet and particle
+
+  Double_t dPhi = Phi() - part->Phi(); 
+  if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
+  if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();
+  Double_t dEta = Eta() - part->Eta(); 
+  Double_t dR = TMath::Sqrt(dPhi*dPhi+dEta*dEta);
+  return dR;
+}
+
+
+Int_t AliAODJet::Compare( const TObject* obj) const {
+
+  // 
+  // see header file for class documentation
+  //
+
+  if (this == obj)
+    return 0;
+  // check type
+  if ( Pt() < ((AliAODJet*)(obj))->Pt())
+    return 1;
+  else
+    return -1;
+}
+