StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTrgSoftEtThresholdBHT.cxx
1 // $Id: StjTrgSoftEtThresholdBHT.cxx,v 1.4 2008/09/17 18:42:59 tai Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjTrgSoftEtThresholdBHT.h"
4 
5 #include "StjTowerEnergyCutEt.h"
6 #include "StjTowerEnergyCutBemcStatus.h"
7 #include "StjTowerEnergyPrint.h"
8 #include "StjTowerEnergyCutEt.h"
9 #include "StjTowerEnergyCutAdc.h"
10 
11 #include "StjBEMC.h"
12 
13 #include "StjTrg.h"
14 
15 #include <TVector3.h>
16 #include <TMath.h>
17 
19 
20 using namespace std;
21 
23  : _bemc(bemc), _minEt(minEt), _runNumber(-1), _eventId(-1)
24 {
25  _cut.addCut( new StjTowerEnergyCutEt(minEt));
26  _cut.addCut( new StjTowerEnergyCutBemcStatus(1));
27  _cut.addCut( new StjTowerEnergyCutAdc(0, 2.0) );
28 }
29 
30 bool StjTrgSoftEtThresholdBHT::isNewEvent()
31 {
32  if(_runNumber != _trg->runNumber()) return true;
33  if(_eventId != _trg->eventId()) return true;
34  return false;
35 }
36 
37 void StjTrgSoftEtThresholdBHT::read()
38 {
39  _runNumber = _trg->runNumber();
40  _eventId = _trg->eventId();
41 
42  _towers.clear();
43  _towerDsmAdc.clear();
44  _towerAdc.clear();
45  _towerEnergy.clear();
46  _towerEt.clear();
47 
48  StjTowerEnergyList energyList = _bemc->getEnergyList();
49  energyList = _cut(energyList);
50 
51 
52  _passed = ( ! energyList.empty() );
53 
54  for(StjTowerEnergyList::const_iterator it = energyList.begin(); it != energyList.end(); ++it) {
55  _towers.push_back((*it).towerId);
56  _towerDsmAdc.push_back(0);
57  _towerAdc.push_back((*it).adc);
58  _towerEnergy.push_back((*it).energy);
59  TVector3 vec3;
60  vec3.SetPtEtaPhi((*it).towerR, (*it).towerEta, (*it).towerPhi);
61  double Et = ((*it).energy)*TMath::Sin(vec3.Theta());
62  _towerEt.push_back(Et);
63  }
64 
65 }
66 
67 bool StjTrgSoftEtThresholdBHT::soft()
68 {
69  if(isNewEvent()) read();
70  return _passed;
71 }
72 
73 vector<int> StjTrgSoftEtThresholdBHT::towers()
74 {
75  if(isNewEvent()) read();
76  return _towers;
77 }
78 
79 vector<int> StjTrgSoftEtThresholdBHT::towerDsmAdc()
80 {
81  if(isNewEvent()) read();
82  return _towerDsmAdc;
83 }
84 
85 vector<unsigned int> StjTrgSoftEtThresholdBHT::towerAdc()
86 {
87  if(isNewEvent()) read();
88  return _towerAdc;
89 }
90 
91 vector<double> StjTrgSoftEtThresholdBHT::towerEnergy()
92 {
93  if(isNewEvent()) read();
94  return _towerEnergy;
95 }
96 
97 vector<double> StjTrgSoftEtThresholdBHT::towerEt()
98 {
99  if(isNewEvent()) read();
100  return _towerEt;
101 }
102 
103