CMS 3D CMS Logo

EnergyTask.cc
Go to the documentation of this file.
2 
4 
7 
9 
10 namespace ecaldqm {
11  EnergyTask::EnergyTask() : DQWorkerTask(), isPhysicsRun_(false) {}
12 
14  isPhysicsRun_ = _params.getUntrackedParameter<bool>("isPhysicsRun");
15  }
16 
17  bool EnergyTask::filterRunType(short const* _runType) {
18  for (unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++) {
19  if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
20  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
21  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
22  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
23  return true;
24  }
25 
26  return false;
27  }
28 
29  void EnergyTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es, bool const& ByLumiResetSwitch, bool&) {
30  if (ByLumiResetSwitch) {
31  MEs_.at("HitMapAllByLumi").reset(GetElectronicsMap());
32  }
33  }
34 
36  MESet& meHitMap(MEs_.at("HitMap"));
37  MESet& meHitMapAll(MEs_.at("HitMapAll"));
38  MESet& meHitMapAllByLumi(MEs_.at("HitMapAllByLumi"));
39  MESet& meHit(MEs_.at("Hit"));
40  MESet& meHitAll(MEs_.at("HitAll"));
41 
42  uint32_t neitherGoodNorPoorCalib(~(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kPoorCalib));
43  uint32_t neitherGoodNorOOT(~(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kOutOfTime));
44 
45  for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) {
46  if (isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorPoorCalib))
47  continue;
48  if (!isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorOOT))
49  continue;
50 
51  float energy(hitItr->energy());
52 
53  if (energy < 0.)
54  continue;
55 
56  DetId id(hitItr->id());
57 
58  meHitMap.fill(getEcalDQMSetupObjects(), id, energy);
59  meHitMapAll.fill(getEcalDQMSetupObjects(), id, energy);
60  meHitMapAllByLumi.fill(getEcalDQMSetupObjects(), id, energy);
61  meHit.fill(getEcalDQMSetupObjects(), id, energy);
62  meHitAll.fill(getEcalDQMSetupObjects(), id, energy);
63 
64  // look for the seeds
65  // float e3x3(energy);
66  // bool isSeed = true;
67 
68  // EcalRecHitCollection::const_iterator neighborItr;
69  // float neighborE;
70  // std::vector<DetId> window(GetTopology()->getWindow(id, 3, 3));
71  // for(std::vector<DetId>::iterator idItr(window.begin()); idItr != window.end(); ++idItr){
72  // if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue;
73  // if(isPhysicsRun_ && neighborItr->checkFlagMask(notGood)) continue;
74  // if(!isPhysicsRun_ && neighborItr->checkFlagMask(neitherGoodNorOOT)) continue;
75  // neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy();
76  // if(neighborE > energy){
77  // isSeed = false;
78  // break;
79  // }
80  // e3x3 += neighborE;
81  // }
82 
83  // if(!isSeed) continue;
84 
85  // if ( e3x3 >= threshS9_ )
86  // MEs_[kMiniCluster]->fill(id, e3x3);
87  }
88  }
89 
91 } // namespace ecaldqm
#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
void setParams(edm::ParameterSet const &) override
Definition: EnergyTask.cc:13
const_iterator begin() const
const_iterator end() const
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
void runOnRecHits(EcalRecHitCollection const &)
Definition: EnergyTask.cc:35
MESetCollection MEs_
Definition: DQWorker.h:131
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98
bool filterRunType(short const *) override
Definition: EnergyTask.cc:17
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: EnergyTask.cc:29