CMS 3D CMS Logo

ClusterSummary.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ClusterSummary
4 // Class: ClusterSummary
5 //
13 //
14 // Original Author: Michael Segala
15 // Created: Wed Feb 23 17:36:23 CST 2011
16 //
17 //
18 
19 #ifndef CLUSTERSUMMARY
20 #define CLUSTERSUMMARY
21 
22 // system include files
23 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
24 #include <atomic>
25 #endif
26 #include <memory>
27 #include <string>
28 #include <map>
29 #include <vector>
30 #include <iostream>
31 #include <cstring>
32 #include <sstream>
34 
35 // user include files
36 
41 
44 
48 
49 /*****************************************************************************************
50 
51 How to use ClusterSummary class:
52 
53 ClusterSummary provides summary inforation for a number of cluster dependent variables.
54 All the variables are stored within variables_
55 The modules selected are stored within modules_
56 The number of variables for each module is stored within iterator_
57 
58 ********************************************************************************************/
59 
60 class ClusterSummary {
61 public:
63  //nSelections is the number of selections that you want to have
64  //It should be highest enum + 1
65  ClusterSummary(const int nSelections);
66  ~ClusterSummary() {}
67  // copy ctor
69  // copy assingment operator
71 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
73 #endif
74 
75  // Enum for each partition within Tracker
76  enum CMSTracker {
77  STRIP = 0,
78  TIB = 1,
79  TOB = 2,
80  TID = 3,
81  TEC = 4,
82  PIXEL = 5,
83  FPIX = 6,
84  BPIX = 7,
87  };
88  static const std::vector<std::string> subDetNames;
89  static const std::vector<std::vector<std::string> > subDetSelections;
90 
91  // Enum which describes the ordering of the summary variables inside vector variables_
93  static const std::vector<std::string> variableNames;
94 
95  //===================+++++++++++++========================
96  //
97  // Main methods to fill
98  // Variables
99  //
100  //===================+++++++++++++========================
101 
102  //These functions are broken into two categories. The standard versions take the enums as input and find the locations in the vector.
103  //The ones labeled "byIndex" take the vector location as input
104 public:
105  int getNClusByIndex(const int mod) const { return nClus.at(mod); }
106  int getClusSizeByIndex(const int mod) const { return clusSize.at(mod); }
107  float getClusChargeByIndex(const int mod) const { return clusCharge.at(mod); }
108 
109  int getNClus(const CMSTracker mod) const {
110  int pos = getModuleLocation(mod);
111  return pos < 0 ? 0. : nClus[pos];
112  }
113  int getClusSize(const CMSTracker mod) const {
115  return pos < 0 ? 0. : clusSize[pos];
116  }
117  float getClusCharge(const CMSTracker mod) const {
118  int pos = getModuleLocation(mod);
119  return pos < 0 ? 0. : clusCharge[pos];
120  }
121 
122  const std::vector<int>& getNClusVector() const { return nClus; }
123  const std::vector<int>& getClusSizeVector() const { return clusSize; }
124  const std::vector<float>& getClusChargeVector() const { 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; }
128  void addClusChargeByIndex(const int mod, const float val) { clusCharge.at(mod) += val; }
129 
130  void addNClus(const CMSTracker mod, const int val) { nClus.at(getModuleLocation(mod)) += val; }
131  void addClusSize(const CMSTracker mod, const int val) { clusSize.at(getModuleLocation(mod)) += val; }
132  void addClusCharge(const CMSTracker mod, const float val) { clusCharge.at(getModuleLocation(mod)) += val; }
133 
134  const std::vector<int>& getModules() const { return modules; }
135  // Return the location of desired module within modules_. If warn is set to true, a warnign will be outputed in case no module was found
136  int getModuleLocation(int mod, bool warn = true) const;
137  unsigned int getNumberOfModules() const { return modules.size(); }
138  int getModule(const int index) const { return modules[index]; }
139 
140  //copies over only non-zero entries into the current one
142  //Set values to 0
143  void reset();
144 
145 private:
146  std::vector<int> modules; // <Module1, Module2 ...>
147  std::vector<int> nClus;
148  std::vector<int> clusSize;
149  std::vector<float> clusCharge;
150 };
151 
152 #endif
ClusterSummary::variableNames
static const std::vector< std::string > variableNames
Definition: ClusterSummary.h:100
PixelSubdetector.h
PixelBarrelName.h
ClusterSummary::clusCharge
std::vector< float > clusCharge
Definition: ClusterSummary.h:156
ClusterSummary::addClusCharge
void addClusCharge(const CMSTracker mod, const float val)
Definition: ClusterSummary.h:139
ClusterSummary::operator=
ClusterSummary & operator=(const ClusterSummary &rhs)
Definition: ClusterSummary.cc:25
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
SiPixelCluster.h
ClusterSummary::modules
std::vector< int > modules
Definition: ClusterSummary.h:153
ClusterSummary::getClusSizeByIndex
int getClusSizeByIndex(const int mod) const
Definition: ClusterSummary.h:113
ClusterSummary::STRIP
Definition: ClusterSummary.h:84
ClusterSummary::addNClus
void addNClus(const CMSTracker mod, const int val)
Definition: ClusterSummary.h:137
ClusterSummary::getModuleLocation
int getModuleLocation(int mod, bool warn=true) const
Definition: ClusterSummary.cc:42
ClusterSummary::getModule
int getModule(const int index) const
Definition: ClusterSummary.h:145
ClusterSummary::ClusterSummary
ClusterSummary()
Definition: ClusterSummary.cc:17
ClusterSummary::~ClusterSummary
~ClusterSummary()
Definition: ClusterSummary.h:73
SiStripProcessedRawDigi.h
ClusterSummary::TEC
Definition: ClusterSummary.h:88
SiStripDigi.h
ClusterSummary::addClusChargeByIndex
void addClusChargeByIndex(const int mod, const float val)
Definition: ClusterSummary.h:135
trackingPlots.other
other
Definition: trackingPlots.py:1464
ClusterSummary::subDetNames
static const std::vector< std::string > subDetNames
Definition: ClusterSummary.h:95
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
ClusterSummary::reset
void reset()
Definition: ClusterSummary.cc:83
SiStripCluster.h
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::getNumberOfModules
unsigned int getNumberOfModules() const
Definition: ClusterSummary.h:144
ClusterSummary::VariablePlacement
VariablePlacement
Definition: ClusterSummary.h:99
ClusterSummary::getClusSize
int getClusSize(const CMSTracker mod) const
Definition: ClusterSummary.h:120
ClusterSummary::FPIX
Definition: ClusterSummary.h:90
ClusterSummary::getClusChargeByIndex
float getClusChargeByIndex(const int mod) const
Definition: ClusterSummary.h:114
ClusterSummary::NCLUSTERS
Definition: ClusterSummary.h:99
ClusterSummary::getClusCharge
float getClusCharge(const CMSTracker mod) const
Definition: ClusterSummary.h:124
DetSetVector.h
ClusterSummary::PIXEL
Definition: ClusterSummary.h:89
ClusterSummary::NTRACKERENUMS
Definition: ClusterSummary.h:93
ClusterSummary::CLUSTERCHARGE
Definition: ClusterSummary.h:99
ClusterSummary::CMSTracker
CMSTracker
Definition: ClusterSummary.h:83
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::TOB
Definition: ClusterSummary.h:86
ClusterSummary::getClusChargeVector
const std::vector< float > & getClusChargeVector() const
Definition: ClusterSummary.h:131
ClusterSummary
Definition: ClusterSummary.h:59
ClusterSummary::BPIX
Definition: ClusterSummary.h:91
DetId.h
ClusterSummary::getModules
const std::vector< int > & getModules() const
Definition: ClusterSummary.h:141
ClusterSummary::CLUSTERSIZE
Definition: ClusterSummary.h:99
Exception.h
ClusterSummary::addClusSize
void addClusSize(const CMSTracker mod, const int val)
Definition: ClusterSummary.h:138
ClusterSummary::getNClusVector
const std::vector< int > & getNClusVector() const
Definition: ClusterSummary.h:129
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ClusterSummary::copyNonEmpty
void copyNonEmpty(const ClusterSummary &src)
Definition: ClusterSummary.cc:57
ClusterSummary::getNClus
int getNClus(const CMSTracker mod) const
Definition: ClusterSummary.h:116
ClusterSummary::NVARIABLES
Definition: ClusterSummary.h:99
DetSetVectorNew.h
ClusterSummary::TIB
Definition: ClusterSummary.h:85
ClusterSummary::subDetSelections
static const std::vector< std::vector< std::string > > subDetSelections
Definition: ClusterSummary.h:96
ClusterSummary::TID
Definition: ClusterSummary.h:87