CMS 3D CMS Logo

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

#include <msegala/ClusterSummary/src/ClusterSummary.cc>

Public Types

enum  CMSTracker {
  STRIP = 0, TIB = 1, TOB = 2, TID = 3,
  TEC = 4, PIXEL = 5, FPIX = 6, BPIX = 7,
  NVALIDENUMS = 8, NTRACKERENUMS = 100
}
 
enum  VariablePlacement { NCLUSTERS, CLUSTERSIZE, CLUSTERCHARGE, NVARIABLES }
 

Public Member Functions

void addClusCharge (const CMSTracker mod, const float val)
 
void addClusChargeByIndex (const int mod, const float val)
 
void addClusSize (const CMSTracker mod, const int val)
 
void addClusSizeByIndex (const int mod, const int val)
 
void addNClus (const CMSTracker mod, const int val)
 
void addNClusByIndex (const int mod, const int val)
 
 ClusterSummary ()
 
 ClusterSummary (ClusterSummary &&other)
 
 ClusterSummary (const ClusterSummary &src)
 
 ClusterSummary (const int nSelections)
 
void copyNonEmpty (const ClusterSummary &src)
 
float getClusCharge (const CMSTracker mod) const
 
float getClusChargeByIndex (const int mod) const
 
const std::vector< float > & getClusChargeVector () const
 
int getClusSize (const CMSTracker mod) const
 
int getClusSizeByIndex (const int mod) const
 
const std::vector< int > & getClusSizeVector () const
 
int getModule (const int index) const
 
int getModuleLocation (int mod, bool warn=true) const
 
const std::vector< int > & getModules () const
 
int getNClus (const CMSTracker mod) const
 
int getNClusByIndex (const int mod) const
 
const std::vector< int > & getNClusVector () const
 
unsigned int getNumberOfModules () const
 
ClusterSummaryoperator= (const ClusterSummary &rhs)
 
void reset ()
 
 ~ClusterSummary ()
 

Static Public Attributes

static const std::vector< std::string > subDetNames
 
static const std::vector< std::vector< std::string > > subDetSelections
 
static const std::vector< std::string > variableNames {"NCLUSTERS", "CLUSTERSIZE", "CLUSTERCHARGE"}
 

Private Attributes

std::vector< float > clusCharge
 
std::vector< int > clusSize
 
std::vector< int > modules
 
std::vector< int > nClus
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 59 of file ClusterSummary.h.

Member Enumeration Documentation

◆ CMSTracker

Enumerator
STRIP 
TIB 
TOB 
TID 
TEC 
PIXEL 
FPIX 
BPIX 
NVALIDENUMS 
NTRACKERENUMS 

Definition at line 83 of file ClusterSummary.h.

93  static const std::vector<std::string> variableNames;
94 

◆ VariablePlacement

Enumerator
NCLUSTERS 
CLUSTERSIZE 
CLUSTERCHARGE 
NVARIABLES 

Definition at line 99 of file ClusterSummary.h.

104 :
105  int getNClusByIndex(const int mod) const { return nClus.at(mod); }

Constructor & Destructor Documentation

◆ ClusterSummary() [1/4]

ClusterSummary::ClusterSummary ( )

Definition at line 17 of file ClusterSummary.cc.

◆ ClusterSummary() [2/4]

ClusterSummary::ClusterSummary ( const int  nSelections)

Definition at line 19 of file ClusterSummary.cc.

20  : modules(nSelections), nClus(nSelections), clusSize(nSelections), clusCharge(nSelections) {
21  for (int i = 0; i < nSelections; ++i)
22  modules[i] = i;
23 }

References mps_fire::i.

◆ ~ClusterSummary()

ClusterSummary::~ClusterSummary ( )
inline

Definition at line 73 of file ClusterSummary.h.

76 {

References PIXEL, STRIP, TEC, TIB, TID, and TOB.

◆ ClusterSummary() [3/4]

ClusterSummary::ClusterSummary ( const ClusterSummary src)

Definition at line 36 of file ClusterSummary.cc.

37  : modules(src.getModules()),
38  nClus(src.getNClusVector()),
39  clusSize(src.getClusSizeVector()),
40  clusCharge(src.getClusChargeVector()) {}

◆ ClusterSummary() [4/4]

ClusterSummary::ClusterSummary ( ClusterSummary &&  other)

Definition at line 34 of file ClusterSummary.cc.

34 : ClusterSummary() { *this = other; }

References trackingPlots::other.

Member Function Documentation

◆ addClusCharge()

void ClusterSummary::addClusCharge ( const CMSTracker  mod,
const float  val 
)
inline

Definition at line 139 of file ClusterSummary.h.

145 :
146  std::vector<int> modules; // <Module1, Module2 ...>

◆ addClusChargeByIndex()

void ClusterSummary::addClusChargeByIndex ( const int  mod,
const float  val 
)
inline

Definition at line 135 of file ClusterSummary.h.

137 { return modules.size(); }

Referenced by ClusterSummaryProducer::produce().

◆ addClusSize()

void ClusterSummary::addClusSize ( const CMSTracker  mod,
const int  val 
)
inline

Definition at line 138 of file ClusterSummary.h.

138 { return modules[index]; }

◆ addClusSizeByIndex()

void ClusterSummary::addClusSizeByIndex ( const int  mod,
const int  val 
)
inline

Definition at line 134 of file ClusterSummary.h.

134 { return modules; }

References modules.

Referenced by ClusterSummaryProducer::produce().

◆ addNClus()

void ClusterSummary::addNClus ( const CMSTracker  mod,
const int  val 
)
inline

Definition at line 137 of file ClusterSummary.h.

137 { return modules.size(); }

◆ addNClusByIndex()

void ClusterSummary::addNClusByIndex ( const int  mod,
const int  val 
)
inline

Definition at line 133 of file ClusterSummary.h.

Referenced by ClusterSummaryProducer::produce().

◆ copyNonEmpty()

void ClusterSummary::copyNonEmpty ( const ClusterSummary src)

Definition at line 57 of file ClusterSummary.cc.

57  {
58  modules.clear();
59  nClus.clear();
60  clusSize.clear();
61  clusCharge.clear();
62 
63  const std::vector<int>& src_modules = src.getModules();
64  const std::vector<int>& src_nClus = src.getNClusVector();
65  const std::vector<int>& src_clusSize = src.getClusSizeVector();
66  const std::vector<float>& src_clusCharge = src.getClusChargeVector();
67 
68  modules.reserve(src_modules.size());
69  nClus.reserve(src_modules.size());
70  clusSize.reserve(src_modules.size());
71  clusCharge.reserve(src_modules.size());
72 
73  for (unsigned int iM = 0; iM < src_nClus.size(); ++iM) {
74  if (src.nClus[iM] != 0) {
75  modules.push_back(src_modules[iM]);
76  nClus.push_back(src_nClus[iM]);
77  clusSize.push_back(src_clusSize[iM]);
78  clusCharge.push_back(src_clusCharge[iM]);
79  }
80  }
81 }

References clusCharge, clusSize, nClus, and TrackRefitter_38T_cff::src.

◆ getClusCharge()

float ClusterSummary::getClusCharge ( const CMSTracker  mod) const
inline

Definition at line 124 of file ClusterSummary.h.

124  { return clusCharge; }
125 
126  void addNClusByIndex(const int mod, const int val) { nClus.at(mod) += val; }
127  void addClusSizeByIndex(const int mod, const int val) { clusSize.at(mod) += val; }

References clusCharge.

Referenced by ClusterSummarySingleMultiplicity::getEvent(), and FromClusterSummaryMultiplicityProducer::produce().

◆ getClusChargeByIndex()

float ClusterSummary::getClusChargeByIndex ( const int  mod) const
inline

Definition at line 114 of file ClusterSummary.h.

115 : clusSize[pos];

Referenced by ClusterSummaryProducer::produce().

◆ getClusChargeVector()

const std::vector<float>& ClusterSummary::getClusChargeVector ( ) const
inline

Definition at line 131 of file ClusterSummary.h.

131 { clusSize.at(getModuleLocation(mod)) += val; }

References clusSize, getModuleLocation(), mod(), and heppy_batch::val.

◆ getClusSize()

int ClusterSummary::getClusSize ( const CMSTracker  mod) const
inline

Definition at line 120 of file ClusterSummary.h.

122  { return nClus; }
123  const std::vector<int>& getClusSizeVector() const { return clusSize; }

Referenced by ClusterSummarySingleMultiplicity::getEvent(), and FromClusterSummaryMultiplicityProducer::produce().

◆ getClusSizeByIndex()

int ClusterSummary::getClusSizeByIndex ( const int  mod) const
inline

Definition at line 113 of file ClusterSummary.h.

113 {

Referenced by ClusterSummaryProducer::produce().

◆ getClusSizeVector()

const std::vector<int>& ClusterSummary::getClusSizeVector ( ) const
inline

Definition at line 130 of file ClusterSummary.h.

130 { nClus.at(getModuleLocation(mod)) += val; }

References getModuleLocation(), mod(), nClus, and heppy_batch::val.

◆ getModule()

int ClusterSummary::getModule ( const int  index) const
inline

Definition at line 145 of file ClusterSummary.h.

145 :
146  std::vector<int> modules; // <Module1, Module2 ...>

◆ getModuleLocation()

int ClusterSummary::getModuleLocation ( int  mod,
bool  warn = true 
) const

Definition at line 42 of file ClusterSummary.cc.

42  {
43  int iM = -1;
44  for (auto m : modules) {
45  ++iM;
46  if (m == mod)
47  return iM;
48  }
49 
50  if (warn)
51  edm::LogWarning("NoModule") << "No information for requested module " << mod
52  << ". Please check in the Provinence Infomation for proper modules.";
53 
54  return -1;
55 }

References visualization-live-secondInstance_cfg::m, mod(), and python::warn().

Referenced by getClusChargeVector(), getClusSizeVector(), and FromClusterSummaryMultiplicityProducer::produce().

◆ getModules()

const std::vector<int>& ClusterSummary::getModules ( ) const
inline

Definition at line 141 of file ClusterSummary.h.

145 :
146  std::vector<int> modules; // <Module1, Module2 ...>

◆ getNClus()

int ClusterSummary::getNClus ( const CMSTracker  mod) const
inline

Definition at line 116 of file ClusterSummary.h.

117  {
118  int pos = getModuleLocation(mod);
119  return pos < 0 ? 0. : clusCharge[pos];

Referenced by ClusterSummarySingleMultiplicity::getEvent(), and FromClusterSummaryMultiplicityProducer::produce().

◆ getNClusByIndex()

int ClusterSummary::getNClusByIndex ( const int  mod) const
inline

Definition at line 112 of file ClusterSummary.h.

113 {

Referenced by ClusterSummaryProducer::produce().

◆ getNClusVector()

const std::vector<int>& ClusterSummary::getNClusVector ( ) const
inline

Definition at line 129 of file ClusterSummary.h.

130 { nClus.at(getModuleLocation(mod)) += val; }

◆ getNumberOfModules()

unsigned int ClusterSummary::getNumberOfModules ( ) const
inline

Definition at line 144 of file ClusterSummary.h.

145 :
146  std::vector<int> modules; // <Module1, Module2 ...>

◆ operator=()

ClusterSummary & ClusterSummary::operator= ( const ClusterSummary rhs)

Definition at line 25 of file ClusterSummary.cc.

25  {
26  modules = rhs.modules;
27  nClus = rhs.nClus;
28  clusSize = rhs.clusSize;
29  clusCharge = rhs.clusCharge;
30  return *this;
31 }

References clusCharge, clusSize, modules, and nClus.

◆ reset()

void ClusterSummary::reset ( void  )

Definition at line 83 of file ClusterSummary.cc.

83  {
84  for (unsigned int iM = 0; iM < modules.size(); ++iM) {
85  nClus[iM] = 0;
86  clusSize[iM] = 0;
87  clusCharge[iM] = 0;
88  }
89 }

References clusCharge, clusSize, and nClus.

Referenced by ClusterSummaryProducer::produce().

Member Data Documentation

◆ clusCharge

std::vector<float> ClusterSummary::clusCharge
private

Definition at line 156 of file ClusterSummary.h.

Referenced by copyNonEmpty(), getClusCharge(), operator=(), and reset().

◆ clusSize

std::vector<int> ClusterSummary::clusSize
private

Definition at line 155 of file ClusterSummary.h.

Referenced by copyNonEmpty(), getClusChargeVector(), operator=(), and reset().

◆ modules

std::vector<int> ClusterSummary::modules
private

◆ nClus

std::vector<int> ClusterSummary::nClus
private

Definition at line 154 of file ClusterSummary.h.

Referenced by copyNonEmpty(), getClusSizeVector(), operator=(), and reset().

◆ subDetNames

const std::vector< std::string > ClusterSummary::subDetNames
static
Initial value:
{
"STRIP", "TOB", "TIB", "TID", "TEC", "PIXEL", "BPIX", "FPIX"}

Definition at line 95 of file ClusterSummary.h.

Referenced by ClusterSummaryProducer::ClusterSummaryProducer().

◆ subDetSelections

const std::vector< std::vector< std::string > > ClusterSummary::subDetSelections
static
Initial value:
{
{"0x1e000000-0x1A000000", "0x1e000000-0x16000000", "0x1e000000-0x18000000", "0x1e000000-0x1C000000"},
{"0x1e000000-0x1A000000"},
{"0x1e000000-0x16000000"},
{"0x1e000000-0x18000000"},
{"0x1e000000-0x1C000000"},
{"0x1e000000-0x12000000", "0x1e000000-0x14000000"},
{"0x1e000000-0x12000000"},
{"0x1e000000-0x14000000"}}

Definition at line 96 of file ClusterSummary.h.

Referenced by ClusterSummaryProducer::ClusterSummaryProducer().

◆ variableNames

const std::vector< std::string > ClusterSummary::variableNames {"NCLUSTERS", "CLUSTERSIZE", "CLUSTERCHARGE"}
static

Definition at line 100 of file ClusterSummary.h.

ClusterSummary::variableNames
static const std::vector< std::string > variableNames
Definition: ClusterSummary.h:100
mps_fire.i
i
Definition: mps_fire.py:428
ClusterSummary::clusCharge
std::vector< float > clusCharge
Definition: ClusterSummary.h:156
ClusterSummary::NVALIDENUMS
Definition: ClusterSummary.h:92
modules
Definition: MuonCleanerBySegments.cc:35
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
pos
Definition: PixelAliasList.h:18
ClusterSummary::modules
std::vector< int > modules
Definition: ClusterSummary.h:153
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
ClusterSummary::getModuleLocation
int getModuleLocation(int mod, bool warn=true) const
Definition: ClusterSummary.cc:42
ClusterSummary::ClusterSummary
ClusterSummary()
Definition: ClusterSummary.cc:17
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
trackingPlots.other
other
Definition: trackingPlots.py:1464
ClusterSummary::nClus
std::vector< int > nClus
Definition: ClusterSummary.h:154
python.warn
def warn(*args, **kwargs)
Definition: __init__.py:21
ClusterSummary::getClusSizeVector
const std::vector< int > & getClusSizeVector() const
Definition: ClusterSummary.h:130
ClusterSummary::addNClusByIndex
void addNClusByIndex(const int mod, const int val)
Definition: ClusterSummary.h:133
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
ClusterSummary::addClusSizeByIndex
void addClusSizeByIndex(const int mod, const int val)
Definition: ClusterSummary.h:134
ClusterSummary::NCLUSTERS
Definition: ClusterSummary.h:99
ClusterSummary::CLUSTERCHARGE
Definition: ClusterSummary.h:99
ClusterSummary::getNClusByIndex
int getNClusByIndex(const int mod) const
Definition: ClusterSummary.h:112
ClusterSummary::clusSize
std::vector< int > clusSize
Definition: ClusterSummary.h:155
heppy_batch.val
val
Definition: heppy_batch.py:351
ClusterSummary::CLUSTERSIZE
Definition: ClusterSummary.h:99
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ClusterSummary::NVARIABLES
Definition: ClusterSummary.h:99