EFResult Class Reference

#include <EFResult.h>

List of all members.

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 ()

Private Attributes

std::vector< std::stringm_answerVector
 List of supported string answers.
int m_answerIndex
 Index of the chosen EF answer inside the List.
int m_midanswerIndex
std::vector< uint32_t > m_efVec
 Vector of 32bit ints with EFResult data members.


Detailed Description

Definition at line 24 of file EFResult.h.


Constructor & Destructor Documentation

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

Definition at line 4 of file EFResult.cxx.

00005   : m_answerVector(ans),
00006     m_answerIndex(-1), 
00007     m_midanswerIndex(-1),
00008     m_efVec()
00009 {
00010 }

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

Definition at line 12 of file EFResult.cxx.

References genRecEmupikp::i, and m_efVec.

00013   : m_answerVector(),
00014     m_answerIndex(-1),
00015     m_midanswerIndex(-1),
00016     m_efVec()
00017 {
00018   if(vec.size()+pos>54) {
00019     std::cout <<"***EFResult:EFResult(): vector size error!" << std::endl;
00020     m_efVec.resize(54,0);
00021   }
00022   else{
00023     for(unsigned int i=0;i<54;++i){
00024       if(i<pos||i>=vec.size()+pos) m_efVec.push_back(0);
00025       else                         m_efVec.push_back(vec[i-pos]);
00026     }
00027   }
00028 }

EFResult::EFResult (  ) 

Definition at line 30 of file EFResult.cxx.

00030                   :
00031   m_answerVector(),
00032   m_answerIndex(-1),
00033   m_midanswerIndex(-1),
00034   m_efVec()
00035 {
00036 
00037 }

EFResult::~EFResult (  )  [virtual]

Definition at line 39 of file EFResult.cxx.

00039 {}


Member Function Documentation

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

Definition at line 81 of file EFResult.cxx.

References m_efVec.

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

00082 {
00083   if(pos>=54) return false;
00084   if(m_efVec.size()!=0&&m_efVec.size()<54){
00085     std::cout << "EFResult::addToEFVec-->size error!" <<std::endl;
00086   }
00087   if(m_efVec.size()==0) m_efVec.resize(54,0);
00088 
00089   m_efVec[pos] +=val;
00090 
00091   return true;
00092 }

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

Definition at line 68 of file EFResult.cxx.

References m_efVec.

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

00069 {
00070   if(pos>=54) return false;
00071   if(m_efVec.size()!=0&&m_efVec.size()<54){
00072     std::cout << "EFResult::appToEFVec-->size error!" <<std::endl;
00073   }
00074   if(m_efVec.size()==0) m_efVec.resize(54,0);
00075   float a=val;
00076   float *f=(float*)&m_efVec[pos];
00077   *f = a;
00078   return true;
00079 }

const CLID & EFResult::classID (  )  [static]

Definition at line 41 of file EFResult.cxx.

References CLID_EFResult.

Referenced by clID().

00042 {
00043   return CLID_EFResult; // hxt  ClassID_traits<EFResult>::ID();
00044 }

const CLID & EFResult::clID (  )  const [virtual]

Definition at line 46 of file EFResult.cxx.

References classID().

00047 {
00048   return EFResult::classID();
00049 }

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

Definition at line 166 of file EFResult.cxx.

References m_answerIndex, and m_answerVector.

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

00166 { return m_answerVector[m_answerIndex]; }

const int EFResult::getAnswerIndex (  )  const

Definition at line 168 of file EFResult.cxx.

References m_answerIndex.

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

00168 { return m_answerIndex; }

const int EFResult::getDecNum (  )  const [inline]

Definition at line 68 of file EFResult.h.

References m_efVec.

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

00068                              { 
00069     if(m_efVec.size()>=54)return m_efVec.size()-54;
00070     else return 0;
00071   }

const uint32_t EFResult::getEFVec ( uint32_t  pos  )  const

Definition at line 55 of file EFResult.cxx.

References m_efVec.

00056 {
00057   if(pos>=m_efVec.size())return 0;
00058   else return m_efVec[pos];
00059 }

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

Definition at line 51 of file EFResult.cxx.

References m_efVec.

Referenced by EFEventLoopMgr::EF_Algorithm_Tag(), EFEventLoopMgr::EF_Fragment_Address(), EFEventLoopMgr::EF_Total_Energy(), EFtoTDS::execute(), EFSectorHits::execute(), and CheckEFResult::execute().

00052 {
00053   return m_efVec;
00054 }

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

Definition at line 170 of file EFResult.cxx.

References m_answerVector, and m_midanswerIndex.

00170 { return m_answerVector[m_midanswerIndex]; }

const int EFResult::getMidAnswerIndex (  )  const

Definition at line 172 of file EFResult.cxx.

References m_midanswerIndex.

Referenced by EFEventLoopMgr::EF_Algorithm_Tag().

00172 { return m_midanswerIndex; }

bool EFResult::push_back ( uint32_t  val  ) 

Definition at line 61 of file EFResult.cxx.

References m_efVec.

Referenced by StepHandler::execute().

00061                                     {
00062   if(m_efVec.size()>0&&m_efVec.size()<54) return false;
00063   if(m_efVec.size()==0) m_efVec.resize(54,0);
00064   m_efVec.push_back(val);
00065   return true;
00066 }

void EFResult::reset (  ) 

Definition at line 153 of file EFResult.cxx.

References genRecEmupikp::i, m_answerIndex, m_efVec, and m_midanswerIndex.

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

00154 {
00155   m_answerIndex = -1;
00156   m_midanswerIndex = -1;
00157   if(m_efVec.size()>=54){
00158     m_efVec.resize(54,0);
00159     for(unsigned int i=0;i<m_efVec.size();++i)  m_efVec[i]=0;
00160   }
00161   else if(m_efVec.size()!=0){
00162     std::cout <<"EFResult::reset(): m_efVec size check error!"<<std::endl;
00163   }
00164 }

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

Definition at line 115 of file EFResult.cxx.

References m_answerIndex, and m_answerVector.

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

00116 {
00117   int iCount = 0;
00118 
00119   std::vector<std::string>::iterator itVs = m_answerVector.begin();
00120   std::vector<std::string>::iterator endVs = m_answerVector.end();
00121   for (;itVs != endVs && m_answerIndex == -1; ++itVs) {
00122     if (*itVs == answer) {
00123       m_answerIndex = iCount;
00124       
00125       // Store the answer index in the first data member field
00126       // zoujh: memory leak ... what's the use of m_efVec ?
00127       //m_efVec.push_back(m_answerIndex); 
00128     }
00129     iCount++;
00130   }
00131 }

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

Definition at line 133 of file EFResult.cxx.

References m_answerIndex, m_answerVector, and m_midanswerIndex.

Referenced by StepHandler::execute().

00134 {
00135   int iCount = 0;
00136   //cout << "EFResult::setMidAnswer   "<<answer<<" ("<<m_answerVector.size()<<")"<<endl;
00137   std::vector<std::string>::iterator itVs = m_answerVector.begin();
00138   std::vector<std::string>::iterator endVs = m_answerVector.end();
00139   for (;itVs != endVs && m_answerIndex == -1; ++itVs) {
00140     if (*itVs == answer) {
00141       m_midanswerIndex = iCount;
00142 
00143       // Store the answer index in the first data member field
00144       // zoujh: memory leak ... what's the use of m_efVec ?
00145       //m_efVec.push_back(m_answerIndex);
00146     }
00147     //cout<<(*itVs)<<endl;
00148     iCount++;
00149   }
00150   //cout<<m_midanswerIndex<<endl;
00151 }

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

Definition at line 105 of file EFResult.cxx.

References m_efVec.

00106 {
00107   if(vecpos>=54) return false;
00108   if(bitpos>=32) return false;
00109   if(m_efVec.size()==0) m_efVec.resize(54,0);
00110   if(val) m_efVec[vecpos]|=(1<<bitpos);
00111   else    m_efVec[vecpos]&=(~(1<<bitpos));
00112   return true;
00113 }

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

Definition at line 94 of file EFResult.cxx.

References m_efVec.

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

00095 {
00096   if(vecpos>=54) return false;
00097   if(bend>=32||bbegin>bend) return false;
00098   if(m_efVec.size()==0) m_efVec.resize(54,0);
00099   uint32_t bits=0xFFFFFFFF>>(31-bend+bbegin);
00100   m_efVec[vecpos]&=  (~((bits)<<bbegin));
00101   m_efVec[vecpos]|= (val&bits)<<bbegin;
00102   return true;
00103 }


Member Data Documentation

int EFResult::m_answerIndex [private]

Index of the chosen EF answer inside the List.

Definition at line 74 of file EFResult.h.

Referenced by getAnswer(), getAnswerIndex(), reset(), setAnswer(), and setMidAnswer().

std::vector<std::string> EFResult::m_answerVector [private]

List of supported string answers.

Definition at line 73 of file EFResult.h.

Referenced by getAnswer(), getMidAnswer(), setAnswer(), and setMidAnswer().

std::vector<uint32_t> EFResult::m_efVec [private]

Vector of 32bit ints with EFResult data members.

Definition at line 76 of file EFResult.h.

Referenced by addToEFVec(), appToEFVec(), EFResult(), getDecNum(), getEFVec(), push_back(), reset(), and setVecBit().

int EFResult::m_midanswerIndex [private]

Definition at line 75 of file EFResult.h.

Referenced by getMidAnswer(), getMidAnswerIndex(), reset(), and setMidAnswer().


Generated on Tue Nov 29 23:18:37 2016 for BOSS_7.0.2 by  doxygen 1.4.7