CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

APVCyclePhaseCollection Class Reference

#include <APVCyclePhaseCollection.h>

List of all members.

Public Types

enum  { nopartition = -91, multiphase = -92, invalid = -99 }

Public Member Functions

 APVCyclePhaseCollection ()
std::map< std::string, int > & get ()
const std::map< std::string,
int > & 
get () const
const int getPhase (const std::string partition) const
const std::vector< int > getPhases (const std::string partition) const
 ~APVCyclePhaseCollection ()

Private Attributes

std::map< std::string, int > _apvmap

Detailed Description

Definition at line 9 of file APVCyclePhaseCollection.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
nopartition 
multiphase 
invalid 

Definition at line 23 of file APVCyclePhaseCollection.h.


Constructor & Destructor Documentation

APVCyclePhaseCollection::APVCyclePhaseCollection ( ) [inline]

Definition at line 12 of file APVCyclePhaseCollection.h.

: _apvmap() { };
APVCyclePhaseCollection::~APVCyclePhaseCollection ( ) [inline]

Definition at line 13 of file APVCyclePhaseCollection.h.

{ };

Member Function Documentation

const std::map<std::string,int>& APVCyclePhaseCollection::get ( void  ) const [inline]

Definition at line 15 of file APVCyclePhaseCollection.h.

References _apvmap.

Referenced by ConfigurableAPVCyclePhaseProducer::beginRun().

{ return _apvmap; };
std::map<std::string,int>& APVCyclePhaseCollection::get ( void  ) [inline]

Definition at line 17 of file APVCyclePhaseCollection.h.

References _apvmap.

{ return _apvmap; };
const int APVCyclePhaseCollection::getPhase ( const std::string  partition) const

Definition at line 5 of file APVCyclePhaseCollection.cc.

References _apvmap, invalid, multiphase, and nopartition.

                                                                           {

  int phase = invalid;

  for(std::map<std::string,int>::const_iterator it=_apvmap.begin();it!=_apvmap.end();it++) {
    if(strstr(it->first.c_str(),partition.c_str())==it->first.c_str() || strcmp(partition.c_str(),"All")==0 ) {
      if(phase==invalid ) {
        phase = it->second;
      }
      else if(phase!=it->second) {
        return multiphase;
      }
    }
  }

  if(phase==invalid) return nopartition;
  return phase;


}
const std::vector< int > APVCyclePhaseCollection::getPhases ( const std::string  partition) const

Definition at line 26 of file APVCyclePhaseCollection.cc.

References _apvmap.

                                                                                       {

  std::set<int> phasesset;

  for(std::map<std::string,int>::const_iterator it=_apvmap.begin();it!=_apvmap.end();it++) {
    if(strstr(it->first.c_str(),partition.c_str())==it->first.c_str() || strcmp(partition.c_str(),"Any")==0 ) {
      if(it->second>=0 ) {
        phasesset.insert(it->second);
      }
    }
  }

  std::vector<int> phases;
  
  for(std::set<int>::const_iterator phase=phasesset.begin();phase!=phasesset.end();++phase) {
    phases.push_back(*phase);
  }

  return phases;


}

Member Data Documentation

std::map<std::string,int> APVCyclePhaseCollection::_apvmap [private]

Definition at line 28 of file APVCyclePhaseCollection.h.

Referenced by get(), getPhase(), and getPhases().