CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClusterSummary.cc
Go to the documentation of this file.
3 
4 const std::vector<std::string> ClusterSummary::subDetNames {"STRIP","TOB","TIB","TID","TEC","PIXEL","BPIX","FPIX"};
5 const std::vector<std::vector<std::string> > ClusterSummary::subDetSelections {
6 {"0x1e000000-0x1A000000","0x1e000000-0x16000000","0x1e000000-0x18000000","0x1e000000-0x1C000000"},
7 {"0x1e000000-0x1A000000"},{"0x1e000000-0x16000000"},{"0x1e000000-0x18000000"},{"0x1e000000-0x1C000000"},
8 {"0x1e000000-0x12000000","0x1e000000-0x14000000"},
9 {"0x1e000000-0x12000000"},{"0x1e000000-0x14000000"}
10 };
11 const std::vector<std::string> ClusterSummary::variableNames {"NCLUSTERS","CLUSTERSIZE","CLUSTERCHARGE"};
12 
14 
15 ClusterSummary::ClusterSummary(const int nSelections) : modules(nSelections),nClus(nSelections),clusSize(nSelections),clusCharge(nSelections)
16 {
17  for(int i = 0; i < nSelections; ++i) modules[i] = i;
18 }
19 
21 {
22  modules = rhs.modules ;
23  nClus = rhs.nClus ;
24  clusSize = rhs.clusSize ;
25  clusCharge = rhs.clusCharge ;
26  return *this;
27 }
28 
29 // move ctor
31 {
32  *this = other;
33 }
34 
36  modules (src.getModules() ),
37  nClus (src.getNClusVector() ),
38  clusSize (src.getClusSizeVector() ),
39  clusCharge(src.getClusChargeVector())
40 {}
41 
42 int ClusterSummary::getModuleLocation ( int mod, bool warn ) const {
43  int iM = -1;
44  for (auto m : modules){++iM; if (m==mod) return iM;}
45 
46  if(warn)
47  edm::LogWarning("NoModule") << "No information for requested module "<<mod<<". Please check in the Provinence Infomation for proper modules.";
48 
49  return -1;
50 }
51 
53  modules .clear();
54  nClus .clear();
55  clusSize .clear();
56  clusCharge.clear();
57 
58  const std::vector<int> & src_modules = src.getModules();
59  const std::vector<int> & src_nClus = src.getNClusVector();
60  const std::vector<int> & src_clusSize = src.getClusSizeVector();
61  const std::vector<float>& src_clusCharge = src.getClusChargeVector();
62 
63  modules .reserve(src_modules.size());
64  nClus .reserve(src_modules.size());
65  clusSize .reserve(src_modules.size());
66  clusCharge.reserve(src_modules.size());
67 
68  for(unsigned int iM = 0; iM < src_nClus.size(); ++iM){
69  if(src.nClus[iM] != 0){
70  modules .push_back(src_modules [iM]);
71  nClus .push_back(src_nClus [iM]);
72  clusSize .push_back(src_clusSize [iM]);
73  clusCharge.push_back(src_clusCharge[iM]);
74  }
75  }
76 }
77 
79  for(unsigned int iM = 0; iM < modules.size(); ++iM){
80  nClus [iM] = 0;
81  clusSize [iM] = 0;
82  clusCharge[iM] = 0;
83  }
84 }
int i
Definition: DBlmapReader.cc:9
const std::vector< int > & getClusSizeVector() const
static const std::vector< std::string > subDetNames
static const std::vector< std::string > variableNames
void copyNonEmpty(const ClusterSummary &src)
const std::vector< float > & getClusChargeVector() const
std::vector< float > clusCharge
int getModuleLocation(int mod, bool warn=true) const
std::vector< int > modules
static const std::vector< std::vector< std::string > > subDetSelections
const std::vector< int > & getNClusVector() const
ClusterSummary & operator=(const ClusterSummary &rhs)
def warn
Definition: __init__.py:20
const std::vector< int > & getModules() const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
std::vector< int > clusSize
std::vector< int > nClus