CMS 3D CMS Logo

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