CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Attributes
SiPixelDetSummary Class Reference

#include <SiPixelDetSummary.h>

Public Member Functions

void add (const DetId &detid, const float &value)
 
void add (const DetId &detid)
 
std::map< int, int > getCounts ()
 
void print (std::stringstream &ss, const bool mean=true) const
 
 SiPixelDetSummary (int verbose=0)
 

Protected Attributes

bool fComputeMean
 
std::map< int, int > fCountMap
 
std::map< int, double > fMeanMap
 
std::map< int, double > fRmsMap
 
int fVerbose
 

Detailed Description

Author
Urs Langenegger, using SiStripDetSummary
Date
2010/05/04 Class to compute and print pixel detector summary information

If values are passed together with DetIds (method add( detId, value)), it computes the mean value and rms of a given quantity and is able to print a summary divided by layer/disk for each subdetector.
If instead only DetIds are passed (method add( detId )), it prints the count divided by layer/disk for each subdetector.

Definition at line 25 of file SiPixelDetSummary.h.

Constructor & Destructor Documentation

SiPixelDetSummary::SiPixelDetSummary ( int  verbose = 0)

Definition at line 9 of file SiPixelDetSummary.cc.

References gather_cfg::cout, fCountMap, fVerbose, and LayerTriplets::layers().

9  : fComputeMean(true), fVerbose(verbose) {
10  unsigned int layers[] = {3, 4};
11  unsigned index = 0;
12 
13  for (unsigned int idet = 0; idet < 2; ++idet) {
14  for (unsigned int il = 0; il < layers[idet]; ++il) {
15  index = (idet + 1) * 10000 + (il + 1) * 1000;
16  if (fVerbose)
17  cout << "Adding index = " << index << endl;
18  fCountMap[index] = 0;
19  }
20  }
21 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
bool verbose
std::map< int, int > fCountMap
tuple cout
Definition: gather_cfg.py:144

Member Function Documentation

void SiPixelDetSummary::add ( const DetId detid,
const float &  value 
)

Definition at line 30 of file SiPixelDetSummary.cc.

References gather_cfg::cout, PixelEndcapName::diskName(), fCountMap, fMeanMap, fRmsMap, fVerbose, PixelEndcapName::halfCylinder(), PixelBarrelName::layerName(), PixelEndcapName::mI, PixelEndcapName::mO, PixelBarrelName::name(), PixelEndcapName::name(), mergeVDriftHistosByStation::name, PixelEndcapName::pI, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, PixelEndcapName::pO, DetId::subdetId(), and relativeConstraints::value.

Referenced by add(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

30  {
31  int detNum = -1;
32  int idet(-1), il(-1);
33  string name;
34 
35  switch (detid.subdetId()) {
37  idet = 1;
38  il = PixelBarrelName(detid).layerName();
39  name = PixelBarrelName(detid).name();
40  break;
41  }
43  idet = 2;
45  name = PixelEndcapName(detid).name();
46  if (hc == PixelEndcapName::pI || hc == PixelEndcapName::pO) {
47  il = 3 - PixelEndcapName(detid).diskName();
48  }
49  if (hc == PixelEndcapName::mI || hc == PixelEndcapName::mO) {
50  il = 2 + PixelEndcapName(detid).diskName();
51  }
52  break;
53  }
54  }
55 
56  detNum = idet * 10000 + il * 1000;
57 
58  if (fVerbose > 0)
59  cout << "detNum: " << detNum << " detID: " << static_cast<int>(detid) << " " << name << endl;
60 
61  fMeanMap[detNum] += value;
62  fRmsMap[detNum] += value * value;
63  fCountMap[detNum] += 1;
64 }
std::map< int, double > fMeanMap
std::string name() const override
from base class
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::map< int, double > fRmsMap
std::string name() const override
from base class
int layerName() const
layer id
std::map< int, int > fCountMap
tuple cout
Definition: gather_cfg.py:144
int diskName() const
disk id
HalfCylinder halfCylinder() const
void SiPixelDetSummary::add ( const DetId detid)

Definition at line 24 of file SiPixelDetSummary.cc.

References add(), and fComputeMean.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

24  {
25  fComputeMean = false;
26  add(detid, 0.);
27 }
void add(const DetId &detid, const float &value)
std::map<int, int> SiPixelDetSummary::getCounts ( )
inline

Definition at line 34 of file SiPixelDetSummary.h.

References fCountMap.

34 { return fCountMap; }
std::map< int, int > fCountMap
void SiPixelDetSummary::print ( std::stringstream &  ss,
const bool  mean = true 
) const

Definition at line 67 of file SiPixelDetSummary.cc.

References submitPVResolutionJobs::count, fComputeMean, fCountMap, fMeanMap, fRmsMap, phase1PixelTopology::layer, SiStripPI::rms, mathSSE::sqrt(), and AlCaHLTBitMon_QueryRunRegistry::string.

67  {
68  std::map<int, int>::const_iterator countIt = fCountMap.begin();
69  std::map<int, double>::const_iterator meanIt = fMeanMap.begin();
70  std::map<int, double>::const_iterator rmsIt = fRmsMap.begin();
71 
72  ss << "subDet" << setw(15) << "layer" << setw(16);
73  if (mean)
74  ss << "mean +- rms" << endl;
75  else
76  ss << "count" << endl;
77 
78  std::string detector;
79  std::string oldDetector;
80 
81  for (; countIt != fCountMap.end(); ++countIt, ++meanIt, ++rmsIt) {
82  int count = countIt->second;
83  double mean = 0.;
84  double rms = 0.;
85  if (fComputeMean && count != 0) {
86  mean = (meanIt->second) / count;
87  rms = (rmsIt->second) / count - mean * mean;
88  if (rms <= 0)
89  rms = 0;
90  else
91  rms = sqrt(rms);
92  }
93 
94  // -- Detector type
95  switch ((countIt->first) / 10000) {
96  case 1:
97  detector = "BPIX";
98  break;
99  case 2:
100  detector = "FPIX";
101  break;
102  }
103  if (detector != oldDetector) {
104  ss << std::endl << detector;
105  oldDetector = detector;
106  } else
107  ss << " ";
108 
109  // -- Layer number
110  int layer = (countIt->first) / 1000 - (countIt->first) / 10000 * 10;
111 
112  ss << std::setw(15) << layer << std::setw(13);
113  if (fComputeMean)
114  ss << mean << " +- " << rms << std::endl;
115  else
116  ss << countIt->second << std::endl;
117  }
118 }
constexpr std::array< uint8_t, layerIndexSize > layer
std::map< int, double > fMeanMap
T sqrt(T t)
Definition: SSEVec.h:19
std::map< int, double > fRmsMap
std::map< int, int > fCountMap

Member Data Documentation

bool SiPixelDetSummary::fComputeMean
protected

Definition at line 40 of file SiPixelDetSummary.h.

Referenced by add(), and print().

std::map<int, int> SiPixelDetSummary::fCountMap
protected

Definition at line 39 of file SiPixelDetSummary.h.

Referenced by add(), getCounts(), print(), and SiPixelDetSummary().

std::map<int, double> SiPixelDetSummary::fMeanMap
protected

Definition at line 37 of file SiPixelDetSummary.h.

Referenced by add(), and print().

std::map<int, double> SiPixelDetSummary::fRmsMap
protected

Definition at line 38 of file SiPixelDetSummary.h.

Referenced by add(), and print().

int SiPixelDetSummary::fVerbose
protected

Definition at line 41 of file SiPixelDetSummary.h.

Referenced by add(), and SiPixelDetSummary().