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, bool warn=true)
 
void addClusChargeByIndex (const int mod, const float val)
 
void addClusSize (const CMSTracker mod, const int val, bool warn=true)
 
void addClusSizeByIndex (const int mod, const int val)
 
void addNClus (const CMSTracker mod, const int val, bool warn=true)
 
void addNClusByIndex (const int mod, const int val)
 
 ClusterSummary ()
 
 ClusterSummary (const int nSelections)
 
 ClusterSummary (const ClusterSummary &src)
 
 ClusterSummary (ClusterSummary &&other)
 
void copyNonEmpty (const ClusterSummary &src)
 
float getClusCharge (const CMSTracker mod, bool warn=true) const
 
float getClusChargeByIndex (const int mod) const
 
const std::vector< float > & getClusChargeVector () const
 
int getClusSize (const CMSTracker mod, bool warn=true) 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, bool warn=true) 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 60 of file ClusterSummary.h.

Member Enumeration Documentation

◆ CMSTracker

Enumerator
STRIP 
TIB 
TOB 
TID 
TEC 
PIXEL 
FPIX 
BPIX 
NVALIDENUMS 
NTRACKERENUMS 

Definition at line 76 of file ClusterSummary.h.

◆ VariablePlacement

Enumerator
NCLUSTERS 
CLUSTERSIZE 
CLUSTERCHARGE 
NVARIABLES 

Definition at line 92 of file ClusterSummary.h.

Constructor & Destructor Documentation

◆ ClusterSummary() [1/4]

ClusterSummary::ClusterSummary ( )

◆ ClusterSummary() [2/4]

ClusterSummary::ClusterSummary ( const int  nSelections)

Definition at line 19 of file ClusterSummary.cc.

References mps_fire::i.

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

◆ ~ClusterSummary()

ClusterSummary::~ClusterSummary ( )
inline

Definition at line 66 of file ClusterSummary.h.

66 {}

◆ 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()) {}
std::vector< float > clusCharge
std::vector< int > modules
std::vector< int > clusSize
std::vector< int > nClus

◆ ClusterSummary() [4/4]

ClusterSummary::ClusterSummary ( ClusterSummary &&  other)

Definition at line 34 of file ClusterSummary.cc.

References trackingPlots::other.

Member Function Documentation

◆ addClusCharge()

void ClusterSummary::addClusCharge ( const CMSTracker  mod,
const float  val,
bool  warn = true 
)
inline

Definition at line 136 of file ClusterSummary.h.

References clusCharge, getModuleLocation(), mod(), heppy_batch::val, and python::warn().

136  {
138  }
def warn(args, kwargs)
Definition: __init__.py:19
std::vector< float > clusCharge
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ addClusChargeByIndex()

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

Definition at line 128 of file ClusterSummary.h.

References clusCharge, mod(), and heppy_batch::val.

Referenced by ClusterSummaryProducer::produce().

128 { clusCharge.at(mod) += val; }
std::vector< float > clusCharge
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ addClusSize()

void ClusterSummary::addClusSize ( const CMSTracker  mod,
const int  val,
bool  warn = true 
)
inline

Definition at line 133 of file ClusterSummary.h.

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

133  {
135  }
def warn(args, kwargs)
Definition: __init__.py:19
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > clusSize

◆ addClusSizeByIndex()

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

Definition at line 127 of file ClusterSummary.h.

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

Referenced by ClusterSummaryProducer::produce().

127 { clusSize.at(mod) += val; }
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > clusSize

◆ addNClus()

void ClusterSummary::addNClus ( const CMSTracker  mod,
const int  val,
bool  warn = true 
)
inline

Definition at line 130 of file ClusterSummary.h.

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

130  {
132  }
def warn(args, kwargs)
Definition: __init__.py:19
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > nClus

◆ addNClusByIndex()

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

Definition at line 126 of file ClusterSummary.h.

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

Referenced by ClusterSummaryProducer::produce().

126 { nClus.at(mod) += val; }
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > nClus

◆ copyNonEmpty()

void ClusterSummary::copyNonEmpty ( const ClusterSummary src)

Definition at line 57 of file ClusterSummary.cc.

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

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 }
std::vector< float > clusCharge
std::vector< int > clusSize
std::vector< int > nClus

◆ getClusCharge()

float ClusterSummary::getClusCharge ( const CMSTracker  mod,
bool  warn = true 
) const
inline

Definition at line 117 of file ClusterSummary.h.

References clusCharge, getModuleLocation(), mod(), and python::warn().

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

117  {
118  int pos = getModuleLocation(mod, warn);
119  return pos < 0 ? 0. : clusCharge[pos];
120  }
def warn(args, kwargs)
Definition: __init__.py:19
std::vector< float > clusCharge
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ getClusChargeByIndex()

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

Definition at line 107 of file ClusterSummary.h.

References clusCharge, and mod().

Referenced by ClusterSummaryProducer::produce().

107 { return clusCharge.at(mod); }
std::vector< float > clusCharge
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ getClusChargeVector()

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

Definition at line 124 of file ClusterSummary.h.

References clusCharge.

124 { return clusCharge; }
std::vector< float > clusCharge

◆ getClusSize()

int ClusterSummary::getClusSize ( const CMSTracker  mod,
bool  warn = true 
) const
inline

Definition at line 113 of file ClusterSummary.h.

References clusSize, getModuleLocation(), mod(), and python::warn().

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

113  {
114  int pos = getModuleLocation(mod, warn);
115  return pos < 0 ? 0. : clusSize[pos];
116  }
def warn(args, kwargs)
Definition: __init__.py:19
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > clusSize

◆ getClusSizeByIndex()

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

Definition at line 106 of file ClusterSummary.h.

References clusSize, and mod().

Referenced by ClusterSummaryProducer::produce().

106 { return clusSize.at(mod); }
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > clusSize

◆ getClusSizeVector()

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

Definition at line 123 of file ClusterSummary.h.

References clusSize.

123 { return clusSize; }
std::vector< int > clusSize

◆ getModule()

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

Definition at line 144 of file ClusterSummary.h.

◆ getModuleLocation()

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

Definition at line 42 of file ClusterSummary.cc.

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

Referenced by addClusCharge(), addClusSize(), addNClus(), getClusCharge(), getClusSize(), getNClus(), and FromClusterSummaryMultiplicityProducer::produce().

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 << " (" << subDetNames[mod] << ")"
52  << ". Please check in the Provenance Infomation for proper modules.";
53 
54  return -1;
55 }
static const std::vector< std::string > subDetNames
def warn(args, kwargs)
Definition: __init__.py:19
Log< level::Warning, false > LogWarning
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4

◆ getModules()

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

Definition at line 140 of file ClusterSummary.h.

References modules.

140 { return modules; }
std::vector< int > modules

◆ getNClus()

int ClusterSummary::getNClus ( const CMSTracker  mod,
bool  warn = true 
) const
inline

Definition at line 109 of file ClusterSummary.h.

References getModuleLocation(), mod(), nClus, and python::warn().

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

109  {
110  int pos = getModuleLocation(mod, warn);
111  return pos < 0 ? 0. : nClus[pos];
112  }
def warn(args, kwargs)
Definition: __init__.py:19
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > nClus

◆ getNClusByIndex()

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

Definition at line 105 of file ClusterSummary.h.

References mod(), and nClus.

Referenced by ClusterSummaryProducer::produce().

105 { return nClus.at(mod); }
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > nClus

◆ getNClusVector()

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

Definition at line 122 of file ClusterSummary.h.

References nClus.

122 { return nClus; }
std::vector< int > nClus

◆ getNumberOfModules()

unsigned int ClusterSummary::getNumberOfModules ( ) const
inline

Definition at line 143 of file ClusterSummary.h.

143 { return modules.size(); }

◆ operator=()

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

Definition at line 25 of file ClusterSummary.cc.

References clusCharge, clusSize, modules, and nClus.

25  {
26  modules = rhs.modules;
27  nClus = rhs.nClus;
28  clusSize = rhs.clusSize;
29  clusCharge = rhs.clusCharge;
30  return *this;
31 }
std::vector< float > clusCharge
std::vector< int > modules
std::vector< int > clusSize
std::vector< int > nClus

◆ reset()

void ClusterSummary::reset ( void  )

Definition at line 83 of file ClusterSummary.cc.

References clusCharge, clusSize, and nClus.

Referenced by ClusterSummaryProducer::produce().

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 }
std::vector< float > clusCharge
std::vector< int > clusSize
std::vector< int > nClus

Member Data Documentation

◆ clusCharge

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

◆ clusSize

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

◆ modules

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

◆ nClus

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

◆ subDetNames

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

Definition at line 88 of file ClusterSummary.h.

Referenced by ClusterSummaryProducer::ClusterSummaryProducer(), and getModuleLocation().

◆ 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 89 of file ClusterSummary.h.

Referenced by ClusterSummaryProducer::ClusterSummaryProducer().

◆ variableNames

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

Definition at line 93 of file ClusterSummary.h.