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