BOSS 6.6.4.p01
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 84 of file EFResult.cxx.

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

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 //m_efVec[pos]=val*1000000.;
76 float a=val;
77 m_efVec[pos]=*((uint32_t*)&a);
78 //double* p=m_efVec;
79 //p[pos]=val;
80 //std::cout <<"Before:"<<val<<"; "<<a<<"; After:"<<*((float*)(&(m_efVec[pos])))<<endl;
81 return true;
82}

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 169 of file EFResult.cxx.

169{ return m_answerVector[m_answerIndex]; }

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

◆ getAnswerIndex()

const int EFResult::getAnswerIndex ( ) const

Definition at line 171 of file EFResult.cxx.

171{ 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 173 of file EFResult.cxx.

173{ return m_answerVector[m_midanswerIndex]; }

◆ getMidAnswerIndex()

const int EFResult::getMidAnswerIndex ( ) const

Definition at line 175 of file EFResult.cxx.

175{ 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 156 of file EFResult.cxx.

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

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

◆ setAnswer()

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

Definition at line 118 of file EFResult.cxx.

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

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

◆ setMidAnswer()

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

Definition at line 136 of file EFResult.cxx.

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

Referenced by StepHandler::execute().

◆ setVecBit() [1/2]

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

Definition at line 108 of file EFResult.cxx.

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

◆ setVecBit() [2/2]

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

Definition at line 97 of file EFResult.cxx.

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

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: