StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEemcTriggerSimu.h
1 // -*- mode: c++ -*-
2 // StEemcTriggerSimu.h,v 0.01
3 //
4 #ifndef STAR_StEemcTriggerSimu
5 #define STAR_StEemcTriggerSimu
6 
7 #include <TObject.h>
8 #include <vector>
9 #include <map>
10 
11 using std::vector;
12 using std::map;
13 
14 #include "StTriggerUtilities/StVirtualTriggerSimu.h"
15 
16 class StEEmcDb;
17 class EEfeeTPTree;
18 class EEdsm0Tree;
19 class EEdsm1Tree;
20 class EMCdsm2Tree;
21 class EEdsm3;
22 class EemcHttpInfo;
23 class TH1;
24 class TObjArray;
25 
26 // #### modified by Liaoyuan ####
27 
28 class DSMLayer_E001_2009;
29 class DSMLayer_E101_2009;
30 
31 // #### modified end ####
32 
34  public:
35  enum {kOnlyAdc=0,kAdcAndTrig, kAdcCompareTrig};
36  void setConfig(int x) {mConfig=x;}
37 
38  private:
39  StEEmcDb *mDbE;
40  int * mBemcEsum5bit; // output from Bemc emulation, not working
41  int * mExternDsmSetup;
42  TString mSetupPath;
43 
44  int mConfig; // see enum
45  int mPedMode;
46  TString mPedFile;
47  enum {nThr=3};
48  int mHTthr[nThr], mTPthr[nThr],mHTTPthrSelc;
49 
50  int eveId;
51  int nInpEve;
52  bool mDumpEve;
53  void getEemcAdc();
54  static int computePed4(float ped);
55  void getDsm0123inputs();
56 
57  enum {mxAH=1000};
58  TObjArray *mHList; // output histo access point
59  TH1* hA[mxAH];
60  void initHisto();
61 
62  // local event storage
63  enum {mxCr=6, mxChan=128};
64  int getRdo(int crate, int chan) const { return (crate-1)*mxChan+chan; }
65  int getCrate(int rdo) const { return rdo/mxChan+1; }
66  int getChannel(int rdo) const { return rdo%mxChan; }
67  int rawAdc [mxCr*mxChan]; // *** 'chan' is counting faster***,
68  int feePed [mxCr*mxChan]; // do NOT change this memory allocation scheme w/o
69  int feeMask[mxCr*mxChan];// understanding details of EEfeeTPTree::compute()
70  int highTowerMask[90]; // mask applied to high tower output of FEE
71  int patchSumMask[90]; // mask applied to patch sum output of FEE
72  float ped[mxCr*mxChan];
73  float gain[mxCr*mxChan];
74 
75 public:
76  // pedestal treatment
77  enum { kOnline, kOffline, kLocal };
78  void setPedMode(int pedmode) { mPedMode = pedmode; }
79  void setPedFile(const char* pedfile) { mPedFile = pedfile; }
80 
81  // Endcap FEE_TP+DSM0...3 Tree emulators processing ADC
82  EEfeeTPTree *feeTPTreeADC;
83  EEdsm0Tree * dsm0TreeADC;
84  EEdsm1Tree * dsm1TreeADC;
85  EMCdsm2Tree * dsm2TreeADC;
86 
87  // #### modified by Liaoyuan ####
88  // 2009 Endcap DSM Layer 0 + 1
89  private:
90  DSMLayer_E001_2009* mE001;
91  DSMLayer_E101_2009* mE101;
92 
93  void get2009_DSMLayer0(); // Reads output from feeTPTreeADC & process
94  void get2009_DSMLayer1(); // Reads output from mE101 & process
95 
96  // Access to 2009 EEMC Layer 0 + 1
97  public:
98  DSMLayer_E001_2009* get2009_DSMLayer0_Result() { return mE001; };
99  DSMLayer_E101_2009* get2009_DSMLayer1_Result() { return mE101; };
100 
101  // #### modified end ####
102 
103  vector<int> mTriggerIds;
104  bool mTestMode;
105  private:
106  // Endcap DSM0...3 Tree only unpacking TRG data, for QA
107  EEdsm0Tree *dsm0TreeTRG;
108  EEdsm1Tree *dsm1TreeTRG;
109  EMCdsm2Tree *dsm2TreeTRG;
110  EEdsm3 *dsm3TRG;
111  private:
112 
113  // various QA methods validating inputs to DSMs
114  void compareTRG0_TRG1();
115  void compareTRG1_TRG2();
116  void compareTRG2_TRG3();
117 
118  void compareADCfee_TRG0();
119  void compareADC0_TRG1();
120  void compareADC1_TRG2();
121  void compareADC2_TRG3();
122 
123  void DSM2EsumSpectra();
124 
125  public:
126 
128  virtual ~StEemcTriggerSimu();
129  void Init();
130  void InitRun(int runnumber);
131  void setDsmSetup(int *x){ mExternDsmSetup=x;} // discard
132  void setSetupPath(char *x) { mSetupPath=x;}
133  void Clear();
134  void Make();
135  bool isCorrupted() const;
136  void getEemcFeeMask();
137  void setHList(TObjArray * x){mHList=x;}
138  void addTriggerList(vector<int>& trgList);
139  StTriggerSimuDecision triggerDecision(int trigId);
140  const vector<int>& triggerIds() const { return mTriggerIds; }
141  void connectBemcL0(int *x) { mBemcEsum5bit=x;};
142  bool getHttpInfo(int tpId, EemcHttpInfo &httpInfo);
143 
144  int endcapJetPatchTh(int i) const;
145  int endcapHighTowerTh(int i) const;
146 
147  int endcapJetPatchAdc(int jp) const;
148  int endcapHighTowerAdc(int towerId) const { return 0; }
149  int endcapPartialJetPatchAdc(int jp) const;
150 
151  int getOutHT(int tp) const;
152  int getOutTPsum(int tp) const;
153  int getEndcapHighTower(int tp) const { return getOutHT(tp); }
154  int getEndcapPatchSum(int tp) const { return getOutTPsum(tp); }
155 
156  // Fill StEmcTriggerDetector in MuDst for MC
157  void fillStEmcTriggerDetector();
158 
159  ClassDef(StEemcTriggerSimu, 1)
160  };
161 
162 
163 #endif
164 
165 //
166 // $Log: StEemcTriggerSimu.h,v $
167 // Revision 1.29 2020/01/13 20:45:51 zchang
168 // removing old run13 dsm algo files
169 //
170 // Revision 1.28 2017/01/02 15:31:56 rfatemi
171 // Updated by Danny OLVITT for 2013 dijet analysiss
172 //
173 // Revision 1.27 2012/08/27 17:16:41 pibero
174 // Add logging of EEMC gains from DB
175 //
176 // Revision 1.26 2011/10/22 20:25:17 pibero
177 // Add getters for output of EEMC FEEs for backward-compatibility
178 //
179 // Revision 1.25 2011/10/16 17:41:59 pibero
180 // Implement EEMC FEE HT & TP masks
181 //
182 // Revision 1.24 2011/10/14 22:33:45 pibero
183 // Add functions to test for data corruption in calorimeters
184 //
185 // Revision 1.23 2011/09/22 15:55:21 pibero
186 // Added EEMC pedestal modes:
187 //
188 // kOnline = use online pedestals
189 // kOffline = use offline pedestals
190 // kLocal = use pedestals from a local file (format: crate channel pedestal ped4)
191 //
192 // Revision 1.22 2011/09/20 13:32:43 pibero
193 // Added support for using EEMC offline pedestals (default)
194 //
195 // Revision 1.21 2010/06/29 16:53:27 pibero
196 // Now, the trigger simulator fills in the StEmcTriggerDetector structure
197 // same as data for MC.
198 //
199 // Revision 1.20 2010/06/24 07:51:21 pibero
200 // Added hooks to overwrite DSM thresholds from the database.
201 //
202 // Revision 1.19 2010/04/16 01:47:46 pibero
203 // Oops, forgot to include triggers before 2009. Thanks, Liaoyuan.
204 //
205 // Revision 1.18 2010/03/01 18:48:42 pibero
206 // More updates for Run 9
207 //
208 // Revision 1.17 2010/02/18 20:07:10 pibero
209 // Run 9 updates
210 //
211 // Revision 1.16 2009/12/22 18:11:05 pibero
212 // Added ability to set input source (MuDst or StEvent) for BBC trigger simulator.
213 //
214 // Revision 1.15 2009/12/15 16:33:33 pibero
215 // Added support to set thresholds manually for Run 9
216 // and overwrite those from the database.
217 //
218 // Revision 1.14 2009/12/08 02:06:59 pibero
219 // Add support for StEvent when running in BFC.
220 //
221 // Revision 1.13 2009/09/20 06:46:42 pibero
222 // Updates for Run 9
223 //
224 // Revision 1.12 2009/02/20 23:40:04 pibero
225 // Updates for Run 9 by Liaoyuan
226 //
227 // Revision 1.11 2009/02/04 20:27:10 rfatemi
228 // Update StEemcDbMaker
229 //
230 // Revision 1.10 2007/11/08 20:59:53 kocolosk
231 // subdet isTrigger returns a bool
232 // triggerDecision returns enumerator including kDoNotCare
233 //
234 // Revision 1.9 2007/10/22 23:09:54 balewski
235 // split L2 to generic and year specific, not finished
236 //
237 // Revision 1.8 2007/10/12 20:11:33 balewski
238 // cleanup of setup path, now at inst/iucf
239 //
240 // Revision 1.7 2007/10/12 17:12:43 kocolosk
241 // rename ABC class for subdetector trigger simulators
242 // StTriggerSimu => StVirtualTriggerSimu
243 //
244 // Revision 1.6 2007/10/12 16:41:04 balewski
245 // *** empty log message ***
246 //
247 // Revision 1.5 2007/10/11 00:33:03 balewski
248 // L2algo added
249 //
250 // Revision 1.4 2007/09/24 18:08:43 kocolosk
251 // added inheritance from ABC clss StTriggerSimu
252 //
253 // Revision 1.3 2007/07/24 01:32:59 balewski
254 // added HTTP id for the endcap
255 //
256 // Revision 1.2 2007/07/23 03:00:00 balewski
257 // cleanup, bbc for M-C still not working
258 //
Definition: EEdsm3.h:7
StTriggerSimuDecision triggerDecision(int trigId)
like isTrigger(), but returns kDoNotCare if detector isn&#39;t a part of the given trigId ...