CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
EFResult Class Reference

#include <EFResult.h>

+ Inheritance diagram for EFResult:

Public Member Functions

 EFResult (std::vector< std::string >)
 
 EFResult (std::vector< uint32_t >, uint32_t)
 
 EFResult ()
 
virtual ~EFResult ()
 
virtual const CLID & clID () const
 
const std::vector< uint32_t > getEFVec () const
 
const uint32_t getEFVec (uint32_t pos) const
 
bool push_back (uint32_t val)
 
bool appToEFVec (double val, uint32_t pos)
 
bool addToEFVec (uint32_t val, uint32_t pos)
 
bool setVecBit (uint32_t val, uint32_t vecpos, uint32_t bbegin, uint32_t bend)
 
bool setVecBit (bool val, uint32_t vecpos, uint32_t bitpos)
 
void setAnswer (std::string &answer)
 
void setMidAnswer (std::string &answer)
 
void reset ()
 
const std::string getAnswer () const
 
const std::string getMidAnswer () const
 
const int getAnswerIndex () const
 
const int getMidAnswerIndex () const
 
const int getDecNum () const
 

Static Public Member Functions

static const CLID & classID ()
 

Detailed Description

Definition at line 24 of file EFResult.h.

Constructor & Destructor Documentation

◆ EFResult() [1/3]

EFResult::EFResult ( std::vector< std::string >  ans)

Definition at line 4 of file EFResult.cxx.

5 : m_answerVector(ans),
6 m_answerIndex(-1),
7 m_midanswerIndex(-1),
8 m_efVec()
9{
10}

◆ EFResult() [2/3]

EFResult::EFResult ( std::vector< uint32_t >  vec,
uint32_t  pos 
)

Definition at line 12 of file EFResult.cxx.

13 : m_answerVector(),
14 m_answerIndex(-1),
15 m_midanswerIndex(-1),
16 m_efVec()
17{
18 if(vec.size()+pos>54) {
19 std::cout <<"***EFResult:EFResult(): vector size error!" << std::endl;
20 m_efVec.resize(54,0);
21 }
22 else{
23 for(unsigned int i=0;i<54;++i){
24 if(i<pos||i>=vec.size()+pos) m_efVec.push_back(0);
25 else m_efVec.push_back(vec[i-pos]);
26 }
27 }
28}
dble_vec_t vec[12]
Definition: ranlxd.c:372

◆ EFResult() [3/3]

EFResult::EFResult ( )

Definition at line 30 of file EFResult.cxx.

30 :
31 m_answerVector(),
32 m_answerIndex(-1),
33 m_midanswerIndex(-1),
34 m_efVec()
35{
36
37}

◆ ~EFResult()

EFResult::~EFResult ( )
virtual

Definition at line 39 of file EFResult.cxx.

39{}

Member Function Documentation

◆ addToEFVec()

bool EFResult::addToEFVec ( uint32_t  val,
uint32_t  pos 
)

Definition at line 81 of file EFResult.cxx.

82{
83 if(pos>=54) return false;
84 if(m_efVec.size()!=0&&m_efVec.size()<54){
85 std::cout << "EFResult::addToEFVec-->size error!" <<std::endl;
86 }
87 if(m_efVec.size()==0) m_efVec.resize(54,0);
88
89 m_efVec[pos] +=val;
90
91 return true;
92}

Referenced by EFChargedTrack::execute(), EFDetectorHits::execute(), EFFlightTime::execute(), EFGlobalEnergy::execute(), EFProcessCluster::execute(), and EFSectorHits::execute().

◆ appToEFVec()

bool EFResult::appToEFVec ( double  val,
uint32_t  pos 
)

Definition at line 68 of file EFResult.cxx.

69{
70 if(pos>=54) return false;
71 if(m_efVec.size()!=0&&m_efVec.size()<54){
72 std::cout << "EFResult::appToEFVec-->size error!" <<std::endl;
73 }
74 if(m_efVec.size()==0) m_efVec.resize(54,0);
75 float a=val;
76 float *f=(float*)&m_efVec[pos];
77 *f = a;
78 return true;
79}

Referenced by EFChargedTrack::execute(), EFFlightTime::execute(), EFGlobalEnergy::execute(), and EFProcessCluster::execute().

◆ classID()

const CLID & EFResult::classID ( )
static

Definition at line 41 of file EFResult.cxx.

42{
43 return CLID_EFResult; // hxt ClassID_traits<EFResult>::ID();
44}

Referenced by clID().

◆ clID()

const CLID & EFResult::clID ( ) const
virtual

Definition at line 46 of file EFResult.cxx.

47{
48 return EFResult::classID();
49}
static const CLID & classID()
Definition: EFResult.cxx:41

◆ getAnswer()

const std::string EFResult::getAnswer ( ) const

Definition at line 166 of file EFResult.cxx.

166{ return m_answerVector[m_answerIndex]; }

Referenced by EFEventLoopMgr::EF_Decision(), CheckEFResult::execute(), and EFtoTDS::execute().

◆ getAnswerIndex()

const int EFResult::getAnswerIndex ( ) const

Definition at line 168 of file EFResult.cxx.

168{ return m_answerIndex; }

Referenced by EFEventLoopMgr::EF_Decision(), StepHandler::execute(), CheckEFResult::execute(), and EFtoTDS::execute().

◆ getDecNum()

const int EFResult::getDecNum ( ) const
inline

Definition at line 68 of file EFResult.h.

68 {
69 if(m_efVec.size()>=54)return m_efVec.size()-54;
70 else return 0;
71 }

Referenced by EFEventLoopMgr::EF_Fragment_Address(), and EFtoTDS::execute().

◆ getEFVec() [1/2]

const std::vector< uint32_t > EFResult::getEFVec ( ) const

◆ getEFVec() [2/2]

const uint32_t EFResult::getEFVec ( uint32_t  pos) const

Definition at line 55 of file EFResult.cxx.

56{
57 if(pos>=m_efVec.size())return 0;
58 else return m_efVec[pos];
59}

◆ getMidAnswer()

const std::string EFResult::getMidAnswer ( ) const

Definition at line 170 of file EFResult.cxx.

170{ return m_answerVector[m_midanswerIndex]; }

◆ getMidAnswerIndex()

const int EFResult::getMidAnswerIndex ( ) const

Definition at line 172 of file EFResult.cxx.

172{ return m_midanswerIndex; }

Referenced by EFEventLoopMgr::EF_Algorithm_Tag().

◆ push_back()

bool EFResult::push_back ( uint32_t  val)

Definition at line 61 of file EFResult.cxx.

61 {
62 if(m_efVec.size()>0&&m_efVec.size()<54) return false;
63 if(m_efVec.size()==0) m_efVec.resize(54,0);
64 m_efVec.push_back(val);
65 return true;
66}

Referenced by StepHandler::execute().

◆ reset()

void EFResult::reset ( )

Definition at line 153 of file EFResult.cxx.

154{
155 m_answerIndex = -1;
156 m_midanswerIndex = -1;
157 if(m_efVec.size()>=54){
158 m_efVec.resize(54,0);
159 for(unsigned int i=0;i<m_efVec.size();++i) m_efVec[i]=0;
160 }
161 else if(m_efVec.size()!=0){
162 std::cout <<"EFResult::reset(): m_efVec size check error!"<<std::endl;
163 }
164}

Referenced by StepHandler::execute(), and EFEventLoopMgr::executeEvent().

◆ setAnswer()

void EFResult::setAnswer ( std::string &  answer)

Definition at line 115 of file EFResult.cxx.

116{
117 int iCount = 0;
118
119 std::vector<std::string>::iterator itVs = m_answerVector.begin();
120 std::vector<std::string>::iterator endVs = m_answerVector.end();
121 for (;itVs != endVs && m_answerIndex == -1; ++itVs) {
122 if (*itVs == answer) {
123 m_answerIndex = iCount;
124
125 // Store the answer index in the first data member field
126 // zoujh: memory leak ... what's the use of m_efVec ?
127 //m_efVec.push_back(m_answerIndex);
128 }
129 iCount++;
130 }
131}

Referenced by StepHandler::execute(), and EFEventLoopMgr::executeEvent().

◆ setMidAnswer()

void EFResult::setMidAnswer ( std::string &  answer)

Definition at line 133 of file EFResult.cxx.

134{
135 int iCount = 0;
136 //cout << "EFResult::setMidAnswer "<<answer<<" ("<<m_answerVector.size()<<")"<<endl;
137 std::vector<std::string>::iterator itVs = m_answerVector.begin();
138 std::vector<std::string>::iterator endVs = m_answerVector.end();
139 for (;itVs != endVs && m_answerIndex == -1; ++itVs) {
140 if (*itVs == answer) {
141 m_midanswerIndex = iCount;
142
143 // Store the answer index in the first data member field
144 // zoujh: memory leak ... what's the use of m_efVec ?
145 //m_efVec.push_back(m_answerIndex);
146 }
147 //cout<<(*itVs)<<endl;
148 iCount++;
149 }
150 //cout<<m_midanswerIndex<<endl;
151}

Referenced by StepHandler::execute().

◆ setVecBit() [1/2]

bool EFResult::setVecBit ( bool  val,
uint32_t  vecpos,
uint32_t  bitpos 
)

Definition at line 105 of file EFResult.cxx.

106{
107 if(vecpos>=54) return false;
108 if(bitpos>=32) return false;
109 if(m_efVec.size()==0) m_efVec.resize(54,0);
110 if(val) m_efVec[vecpos]|=(1<<bitpos);
111 else m_efVec[vecpos]&=(~(1<<bitpos));
112 return true;
113}

◆ setVecBit() [2/2]

bool EFResult::setVecBit ( uint32_t  val,
uint32_t  vecpos,
uint32_t  bbegin,
uint32_t  bend 
)

Definition at line 94 of file EFResult.cxx.

95{
96 if(vecpos>=54) return false;
97 if(bend>=32||bbegin>bend) return false;
98 if(m_efVec.size()==0) m_efVec.resize(54,0);
99 uint32_t bits=0xFFFFFFFF>>(31-bend+bbegin);
100 m_efVec[vecpos]&= (~((bits)<<bbegin));
101 m_efVec[vecpos]|= (val&bits)<<bbegin;
102 return true;
103}

Referenced by EFChargedTrack::execute(), EFDetectorHits::execute(), EFFlightTime::execute(), EFGlobalEnergy::execute(), EFProcessCluster::execute(), and EFSectorHits::execute().


The documentation for this class was generated from the following files: