CMS 3D CMS Logo

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, diffTreeTool::index, and LayerTriplets::layers().

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

Member Function Documentation

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

Definition at line 32 of file SiPixelDetSummary.cc.

References gather_cfg::cout, PixelEndcapName::diskName(), fCountMap, fMeanMap, fRmsMap, fVerbose, PixelEndcapName::halfCylinder(), AnalysisDataFormats_SUSYBSMObjects::hc, PixelBarrelName::layerName(), PixelEndcapName::mI, PixelEndcapName::mO, PixelEndcapName::name(), PixelBarrelName::name(), dataset::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().

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

Definition at line 25 of file SiPixelDetSummary.cc.

References add(), and fComputeMean.

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

25  {
26  fComputeMean= false;
27  add(detid, 0.);
28 }
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 73 of file SiPixelDetSummary.cc.

References KineDebug3::count(), gamEcalExtractorBlocks_cff::detector, fComputeMean, fCountMap, fMeanMap, fRmsMap, SiStripPI::rms, mathSSE::sqrt(), and AlCaHLTBitMon_QueryRunRegistry::string.

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