DQM
EcalMonitorTasks
src
PresampleTask.cc
Go to the documentation of this file.
1
#include "
DQM/EcalMonitorTasks/interface/PresampleTask.h
"
2
3
#include "
DQM/EcalCommon/interface/EcalDQMCommonUtils.h
"
4
5
#include "
DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h
"
6
7
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
8
9
namespace
ecaldqm
{
10
PresampleTask::PresampleTask
()
11
:
DQWorkerTask
(), doPulseMaxCheck_(
true
), pulseMaxPosition_(0), nSamples_(0), mePedestalByLS(nullptr) {}
12
13
void
PresampleTask::setParams
(
edm::ParameterSet
const
&
_params
) {
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
31
void
PresampleTask::beginLuminosityBlock
(
edm::LuminosityBlock
const
&,
edm::EventSetup
const
&) {
32
// Fill separate MEs with only 10 LSs worth of stats
33
// Used to correctly fill Presample Trend plots:
34
// 1 pt:10 LS in Trend plots
35
mePedestalByLS
= &
MEs_
.at(
"PedestalByLS"
);
36
if
(
timestamp_
.
iLumi
% 10 == 0)
37
mePedestalByLS
->
reset
();
38
}
39
40
template
<
typename
DigiCollection>
41
void
PresampleTask::runOnDigis
(
DigiCollection
const
& _digis) {
42
MESet
& mePedestal(
MEs_
.at(
"Pedestal"
));
// contains cumulative run stats => not suitable for Trend plots
43
44
for
(
typename
DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
45
DetId
id
(digiItr->id());
46
47
// EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
48
EcalDataFrame
dataFrame(*digiItr);
49
50
// Check that the digi pulse maximum occurs on the 6th sample
51
// For cosmics: disable this check to preserve statistics
52
if
(
doPulseMaxCheck_
) {
53
bool
gainSwitch(
false
);
54
int
iMax(-1);
55
int
maxADC(0);
56
for
(
int
iSample(0); iSample <
EcalDataFrame::MAXSAMPLES
; ++iSample) {
57
int
adc
(dataFrame.sample(iSample).adc());
58
if
(
adc
> maxADC) {
59
iMax = iSample;
60
maxADC =
adc
;
61
}
62
if
(iSample <
nSamples_
&& dataFrame.sample(iSample).gainId() != 1) {
63
gainSwitch =
true
;
64
break
;
65
}
66
}
// iSample
67
if
(iMax !=
pulseMaxPosition_
|| gainSwitch)
68
continue
;
69
}
// PulseMaxCheck
70
71
for
(
int
iSample(0); iSample <
nSamples_
; ++iSample) {
72
mePedestal.fill(
id
,
double
(dataFrame.sample(iSample).adc()));
73
mePedestalByLS
->
fill
(
id
,
double
(dataFrame.sample(iSample).adc()));
74
}
75
76
}
// _digis loop
77
}
// runOnDigis
78
79
DEFINE_ECALDQM_WORKER
(
PresampleTask
);
80
}
// namespace ecaldqm
EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition:
EcalDataFrame.h:48
ecalMGPA::adc
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
Definition:
EcalMGPASample.h:11
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition:
EcalDCCHeaderBlock.h:49
ecaldqm::PresampleTask::doPulseMaxCheck_
bool doPulseMaxCheck_
Definition:
PresampleTask.h:26
ecaldqm
Definition:
DQWorker.h:24
edm::LuminosityBlock
Definition:
LuminosityBlock.h:50
ecaldqm::PresampleTask::runOnDigis
void runOnDigis(DigiCollection const &)
Definition:
PresampleTask.cc:41
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
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::PresampleTask::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition:
PresampleTask.cc:31
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition:
DQWorker.h:78
funct::true
true
Definition:
Factorize.h:173
edm::ParameterSet
Definition:
ParameterSet.h:36
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::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
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition:
MESet.h:27
Generated for CMSSW Reference Manual by
1.8.16