StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTriggerSimuResult.h
1 // -*- mode:c++ -*-
2 
3 #ifndef STAR_StTriggerSimuResult
4 #define STAR_StTriggerSimuResult
5 
6 // $Id: StTriggerSimuResult.h,v 1.8 2016/03/18 22:49:38 zchang Exp $
7 
8 /*****************************************************************************
9  * @class StTriggerSimuResult
10  * @author A.Kocoloski
11  *
12  * Stores detailed simulator information for a single trigger ID.
13  *****************************************************************************/
14 
15 #include <utility>
16 using std::pair;
17 
18 #include <vector>
19 using std::vector;
20 
21 #include <utility>
22 using std::make_pair;
23 
24 #include <map>
25 using std::map;
26 
27 #include "TObject.h"
28 
29 #include "StVirtualTriggerSimu.h"
30 
31 class L2pedResults2006;
32 class L2jetResults2006;
33 class L2gammaResult;
34 class L2Result;
35 
37 class HttpResult {
38 public:
39  int towerId;
40  int towerAdc;
41  int triggerPatchId;
42  int triggerPatchAdc;
43 // ClassDef(HttpResult,1)
44 };
45 
46 enum L2ResultType {kPed, kJet, kGammaBemc, kGammaEemc, kUpsilon};
47 
48 class StTriggerSimuResult : public TObject
49 {
50 public:
52 
53  unsigned int triggerId() const;
54  StTriggerSimuDecision bbcDecision() const;
55  StTriggerSimuDecision bemcDecision() const;
56  StTriggerSimuDecision eemcDecision() const;
57  StTriggerSimuDecision l2Decision() const;
58 
59  const vector<short>& highTowerIds() const;
60  const vector<short>& triggerPatchIds() const;
61  const vector<short>& jetPatchIds() const;
62 
64  int highTowerAdc(short towerId) const;
65 
67  int triggerPatchAdc(short patchId) const;
68 
70  int jetPatchAdc(short jetPatchId) const;
71 
73  HttpResult httpPair(short towerId) const;
74 
76 
85  const unsigned int* l2Result(L2ResultType algo, int year=2006) const;
86  const unsigned int* l2Result() const;
87 
88  void setTriggerId(unsigned int);
89  void setBbcDecision(StTriggerSimuDecision);
90  void setBemcDecision(StTriggerSimuDecision);
91  void setEemcDecision(StTriggerSimuDecision);
92  void setL2Decision(StTriggerSimuDecision);
93 
94  void addHighTower(int towerId, int dsmAdc);
95  void addTriggerPatch(int patchId, int dsmAdc);
96  void addJetPatch(int jetPatchId, int dsmAdc);
97 
98  // 2009
99  void addBarrelJetPatchAdc(int jp, int adc);
100  void addEndcapJetPatchAdc(int jp, int adc);
101  void addOverlapJetPatchAdc(int jp, int adc);
102 
103  const map<int,int>& barrelJetPatches() const;
104  const map<int,int>& endcapJetPatches() const;
105  const map<int,int>& overlapJetPatches() const;
106 
107  void setL2Result(const unsigned int* result);
108 
109 private:
110  UInt_t mTriggerId;
111  UChar_t mBbcDecision;
112  UChar_t mBemcDecision;
113  UChar_t mEemcDecision;
114  UChar_t mL2Decision;
115 
116  vector<short> mHighTowerIds;
117  vector<short> mHighTowerAdcs;
118 
119  vector<short> mTriggerPatchIds;
120  vector<short> mTriggerPatchAdcs;
121 
122  vector<short> mJetPatchIds;
123  vector<short> mJetPatchAdcs;
124 
125  // 2009
126  map<int,int> mBarrelJetPatches;
127  map<int,int> mEndcapJetPatches;
128  map<int,int> mOverlapJetPatches;
129 
130  unsigned int mL2Result[64];
131  //enum L2ResultOffset { kPed2006=0, kJet2006=14, kGammaBemc2006=6, kGammaEemc2006=8, kUpsilon2006=10 }; //!
132 
133  ClassDef(StTriggerSimuResult, 1)
134 };
135 
136 inline unsigned int StTriggerSimuResult::triggerId() const { return mTriggerId; }
137 inline StTriggerSimuDecision StTriggerSimuResult::bbcDecision() const { return (StTriggerSimuDecision)mBbcDecision; }
138 inline StTriggerSimuDecision StTriggerSimuResult::bemcDecision() const { return (StTriggerSimuDecision)mBemcDecision; }
139 inline StTriggerSimuDecision StTriggerSimuResult::eemcDecision() const { return (StTriggerSimuDecision)mEemcDecision; }
140 inline StTriggerSimuDecision StTriggerSimuResult::l2Decision() const { return (StTriggerSimuDecision)mL2Decision; }
141 
142 inline const vector<short>& StTriggerSimuResult::highTowerIds() const { return mHighTowerIds; }
143 inline const vector<short>& StTriggerSimuResult::triggerPatchIds() const { return mTriggerPatchIds; }
144 inline const vector<short>& StTriggerSimuResult::jetPatchIds() const { return mJetPatchIds; }
145 
146 inline void StTriggerSimuResult::setTriggerId(unsigned int tid) { mTriggerId = tid; }
147 inline void StTriggerSimuResult::setBbcDecision(StTriggerSimuDecision d) { mBbcDecision = d; }
148 inline void StTriggerSimuResult::setBemcDecision(StTriggerSimuDecision d) { mBemcDecision = d; }
149 inline void StTriggerSimuResult::setEemcDecision(StTriggerSimuDecision d) { mEemcDecision = d; }
150 inline void StTriggerSimuResult::setL2Decision(StTriggerSimuDecision d) { mL2Decision = d; }
151 
152 // 2009
153 inline void StTriggerSimuResult::addBarrelJetPatchAdc(int jp, int adc) { mBarrelJetPatches.insert(make_pair(jp,adc)); }
154 inline void StTriggerSimuResult::addEndcapJetPatchAdc(int jp, int adc) { mEndcapJetPatches.insert(make_pair(jp,adc)); }
155 inline void StTriggerSimuResult::addOverlapJetPatchAdc(int jp, int adc) { mOverlapJetPatches.insert(make_pair(jp,adc)); }
156 
157 inline const map<int,int>& StTriggerSimuResult::barrelJetPatches() const { return mBarrelJetPatches; }
158 inline const map<int,int>& StTriggerSimuResult::endcapJetPatches() const { return mEndcapJetPatches; }
159 inline const map<int,int>& StTriggerSimuResult::overlapJetPatches() const { return mOverlapJetPatches; }
160 
161 #endif
162 
163 /*****************************************************************************
164  * $Log: StTriggerSimuResult.h,v $
165  * Revision 1.8 2016/03/18 22:49:38 zchang
166  * updating trigger simulator for run12 analysis
167  *
168  * Revision 1.7 2010/08/13 00:21:27 rfatemi
169  * changed PIG+2 address from BEMC to EEMC based on structure in StTriggerData2005::isL2Trigger()
170  *
171  * Revision 1.6 2010/04/29 10:34:34 pibero
172  * Preserve backward compatibility with reading of Run 6 skim trees
173  *
174  * Revision 1.5 2010/02/18 20:07:03 pibero
175  * Run 9 updates
176  *
177  * Revision 1.4 2008/01/22 18:06:27 kocolosk
178  * added detailedResult code for BEMC L0, courtesy Dave Staszak
179  * fixed two bugs in vector accessors in result class (also thanks to Dave)
180  *
181  * Revision 1.3 2008/01/18 02:10:30 kocolosk
182  * add comment pointing to documentation of L2 result structures
183  *
184  * Revision 1.2 2008/01/17 17:04:08 kocolosk
185  * some revisions to StTriggerSimuResult structure to hopefully improve clarity and maintainability
186  *
187  * Revision 1.1 2008/01/17 01:58:26 kocolosk
188  * StTriggerSimuResult makes detailed emulation results persistent
189  *
190  *
191  *****************************************************************************/
simple struct to return HHTP tower - trigger patch pairs
int jetPatchAdc(short jetPatchId) const
returns DSM ADC if above trigger threshold, otherwise -1
int highTowerAdc(short towerId) const
returns DSM ADC if above trigger threshold, otherwise -1
HttpResult httpPair(short towerId) const
returns simple struct encapsulating (id,adc) of HT and TP pair
int triggerPatchAdc(short patchId) const
returns DSM ADC if above trigger threshold, otherwise -1
const unsigned int * l2Result(L2ResultType algo, int year=2006) const
returns address of specific L2 result struct – cast it yourself