1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
#include "DQM/EcalMonitorTasks/interface/RecoSummaryTask.h"
#include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
#include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
#include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalTools.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
namespace ecaldqm {
RecoSummaryTask::RecoSummaryTask()
: DQWorkerTask(),
rechitThresholdEB_(0.),
rechitThresholdEE_(0.),
ebHits_(nullptr),
eeHits_(nullptr),
fillRecoFlagReduced_(true) {}
void RecoSummaryTask::setParams(edm::ParameterSet const& _params) {
rechitThresholdEB_ = _params.getUntrackedParameter<double>("rechitThresholdEB");
rechitThresholdEE_ = _params.getUntrackedParameter<double>("rechitThresholdEE");
fillRecoFlagReduced_ = _params.getUntrackedParameter<bool>("fillRecoFlagReduced");
if (!fillRecoFlagReduced_) {
MEs_.erase(std::string("RecoFlagReduced"));
}
}
void RecoSummaryTask::addDependencies(DependencySet& _dependencies) {
_dependencies.push_back(Dependency(kEBBasicCluster, kEBRecHit));
_dependencies.push_back(Dependency(kEEBasicCluster, kEERecHit));
}
bool RecoSummaryTask::filterRunType(short const* _runType) {
for (unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++) {
if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
_runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
_runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
_runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
return true;
}
return false;
}
void RecoSummaryTask::endEvent(edm::Event const&, edm::EventSetup const&) {
ebHits_ = nullptr;
eeHits_ = nullptr;
}
void RecoSummaryTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) {
bool isBarrel(_collection == kEBRecHit);
MESet& meEnergyMax(MEs_.at("EnergyMax"));
MESet& meChi2(MEs_.at("Chi2"));
MESet& meTime(MEs_.at("Time"));
MESet* meSwissCross(isBarrel ? &MEs_.at("SwissCross") : nullptr);
MESet& meRecoFlag(MEs_.at("RecoFlagAll"));
double maxE[2] = {-1., -1};
int subdet(isBarrel ? EcalBarrel : EcalEndcap);
for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) {
meRecoFlag.fill(getEcalDQMSetupObjects(), subdet, hitItr->recoFlag());
float energy(hitItr->energy());
int signedSubdet;
float rechitThreshold;
if (isBarrel) {
signedSubdet = EcalBarrel;
rechitThreshold = rechitThresholdEB_;
if (energy > 3.) {
EBDetId ebId(hitItr->id());
if (ebId.ieta() != 85)
meSwissCross->fill(getEcalDQMSetupObjects(), EcalTools::swissCross(ebId, _hits, 0.));
}
if (energy > maxE[0])
maxE[0] = energy;
} else {
rechitThreshold = rechitThresholdEE_;
EEDetId eeId(hitItr->id());
if (eeId.zside() < 0) {
signedSubdet = -EcalEndcap;
if (energy > maxE[0])
maxE[0] = energy;
} else {
signedSubdet = EcalEndcap;
if (energy > maxE[1])
maxE[1] = energy;
}
}
if (energy > rechitThreshold) {
meChi2.fill(getEcalDQMSetupObjects(), signedSubdet, hitItr->chi2());
meTime.fill(getEcalDQMSetupObjects(), signedSubdet, hitItr->time());
}
}
if (isBarrel) {
meEnergyMax.fill(getEcalDQMSetupObjects(), EcalBarrel, maxE[0]);
ebHits_ = &_hits;
} else {
meEnergyMax.fill(getEcalDQMSetupObjects(), -EcalEndcap, maxE[0]);
meEnergyMax.fill(getEcalDQMSetupObjects(), EcalEndcap, maxE[1]);
eeHits_ = &_hits;
}
}
void RecoSummaryTask::runOnReducedRecHits(EcalRecHitCollection const& _hits, Collections _collections) {
MESet& meRecoFlag(MEs_.at("RecoFlagReduced"));
int subdet(_collections == kEBReducedRecHit ? EcalBarrel : EcalEndcap);
for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr)
meRecoFlag.fill(getEcalDQMSetupObjects(), subdet, hitItr->recoFlag());
}
void RecoSummaryTask::runOnBasicClusters(edm::View<reco::CaloCluster> const& _bcs, Collections _collection) {
bool isBarrel(_collection == kEBBasicCluster);
MESet& meRecoFlag(MEs_.at("RecoFlagBasicCluster"));
EcalRecHitCollection const* hitCol(isBarrel ? ebHits_ : eeHits_);
int subdet(isBarrel ? EcalBarrel : EcalEndcap);
for (edm::View<reco::CaloCluster>::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr) {
if (bcItr->caloID().detectors() != 0) {
if (isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_BARREL))
continue;
if (!isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_ENDCAP))
continue;
}
std::vector<std::pair<DetId, float> > const& haf(bcItr->hitsAndFractions());
for (unsigned iH(0); iH != haf.size(); ++iH) {
if (isBarrel && haf[iH].first.subdetId() != EcalBarrel)
continue;
if (!isBarrel && haf[iH].first.subdetId() != EcalEndcap)
continue;
EcalRecHitCollection::const_iterator hItr(hitCol->find(haf[iH].first));
if (hItr == hitCol->end())
continue;
meRecoFlag.fill(getEcalDQMSetupObjects(), subdet, hItr->recoFlag());
}
}
}
DEFINE_ECALDQM_WORKER(RecoSummaryTask);
} // namespace ecaldqm
|