CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
APVCyclePhaseCollection Class Reference

#include <APVCyclePhaseCollection.h>

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 8 of file APVCyclePhaseCollection.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
nopartition 
multiphase 
empty 
invalid 

Definition at line 21 of file APVCyclePhaseCollection.h.

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

Constructor & Destructor Documentation

◆ APVCyclePhaseCollection()

APVCyclePhaseCollection::APVCyclePhaseCollection ( )
inline

Definition at line 10 of file APVCyclePhaseCollection.h.

10 : _apvmap(){};

◆ ~APVCyclePhaseCollection()

APVCyclePhaseCollection::~APVCyclePhaseCollection ( )
inline

Definition at line 11 of file APVCyclePhaseCollection.h.

11 {};

Member Function Documentation

◆ get() [1/2]

std::map<std::string, int>& APVCyclePhaseCollection::get ( )
inline

◆ get() [2/2]

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

◆ getPhase()

const int APVCyclePhaseCollection::getPhase ( const std::string  partition) const

Definition at line 5 of file APVCyclePhaseCollection.cc.

5  {
6  int phase = empty;
7 
8  for (std::map<std::string, int>::const_iterator it = _apvmap.begin(); it != _apvmap.end(); it++) {
9  if (strstr(it->first.c_str(), partition.c_str()) == it->first.c_str() || strcmp(partition.c_str(), "All") == 0) {
10  if (phase == empty) {
11  phase = it->second;
12  } else if (phase != it->second) {
13  return multiphase;
14  }
15  }
16  }
17 
18  if (phase == empty)
19  return nopartition;
20  return phase;
21 }

References _apvmap, empty, multiphase, and nopartition.

Referenced by SiStripMonitorDigi::analyze(), SiStripMonitorCluster::analyze(), APVCyclePhaseMonitor::analyze(), EventTimeDistribution::analyze(), CommonModeAnalyzer::analyze(), and APVShotsAnalyzer::analyze().

◆ getPhases()

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

Definition at line 23 of file APVCyclePhaseCollection.cc.

23  {
24  std::set<int> phasesset;
25 
26  for (std::map<std::string, int>::const_iterator it = _apvmap.begin(); it != _apvmap.end(); it++) {
27  if (strstr(it->first.c_str(), partition.c_str()) == it->first.c_str() || strcmp(partition.c_str(), "Any") == 0) {
28  if (it->second >= 0) {
29  phasesset.insert(it->second);
30  }
31  }
32  }
33 
34  std::vector<int> phases;
35 
36  for (std::set<int>::const_iterator phase = phasesset.begin(); phase != phasesset.end(); ++phase) {
37  if (*phase != empty && *phase != invalid) {
38  phases.push_back(*phase);
39  }
40  }
41 
42  return phases;
43 }

References _apvmap, empty, invalid, and phases.

Referenced by APVCyclePhaseMonitor::analyze(), and EventWithHistoryFilter::getAPVPhase().

Member Data Documentation

◆ _apvmap

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

Definition at line 24 of file APVCyclePhaseCollection.h.

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

APVCyclePhaseCollection::multiphase
Definition: APVCyclePhaseCollection.h:21
APVCyclePhaseCollection::invalid
Definition: APVCyclePhaseCollection.h:21
phases
std::vector< int > phases
Definition: compareAlignments.cc:30
APVCyclePhaseCollection::empty
Definition: APVCyclePhaseCollection.h:21
APVCyclePhaseCollection::_apvmap
std::map< std::string, int > _apvmap
Definition: APVCyclePhaseCollection.h:24
SiPixelPI::phase
phase
Definition: SiPixelPayloadInspectorHelper.h:39
APVCyclePhaseCollection::nopartition
Definition: APVCyclePhaseCollection.h:21