CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

egHLT::TrigCodes::TrigBitSetMap Class Reference

#include <EgHLTTrigCodes.h>

List of all members.

Public Member Functions

TrigBitSet getCode (const char *descript) const
void getCodeName (TrigBitSet code, std::string &id) const
void printCodes ()
void setCode (const char *descript, TrigBitSet code)
void setCode (const char *descript, int bitNr)
size_t size () const
void sort ()
 TrigBitSetMap ()
 ~TrigBitSetMap ()

Static Public Member Functions

static bool keyComp (const std::pair< std::string, TrigBitSet > &lhs, const std::pair< std::string, TrigBitSet > &rhs)

Private Attributes

std::vector< std::pair
< std::string, TrigBitSet > > 
codeDefs_

Detailed Description

Definition at line 27 of file EgHLTTrigCodes.h.


Constructor & Destructor Documentation

egHLT::TrigCodes::TrigBitSetMap::TrigBitSetMap ( ) [inline]

Definition at line 34 of file EgHLTTrigCodes.h.

{}
egHLT::TrigCodes::TrigBitSetMap::~TrigBitSetMap ( ) [inline]

Definition at line 35 of file EgHLTTrigCodes.h.

{}

Member Function Documentation

TrigCodes::TrigBitSet TrigCodes::TrigBitSetMap::getCode ( const char *  descript) const

Definition at line 42 of file EgHLTTrigCodes.cc.

References first, newFWLiteAna::found, i, and NULL.

Referenced by egHLT::TrigCodes::getCode().

{ 
  //first copy the character string to a local array so we can manipulate it
  char localDescript[512];
  strcpy(localDescript,descript);
  
  TrigBitSet code; 
  char* codeKey = strtok(localDescript,":");
  //  std::map<std::string,int> ::const_iterator mapIt;
  while(codeKey!=NULL){
    bool found=false;

    for(size_t i=0;i<codeDefs_.size() && !found;i++){
      if(codeDefs_[i].first.compare(codeKey)==0){
        found=true;
        code |= codeDefs_[i].second;

       }
    }
   
    //  if(!found)  edm::LogError("TrigCodes::TrigBitSetMap") <<"TrigCodes::TrigBitSetMap::getCode : Error, Key "<<codeKey<<" not found";
    codeKey = strtok(NULL,":"); //getting new substring
    
  }
  return code;
}
void TrigCodes::TrigBitSetMap::getCodeName ( TrigBitSet  code,
std::string &  id 
) const

Definition at line 74 of file EgHLTTrigCodes.cc.

References relativeConstraints::empty, i, and edm::second().

Referenced by egHLT::TrigCodes::getCodeName().

{
  id.clear();
  for(size_t i=0;i<codeDefs_.size();i++){ 
    if((code&codeDefs_[i].second)==codeDefs_[i].second){
      if(!id.empty()) id+=":";//seperating entries by a ':'
      id+=codeDefs_[i].first;
    }
    
  }
 
}
bool TrigCodes::TrigBitSetMap::keyComp ( const std::pair< std::string, TrigBitSet > &  lhs,
const std::pair< std::string, TrigBitSet > &  rhs 
) [static]

Definition at line 69 of file EgHLTTrigCodes.cc.

Referenced by sort().

{
  return lhs.first < rhs.first;
}
void TrigCodes::TrigBitSetMap::printCodes ( )

Definition at line 87 of file EgHLTTrigCodes.cc.

References first, i, runTheMatrix::msg, and edm::second().

Referenced by egHLT::TrigCodes::printCodes().

{
  std::ostringstream msg;
  msg <<" trig bits defined: "<<std::endl;
  for(size_t i=0;i<codeDefs_.size();i++) msg <<" key : "<<codeDefs_[i].first<<" bit "<<codeDefs_[i].second<<std::endl;
  edm::LogInfo("TrigCodes") <<msg;
 
}
void TrigCodes::TrigBitSetMap::setCode ( const char *  descript,
int  bitNr 
)

Definition at line 19 of file EgHLTTrigCodes.cc.

References egHLT::TrigCodes::maxNrBits(), and setCode().

{
  if(bitNr<maxNrBits()){
    TrigBitSet code;
    code.set(bitNr);
    setCode(descript,code);
  }else{
    edm::LogWarning("TrigCodes::TrigBitSetMap") <<" Warning, trying to store at bit "<<bitNr<<" but max nr bits is "<<maxNrBits();
  }
}
void TrigCodes::TrigBitSetMap::setCode ( const char *  descript,
TrigBitSet  code 
)

Definition at line 30 of file EgHLTTrigCodes.cc.

References first, newFWLiteAna::found, and i.

Referenced by setCode(), and egHLT::TrigCodes::setCodes().

{
  bool found=false;
  for(size_t i=0;i<codeDefs_.size() && !found;i++){
    if(codeDefs_[i].first.compare(descript)==0) found=true;
  }
  if(!found) codeDefs_.push_back(std::pair<std::string,TrigBitSet>(descript,code));
  //_codeDefs[descript] = code;
}
size_t egHLT::TrigCodes::TrigBitSetMap::size ( void  ) const [inline]

Definition at line 48 of file EgHLTTrigCodes.h.

References codeDefs_.

Referenced by egHLT::TrigCodes::setCodes().

{return codeDefs_.size();}
void egHLT::TrigCodes::TrigBitSetMap::sort ( ) [inline]

Definition at line 47 of file EgHLTTrigCodes.h.

References codeDefs_, and keyComp().

Referenced by egHLT::TrigCodes::setCodes().


Member Data Documentation

std::vector<std::pair<std::string,TrigBitSet> > egHLT::TrigCodes::TrigBitSetMap::codeDefs_ [private]

Definition at line 31 of file EgHLTTrigCodes.h.

Referenced by size(), and sort().