CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EnergyTask.cc
Go to the documentation of this file.
1 #include "../interface/EnergyTask.h"
2 
6 
8 
9 namespace ecaldqm {
10 
12  DQWorkerTask(_params, _paths, "EnergyTask"),
13  topology_(0),
14  isPhysicsRun_(false),
15  threshS9_(0.)
16  {
18  (0x1 << kRun) |
19  (0x1 << kEBRecHit) |
20  (0x1 << kEERecHit);
21 
22  edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
23 
24  isPhysicsRun_ = taskParams.getUntrackedParameter<bool>("isPhysicsRun");
25  threshS9_ = taskParams.getUntrackedParameter<double>("threshS9");
26 
27  std::map<std::string, std::string> replacements;
28  if(!isPhysicsRun_) replacements["oot"] = " (outOfTime)";
29  else replacements["oot"] = "";
30 
31  for(unsigned iME(0); iME < nMESets; iME++)
32  MEs_[iME]->name(replacements);
33  }
34 
36  {
37  }
38 
39  void
41  {
43  _es.get<CaloTopologyRecord>().get(topoHndl);
44  topology_ = topoHndl.product();
45  if(!topology_)
46  throw cms::Exception("EventSetup") << "CaloTopology missing" << std::endl;
47  }
48 
49  bool
50  EnergyTask::filterRunType(const std::vector<short>& _runType)
51  {
52  for(int iFED(0); iFED < 54; iFED++){
53  if ( _runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
54  _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
55  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
56  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
57  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
58  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) return true;
59  }
60 
61  return false;
62  }
63 
64  void
66  {
67  uint32_t mask(~(0x1 << EcalRecHit::kGood));
68 
69  for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){
70 
71  if(isPhysicsRun_ && hitItr->checkFlagMask(mask)) continue;
72 
73  float energy(isPhysicsRun_ ? hitItr->energy() : hitItr->outOfTimeEnergy());
74 
75  if ( energy < 0. ) energy = 0.0;
76 
77  DetId id(hitItr->id());
78 
79  MEs_[kHitMap]->fill(id, energy);
80  MEs_[kHitMapAll]->fill(id, energy);
81  MEs_[kHit]->fill(id, energy);
82  MEs_[kHitAll]->fill(id, energy);
83 
84  // look for the seeds
85  float e3x3(energy);
86  bool isSeed = true;
87 
89  float neighborE;
90  std::vector<DetId> window(topology_->getWindow(id, 3, 3));
91  for(std::vector<DetId>::iterator idItr(window.begin()); idItr != window.end(); ++idItr){
92  if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue;
93  if(isPhysicsRun_ && neighborItr->checkFlagMask(mask)) continue;
94  neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy();
95  if(neighborE > energy){
96  isSeed = false;
97  break;
98  }
99  e3x3 += neighborE;
100  }
101 
102  if(!isSeed) continue;
103 
104  if ( e3x3 >= threshS9_ )
105  MEs_[kMiniCluster]->fill(id, e3x3);
106 
107  }
108  }
109 
110  /*static*/
111  void
112  EnergyTask::setMEData(std::vector<MEData>& _data)
113  {
114  BinService::AxisSpecs xaxis, zaxis;
115 
116  zaxis.low = 0.;
117  zaxis.high = 10.;
120 
121  xaxis.nbins = 50;
122  xaxis.low = 0.;
123  xaxis.high = 20.;
126 
128  }
129 
131 }
132 
133 
def window
Definition: svgfig.py:642
std::vector< EcalRecHit >::const_iterator const_iterator
bool filterRunType(const std::vector< short > &) override
Definition: EnergyTask.cc:50
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
static void setMEData(std::vector< MEData > &)
Definition: EnergyTask.cc:112
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:73
const CaloTopology * topology_
Definition: EnergyTask.h:38
const_iterator end() const
Definition: DetId.h:18
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
const T & get() const
Definition: EventSetup.h:55
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition: EnergyTask.cc:40
T const * product() const
Definition: ESHandle.h:62
void runOnRecHits(const EcalRecHitCollection &)
Definition: EnergyTask.cc:65
iterator find(key_type k)
EnergyTask(const edm::ParameterSet &, const edm::ParameterSet &)
Definition: EnergyTask.cc:11
DEFINE_ECALDQM_WORKER(CertificationClient)
volatile std::atomic< bool > shutdown_flag false
std::string name_
Definition: DQWorker.h:55
const_iterator begin() const
Definition: Run.h:41