Get momentum
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Sep 2011 13:25:18 +0000 (13:25 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Sep 2011 13:25:18 +0000 (13:25 +0000)
PWG4/UserTasks/EmcalTasks/AliAnalysisTaskEMCALPi0PbPb.cxx
PWG4/UserTasks/EmcalTasks/AliAnalysisTaskEMCALPi0PbPb.h

index f591be8..c4154f3 100644 (file)
@@ -1495,7 +1495,6 @@ void AliAnalysisTaskEMCALPi0PbPb::FillClusHists()
     fHClustEnergySigma->Fill(clus->E()*maxAxis,clus->E());
     fHClustSigmaSigma->Fill(max(clus->GetM02(),clus->GetM20()),clus->E()*maxAxis);
     fHClustNCellEnergyRatio->Fill(clus->GetNCells(),GetMaxCellEnergy(clus)/clus->E());
-    //====
     fHClustEnergyNCell->Fill(clus->E(),clus->GetNCells());  
   }
 }
@@ -2498,3 +2497,33 @@ void AliAnalysisTaskEMCALPi0PbPb::ProcessDaughters(AliMCParticle *p, Int_t index
     ProcessDaughters(dmc,i,arr);
   }
 }
+
+//__________________________________________________________________________________________________
+void AliStaCluster::GetMom(TLorentzVector& p, Double_t *vertex) 
+{
+  // Calculate momentum.
+
+  TVector3 pos;
+  pos.SetPtEtaPhi(fR,fEta,fPhi);
+
+  if(vertex){ //calculate direction relative to  vertex
+    pos -= vertex;
+  }
+  
+  Double_t r = pos.Mag();
+  p.SetPxPyPzE(fE*pos.x()/r, fE*pos.y()/r, fE*pos.z()/r, fE);
+}
+
+//__________________________________________________________________________________________________
+void AliStaCluster::GetMom(TLorentzVector& p, AliStaVertex *vertex) 
+{
+  // Calculate momentum.
+
+  Double_t v[3] = {0,0,0};
+  if (vertex) {
+    v[0] = vertex->fVx;
+    v[1] = vertex->fVy;
+    v[2] = vertex->fVz;
+  }
+  GetMom(p, v);
+}
index 3362aea..5d352c6 100644 (file)
@@ -334,6 +334,9 @@ class AliStaCluster : public TObject
                       fCeIso3(0), fCeIso4(0), fCeIso4x4(0), fCeIso5x5(0), fCeCore(0), fCeIso3x22(0), 
                       fIsShared(0), fTrigId(-1), fTrigE(0), fMcLabel(-1), fEmbE(0) {;}
 
+  void                GetMom(TLorentzVector& p, Double_t *vertex=0);
+  void                GetMom(TLorentzVector& p, AliStaVertex *vertex);
+
  public:
   Double32_t    fE;                //[0,0,16] energy
   Double32_t    fR;                //[0,0,16] radius (cylinder)