StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjeTowerEnergyListToStMuTrackFourVecList.cxx
1 // $Id: StjeTowerEnergyListToStMuTrackFourVecList.cxx,v 1.5 2016/01/06 22:00:17 gdwebb Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjeTowerEnergyListToStMuTrackFourVecList.h"
4 
5 #include "StjTowerEnergyToTLorentzVector.h"
6 
7 #include "../emulator/StMuTrackFourVec.h"
8 #include "../emulator/StMuTowerEmu.h"
9 
10 StjeTowerEnergyListToStMuTrackFourVecList::StjeTowerEnergyListToStMuTrackFourVecList()
11  : _energyTo4p(*(new StjTowerEnergyToTLorentzVector)) { }
12 
13 FourList StjeTowerEnergyListToStMuTrackFourVecList::operator()(const StjTowerEnergyList& energyDepositList)
14 {
15  FourList ret;
16 
17  for(StjTowerEnergyList::const_iterator tower = energyDepositList.begin(); tower != energyDepositList.end(); ++tower) {
18 
19  TLorentzVector p4 = _energyTo4p(*tower);
20 
21  StMuTrackFourVec* pmu = new StMuTrackFourVec(0, createTowerEmu(*tower), 0, p4, 0, tower->towerId, tower->detectorId);
22 
23  ret.push_back(pmu);
24  }
25 
26  return ret;
27 }
28 
29 StMuTowerEmu* StjeTowerEnergyListToStMuTrackFourVecList::createTowerEmu(const StjTowerEnergy& tower)
30 {
31  StMuTowerEmu* ret = new StMuTowerEmu;
32  TLorentzVector mom = _energyTo4p(tower);
33 
34  ret->_px = mom.Px();
35  ret->_py = mom.Py();
36  ret->_pz = mom.Pz();
37  ret->_adc = tower.adc;
38  ret->_pedestal = tower.pedestal;
39  ret->_rms = tower.rms;
40  ret->_status = tower.status;
41  ret->_id = tower.towerId;
42  ret->_detectorId = tower.detectorId;
43 
44  return ret;
45 }