CMS 3D CMS Logo

TimingTask.cc
Go to the documentation of this file.
2 
5 
7 
9 
11 
12 namespace ecaldqm {
14  : DQWorkerTask(),
15  bxBinEdges_(),
16  bxBin_(0.),
17  chi2ThresholdEB_(0.),
18  chi2ThresholdEE_(0.),
19  energyThresholdEB_(0.),
20  energyThresholdEE_(0.),
21  energyThresholdEEFwd_(0.),
22  timingVsBXThreshold_(0.),
23  timeErrorThreshold_(0.),
24  meTimeMapByLS(nullptr) {}
25 
27  bxBinEdges_ = onlineMode_ ? _params.getUntrackedParameter<std::vector<int> >("bxBins")
28  : _params.getUntrackedParameter<std::vector<int> >("bxBinsFine");
29  chi2ThresholdEB_ = _params.getUntrackedParameter<double>("chi2ThresholdEB");
30  chi2ThresholdEE_ = _params.getUntrackedParameter<double>("chi2ThresholdEE");
31  energyThresholdEB_ = _params.getUntrackedParameter<double>("energyThresholdEB");
32  energyThresholdEE_ = _params.getUntrackedParameter<double>("energyThresholdEE");
33  energyThresholdEEFwd_ = _params.getUntrackedParameter<double>("energyThresholdEEFwd");
34  timingVsBXThreshold_ = _params.getUntrackedParameter<double>("timingVsBXThreshold");
35  timeErrorThreshold_ = _params.getUntrackedParameter<double>("timeErrorThreshold");
36  }
37 
38  bool TimingTask::filterRunType(short const* _runType) {
39  for (int iFED(0); iFED < nDCC; iFED++) {
40  if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
41  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
42  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
43  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
44  return true;
45  }
46 
47  return false;
48  }
49 
50  void TimingTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es, bool const& ByLumiResetSwitch, bool&) {
51  using namespace std;
52  std::vector<int>::iterator pBin = std::upper_bound(bxBinEdges_.begin(), bxBinEdges_.end(), _evt.bunchCrossing());
53  bxBin_ = static_cast<int>(pBin - bxBinEdges_.begin()) - 0.5;
54  if (ByLumiResetSwitch) {
55  meTimeMapByLS = &MEs_.at("TimeMapByLS");
56  if (timestamp_.iLumi % 10 == 0)
58  }
59  }
60 
61  void TimingTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) {
62  MESet& meTimeAmp(MEs_.at("TimeAmp"));
63  MESet& meTimeAmpAll(MEs_.at("TimeAmpAll"));
64  MESet& meTimingVsBX(onlineMode_ ? MEs_.at("BarrelTimingVsBX") : MEs_.at("BarrelTimingVsBXFineBinned"));
65  MESet& meTimeAll(MEs_.at("TimeAll"));
66  MESet& meTimeAllMap(MEs_.at("TimeAllMap"));
67  MESet& meTimeMap(MEs_.at("TimeMap")); // contains cumulative run stats => not suitable for Trend plots
68  MESet& meTime1D(MEs_.at("Time1D"));
69  MESet& meChi2(MEs_.at("Chi2"));
70 
71  uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime)));
72  int signedSubdet;
73 
74  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) {
75  if (hit.checkFlagMask(mask))
76  return;
77 
78  DetId id(hit.id());
79 
80  float time(hit.time());
81  float energy(hit.energy());
82 
84  if (id.subdetId() == EcalBarrel) {
87  } else {
90  }
91 
92  if (id.subdetId() == EcalBarrel)
93  signedSubdet = EcalBarrel;
94  else {
95  EEDetId eeId(hit.id());
96  if (eeId.zside() < 0)
97  signedSubdet = -EcalEndcap;
98  else
99  signedSubdet = EcalEndcap;
100  }
101 
102  if (energy > energyThreshold)
103  meChi2.fill(getEcalDQMSetupObjects(), signedSubdet, hit.chi2());
104 
105  // Apply cut on chi2 of pulse shape fit
106  if (hit.chi2() > chi2Threshold)
107  return;
108 
109  // Apply cut based on timing error of rechit
110  if (hit.timeError() > timeErrorThreshold_)
111  return;
112 
113  meTimeAmp.fill(getEcalDQMSetupObjects(), id, energy, time);
114  meTimeAmpAll.fill(getEcalDQMSetupObjects(), id, energy, time);
115 
116  if (energy > timingVsBXThreshold_ && signedSubdet == EcalBarrel)
117  meTimingVsBX.fill(getEcalDQMSetupObjects(), bxBin_, time);
118 
119  if (energy > energyThreshold) {
120  meTimeAll.fill(getEcalDQMSetupObjects(), id, time);
121  meTimeMap.fill(getEcalDQMSetupObjects(), id, time);
123  meTime1D.fill(getEcalDQMSetupObjects(), id, time);
124  meTimeAllMap.fill(getEcalDQMSetupObjects(), id, time);
125  }
126  });
127  }
128 
129  // For In-time vs Out-of-Time amplitude correlation MEs:
130  // Only UncalibRecHits carry information about OOT amplitude
131  // But still need to make sure we apply similar cuts as on RecHits
133  MESet& meTimeAmpBXm(MEs_.at("TimeAmpBXm"));
134  MESet& meTimeAmpBXp(MEs_.at("TimeAmpBXp"));
135 
136  for (EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr) {
137  // Apply reconstruction quality cuts
138  if (!uhitItr->checkFlag(EcalUncalibratedRecHit::kGood))
139  continue;
140  DetId id(uhitItr->id());
141  float chi2Threshold = 0.;
142  float ampThreshold = 0.;
143  if (id.subdetId() == EcalBarrel) {
145  ampThreshold = 20. * energyThresholdEB_; // 1 GeV ~ 20 ADC in EB
146  } else {
148  ampThreshold = 5. * ((isForward(id)) ? energyThresholdEEFwd_ : energyThresholdEE_); // 1 GeV ~ 5 ADC in EE
149  }
150 
151  if (uhitItr->chi2() > chi2Threshold)
152  continue;
153 
154  // Apply amplitude cut based on approx rechit energy
155  float amp(uhitItr->amplitude());
156  if (amp < ampThreshold)
157  continue;
158 
159  // Apply jitter timing cut based on approx rechit timing
160  float timeOff(id.subdetId() == EcalBarrel ? 0.4 : 1.8);
161  float hitTime(uhitItr->jitter() * 25. + timeOff); // 1 jitter ~ 25 ns
162  if (std::abs(hitTime) >= 5.)
163  continue;
164 
165  // Fill MEs
166  meTimeAmpBXm.fill(getEcalDQMSetupObjects(), id, amp, uhitItr->outOfTimeAmplitude(4)); // BX-1
167  meTimeAmpBXp.fill(getEcalDQMSetupObjects(), id, amp, uhitItr->outOfTimeAmplitude(6)); // BX+1
168  }
169  }
170 
172 } // namespace ecaldqm
pfDeepBoostedJetPreprocessParams_cfi.upper_bound
upper_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:16
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition: EcalDCCHeaderBlock.h:49
EcalRecHit
Definition: EcalRecHit.h:15
ecaldqm::TimingTask::runOnRecHits
void runOnRecHits(EcalRecHitCollection const &, Collections)
Definition: TimingTask.cc:61
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
ecaldqm::TimingTask::TimingTask
TimingTask()
Definition: TimingTask.cc:13
edm::EventBase::bunchCrossing
int bunchCrossing() const
Definition: EventBase.h:64
ecaldqm
Definition: DQWorker.h:29
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
ecaldqm::TimingTask::energyThresholdEB_
float energyThresholdEB_
Definition: TimingTask.h:31
ecaldqm::TimingTask::beginEvent
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: TimingTask.cc:50
ecaldqm::MESet::fill
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
protons_cff.time
time
Definition: protons_cff.py:39
edm::SortedCollection< EcalRecHit >
dtSegmentAnalysisTest_cfi.chi2Threshold
chi2Threshold
Definition: dtSegmentAnalysisTest_cfi.py:12
EcalUncalibratedRecHit::kGood
Definition: EcalUncalibratedRecHit.h:13
TimingTask.h
ecaldqm::TimingTask::filterRunType
bool filterRunType(short const *) override
Definition: TimingTask.cc:38
ecaldqm::isForward
bool isForward(DetId const &)
Definition: EcalDQMCommonUtils.cc:243
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:104
EcalBarrel
Definition: EcalSubdetector.h:10
ecaldqm::TimingTask::timingVsBXThreshold_
float timingVsBXThreshold_
Definition: TimingTask.h:34
DetId
Definition: DetId.h:17
EcalDCCHeaderBlock::PHYSICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:37
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
ecaldqm::TimingTask::energyThresholdEE_
float energyThresholdEE_
Definition: TimingTask.h:32
ecaldqm::DQWorkerTask
Definition: DQWorkerTask.h:71
ecaldqm::MESet::reset
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98
ecaldqm::TimingTask::timeErrorThreshold_
float timeErrorThreshold_
Definition: TimingTask.h:35
ecaldqm::TimingTask::chi2ThresholdEB_
float chi2ThresholdEB_
Definition: TimingTask.h:29
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
EcalRecHit::kGood
Definition: EcalRecHit.h:21
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:104
EEDetId
Definition: EEDetId.h:14
muonRecoAnalyzer_cfi.pBin
pBin
Definition: muonRecoAnalyzer_cfi.py:37
EcalEndcap
Definition: EcalSubdetector.h:10
ecaldqm::DQWorker::onlineMode_
bool onlineMode_
Definition: DQWorker.h:111
EcalRecHit::kOutOfTime
Definition: EcalRecHit.h:23
ecaldqm::TimingTask::energyThresholdEEFwd_
float energyThresholdEEFwd_
Definition: TimingTask.h:33
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
ecaldqm::TimingTask::setParams
void setParams(edm::ParameterSet const &) override
Definition: TimingTask.cc:26
EcalDCCHeaderBlock::PHYSICS_LOCAL
Definition: EcalDCCHeaderBlock.h:48
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::Collections
Collections
Definition: Collections.h:8
EcalDCCHeaderBlock.h
edm::EventSetup
Definition: EventSetup.h:58
ecaldqm::TimingTask::meTimeMapByLS
MESet * meTimeMapByLS
Definition: TimingTask.h:37
ecaldqm::TimingTask::runOnUncalibRecHits
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const &)
Definition: TimingTask.cc:132
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:40
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:128
EcalDCCHeaderBlock::COSMICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:38
std
Definition: JetResolutionObject.h:76
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ecaldqm::TimingTask::bxBinEdges_
std::vector< int > bxBinEdges_
Definition: TimingTask.h:26
EcalDCCHeaderBlock::MTCC
Definition: EcalDCCHeaderBlock.h:25
ecaldqm::TimingTask
Definition: TimingTask.h:10
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:107
EventSetup.h
EcalDCCHeaderBlock::COSMIC
Definition: EcalDCCHeaderBlock.h:22
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:91
ecaldqm::TimingTask::chi2ThresholdEE_
float chi2ThresholdEE_
Definition: TimingTask.h:30
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:141
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
ClusterTask_cfi.energyThreshold
energyThreshold
Definition: ClusterTask_cfi.py:3
edm::Event
Definition: Event.h:73
hit
Definition: SiStripHitEffFromCalibTree.cc:88
ecaldqm::TimingTask::bxBin_
double bxBin_
Definition: TimingTask.h:27
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:42