StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjeBemcEnergySumCalculator.cxx
1 // $Id: StjeBemcEnergySumCalculator.cxx,v 1.3 2008/08/03 00:26:50 tai Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjeBemcEnergySumCalculator.h"
4 
5 #include "StjBEMC.h"
6 #include "StjTowerEnergyListCut.h"
7 
8 StjeBemcEnergySumCalculatorImp::StjeBemcEnergySumCalculatorImp(StjBEMC* bemc, StjTowerEnergyListCut* cut)
9  : _bemc(bemc)
10  , _cut(cut)
11  , _DylanPoints(0)
12  , _SumEmcEt(0.0)
13 {
14 
15 }
16 void StjeBemcEnergySumCalculatorImp::Init()
17 {
18  _bemc->Init();
19 }
20 
21 void StjeBemcEnergySumCalculatorImp::Make()
22 {
23  StjTowerEnergyList energyList = _bemc->getEnergyList();
24 
25  energyList = (*_cut)(energyList);
26 
27  _SumEmcEt = sumEnergyOverBemcTowers(0.4, energyList);
28 
29  _DylanPoints = numberOfBemcTowersWithEnergyAbove(0.4, energyList);
30 }
31 
32 void StjeBemcEnergySumCalculatorImp::Clear()
33 {
34  _SumEmcEt = 0;
35  _DylanPoints = 0;
36 }
37 
38 double StjeBemcEnergySumCalculatorImp::sumEnergyOverBemcTowers(double minE, const StjTowerEnergyList &energyDepositList)
39 {
40  double ret(0.0);
41 
42  for(StjTowerEnergyList::const_iterator it = energyDepositList.begin(); it != energyDepositList.end(); ++it)
43  if((*it).energy > minE) ret += (*it).energy;
44 
45  return ret;
46 }
47 
48 int StjeBemcEnergySumCalculatorImp::numberOfBemcTowersWithEnergyAbove(double minE, const StjTowerEnergyList &energyDepositList)
49 {
50  int ret(0);
51 
52  for(StjTowerEnergyList::const_iterator it = energyDepositList.begin(); it != energyDepositList.end(); ++it)
53  if((*it).energy > minE) ret ++;
54 
55  return ret;
56 }