CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes
egHLT::TrigCodes Class Reference

#include <EgHLTTrigCodes.h>

Public Types

typedef std::bitset< maxNrBits_TrigBitSet
 

Public Member Functions

TrigBitSet getCode (const char *descript) const
 
TrigBitSet getCode (const std::string &descript) const
 
TrigCodesoperator= (const TrigCodes &)=delete
 
 TrigCodes (const TrigCodes &)=delete
 
 ~TrigCodes ()
 

Static Public Member Functions

static TrigCodesmakeCodes (std::vector< std::string > &filterNames)
 

Static Public Attributes

static const int maxNrBits_ =128
 

Private Member Functions

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

Static Private 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 21 of file EgHLTTrigCodes.h.

Member Typedef Documentation

Definition at line 25 of file EgHLTTrigCodes.h.

Constructor & Destructor Documentation

egHLT::TrigCodes::~TrigCodes ( )
inline

Definition at line 33 of file EgHLTTrigCodes.h.

References getCode(), operator=(), and TrigCodes().

33 {}
egHLT::TrigCodes::TrigCodes ( const TrigCodes )
delete
egHLT::TrigCodes::TrigCodes ( )
inlineprivate

Definition at line 42 of file EgHLTTrigCodes.h.

References getCodeName(), keyComp(), setCode(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by makeCodes(), and ~TrigCodes().

42 {}

Member Function Documentation

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

Definition at line 44 of file EgHLTTrigCodes.cc.

References codeDefs_, plotBeamSpotDB::first, runEdmFileComparison::found, mps_fire::i, and NULL.

Referenced by egHLT::MonElemFuncs::addTightLooseTrigHist(), egHLT::trigTools::getFiltersPassed(), egHLT::MonElemFuncs::initTightLooseDiObjTrigHistsTrigCuts(), egHLT::MonElemFuncs::initTightLooseTrigHistsTrigCuts(), egHLT::MonElemFuncs::initTrigTagProbeHist(), egHLT::MonElemFuncs::initTrigTagProbeHist_2Leg(), egHLT::MonElemFuncs::initTrigTagProbeHists(), egHLT::trigTools::setFiltersObjPasses(), egHLT::OffHelper::setTrigInfo(), egHLT::OffHelper::setupTriggers(), and ~TrigCodes().

45 {
46  //first copy the character string to a local array so we can manipulate it
47  char localDescript[512];
48  strcpy(localDescript,descript);
49 
50  TrigBitSet code;
51  char* codeKey = strtok(localDescript,":");
52  // std::map<std::string,int> ::const_iterator mapIt;
53  while(codeKey!=NULL){
54  bool found=false;
55 
56  for(size_t i=0;i<codeDefs_.size() && !found;i++){
57  if(codeDefs_[i].first.compare(codeKey)==0){
58  found=true;
59  code |= codeDefs_[i].second;
60 
61  }
62  }
63 
64  // if(!found) edm::LogError("TrigCodes::TrigBitSetMap") <<"TrigCodes::TrigBitSetMap::getCode : Error, Key "<<codeKey<<" not found";
65  codeKey = strtok(NULL,":"); //getting new substring
66 
67  }
68  return code;
69 }
#define NULL
Definition: scimark2.h:8
std::vector< std::pair< std::string, TrigBitSet > > codeDefs_
std::bitset< maxNrBits_ > TrigBitSet
TrigBitSet egHLT::TrigCodes::getCode ( const std::string &  descript) const
inline

Definition at line 39 of file EgHLTTrigCodes.h.

References getCode().

Referenced by getCode().

39 { return getCode(descript.c_str()); }
TrigBitSet getCode(const char *descript) const
void TrigCodes::getCodeName ( TrigBitSet  code,
std::string &  id 
) const
private

Definition at line 76 of file EgHLTTrigCodes.cc.

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

Referenced by TrigCodes().

77 {
78  id.clear();
79  for(size_t i=0;i<codeDefs_.size();i++){
80  if((code&codeDefs_[i].second)==codeDefs_[i].second){
81  if(!id.empty()) id+=":";//seperating entries by a ':'
82  id+=codeDefs_[i].first;
83  }
84 
85  }
86 
87 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, TrigBitSet > > codeDefs_
bool TrigCodes::keyComp ( const std::pair< std::string, TrigBitSet > &  lhs,
const std::pair< std::string, TrigBitSet > &  rhs 
)
staticprivate

Definition at line 71 of file EgHLTTrigCodes.cc.

Referenced by sort(), and TrigCodes().

72 {
73  return lhs.first < rhs.first;
74 }
TrigCodes * TrigCodes::makeCodes ( std::vector< std::string > &  filterNames)
static

Definition at line 9 of file EgHLTTrigCodes.cc.

References mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, setCode(), sort(), and TrigCodes().

10 {
11  TrigCodes *p = new TrigCodes();
12 
13  for (size_t i=0;i<filterNames.size();i++) {
14  p->setCode(filterNames[i].c_str(),i);
15  }
16  p->sort();
17 
18  return p;
19 }
void setCode(const char *descript, TrigBitSet code)
TrigCodes& egHLT::TrigCodes::operator= ( const TrigCodes )
delete

Referenced by ~TrigCodes().

void TrigCodes::printCodes ( )
private

Definition at line 89 of file EgHLTTrigCodes.cc.

References codeDefs_, plotBeamSpotDB::first, mps_fire::i, mps_alisetup::msg, and edm::second().

Referenced by size().

90 {
91  std::ostringstream msg;
92  msg <<" trig bits defined: "<<std::endl;
93  for(size_t i=0;i<codeDefs_.size();i++) msg <<" key : "<<codeDefs_[i].first<<" bit "<<codeDefs_[i].second<<std::endl;
94  edm::LogInfo("TrigCodes") << msg.str();
95 
96 }
U second(std::pair< T, U > const &p)
std::vector< std::pair< std::string, TrigBitSet > > codeDefs_
void TrigCodes::setCode ( const char *  descript,
TrigBitSet  code 
)
private

Definition at line 32 of file EgHLTTrigCodes.cc.

References codeDefs_, plotBeamSpotDB::first, runEdmFileComparison::found, and mps_fire::i.

Referenced by makeCodes(), setCode(), and TrigCodes().

33 {
34  bool found=false;
35  for(size_t i=0;i<codeDefs_.size() && !found;i++){
36  if(codeDefs_[i].first.compare(descript)==0) found=true;
37  }
38  if(!found) codeDefs_.push_back(std::pair<std::string,TrigBitSet>(descript,code));
39  //_codeDefs[descript] = code;
40 }
std::vector< std::pair< std::string, TrigBitSet > > codeDefs_
void TrigCodes::setCode ( const char *  descript,
int  bitNr 
)
private

Definition at line 21 of file EgHLTTrigCodes.cc.

References maxNrBits_, and setCode().

22 {
23  if(bitNr < maxNrBits_){
24  TrigBitSet code;
25  code.set(bitNr);
26  setCode(descript,code);
27  }else{
28  edm::LogWarning("TrigCodes::TrigBitSetMap") <<" Warning, trying to store at bit "<<bitNr<<" but max nr bits is "<<maxNrBits_;
29  }
30 }
void setCode(const char *descript, TrigBitSet code)
static const int maxNrBits_
std::bitset< maxNrBits_ > TrigBitSet
size_t egHLT::TrigCodes::size ( void  ) const
inlineprivate

Definition at line 53 of file EgHLTTrigCodes.h.

References printCodes().

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

53 {return codeDefs_.size();}
std::vector< std::pair< std::string, TrigBitSet > > codeDefs_
void egHLT::TrigCodes::sort ( )
inlineprivate

Definition at line 52 of file EgHLTTrigCodes.h.

References keyComp().

Referenced by makeCodes().

52 {std::sort(codeDefs_.begin(),codeDefs_.end(),keyComp);}
std::vector< std::pair< std::string, TrigBitSet > > codeDefs_
static bool keyComp(const std::pair< std::string, TrigBitSet > &lhs, const std::pair< std::string, TrigBitSet > &rhs)

Member Data Documentation

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

Definition at line 29 of file EgHLTTrigCodes.h.

Referenced by getCode(), getCodeName(), printCodes(), and setCode().

const int egHLT::TrigCodes::maxNrBits_ =128
static

Definition at line 24 of file EgHLTTrigCodes.h.

Referenced by setCode().