StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTriggerSimuMaker.h
1 // -*- mode:c++ -*-
2 
4 //
5 //
6 // StTriggerSimuMaker R.Fatemi, Adam Kocoloski , Jan Balewski (Fall, 2007)
7 //
8 // Goal: generate trigger response based on ADC
9 // implemented BEMC,EEMC,....
10 // >StTriggerSimu/*SUB*/St*SUB*TriggerSimu.h
11 // >where *SUB* are the subsystems: Eemc, Bemc, Bbc, L2,....
12 //
14 
15 #ifndef STAR_StTriggerSimuMaker
16 #define STAR_StTriggerSimuMaker
17 
18 #include <vector>
19 #include <map>
20 
21 using namespace std;
22 
23 #include "StTriggerSimuResult.h"
24 
25 #ifndef StMaker_H
26 #include "StMaker.h"
27 #endif
28 
29 class StEvent;
30 class StBemcTables;
31 class St_db_Maker;
32 
34 class StBbcTriggerSimu;
35 class StBemcTriggerSimu;
36 class StEemcTriggerSimu;
37 class StEmcTriggerSimu;
38 class StL2TriggerSimu;
41 //class StTriggerSimuResult;
42 const int numSimulators=5;
43 
44 class StTriggerSimuMaker : public StMaker {
45 private:
46  int mYear;
47  int mMCflag; // 0=data, 1=simulation, 2=embedding
48 
50  //vector<StVirtualTriggerSimu*> mSimulators;
51  StVirtualTriggerSimu* mSimulators[numSimulators];
52 
54  //int mBarrelJetPatchTh[3];
55  int mBarrelJetPatchTh[4];
56  int mBarrelHighTowerTh[4];
57  //int mEndcapJetPatchTh[3];
58  int mEndcapJetPatchTh[4];
59  int mEndcapHighTowerTh[2];
60  int mOverlapJetPatchTh[3];
61  void overwrite2009DsmRegisters();
62 
63  int mChangeJPThresh;
64  void changeJetPatchTh();
65 
67  int mUseOnlineDB;
68  int mUseOfflineDB;
69 
71  map<int,StTriggerSimuResult> mResults;
72 
73  void buildDetailedResult(int trigId);
74  bool get2009DsmRegistersFromOfflineDatabase(int runNumber);
75  bool get2009DsmRegistersFromOnlineDatabase(int runNumber);
76  bool getTriggerDefinitions(int runNumber);
77  bool getTriggerThresholds(int runNumber);
78 
79  void setTriggerThresholds2017();
80 public:
81  StTriggerSimuMaker(const char *name="StarTrigSimu");
82 
83  void useEemc(int flag=0); //0:just process ADC, 1:compare w/ trigData, see enum in Eemc class
84  void useBbc();
85  void useBemc();
86  void useEmc();
87  void useL2(StGenericL2Emulator* );
88  void useL2(StGenericL2Emulator2009* );
89  void setMC(int x) {mMCflag=x;} // 0=data, 1=simulation, 2=embedding
90 
91  virtual Int_t Init();
92  virtual Int_t Make();
93  virtual Int_t Finish();
94  virtual void Clear(const Option_t* = "");
95  virtual Int_t InitRun (int runumber);
96 
97  TObjArray *mHList; // output histo access point
98  void setHList(TObjArray * x){mHList=x;}
99  bool isTrigger(int trigId);
100  bool isTriggerDefined(int trigId);
101  vector<int> triggerIds() const;
102 
104  const StTriggerSimuResult& detailedResult(int trigId) { return mResults[trigId]; }
105 
106  //hang all activated trigger detectors below
107  StBbcTriggerSimu *bbc;
108  StBemcTriggerSimu *bemc;
109  StEemcTriggerSimu *eemc;
110  StEmcTriggerSimu *emc;
111  StL2TriggerSimu *lTwo;
112 
114  void setBarrelJetPatchTh(int i, int value) { mBarrelJetPatchTh[i] = value; }
115  void setBarrelHighTowerTh(int i, int value) { mBarrelHighTowerTh[i] = value; }
116 
117  void setEndcapJetPatchTh(int i, int value) { mEndcapJetPatchTh[i] = value; }
118  void setEndcapHighTowerTh(int i, int value) { mEndcapHighTowerTh[i] = value; }
119 
120  void setOverlapJetPatchTh(int i, int value) { mOverlapJetPatchTh[i] = value; }
121 
122  void changeJPThresh(int value) { mChangeJPThresh = value; }
123 
124  void setLastDsmRegister(int reg, int value);
125 
127  void useOnlineDB() { mUseOnlineDB = 1; }
128  void useOfflineDB() { mUseOfflineDB = 1; }
129 
130 
131  virtual const char *GetCVS() const
132  {static const char cvs[]="Tag $Name: $ $Id: StTriggerSimuMaker.h $ built " __DATE__ " " __TIME__ ; return cvs;}
133 
134  ClassDef(StTriggerSimuMaker,0)
135 };
136 
137 #endif
138 
139 // $Id: StTriggerSimuMaker.h,v 1.35 2020/04/12 03:56:25 zchang Exp $
140 //
141 // $Log: StTriggerSimuMaker.h,v $
142 // Revision 1.35 2020/04/12 03:56:25 zchang
143 // Add EMC DSM algorithm for the 2017 pp run
144 //
145 // Revision 1.34 2017/01/02 15:31:39 rfatemi
146 // Updated by Danny OLVITT for 2013 dijet analysiss
147 //
148 // Revision 1.33 2016/03/18 22:49:38 zchang
149 // updating trigger simulator for run12 analysis
150 //
151 // Revision 1.32 2013/10/08 23:13:13 zchang
152 // Add member mTrigName and function askTrigger() to request trigger definition
153 //
154 // Revision 1.31 2012/07/13 16:47:26 pibero
155 // Users must now specify database to use for trigger definitions and thresholds
156 //
157 // Revision 1.30 2011/12/11 17:16:43 pibero
158 // Add function to set LD301 registers
159 //
160 // Revision 1.29 2011/10/04 18:29:16 pibero
161 // *** empty log message ***
162 //
163 // Revision 1.28 2011/06/10 18:56:18 pibero
164 // Updated meaning of mMCflag variable: 0=data, 1=simulation, 2=embedding
165 //
166 // Revision 1.27 2010/10/05 15:49:23 rfatemi
167 // Include function to test if trigger is defined in trigger code
168 //
169 // Revision 1.26 2010/08/13 22:21:10 pibero
170 // Move from online to offline DB
171 //
172 // Revision 1.25 2010/06/24 07:51:14 pibero
173 // Added hooks to overwrite DSM thresholds from the database.
174 //
175 // Revision 1.24 2010/04/17 17:43:40 pibero
176 // *** empty log message ***
177 //
178 // Revision 1.23 2010/03/01 18:48:36 pibero
179 // More updates for Run 9
180 //
181 // Revision 1.22 2010/02/18 20:07:03 pibero
182 // Run 9 updates
183 //
184 // Revision 1.21 2009/11/16 07:51:20 pibero
185 // Added LOG_DEBUG messages and triggerIds()
186 //
187 // Revision 1.20 2009/09/26 18:46:28 pibero
188 // Migration from ROOT MySQL to STAR DB API
189 //
190 // Revision 1.19 2009/09/23 22:35:30 pibero
191 // Removed dependencies on ROOT MySQL
192 //
193 // Revision 1.18 2009/09/20 06:46:29 pibero
194 // Updates for Run 9
195 //
196 // Revision 1.17 2009/02/03 15:40:55 rfatemi
197 // Update mSimulators structure for 2009 EMC simulator update
198 //
199 // Revision 1.16 2009/01/17 13:08:44 pibero
200 // Initial version of EMC DSM algorithms for 2009
201 //
202 // Revision 1.15 2008/01/17 01:58:25 kocolosk
203 // StTriggerSimuResult makes detailed emulation results persistent
204 //
205 // Revision 1.14 2007/11/18 21:58:50 balewski
206 // L2algos triggerId list fixed
207 //
208 // Revision 1.13 2007/10/12 20:10:23 balewski
209 // cleanup
210 //
211 // Revision 1.12 2007/10/12 17:19:17 kocolosk
212 // move BEMC-specific code to StBemcTriggerSimu
213 // replace some config methods like setDbMaker with code that finds the Maker automatically
214 //
215 // Revision 1.11 2007/10/12 14:36:01 balewski
216 // added L2 interface
217 //
218 // Revision 1.10 2007/10/11 00:32:56 balewski
219 // L2algo added
220 //
221 // Revision 1.9 2007/09/25 18:19:35 rfatemi
222 // Update for TP work
223 //
224 // Revision 1.8 2007/09/24 18:08:11 kocolosk
225 // some code restructuring
226 //
227 // Revision 1.7 2007/09/21 18:45:51 rfatemi
228 // End of week update
229 //
230 // Revision 1.6 2007/08/12 01:03:22 rfatemi
231 // Added flag for offline/online/expert settings
232 //
233 // Revision 1.5 2007/08/07 15:48:38 rfatemi
234 // Added BEMC access methods
235 //
236 // Revision 1.4 2007/07/23 03:03:39 balewski
237 // fix
238 //
239 // Revision 1.3 2007/07/22 23:09:51 rfatemi
240 // added access to Bbc
241 //
242 // Revision 1.2 2007/07/21 23:35:24 balewski
243 // works for M-C
244 //
245 // Revision 1.1 2007/07/20 21:01:41 balewski
246 // start
247 //
void setBarrelJetPatchTh(int i, int value)
Use these setters to overwrite thresholds from the database (2009)
void useOnlineDB()
Choose DB to access trigger definitions and thresholds.
const StTriggerSimuResult & detailedResult(int trigId)
returns object containing detailed information about simulation of given trigger