BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
InstallArea/include/Trigger/Trigger/BesGlobalTrigSvc.h
Go to the documentation of this file.
1#ifndef BesGlobalTrigSvc_h
2#define BesGlobalTrigSvc_h 1
3
4#include "Trigger/IBesGlobalTrigSvc.h"
5#include "GaudiKernel/Service.h"
6#include <vector>
7#include <map>
8#include <complex>
9#include <fstream>
10
11#include "GaudiKernel/IIncidentListener.h"
12#include "RealizationSvc/RealizationSvc.h"
13#include "RealizationSvc/IRealizationSvc.h"
14#include "Trigger/TrigPara.h"
15
16using namespace std;
17
18class IDataProviderSvc;
19class BesMdcTrig;
20class BesEmcTrig;
21class BesTofTrig;
22class BesMucTrig;
23class BesTMTrig;
24
25class BesGlobalTrigSvc: public Service,
26 virtual public IIncidentListener,
27 virtual public IBesGlobalTrigSvc {
28public:
29 BesGlobalTrigSvc(const std::string& name, ISvcLocator* svc);
30 virtual ~BesGlobalTrigSvc();
31public:
32 virtual StatusCode queryInterface( const InterfaceID& riid,
33 void** ppvInterface);
34 /// Initialise the service (Inherited Service overrides)
35 virtual StatusCode initialize();
36 /// Finalise the service.
37 virtual StatusCode finalize();
38 // Incident handler
39 void handle(const Incident&);
40
41 void startMdcTrig();
42 void startTofTrig();
43 void startEmcTrig();
44 void startTMTrig();
45
46 StatusCode GlobalTrig();
47
48 inline void setEvtTime(double i) { m_evttime = i; };
49 inline double getEvtTime() { return m_evttime; }
50
51 inline void setGoodEvent(bool i) { m_goodEvent = i; };
52 inline bool getGoodEvent() { return m_goodEvent; };
53 //set trigger conditions
54 StatusCode setTrigCondition();
55
56 //values controled in jobOptions
57 inline double getL1TC_GATE() { return L1TC_GATE; }
58 inline double getL1TC_THRESH() { return L1TC_THRESH; }
59 inline int getL1ETOT_L_Peak() { return L1ETOT_L_Peak; }
60 inline int getL1ETOT_L_Sigma() { return L1ETOT_L_Sigma; }
61 inline int getL1ETOT_M_Peak() { return L1ETOT_M_Peak; }
62 inline int getL1ETOT_M_Sigma() { return L1ETOT_M_Sigma; }
63 inline int getL1ETOT_BR_Peak() { return L1ETOT_BR_Peak; }
64 inline int getL1ETOT_BR_Sigma() { return L1ETOT_BR_Sigma; }
65 inline int getL1ETOT_EC_Peak() { return L1ETOT_EC_Peak; }
66 inline int getL1ETOT_EC_Sigma() { return L1ETOT_EC_Sigma; }
67 inline int getL1EBL_Z_Peak() { return L1EBL_Z_Peak; }
68 inline int getL1EBL_Z_Sigma() { return L1EBL_Z_Sigma; }
69 int getL1ETOT_L();
70 int getL1ETOT_M();
71 int getL1ETOT_BR();
72 int getL1ETOT_EC();
73 int getL1EBL_BR();
74 int getL1EBL_EC();
75 int getL1EDIFF_BR();
76 int getL1EDIFF_EC();
77 int getL1BLK_GATE();
78 int getL1EBL_Z();
79
80 inline int getMAXMDCTRACK() { return MAXMDCTRACK; }
81 inline double getEnergy_Ratio() { return Energy_Ratio; }
82
83 inline double getBarrelGate() { return emcBarrelGate; }
84 inline double getEndGate() { return emcEndGate; }
85 inline int getTofLayerControl() { return m_tofLayer; }
86
87 //interface of the trigger channels in each event
88 const int getTrigChan(int i) { return m_trigChannel[i]; }
89 const int* getTrigChan() const { return m_trigChannel; }
90
91 inline void setTrigChan(int i, int j) { m_trigChannel[i] = j; }
92
93 //interface to get trigger conditions in each events
94 const int getTrigCond(int i) { return m_trigCondition[i]; }
95 const int* getTrigCond() const { return m_trigCondition; }
96
97 inline void setTrigCond(int i, bool j) {
98 trigCond[i] = j;
99 if(j) m_trigCondition[i] = 1;
100 else m_trigCondition[i] = 0;
101 }
102
103 //set L1 signal
104 inline void setIfpass(bool i) { ifpass = i; }
105 //get L1 signal
106 inline bool getIfpass() { return ifpass; }
107
108 //set run mode
109 inline void setRunMode(int mode) { m_runMode = mode; }
110 //get run mode
111 inline int getRunMode() { return m_runMode; }
112
113 //set MDC information
114 //set MDC trigger conditions
115 inline void setSTrk_BB(bool i) { mdc_STrk_BB = i; }
116 inline void setNStrkN(bool i) { mdc_NStrkN = i; }
117 inline void setNStrk2(bool i) { mdc_NStrk2 = i; }
118 inline void setNStrk1(bool i) { mdc_NStrk1 = i; }
119 inline void setLTrk_BB(bool i) { mdc_LTrk_BB = i; }
120 inline void setNLtrkN(bool i) { mdc_NLtrkN = i; }
121 inline void setNLtrk2(bool i) { mdc_NLtrk2 = i; }
122 inline void setNLtrk1(bool i) { mdc_NLtrk1 = i; }
123 inline void setNItrk1(bool i) { mdc_NItrk1 = i; }
124 inline void setNItrk2(bool i) { mdc_NItrk2 = i; }
125
126 //set other information of MDC
127 inline void setMdcStrkId(std::vector<int> i) { mdcStrkId = i; }
128 inline void setMdcLtrkId(std::vector<int> i) { mdcLtrkId = i; }
129
130 //get MDC information
131 //get MDC trigger conditions
132 inline bool getSTrk_BB() { return mdc_STrk_BB; }
133 inline bool getNStrkN() { return mdc_NStrkN; }
134 inline bool getNStrk2() { return mdc_NStrk2; }
135 inline bool getNStrk1() { return mdc_NStrk1; }
136 inline bool getLTrk_BB() { return mdc_LTrk_BB; }
137 inline bool getNLtrkN() { return mdc_NLtrkN; }
138 inline bool getNLtrk2() { return mdc_NLtrk2; }
139 inline bool getNLtrk1() { return mdc_NLtrk1; }
140 inline bool getNItrk1() { return mdc_NItrk1; }
141 inline bool getNItrk2() { return mdc_NItrk2; }
142 //get other information in MDC
143 inline std::vector<int> getMdcStrkId() { return mdcStrkId; }
144 inline std::vector<int> getMdcLtrkId() { return mdcLtrkId; }
145
146 //set TOF information
147 //set TOF trigger conditions
148 inline void setETofBB(bool i) { tof_ETofBB = i; }
149 inline void setBTofBB(bool i) { tof_BTofBB = i; }
150 inline void setNETof2(bool i) { tof_NETof2 = i; }
151 inline void setNETof1(bool i) { tof_NETof1 = i; }
152 inline void setNBTof2(bool i) { tof_NBTof2 = i; }
153 inline void setNBTof1(bool i) { tof_NBTof1 = i; }
154 inline void setNTof1(bool i) { tof_NTof1 = i; }
155
156 //set other information of TOF
157 inline void setTofHitPos(map<int,vector<int>,greater<int> > i) { tofHitPos = i; }
158 inline void setBTofHitMap(vector<int> i) { btofHitMap = i; }
159 inline void setETofHitMap(vector<int> i) { etofHitMap = i; }
160
161 //get TOF information
162 //get TOF trigger conditions
163 inline bool getNBTof1() { return tof_NBTof1; }
164 inline bool getNBTof2() { return tof_NBTof2; }
165 inline bool getNETof1() { return tof_NETof1; }
166 inline bool getNETof2() { return tof_NETof2; }
167 inline bool getNTof1() { return tof_NTof1; }
168 inline bool getBTofBB() { return tof_BTofBB; }
169 inline bool getETofBB() { return tof_ETofBB; }
170
171 //get other information in TOF
172 inline map<int,vector<int>,greater<int> > getTofHitPos() { return tofHitPos; }
173 inline vector<int> getBTofHitMap() { return btofHitMap; }
174 inline vector<int> getETofHitMap() { return etofHitMap; }
175
176 //set EMC information
177 //set trigger conditions
178 inline void setNClus1(bool i) { emc_NClus1 = i; }
179 inline void setNClus2(bool i) { emc_NClus2 = i; }
180 inline void setNBClus1(bool i) { emc_NBClus1 = i; }
181 inline void setNEClus1(bool i) { emc_NEClus1 = i; }
182 inline void setBClusBB(bool i) { emc_BClusBB = i; }
183 inline void setEClusBB(bool i) { emc_EClusBB = i; }
184 inline void setClus_Z(bool i) { emc_Clus_Z = i; }
185 inline void setBClus_PHI(bool i) { emc_BClus_PHI = i; }
186 inline void setEClus_PHI(bool i) { emc_EClus_PHI = i; }
187 inline void setBEtot_H(bool i) { emc_BEtot_H = i; }
188 inline void setEEtot_H(bool i) { emc_EEtot_H = i; }
189 inline void setEtot_L(bool i) { emc_Etot_L = i; }
190 inline void setEtot_M(bool i) { emc_Etot_M = i; }
191 inline void setBL_Z(bool i) { emc_BL_Z = i; }
192 inline void setDiff_B(bool i) { emc_Diff_B = i; }
193 inline void setDiff_E(bool i) { emc_Diff_E = i; }
194 inline void setBL_BBLK(bool i) { emc_BL_BBLK = i; }
195 inline void setBL_EBLK(bool i) { emc_BL_EBLK = i; }
196
197 //set other information of EMC
198 inline void setEmcNbCluster(int i) { emcNbCluster = i; }
199 inline void setEmcNweCluster(int i) { emcNweCluster = i; }
200 inline void setEmcNeeCluster(int i) { emcNeeCluster = i; }
201 inline void setEmcTotE(double i) { emcTotE = i; }
202 inline void setEmcLTotE(double i) { emcLTotE = i; }
203 inline void setEmcRTotE(double i) { emcRTotE = i; }
204 inline void setEmcBTotE(double i) { emcBTotE = i; }
205 inline void setEmcETotE(double i) { emcETotE = i; }
206 inline void setEmcLBTotE(double i) { emcLBTotE = i; }
207 inline void setEmcRBTotE(double i) { emcRBTotE = i; }
208 inline void setEmcWETotE(double i) { emcWETotE = i; }
209 inline void setEmcEETotE(double i) { emcEETotE = i; }
210 inline void setBTCEnergy(int theta, int phi, double energy) { emcBTCEnergy[theta][phi] = energy; }
211 inline void setWETCEnergy(int theta, int phi, double energy) { emcWETCEnergy[theta][phi] = energy; }
212 inline void setEETCEnergy(int theta, int phi, double energy) { emcEETCEnergy[theta][phi] = energy; }
213 inline void setEmcBlockE(std::vector<double> i) { emcBlockE = i; }
214 inline void setEmcClusId(map<int,vector<complex<int> >, greater<int> > i) { emcClusId = i; }
215 inline void setEmcClusE(std::vector<double> i) { emcClusE = i; }
216
217 //get EMC information
218 //get EMC trigger conditions
219 inline bool getNClus1() { return emc_NClus1; }
220 inline bool getNClus2() { return emc_NClus2; }
221 inline bool getNBClus1() { return emc_NBClus1; }
222 inline bool getNEClus1() { return emc_NEClus1; }
223 inline bool getBClusBB() { return emc_BClusBB; }
224 inline bool getEClusBB() { return emc_EClusBB; }
225 inline bool getClus_Z() { return emc_Clus_Z; }
226 inline bool getBClus_PHI() { return emc_BClus_PHI; }
227 inline bool getEClus_PHI() { return emc_EClus_PHI; }
228 inline bool getBEtot_H() { return emc_BEtot_H; }
229 inline bool getEEtot_H() { return emc_EEtot_H; }
230 inline bool getEtot_L() { return emc_Etot_L; }
231 inline bool getEtot_M() { return emc_Etot_M; }
232 inline bool getBL_Z() { return emc_BL_Z; }
233 inline bool getDiff_B() { return emc_Diff_B; }
234 inline bool getDiff_E() { return emc_Diff_E; }
235 inline bool getBL_BBLK() { return emc_BL_BBLK; }
236 inline bool getBL_EBLK() { return emc_BL_EBLK; }
237
238 //get other information of EMC
239 inline std::vector<double>& getEmcBlockE() { return emcBlockE; };
240 inline int getEmcNbCluster() { return emcNbCluster; }
241 inline int getEmcNweCluster() { return emcNweCluster; }
242 inline int getEmcNeeCluster() { return emcNeeCluster; }
243 inline double getEmcTotE() { return emcTotE; }
244 inline double getEmcLTotE() { return emcLTotE; }
245 inline double getEmcRTotE() { return emcRTotE; }
246 inline double getEmcBTotE() { return emcBTotE; }
247 inline double getEmcETotE() { return emcETotE; }
248 inline double getEmcLBTotE() { return emcLBTotE; }
249 inline double getEmcRBTotE() { return emcRBTotE; }
250 inline double getEmcWETotE() { return emcWETotE; }
251 inline double getEmcEETotE() { return emcEETotE; }
252 inline double getBTCEnergy(int theta, int phi) { return emcBTCEnergy[theta][phi]; }
253 inline double getWETCEnergy(int theta, int phi) { return emcWETCEnergy[theta][phi]; }
254 inline double getEETCEnergy(int theta, int phi) { return emcEETCEnergy[theta][phi]; }
255 inline map<int,vector<complex<int> >,greater<int> > getEmcClusId() { return emcClusId; }
256 inline std::vector<double> getEmcClusE() { return emcClusE; }
257
258 //set Muc information
259 //set Muc trigger conditions
260 inline void setMucBB3478(bool i) { muc_BB3478 = i; }
261 inline void setMucBB37(bool i) { muc_BB37 = i; }
262
263 //set other Muc infor.
264 inline void setMucIndex(std::vector<int> i) { muc_index = i; }
265 inline void setMucNtrackBR(int i) { muc_ntrackBR = i; }
266 inline void setMucNtrackEC(int i) { muc_ntrackEC = i; }
267 inline void setMucN3ltrackTotal(int i) { muc_n3ltracktotal = i; }
268
269 //get Muc information
270 //get Muc trigger conditions
271 inline bool getMucBB3478() { return muc_BB3478; }
272 inline bool getMucBB37() { return muc_BB37; }
273
274 //get other Muc infor.
275 inline std::vector<int> getMuclayerSeg() { return muc_vlayerSeg; }
276 inline std::vector<int> getMuchitLayer() { return muc_vhitLayer; }
277 inline std::vector<int> getMuchitSeg() { return muc_vhitSeg; }
278 inline std::vector<int> getMucIndex() { return muc_index; }
279 inline int getMucNhitEE() { return muc_nhitEE; }
280 inline int getMucNhitBR() { return muc_nhitBR; }
281 inline int getMucNhitWE() { return muc_nhitWE; }
282 inline int getMucNhitTotal() { return muc_nhitTotal; }
283 inline int getMucNlayerBR() { return muc_nlayerBR; }
284 inline int getMucNlayerWE() { return muc_nlayerWE; }
285 inline int getMucNlayerEE() { return muc_nlayerEE; }
286 inline int getMucNtrackBR() { return muc_ntrackBR; }
287 inline int getMucNtrackEC() { return muc_ntrackEC; }
288 inline int getMucN3ltrackTotal() { return muc_n3ltracktotal; }
289
290 //set track match trigger conditions
291 inline void setTMNATrk1(bool i) { tm_NATrk1 = i; }
292 inline void setTMNATrk2(bool i) { tm_NATrk2 = i; }
293 inline void setTMATrkBB(bool i) { tm_ATrk_BB = i; }
294 inline void setTMNBTrk1(bool i) { tm_NBTrk1 = i; }
295 inline void setTMNBTrk2(bool i) { tm_NBTrk2 = i; }
296 inline void setTMBTrkBB(bool i) { tm_BTrk_BB = i; }
297 inline void setTMNCTrk1(bool i) { tm_NCTrk1 = i; }
298 inline void setTMNCTrk2(bool i) { tm_NCTrk2 = i; }
299 inline void setTMCTrkBB(bool i) { tm_CTrk_BB = i; }
300
301 //get track match trigger conditions
302 inline bool getTMNATrk1() { return tm_NATrk1; }
303 inline bool getTMNATrk2() { return tm_NATrk2; }
304 inline bool getTMATrkBB() { return tm_ATrk_BB; }
305 inline bool getTMNBTrk1() { return tm_NBTrk1; }
306 inline bool getTMNBTrk2() { return tm_NBTrk2; }
307 inline bool getTMBTrkBB() { return tm_BTrk_BB; }
308 inline bool getTMNCTrk1() { return tm_NCTrk1; }
309 inline bool getTMNCTrk2() { return tm_NCTrk2; }
310 inline bool getTMCTrkBB() { return tm_CTrk_BB; }
311
312 //get endcap track match mode
313 inline int getEndCapMode() { return tm_endcap; }
314
315private:
316 BesMdcTrig* m_MdcTrig;
317 BesTofTrig* m_TofTrig;
318 BesEmcTrig* m_EmcTrig;
319 BesMucTrig* m_MucTrig;
320 BesTMTrig* m_TMTrig;
321
322 std::vector<int> trigOut;
323
324 std::vector<std::string> trigChannel;
325 std::vector<std::string> trigCondName;
326 std::vector<std::string> trigTable;
327 std::vector<int> channelNo;
328
329 double m_evttime;
330
331 bool m_goodEvent;
332
333 //MDC
334 //MDC trigger conditions
335 bool mdc_STrk_BB,mdc_NStrkN,mdc_NStrk2,mdc_NStrk1;
336 bool mdc_LTrk_BB,mdc_NLtrkN,mdc_NLtrk2,mdc_NLtrk1;
337 bool mdc_NItrk1,mdc_NItrk2;
338
339 //Other variables in MDC
340 std::vector<int> mdcStrkId;
341 std::vector<int> mdcLtrkId;
342
343 //TOF
344 //TOF trigger conditions
345 bool tof_NBTof1,tof_NBTof2,tof_NETof1,tof_NETof2,tof_NTof1;
346 bool tof_BTofBB,tof_ETofBB;
347 //Other variables in TOF
348 map<int,vector<int>,greater<int> > tofHitPos;
349 std::vector<int> btofHitMap;
350 std::vector<int> etofHitMap;
351
352 //EMC
353 //EMC trigger conditions
354 bool emc_NClus1, emc_NClus2, emc_NBClus1, emc_NEClus1, emc_BClusBB,emc_EClusBB,emc_Clus_Z,emc_BClus_PHI;
355 bool emc_EClus_PHI,emc_BEtot_H,emc_EEtot_H,emc_Etot_L,emc_Etot_M,emc_BL_Z;
356 bool emc_Diff_B,emc_Diff_E,emc_BL_BBLK,emc_BL_EBLK;
357
358 //Other variables in EMC
359 double emcBarrelGate, emcEndGate;
360 double emcTotE,emcLTotE,emcRTotE,emcBTotE,emcETotE,emcLBTotE,emcRBTotE,emcWETotE,emcEETotE;
361 int emcNbCluster,emcNweCluster,emcNeeCluster;
362 std::vector<double> emcBlockE;
363 std::vector<double> emcClusE;
364 map<int,vector<complex<int> >, greater<int> > emcClusId;
365 double emcBTCEnergy[TrigConf::TCTHETANO_B][TrigConf::TCPHINO_B];
366 double emcWETCEnergy[TrigConf::TCTHETANO_E][TrigConf::TCPHINO_E];
367 double emcEETCEnergy[TrigConf::TCTHETANO_E][TrigConf::TCPHINO_E];
368
369 //muc
370 //MUC trigger conditions
371 bool muc_BB3478, muc_BB37;
372
373 //Other variables in MUC
374 int muc_nhitEE, muc_nhitBR, muc_nhitWE, muc_nhitTotal;
375 int muc_nlayerBR, muc_nlayerWE, muc_nlayerEE;
376 int muc_ntrackBR, muc_ntrackEC;
377 int muc_n3ltracktotal;
378 std::vector<int> muc_vlayerSeg;
379 std::vector<int> muc_vhitLayer;
380 std::vector<int> muc_vhitSeg;
381 std::vector<int> muc_index;
382
383 //Track match
384 //TM trigger conditions
385 bool tm_NATrk1, tm_NATrk2, tm_ATrk_BB, tm_NBTrk1, tm_NBTrk2, tm_BTrk_BB, tm_NCTrk1, tm_NCTrk2, tm_CTrk_BB;
386
387 //trigger lines which can trigger events
388 std::vector<std::string> vTrigLine;
389
390 //trigger condition status in each events
391 std::vector<int> vTrigCond;
392
393 //trigger condition Id, from 0--47
394 bool trigCond[48];
395
396 //trigger data which need to be registered to TDS
397 int m_trigCondition[48];
398 int m_trigChannel[16];
399
400 //L1 signal
401 bool ifpass;
402
403 //run mode
404 int m_runMode;
405 int m_tofLayer;
406 std::string trigTableFile;
407
408 //property
409 double L1TC_GATE;
410 double L1TC_THRESH;
411 int L1ETOT_L;
412 int L1ETOT_L_Peak;
413 int L1ETOT_L_Sigma;
414 int L1ETOT_M;
415 int L1ETOT_M_Peak;
416 int L1ETOT_M_Sigma;
417 int L1ETOT_BR;
418 int L1ETOT_BR_Peak;
419 int L1ETOT_BR_Sigma;
420 int L1ETOT_EC;
421 int L1ETOT_EC_Peak;
422 int L1ETOT_EC_Sigma;
423 int L1EBL_BR;
424 int L1EBL_EC;
425 int L1EDIFF_BR;
426 int L1EDIFF_EC;
427 int L1BLK_GATE;
428 int L1EBL_Z;
429 int L1EBL_Z_Peak;
430 int L1EBL_Z_Sigma;
431 int MAXMDCTRACK;
432 double Energy_Ratio;
433 //endcap track match 0: MDC&TOF; 1: MDC&TOF&EMC
434 int tm_endcap;
435
436 // Reference to RealizationSvc
437 RealizationSvc* m_RealizationSvc;
438
439 static const std::string COND_NAME[48]; //The name of each trigger condition
440};
441#endif
************Class m_ypar INTEGER m_KeyWgt INTEGER m_KeyIHVP INTEGER m_KeyGPS INTEGER m_IsBeamPolarized INTEGER m_EvtGenInterface DOUBLE PRECISION m_Emin DOUBLE PRECISION m_sphot DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_q2 DOUBLE PRECISION m_PolBeam2 DOUBLE PRECISION m_xErrPb *COMMON c_KK2f $ !CMS energy average $ !Spin Polarization vector first beam $ !Spin Polarization vector second beam $ !Beam energy spread[GeV] $ !minimum hadronization energy[GeV] $ !input READ never touch them !$ !debug facility $ !maximum weight $ !inverse alfaQED $ !minimum real photon energy
Definition: KK2f.h:50
void setBTCEnergy(int theta, int phi, double energy)
void setEmcClusId(map< int, vector< complex< int > >, greater< int > > i)
StatusCode GlobalTrig()
virtual StatusCode initialize()
Initialise the service (Inherited Service overrides)
map< int, vector< complex< int > >, greater< int > > getEmcClusId()
virtual StatusCode finalize()
Finalise the service.
void handle(const Incident &)
void setEETCEnergy(int theta, int phi, double energy)
void setWETCEnergy(int theta, int phi, double energy)
map< int, vector< int >, greater< int > > getTofHitPos()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
StatusCode setTrigCondition()
void setTofHitPos(map< int, vector< int >, greater< int > > i)