CMS 3D CMS Logo

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