CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TimingTask.cc
Go to the documentation of this file.
1 #include "../interface/TimingTask.h"
2 
4 
5 namespace ecaldqm {
6 
8  DQWorkerTask(_params, _paths, "TimingTask"),
9  energyThresholdEB_(0.),
10  energyThresholdEE_(0.)
11  {
13  (0x1 << kEBRecHit) |
14  (0x1 << kEERecHit);
15 
16  edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));
17 
18  energyThresholdEB_ = taskParams.getUntrackedParameter<double>("energyThresholdEB");
19  energyThresholdEE_ = taskParams.getUntrackedParameter<double>("energyThresholdEE");
20  }
21 
23  {
24  }
25 
26  bool
27  TimingTask::filterRunType(const std::vector<short>& _runType)
28  {
29  for(int iFED(0); iFED < 54; iFED++){
30  if ( _runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
31  _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
32  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
33  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
34  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
35  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) return true;
36  }
37 
38  return false;
39  }
40 
41  void
43  {
44  uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime)));
45  float threshold(_collection == kEBRecHit ? energyThresholdEB_ : energyThresholdEE_);
46 
47  for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){
48 
49  if(hitItr->checkFlagMask(mask)) continue;
50 
51  DetId id(hitItr->id());
52 
53  float time(hitItr->time());
54  float energy(hitItr->energy());
55 
56  MEs_[kTimeAmp]->fill(id, energy, time);
57  MEs_[kTimeAmpAll]->fill(id, energy, time);
58 
59  if(energy > threshold){
60  MEs_[kTimeAll]->fill(id, time);
61  MEs_[kTimeMap]->fill(id, time);
62  MEs_[kTimeAllMap]->fill(id, time);
63  }
64  }
65  }
66 
67  /*static*/
68  void
69  TimingTask::setMEData(std::vector<MEData>& _data)
70  {
71  BinService::AxisSpecs axis, axisE, axisT;
72 
73  axis.low = -20.;
74  axis.high = 20.;
76 
77  axis.nbins = 100;
78  axis.low = -25.;
79  axis.high = 25.;
81 
82  axis.low = -7.;
83  axis.high = 7.;
85 
86 
87  axisE.nbins = 25;
88  axisE.low = -0.5;
89  axisE.high = 2.;
90  axisE.edges = new double[axisE.nbins + 1];
91  for(int i = 0; i <= axisE.nbins; i++)
92  axisE.edges[i] = pow((float)10., axisE.low + (axisE.high - axisE.low) / axisE.nbins * i);
93 
94  axisT.nbins = 200;
95  axisT.low = -50.;
96  axisT.high = 50.;
97  axisT.edges = new double[axisT.nbins + 1];
98  for(int i = 0; i <= axisT.nbins; i++)
99  axisT.edges[i] = axisT.low + (axisT.high - axisT.low) / axisT.nbins * i;
100 
101  _data[kTimeAmp] = MEData("TimeAmp", BinService::kSM, BinService::kUser, MonitorElement::DQM_KIND_TH2F, &axisE, &axisT);
103  }
104 
106 }
107 
108 
int i
Definition: DBlmapReader.cc:9
static void setMEData(std::vector< MEData > &)
Definition: TimingTask.cc:69
std::vector< EcalRecHit >::const_iterator const_iterator
ParameterSet const & getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
TimingTask(const edm::ParameterSet &, const edm::ParameterSet &)
Definition: TimingTask.cc:7
bool filterRunType(const std::vector< short > &)
Definition: TimingTask.cc:27
float energyThresholdEE_
Definition: TimingTask.h:34
const_iterator end() const
Definition: DetId.h:20
std::vector< MESet * > MEs_
Definition: DQWorker.h:56
float energyThresholdEB_
Definition: TimingTask.h:33
DEFINE_ECALDQM_WORKER(CertificationClient)
void runOnRecHits(const EcalRecHitCollection &, Collections)
Definition: TimingTask.cc:42
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::string name_
Definition: DQWorker.h:55
const_iterator begin() const