SimCalorimetry
CaloSimAlgos
src
CaloHitAnalyzer.cc
Go to the documentation of this file.
1
#include "
DataFormats/DetId/interface/DetId.h
"
2
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloHitAnalyzer.h
"
3
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloSimParameters.h
"
4
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloVHitFilter.h
"
5
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloVSimParameterMap.h
"
6
#include "
SimCalorimetry/CaloSimAlgos/interface/CaloValidationStatistics.h
"
7
8
#include <iostream>
9
10
CaloHitAnalyzer::CaloHitAnalyzer
(
const
std::string
&
name
,
11
double
hitEnergyThreshold,
12
const
CaloVSimParameterMap
*parameterMap,
13
const
CaloVHitFilter
*
filter
)
14
: hitEnergySumMap_(),
15
hitEnergyThreshold_(hitEnergyThreshold),
16
simParameterMap_(parameterMap),
17
hitFilter_(
filter
),
18
summary_(
name
, 1., 0.),
19
noiseHits_(0) {}
20
21
#include "
DataFormats/HcalDetId/interface/HcalDetId.h
"
22
void
CaloHitAnalyzer::fillHits
(
MixCollection<PCaloHit>
&
hits
) {
23
hitEnergySumMap_
.clear();
24
noiseHits_
= 0;
25
// store the energy of each hit in a map
26
MixCollection<PCaloHit>::MixItr
hitItr =
hits
.begin();
27
MixCollection<PCaloHit>::MixItr
last
=
hits
.end();
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()) {
39
hitEnergySumMap_
[
id
] =
energy
;
40
}
else
{
41
mapItr->second +=
energy
;
42
}
43
}
44
}
45
}
46
47
void
CaloHitAnalyzer::analyze
(
int
id
,
double
recEnergy) {
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
}
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
CaloVSimParameterMap
Definition:
CaloVSimParameterMap.h:7
CaloHitAnalyzer::hitEnergyThreshold_
double hitEnergyThreshold_
Definition:
CaloHitAnalyzer.h:36
CaloValidationStatistics.h
ecalSimParameterMap_cff.samplingFactor
samplingFactor
Definition:
ecalSimParameterMap_cff.py:7
CaloSimParameters.h
CaloHitAnalyzer::hitEnergySumMap_
std::map< int, double > hitEnergySumMap_
Definition:
CaloHitAnalyzer.h:35
MixCollection::MixItr
Definition:
MixCollection.h:61
CaloVHitFilter.h
dqmdumpme.last
last
Definition:
dqmdumpme.py:56
MixCollection
Definition:
MixCollection.h:10
CaloHitAnalyzer::fillHits
void fillHits(MixCollection< PCaloHit > &hits)
should be called each event
Definition:
CaloHitAnalyzer.cc:22
CaloVHitFilter::accepts
virtual bool accepts(const PCaloHit &hit) const =0
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition:
HCALHighEnergyHPDFilter_cfi.py:5
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition:
ALCARECOTkAlBeamHalo_cff.py:27
CaloHitAnalyzer.h
HcalDetId.h
CaloHitAnalyzer::summary_
CaloValidationStatistics summary_
Definition:
CaloHitAnalyzer.h:39
CaloVSimParameterMap.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
CaloHitAnalyzer::hitFilter_
const CaloVHitFilter * hitFilter_
Definition:
CaloHitAnalyzer.h:38
CaloHitAnalyzer::analyze
void analyze(int detId, double recEnergy)
to be called for each RecHit
Definition:
CaloHitAnalyzer.cc:47
CaloHitAnalyzer::noiseHits_
int noiseHits_
Definition:
CaloHitAnalyzer.h:40
CaloHitAnalyzer::CaloHitAnalyzer
CaloHitAnalyzer(const std::string &name, double hitEnergyThreshold, const CaloVSimParameterMap *parameterMap, const CaloVHitFilter *filter=nullptr)
Definition:
CaloHitAnalyzer.cc:10
DetId.h
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:29
CaloVHitFilter
Definition:
CaloVHitFilter.h:6
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
CaloValidationStatistics::addEntry
void addEntry(float value, float weight=1.)
Definition:
CaloValidationStatistics.cc:18
Generated for CMSSW Reference Manual by
1.8.16