CMS 3D CMS Logo

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