3 #include "StjTrgSoftGetAdcEt.h"
5 #include "StjTrgBEMCJetPatchTowerIdMap.h"
7 #include "StjTowerEnergyCutBemcStatus.h"
8 #include "StjTowerEnergyCutEnergy.h"
9 #include "StjTowerEnergyCutEt.h"
10 #include "StjTowerEnergyCutAdc.h"
11 #include "StjTowerEnergyCutTowerId.h"
25 : _bemc(bemc), _bemcJpTowerMap(bemcJpTowerMap), _trg(0)
26 , _runNumber(-1), _eventId(-1)
34 bool StjTrgSoftGetAdcEt::isNewEvent()
36 if(_runNumber != _trg->runNumber())
return true;
37 if(_eventId != _trg->eventId())
return true;
41 void StjTrgSoftGetAdcEt::read()
48 _jetPatchEnergy.clear();
51 vector<int> towers = _trg->towers();
52 vector<int> jetPatches = _trg->jetPatches();
54 StjTowerEnergyList energyList = _bemc->getEnergyList();
55 energyList = _cut(energyList);
57 for(vector<int>::const_iterator tower = towers.begin(); tower != towers.end(); ++tower) {
59 for(StjTowerEnergyList::const_iterator it = energyList.begin(); it != energyList.end(); ++it) {
60 if((*it).towerId == (*tower)) {
61 _towerAdc.push_back((*it).adc);
62 _towerEnergy.push_back((*it).energy);
64 vec3.SetPtEtaPhi((*it).towerR, (*it).towerEta, (*it).towerPhi);
65 _towerEt.push_back(((*it).energy)*TMath::Sin(vec3.Theta()));
71 _towerAdc.push_back(0);
72 _towerEnergy.push_back(0);
73 _towerEt.push_back(0);
77 for(vector<int>::const_iterator jp = jetPatches.begin(); jp != jetPatches.end(); ++jp) {
81 for(StjTowerEnergyList::const_iterator it = energyList.begin(); it != energyList.end(); ++it) {
82 if(*jp == _bemcJpTowerMap->getJetPatchIdForTower((*it).towerId)) {
84 energy += (*it).energy;
86 vec3.SetPtEtaPhi((*it).towerR, (*it).towerEta, (*it).towerPhi);
87 et += ((*it).energy)*TMath::Sin(vec3.Theta());
90 _jetPatchAdc.push_back(adc);
91 _jetPatchEnergy.push_back(energy);
92 _jetPatchEt.push_back(et);
98 vector<unsigned int> StjTrgSoftGetAdcEt::towerAdc()
100 if(isNewEvent()) read();
104 vector<double> StjTrgSoftGetAdcEt::towerEnergy()
106 if(isNewEvent()) read();
110 vector<double> StjTrgSoftGetAdcEt::towerEt()
112 if(isNewEvent()) read();
116 vector<unsigned int> StjTrgSoftGetAdcEt::jetPatchAdc()
118 if(isNewEvent()) read();
122 vector<double> StjTrgSoftGetAdcEt::jetPatchEnergy()
124 if(isNewEvent()) read();
125 return _jetPatchEnergy;
128 vector<double> StjTrgSoftGetAdcEt::jetPatchEt()
130 if(isNewEvent()) read();