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, empty = -98, 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 
empty 
invalid 

Definition at line 23 of file APVCyclePhaseCollection.h.

{nopartition=-91,multiphase=-92,empty=-98,invalid=-99};

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, empty, multiphase, and nopartition.

                                                                           {

  int phase = empty;

  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==empty ) {
        phase = it->second;
      }
      else if(phase!=it->second) {
        return multiphase;
      }
    }
  }

  if(phase==empty) 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, empty, and invalid.

                                                                                       {

  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) {
    if(*phase!=empty && *phase!=invalid) {
      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().