File indexing completed on 2024-04-06 12:05:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef CLUSTERSUMMARY
0020 #define CLUSTERSUMMARY
0021
0022
0023 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0024 #include <atomic>
0025 #endif
0026 #include <memory>
0027 #include <string>
0028 #include <map>
0029 #include <vector>
0030 #include <iostream>
0031 #include <cstring>
0032 #include <sstream>
0033 #include "FWCore/Utilities/interface/Exception.h"
0034
0035
0036
0037 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
0038 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0039 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0040 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0041
0042 #include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
0043 #include "DataFormats/Common/interface/DetSetVector.h"
0044
0045 #include "DataFormats/DetId/interface/DetId.h"
0046 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0047 #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h"
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 class ClusterSummary {
0061 public:
0062 ClusterSummary();
0063
0064
0065 ClusterSummary(const int nSelections);
0066 ~ClusterSummary() {}
0067
0068 ClusterSummary(const ClusterSummary& src);
0069
0070 ClusterSummary& operator=(const ClusterSummary& rhs);
0071 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0072 ClusterSummary(ClusterSummary&& other);
0073 #endif
0074
0075
0076 enum CMSTracker {
0077 STRIP = 0,
0078 TIB = 1,
0079 TOB = 2,
0080 TID = 3,
0081 TEC = 4,
0082 PIXEL = 5,
0083 FPIX = 6,
0084 BPIX = 7,
0085 NVALIDENUMS = 8,
0086 NTRACKERENUMS = 100
0087 };
0088 static const std::vector<std::string> subDetNames;
0089 static const std::vector<std::vector<std::string> > subDetSelections;
0090
0091
0092 enum VariablePlacement { NCLUSTERS, CLUSTERSIZE, CLUSTERCHARGE, NVARIABLES };
0093 static const std::vector<std::string> variableNames;
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 public:
0105 int getNClusByIndex(const int mod) const { return nClus.at(mod); }
0106 int getClusSizeByIndex(const int mod) const { return clusSize.at(mod); }
0107 float getClusChargeByIndex(const int mod) const { return clusCharge.at(mod); }
0108
0109 int getNClus(const CMSTracker mod) const {
0110 int pos = getModuleLocation(mod);
0111 return pos < 0 ? 0. : nClus[pos];
0112 }
0113 int getClusSize(const CMSTracker mod) const {
0114 int pos = getModuleLocation(mod);
0115 return pos < 0 ? 0. : clusSize[pos];
0116 }
0117 float getClusCharge(const CMSTracker mod) const {
0118 int pos = getModuleLocation(mod);
0119 return pos < 0 ? 0. : clusCharge[pos];
0120 }
0121
0122 const std::vector<int>& getNClusVector() const { return nClus; }
0123 const std::vector<int>& getClusSizeVector() const { return clusSize; }
0124 const std::vector<float>& getClusChargeVector() const { return clusCharge; }
0125
0126 void addNClusByIndex(const int mod, const int val) { nClus.at(mod) += val; }
0127 void addClusSizeByIndex(const int mod, const int val) { clusSize.at(mod) += val; }
0128 void addClusChargeByIndex(const int mod, const float val) { clusCharge.at(mod) += val; }
0129
0130 void addNClus(const CMSTracker mod, const int val) { nClus.at(getModuleLocation(mod)) += val; }
0131 void addClusSize(const CMSTracker mod, const int val) { clusSize.at(getModuleLocation(mod)) += val; }
0132 void addClusCharge(const CMSTracker mod, const float val) { clusCharge.at(getModuleLocation(mod)) += val; }
0133
0134 const std::vector<int>& getModules() const { return modules; }
0135
0136 int getModuleLocation(int mod, bool warn = true) const;
0137 unsigned int getNumberOfModules() const { return modules.size(); }
0138 int getModule(const int index) const { return modules[index]; }
0139
0140
0141 void copyNonEmpty(const ClusterSummary& src);
0142
0143 void reset();
0144
0145 private:
0146 std::vector<int> modules;
0147 std::vector<int> nClus;
0148 std::vector<int> clusSize;
0149 std::vector<float> clusCharge;
0150 };
0151
0152 #endif