CMS 3D CMS Logo

Public Member Functions | Public Attributes

CaloHitAnalyzer Class Reference

#include <CaloHitAnalyzer.h>

List of all members.

Public Member Functions

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

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.

: hitEnergySumMap_(),
  hitEnergyThreshold_(hitEnergyThreshold),
  simParameterMap_(parameterMap),
  hitFilter_(filter),
  summary_(name, 1., 0.),
  noiseHits_(0)
{
}

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 HcalDigiStatistics::analyze(), CastorDigiStatistics::analyze(), CastorHitAnalyzerImpl::analyze(), and HcalHitAnalyzerImpl::analyze().

                                                      {
  if(recEnergy > hitEnergyThreshold_) {
    std::map<int, double>::iterator mapItr = hitEnergySumMap_.find(id);
    if(mapItr == hitEnergySumMap_.end()) {
      ++noiseHits_;
    } else {
       // keep statistics of the rec energy / sim energy
      summary_.addEntry(recEnergy/mapItr->second);
    }
  }
}
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_, prof2calltree::last, and noiseHits_.

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

                                                             {
  hitEnergySumMap_.clear();
  noiseHits_ = 0;
  // store the energy of each hit in a map
  MixCollection<PCaloHit>::MixItr hitItr = hits.begin();
  MixCollection<PCaloHit>::MixItr last = hits.end();
  for( ; hitItr != last; ++hitItr) 
  {
    if(hitFilter_ == 0 || hitFilter_->accepts(*hitItr)) {
      int id = hitItr->id();
      //double samplingFactor = simParameterMap_->simParameters(DetId(id)).samplingFactor();
      double samplingFactor = 1.;
      double energy = hitItr->energy() * samplingFactor;

      // add it to the map
      std::map<int, double>::iterator mapItr = hitEnergySumMap_.find(id);
      if(mapItr == hitEnergySumMap_.end()) {
        hitEnergySumMap_[id] = energy;
      } else {
        mapItr->second += energy;
      }
    }
  }
}

Member Data Documentation

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

Definition at line 37 of file CaloHitAnalyzer.h.

Referenced by analyze(), and fillHits().

Definition at line 38 of file CaloHitAnalyzer.h.

Referenced by analyze().

Definition at line 40 of file CaloHitAnalyzer.h.

Referenced by fillHits().

Definition at line 42 of file CaloHitAnalyzer.h.

Referenced by analyze(), and fillHits().

Definition at line 39 of file CaloHitAnalyzer.h.

Definition at line 41 of file CaloHitAnalyzer.h.

Referenced by analyze().