StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTowerEnergyToTLorentzVector.cxx
1 // $Id: StjTowerEnergyToTLorentzVector.cxx,v 1.1 2008/11/27 07:35:33 tai Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjTowerEnergyToTLorentzVector.h"
4 
5 #include "StjTowerEnergyList.h"
6 
8 
9 TLorentzVector StjTowerEnergyToTLorentzVector::operator()(const StjTowerEnergy& deposit)
10 {
11  TVector3 towerLocation;
12  towerLocation.SetPtEtaPhi(deposit.towerR, deposit.towerEta, deposit.towerPhi);
13  TVector3 vertex(deposit.vertexX, deposit.vertexY, deposit.vertexZ);
14 
15  TVector3 momentum = towerLocation - vertex;
16 
17  double pMag = (deposit.energy > _mass) ? sqrt(deposit.energy*deposit.energy - _mass*_mass) : deposit.energy;
18 
19  momentum.SetMag(pMag);
20  TLorentzVector ret(momentum.x(), momentum.y(), momentum.z(), deposit.energy);
21  return ret;
22 }