CMS 3D CMS Logo

PresampleTask.cc
Go to the documentation of this file.
2 
4 
6 
8 
9 namespace ecaldqm {
11  : DQWorkerTask(), doPulseMaxCheck_(true), pulseMaxPosition_(0), nSamples_(0), mePedestalByLS(nullptr) {}
12 
14  doPulseMaxCheck_ = _params.getUntrackedParameter<bool>("doPulseMaxCheck");
15  pulseMaxPosition_ = _params.getUntrackedParameter<int>("pulseMaxPosition");
16  nSamples_ = _params.getUntrackedParameter<int>("nSamples");
17  }
18 
19  bool PresampleTask::filterRunType(short const* _runType) {
20  for (int iFED(0); iFED < nDCC; iFED++) {
21  if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
22  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
23  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
24  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
25  return true;
26  }
27 
28  return false;
29  }
30 
32  edm::EventSetup const& _es,
33  bool const& ByLumiResetSwitch,
34  bool&) {
35  if (ByLumiResetSwitch) {
36  // Fill separate MEs with only 10 LSs worth of stats
37  // Used to correctly fill Presample Trend plots:
38  // 1 pt:10 LS in Trend plots
39  mePedestalByLS = &MEs_.at("PedestalByLS");
40  if (timestamp_.iLumi % 10 == 0)
42  }
43  }
44 
45  template <typename DigiCollection>
47  MESet& mePedestal(MEs_.at("Pedestal")); // contains cumulative run stats => not suitable for Trend plots
48 
49  for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
50  DetId id(digiItr->id());
51 
52  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
53  EcalDataFrame dataFrame(*digiItr);
54 
55  // Check that the digi pulse maximum occurs on the 6th sample
56  // For cosmics: disable this check to preserve statistics
57  if (doPulseMaxCheck_) {
58  bool gainSwitch(false);
59  int iMax(-1);
60  int maxADC(0);
61  for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; ++iSample) {
62  int adc(dataFrame.sample(iSample).adc());
63  if (adc > maxADC) {
64  iMax = iSample;
65  maxADC = adc;
66  }
67  if (iSample < nSamples_ && dataFrame.sample(iSample).gainId() != 1) {
68  gainSwitch = true;
69  break;
70  }
71  } // iSample
72  if (iMax != pulseMaxPosition_ || gainSwitch)
73  continue;
74  } // PulseMaxCheck
75 
76  for (int iSample(0); iSample < nSamples_; ++iSample) {
77  mePedestal.fill(id, double(dataFrame.sample(iSample).adc()));
78  mePedestalByLS->fill(id, double(dataFrame.sample(iSample).adc()));
79  }
80 
81  } // _digis loop
82  } // runOnDigis
83 
85 } // namespace ecaldqm
EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition: EcalDCCHeaderBlock.h:49
ecaldqm::PresampleTask::doPulseMaxCheck_
bool doPulseMaxCheck_
Definition: PresampleTask.h:26
ecaldqm
Definition: DQWorker.h:24
ecaldqm::PresampleTask::runOnDigis
void runOnDigis(DigiCollection const &)
Definition: PresampleTask.cc:46
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::PresampleTask::filterRunType
bool filterRunType(short const *) override
Definition: PresampleTask.cc:19
EcalDataFrame
Definition: EcalDataFrame.h:16
ecaldqm::PresampleTask::mePedestalByLS
MESet * mePedestalByLS
Definition: PresampleTask.h:29
ecalLiteDTU::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition: EcalLiteDTUSample.h:12
ecaldqm::MESet::fill
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
DetId
Definition: DetId.h:17
EcalDCCHeaderBlock::PHYSICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:37
ecaldqm::DQWorkerTask
Definition: DQWorkerTask.h:71
ecaldqm::PresampleTask::pulseMaxPosition_
int pulseMaxPosition_
Definition: PresampleTask.h:27
ecaldqm::PresampleTask
Definition: PresampleTask.h:10
ecaldqm::PresampleTask::nSamples_
int nSamples_
Definition: PresampleTask.h:28
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
funct::true
true
Definition: Factorize.h:173
edm::ParameterSet
Definition: ParameterSet.h:47
ecaldqm::PresampleTask::setParams
void setParams(edm::ParameterSet const &) override
Definition: PresampleTask.cc:13
ecaldqm::PresampleTask::PresampleTask
PresampleTask()
Definition: PresampleTask.cc:10
EcalDCCHeaderBlock::PHYSICS_LOCAL
Definition: EcalDCCHeaderBlock.h:48
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:362
ecaldqm::MESet::reset
virtual void reset(double=0., double=0., double=0.)
Definition: MESet.cc:98
EcalDCCHeaderBlock.h
edm::EventSetup
Definition: EventSetup.h:57
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
EcalDCCHeaderBlock::COSMICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:38
siStripShotFilter_cfi.DigiCollection
DigiCollection
Definition: siStripShotFilter_cfi.py:6
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
EcalDCCHeaderBlock::MTCC
Definition: EcalDCCHeaderBlock.h:25
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:81
EcalDCCHeaderBlock::COSMIC
Definition: EcalDCCHeaderBlock.h:22
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:92
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:112
PresampleTask.h
ParameterSet.h
ecaldqm::PresampleTask::beginEvent
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: PresampleTask.cc:31
edm::Event
Definition: Event.h:73
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:27