StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmcTriggerDetector.cxx
1 /***************************************************************************
2  *
3  * $Id: StEmcTriggerDetector.cxx,v 2.4 2007/07/11 23:06:45 perev Exp $
4  *
5  * Author: Alex Suaide, Feb 2002
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StEmcTriggerDetector.cxx,v $
13  * Revision 2.4 2007/07/11 23:06:45 perev
14  * Cleanup+fix StXXXTriggerDetector
15  *
16  * Revision 2.3 2004/08/03 17:22:16 ullrich
17  * Major update by Akio and Marco.
18  *
19  * Revision 2.2 2004/02/11 01:42:09 ullrich
20  * Added new constructor to load data from StTriggerData.
21  *
22  * Revision 2.1 2002/02/20 03:11:45 ullrich
23  * Initial Revision.
24  *
25  **************************************************************************/
26 #include <algorithm>
27 #include "StEmcTriggerDetector.h"
28 #include "tables/St_dst_TrgDet_Table.h"
29 #include "StTriggerData.h"
30 
31 static const char rcsid[] = "$Id: StEmcTriggerDetector.cxx,v 2.4 2007/07/11 23:06:45 perev Exp $";
32 
33 ClassImp(StEmcTriggerDetector)
34 
36 {
37  memset(mBeg,0,mEnd-mBeg);
38 }
39 
40 StEmcTriggerDetector::StEmcTriggerDetector(const dst_TrgDet_st& t)
41 {
42  memset(mBeg,0,mEnd-mBeg);
43  for(int i=0; i<mNPatch; i++) {
44  mHighTower[i]=static_cast<char>(t.emcHiTower[i]);
45  mPatch[i]=static_cast<char>(t.emcTrigPatch[i]);
46  }
47 }
48 
49 StEmcTriggerDetector::StEmcTriggerDetector(const StTriggerData &trg_dat)
50 {
51  memset(mBeg,0,mEnd-mBeg);
52  for(int i=0; i<mNPatch; i++) {
53  mHighTower[i]=trg_dat.bemcHighTower(i);
54  mPatch[i]=trg_dat.bemcJetPatch(i);
55  }
56  for(int i=0; i<mENPatch; i++) {
57  mEHighTower[i]=trg_dat.eemcHighTower(i);
58  mEPatch[i]=trg_dat.eemcJetPatch(i);
59  }
60  for(int i=0; i<mNBemcLayer1; i++)
61  mBemcLayer1[i]=trg_dat.bemcLayer1DSM(i);
62  for(int i=0; i<mNEemcLayer1; i++)
63  mEemcLayer1[i]=trg_dat.eemcLayer1DSM(i);
64  for(int i=0; i<mNEmcLayer2; i++)
65  mEmcLayer2[i]=trg_dat.emcLayer2DSM(i);
66 }
67 
68 StEmcTriggerDetector::~StEmcTriggerDetector() {/* noop */}
69 
70 int
71 StEmcTriggerDetector::numberOfTowers() const {return mNPatch;}
72 
73 int
74 StEmcTriggerDetector::highTower(unsigned int i) const
75 {
76  if (i < mNPatch)
77  return static_cast<int>(mHighTower[i]);
78  else
79  return 0;
80 }
81 
82 int
83 StEmcTriggerDetector::patch(unsigned int i) const
84 {
85  if (i < mNPatch)
86  return static_cast<int>(mPatch[i]);
87  else
88  return 0;
89 }
90 
91 int
92 StEmcTriggerDetector::highTowerEndcap(unsigned int i) const
93 {
94  if (i < mENPatch)
95  return static_cast<int>(mEHighTower[i]);
96  else
97  return 0;
98 }
99 
100 int
101 StEmcTriggerDetector::patchEndcap(unsigned int i) const
102 {
103  if (i < mENPatch)
104  return static_cast<int>(mEPatch[i]);
105  else
106  return 0;
107 }
108 
109 unsigned short StEmcTriggerDetector::bemcLayer1(int idx) const {
110  if (idx>=0 && idx<mNBemcLayer1)
111  return mBemcLayer1[idx];
112  return 0;
113 }
114 
115 unsigned short StEmcTriggerDetector::eemcLayer1(int idx) const {
116  if (idx>=0 && idx<mNEemcLayer1)
117  return mEemcLayer1[idx];
118  return 0;
119 }
120 
121 unsigned short StEmcTriggerDetector::emcLayer2(int idx) const {
122  if (idx>=0 && idx<mNEmcLayer2)
123  return mEmcLayer2[idx];
124  return 0;
125 }
126 
127 void
128 StEmcTriggerDetector::setHighTower(unsigned int i, int val)
129 {
130  if (i < mNPatch)
131  mHighTower[i] = static_cast<char>(val);
132 }
133 
134 void
135 StEmcTriggerDetector::setPatch(unsigned int i, int val)
136 {
137  if (i < mNPatch)
138  mPatch[i] = static_cast<char>(val);
139 }
140 
141 void
142 StEmcTriggerDetector::setHighTowerEndcap(unsigned int i, int val)
143 {
144  if (i < mENPatch)
145  mEHighTower[i] = static_cast<char>(val);
146 }
147 
148 void
149 StEmcTriggerDetector::setPatchEndcap(unsigned int i, int val)
150 {
151  if (i < mENPatch)
152  mEPatch[i] = static_cast<char>(val);
153 }