• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/Users/jmonk/Physics/ForIA/src/TriggerDecision.cxx

Go to the documentation of this file.
00001 #include "ForIA/TriggerDecision.hh"
00002 
00003 #include "ForIA/Event.hh"
00004 
00005 #include <stdexcept>
00006 #include <boost/lexical_cast.hpp>
00007 
00008 namespace ForIA {
00009   
00010   TriggerDecision::TriggerDecision(): m_ctpBits(0), m_filledBitSet(false), 
00011   m_efPassedPhysics(0), m_l2PassedPhysics(0), m_nTAVWords(8){}
00012   
00013   void TriggerDecision::setEvent(const Event &evt){
00014     m_trigConf = evt.triggerConfiguration();
00015     return;
00016   }
00017   
00019   bool TriggerDecision::passesL1(const string &name){
00020     fillBits();
00021     
00022     int pos = m_trigConf.l1Ctpid(name);
00023     
00024 //    std::cout<<"pos = "<<pos<<std::endl;
00025 //    std::cout<<m_l1Bits.size()<<std::endl;
00026     
00027     return m_l1Bits.test(pos);
00028     
00029   }
00030   
00032   void TriggerDecision::fillBits(){
00033     
00034     if(m_filledBitSet) return;
00035     
00036     if(m_ctpBits == 0){
00037       throw std::runtime_error("CTP TAV bits not set before requesting bitset");
00038     }
00039     
00040     if(m_ctpBits->size() != m_nTAVWords){
00041       throw std::runtime_error("Incorrect number of CTP TAV words: " + 
00042                                boost::lexical_cast<string>(m_ctpBits->size())+ ", should be "+
00043                                boost::lexical_cast<string>(m_nTAVWords));
00044     }
00045     
00046     m_l1Bits.reset();
00047     
00048     for(vector<unsigned int>::const_reverse_iterator word = m_ctpBits->rbegin();
00049         word != m_ctpBits->rend(); ++word){
00050       m_l1Bits <<= 32;
00051       m_l1Bits |= (*word);
00052     }
00053     
00054     m_filledBitSet = true;
00055     return;
00056   }
00057   
00059   bool TriggerDecision::passesEF(const string &name)const{
00060     if(m_efPassed.count(name) != 0) return true;
00061     if(m_efFailed.count(name) != 0) return false;
00062     
00063     if(m_efPassedPhysics == 0){
00064       throw std::runtime_error("TriggerDecision: Have not set the m_efPassedPhysics data!");
00065     }
00066     
00067     for(vector<short int>::const_iterator passed = m_efPassedPhysics->begin();
00068         passed != m_efPassedPhysics->end(); ++passed){
00069       string passedName = m_trigConf.hltChainName(*passed);
00070       m_efPassed.insert(passedName);
00071       if(passedName==name)return true;
00072     }
00073     
00074     m_efFailed.insert(name);
00075     
00076     return false;
00077   }
00079   bool TriggerDecision::passesL2(const string &name){
00080     if(m_l2Passed.count(name) != 0) return true;
00081     if(m_l2Failed.count(name) != 0) return false;
00082     
00083     if(m_l2PassedPhysics == 0){
00084       throw std::runtime_error("TriggerDecision: Have not set the m_l2PassedPhysics data!");
00085     }
00086     
00087     for(vector<short int>::const_iterator passed = m_l2PassedPhysics->begin();
00088         passed != m_l2PassedPhysics->end(); ++passed){
00089       string passedName = m_trigConf.hltChainName(*passed);
00090       m_l2Passed.insert(passedName);
00091       if(passedName==name) return true;
00092     }
00093     return false;
00094   }
00095   
00096   
00097 }

Generated on Mon Jul 30 2012 16:56:35 for ForIA by  doxygen 1.7.2