BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMdcTrig.cxx
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool /
3//
4//---------------------------------------------------------------------------/
5//
6//Description:
7//Author: Caogf
8//Created: Feb, 2006
9//Modified:
10//Comment:
11
12#include "Trigger/BesMdcTrig.h"
13#include "Trigger/MdcTCount.h"
14#include "Trigger/TrigPara.h"
15#include <iostream>
16#include <vector>
17#include <algorithm>
18
21#include "GaudiKernel/ISvcLocator.h"
22#include "GaudiKernel/Bootstrap.h"
23#include "GaudiKernel/IDataProviderSvc.h"
24
25using namespace TrigConf;
26
28{
29 m_MdcTCount = new MdcTCount();
30}
32{
33 if(m_MdcTCount) delete m_MdcTCount;
34}
36{
37 StatusCode sc = Gaudi::svcLocator()->service("BesGlobalTrigSvc", m_tmpSvc);
38 m_pIBGT = dynamic_cast<BesGlobalTrigSvc* >(m_tmpSvc);
39
40 NLtrk1 = false;
41 NLtrk2 = false;
42 NLtrkN = false;
43 LTrk_BB = false;
44 NStrk1 = false;
45 NStrk2 = false;
46 NStrkN = false;
47 STrk_BB = false;
48 NItrk1 = false;
49 NItrk2 = false;
50
51 if(!m_MdcTCount) std::cerr<<"can not initialize mdcTCount"<<std::endl;
52 m_MdcTCount->GetTCount();
53 int nItrk1 = m_MdcTCount->GetnItrkSL1();
54 int nItrk2 = m_MdcTCount->GetnItrkSL2();
55
56// std::cout<<"track number is "<<s<<" "<<l<<std::endl;
57 //trigger condition of short and long track in outer room
58 int MAXMDCTRACK = m_pIBGT->getMAXMDCTRACK();
59 if((nItrk1 >= 1) || (nItrk2 >= 1)) NItrk1 = true;
60 if((nItrk1 >= 1) && (nItrk2 >= 1)) NItrk2 = true;
61
62 //trigger condition of babar using short track information
63 std::vector<int> stmp;
64 std::vector<int>::iterator siter;
65 stmp.clear();
66 stmp = m_MdcTCount->GetstrackId();
67 int nstrk = stmp.size();
68 if(nstrk>=1) NStrk1 = true;
69 if(nstrk>=2) NStrk2 = true;
70 if(nstrk>=MAXMDCTRACK) NStrkN = true;
71
72 // if(stmp.empty()) std::cout<<"have no short track id infor in vector tmp"<<std::endl;
73
74 for(siter=stmp.begin();siter!=stmp.end();siter++)
75 {
76 for(int i=0;i<15;i++)
77 {
78 if(((*siter)+i+57)>127)
79 {
80 int id;
81 id = (*siter)+i+57-128;
82 if(find(stmp.begin(),stmp.end(),id)!=stmp.end()) { STrk_BB = true; break; }
83 }
84 else
85 {
86 int id;
87 id = (*siter)+i+57;
88 if(find(stmp.begin(),stmp.end(),id)!=stmp.end()) { STrk_BB = true; break; }
89 }
90 }
91
92 if(STrk_BB == true) break;
93 }
94 //trigger condition of babar using long track information
95 std::vector<int> ltmp;
96 std::vector<int>::iterator liter;
97 ltmp.clear();
98 ltmp = m_MdcTCount->GetltrackId();
99 int nltrk = ltmp.size();
100 if(nltrk>=1) NLtrk1 = true;
101 if(nltrk>=2) NLtrk2 = true;
102 if(nltrk>=MAXMDCTRACK) NLtrkN = true;
103// if(ltmp.empty()) std::cout<<"have no long track id infor in vector tmp"<<std::endl;
104 for(liter=ltmp.begin();liter!=ltmp.end();liter++)
105 {
106 for(int i=0;i<15;i++)
107 {
108 if(((*liter)+i+57)>127)
109 {
110 int id;
111 id = (*liter)+i+57-128;
112 if(find(ltmp.begin(),ltmp.end(),id)!=ltmp.end()) { LTrk_BB = true; break; }
113 }
114 else
115 {
116 int id;
117 id = (*liter)+i+57;
118 if(find(ltmp.begin(),ltmp.end(),id)!=ltmp.end()) { LTrk_BB = true; break; }
119 }
120 }
121// std::cout<<"LTrk_BB is "<<LTrk_BB<<std::endl;
122 if(LTrk_BB == true) break;
123 }
124
125 //set trigger conditions in service
126 m_pIBGT->setSTrk_BB(STrk_BB);
127 m_pIBGT->setNStrkN(NStrkN);
128 m_pIBGT->setNStrk2(NStrk2);
129 m_pIBGT->setNStrk1(NStrk1);
130 m_pIBGT->setLTrk_BB(LTrk_BB);
131 m_pIBGT->setNLtrkN(NLtrkN);
132 m_pIBGT->setNLtrk2(NLtrk2);
133 m_pIBGT->setNLtrk1(NLtrk1);
134 m_pIBGT->setNItrk2(NItrk2);
135 m_pIBGT->setNItrk1(NItrk1);
136}
void setNStrk1(bool i)
void setNLtrkN(bool i)
void setNItrk1(bool i)
void setNLtrk1(bool i)
void setNStrkN(bool i)
void setNStrk2(bool i)
void setNLtrk2(bool i)
void setNItrk2(bool i)
void setSTrk_BB(bool i)
void setLTrk_BB(bool i)
void startMdcTrig()
Definition: BesMdcTrig.cxx:35
int GetnItrkSL2()
Definition: MdcTCount.h:17
int GetnItrkSL1()
Definition: MdcTCount.h:16
std::vector< int > & GetstrackId()
Definition: MdcTCount.h:18
void GetTCount()
Definition: MdcTCount.cxx:31
std::vector< int > & GetltrackId()
Definition: MdcTCount.h:19