CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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=0)
 
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 22 of file CaloHitAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file CaloHitAnalyzer.cc.

15  hitEnergyThreshold_(hitEnergyThreshold),
16  simParameterMap_(parameterMap),
17  hitFilter_(filter),
18  summary_(name, 1., 0.),
19  noiseHits_(0)
20 {
21 }
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 51 of file CaloHitAnalyzer.cc.

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

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

51  {
52  if(recEnergy > hitEnergyThreshold_) {
53  std::map<int, double>::iterator mapItr = hitEnergySumMap_.find(id);
54  if(mapItr == hitEnergySumMap_.end()) {
55  ++noiseHits_;
56  } else {
57  // keep statistics of the rec energy / sim energy
58  summary_.addEntry(recEnergy/mapItr->second);
59  }
60  }
61 }
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 25 of file CaloHitAnalyzer.cc.

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

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

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

Member Data Documentation

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

Definition at line 37 of file CaloHitAnalyzer.h.

Referenced by analyze(), and fillHits().

double CaloHitAnalyzer::hitEnergyThreshold_

Definition at line 38 of file CaloHitAnalyzer.h.

Referenced by analyze().

const CaloVHitFilter* CaloHitAnalyzer::hitFilter_

Definition at line 40 of file CaloHitAnalyzer.h.

Referenced by fillHits().

int CaloHitAnalyzer::noiseHits_

Definition at line 42 of file CaloHitAnalyzer.h.

Referenced by analyze(), and fillHits().

const CaloVSimParameterMap* CaloHitAnalyzer::simParameterMap_

Definition at line 39 of file CaloHitAnalyzer.h.

CaloValidationStatistics CaloHitAnalyzer::summary_

Definition at line 41 of file CaloHitAnalyzer.h.

Referenced by analyze().