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 | Public Attributes
CaloHitAnalyzer Class Reference

#include <CaloHitAnalyzer.h>

Public Member Functions

void analyze (int detId, double recEnergy)
 to be called for each RecHit More...
 
 CaloHitAnalyzer (const std::string &name, double hitEnergyThreshold, const CaloVSimParameterMap *parameterMap, const CaloVHitFilter *filter=nullptr)
 
void fillHits (MixCollection< PCaloHit > &hits)
 should be called each event More...
 

Public Attributes

std::map< int, double > hitEnergySumMap_
 
double hitEnergyThreshold_
 
const CaloVHitFilterhitFilter_
 
int noiseHits_
 
const CaloVSimParameterMapsimParameterMap_
 
CaloValidationStatistics summary_
 

Detailed Description

Definition at line 21 of file CaloHitAnalyzer.h.

Constructor & Destructor Documentation

CaloHitAnalyzer::CaloHitAnalyzer ( const std::string &  name,
double  hitEnergyThreshold,
const CaloVSimParameterMap parameterMap,
const CaloVHitFilter filter = nullptr 
)

Definition at line 10 of file CaloHitAnalyzer.cc.

14  : hitEnergySumMap_(),
15  hitEnergyThreshold_(hitEnergyThreshold),
16  simParameterMap_(parameterMap),
17  hitFilter_(filter),
18  summary_(name, 1., 0.),
19  noiseHits_(0) {}
double hitEnergyThreshold_
CaloValidationStatistics summary_
const CaloVHitFilter * hitFilter_
const CaloVSimParameterMap * simParameterMap_
std::map< int, double > hitEnergySumMap_

Member Function Documentation

void CaloHitAnalyzer::analyze ( int  detId,
double  recEnergy 
)

to be called for each RecHit

Definition at line 47 of file CaloHitAnalyzer.cc.

References CaloValidationStatistics::addEntry(), hitEnergySumMap_, hitEnergyThreshold_, noiseHits_, and summary_.

Referenced by CastorDigiStatistics::analyze(), HcalDigiStatistics::analyze(), CastorHitAnalyzerImpl::analyze(), and HcalHitAnalyzerImpl::analyze().

47  {
48  if (recEnergy > hitEnergyThreshold_) {
49  std::map<int, double>::iterator mapItr = hitEnergySumMap_.find(id);
50  if (mapItr == hitEnergySumMap_.end()) {
51  ++noiseHits_;
52  } else {
53  // keep statistics of the rec energy / sim energy
54  summary_.addEntry(recEnergy / mapItr->second);
55  }
56  }
57 }
double hitEnergyThreshold_
CaloValidationStatistics summary_
void addEntry(float value, float weight=1.)
std::map< int, double > hitEnergySumMap_
void CaloHitAnalyzer::fillHits ( MixCollection< PCaloHit > &  hits)

should be called each event

Definition at line 22 of file CaloHitAnalyzer.cc.

References CaloVHitFilter::accepts(), MixCollection< T >::begin(), MixCollection< T >::end(), relval_parameters_module::energy, hitEnergySumMap_, hitFilter_, gpuClustering::id, dqmdumpme::last, and noiseHits_.

Referenced by CastorHitAnalyzer::analyze(), HcalHitAnalyzer::analyze(), CastorDigiAnalyzer::analyze(), and HcalDigiAnalyzer::analyze().

22  {
23  hitEnergySumMap_.clear();
24  noiseHits_ = 0;
25  // store the energy of each hit in a map
26  MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
28  for (; hitItr != last; ++hitItr) {
29  if (hitFilter_ == nullptr || hitFilter_->accepts(*hitItr)) {
30  int id = hitItr->id();
31  // double samplingFactor =
32  // simParameterMap_->simParameters(DetId(id)).samplingFactor();
33  double samplingFactor = 1.;
34  double energy = hitItr->energy() * samplingFactor;
35 
36  // add it to the map
37  std::map<int, double>::iterator mapItr = hitEnergySumMap_.find(id);
38  if (mapItr == hitEnergySumMap_.end()) {
40  } else {
41  mapItr->second += energy;
42  }
43  }
44  }
45 }
uint16_t *__restrict__ id
const CaloVHitFilter * hitFilter_
iterator end() const
virtual bool accepts(const PCaloHit &hit) const =0
std::map< int, double > hitEnergySumMap_
tuple last
Definition: dqmdumpme.py:56
iterator begin() const

Member Data Documentation

std::map<int, double> CaloHitAnalyzer::hitEnergySumMap_

Definition at line 35 of file CaloHitAnalyzer.h.

Referenced by analyze(), and fillHits().

double CaloHitAnalyzer::hitEnergyThreshold_

Definition at line 36 of file CaloHitAnalyzer.h.

Referenced by analyze().

const CaloVHitFilter* CaloHitAnalyzer::hitFilter_

Definition at line 38 of file CaloHitAnalyzer.h.

Referenced by fillHits().

int CaloHitAnalyzer::noiseHits_

Definition at line 40 of file CaloHitAnalyzer.h.

Referenced by analyze(), and fillHits().

const CaloVSimParameterMap* CaloHitAnalyzer::simParameterMap_

Definition at line 37 of file CaloHitAnalyzer.h.

CaloValidationStatistics CaloHitAnalyzer::summary_

Definition at line 39 of file CaloHitAnalyzer.h.

Referenced by analyze().