CMS 3D CMS Logo

ClusterSummary.cc
Go to the documentation of this file.
3 
4 const std::vector<std::string> ClusterSummary::subDetNames{
5  "STRIP", "TOB", "TIB", "TID", "TEC", "PIXEL", "BPIX", "FPIX"};
6 const std::vector<std::vector<std::string> > ClusterSummary::subDetSelections{
7  {"0x1e000000-0x1A000000", "0x1e000000-0x16000000", "0x1e000000-0x18000000", "0x1e000000-0x1C000000"},
8  {"0x1e000000-0x1A000000"},
9  {"0x1e000000-0x16000000"},
10  {"0x1e000000-0x18000000"},
11  {"0x1e000000-0x1C000000"},
12  {"0x1e000000-0x12000000", "0x1e000000-0x14000000"},
13  {"0x1e000000-0x12000000"},
14  {"0x1e000000-0x14000000"}};
15 const std::vector<std::string> ClusterSummary::variableNames{"NCLUSTERS", "CLUSTERSIZE", "CLUSTERCHARGE"};
16 
18 
19 ClusterSummary::ClusterSummary(const int nSelections)
20  : modules(nSelections), nClus(nSelections), clusSize(nSelections), clusCharge(nSelections) {
21  for (int i = 0; i < nSelections; ++i)
22  modules[i] = i;
23 }
24 
26  modules = rhs.modules;
27  nClus = rhs.nClus;
28  clusSize = rhs.clusSize;
29  clusCharge = rhs.clusCharge;
30  return *this;
31 }
32 
33 // move ctor
35 
37  : modules(src.getModules()),
38  nClus(src.getNClusVector()),
39  clusSize(src.getClusSizeVector()),
40  clusCharge(src.getClusChargeVector()) {}
41 
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 }
56 
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 }
82 
84  for (unsigned int iM = 0; iM < modules.size(); ++iM) {
85  nClus[iM] = 0;
86  clusSize[iM] = 0;
87  clusCharge[iM] = 0;
88  }
89 }
static const std::vector< std::string > subDetNames
static const std::vector< std::string > variableNames
def warn(args, kwargs)
Definition: __init__.py:21
void copyNonEmpty(const ClusterSummary &src)
std::vector< float > clusCharge
std::vector< int > modules
static const std::vector< std::vector< std::string > > subDetSelections
ClusterSummary & operator=(const ClusterSummary &rhs)
Log< level::Warning, false > LogWarning
int getModuleLocation(int mod, bool warn=true) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > clusSize
std::vector< int > nClus