StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjDijetListTriggerBHT.cxx
1 // $Id: StjDijetListTriggerBHT.cxx,v 1.2 2008/09/12 22:32:53 tai Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjDijetListTriggerBHT.h"
4 
5 #include <StjTrg.h>
6 
7 #include <vector>
8 
10 
11 using namespace std;
12 
13 StjDijetList StjDijetListTriggerBHT::processOneItem(const StjDijetList::value_type& item)
14 {
15  StjDijetList retList;
16 
17  if( ! _trg->passed() ) return retList;
18 
19  double maxEt3 = getMaxEtForBEMCTowersThatPassedBHT(item.jet3);
20  double maxEt4 = getMaxEtForBEMCTowersThatPassedBHT(item.jet4);
21 
22  if(maxEt3 == 0 && maxEt4 == 0) return retList;
23 
24  StjDijet dijet(item);
25 
26  if(maxEt3 >= maxEt4)
27  {
28  dijet.jetSameSide = item.jet3;
29  dijet.jetAwaySide = item.jet4;
30  dijet.neuRtSameSide = item.jet3.neuRt;
31  dijet.neuRtAwaySide = item.jet4.neuRt;
32  }
33  else
34  {
35  dijet.jetSameSide = item.jet4;
36  dijet.jetAwaySide = item.jet3;
37  dijet.neuRtSameSide = item.jet4.neuRt;
38  dijet.neuRtAwaySide = item.jet3.neuRt;
39  }
40 
41  retList.push_back(dijet);
42 
43  return retList;
44 }
45 
46 double StjDijetListTriggerBHT::getMaxEtForBEMCTowersThatPassedBHT(const StjJet& jet)
47 {
48  double ret = 0;
49  for(StjFourVecList::const_iterator it = jet.fourVecList.begin(); it != jet.fourVecList.end(); ++it)
50  {
51  double towerEt = getTowerEtIfFiredBHT(*it);
52  if(towerEt > ret) ret = towerEt;
53  }
54  return ret;
55 }
56 
57 double StjDijetListTriggerBHT::getTowerEtIfFiredBHT(const StjFourVec& p4)
58 {
59  if(p4.type != 2) return 0;
60  if(p4.detectorId != 9) return 0;
61  vector<int> towers = _trg->towers();
62  vector<double> towerEt = _trg->towerEt();
63  for(size_t i = 0; i != towers.size(); ++i)
64  {
65  if(p4.towerId == towers[i]) return towerEt[i];
66  }
67  return 0;
68 }
69