CMS 3D CMS Logo

PresampleTask.cc
Go to the documentation of this file.
3 
5 
7 
9 
10 namespace ecaldqm {
12  : DQWorkerTask(), doPulseMaxCheck_(true), pulseMaxPosition_(0), nSamples_(0), mePedestalByLS(nullptr) {}
13 
15  doPulseMaxCheck_ = _params.getUntrackedParameter<bool>("doPulseMaxCheck");
16  pulseMaxPosition_ = _params.getUntrackedParameter<int>("pulseMaxPosition");
17  nSamples_ = _params.getUntrackedParameter<int>("nSamples");
18  }
20 
21  bool PresampleTask::filterRunType(short const* _runType) {
22  for (int iFED(0); iFED < nDCC; iFED++) {
23  if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
24  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
25  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
26  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
27  return true;
28  }
29 
30  return false;
31  }
32 
33  void PresampleTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { FillPedestal = true; }
34 
36  edm::EventSetup const& _es,
37  bool const& ByLumiResetSwitch,
38  bool&) {
39  if (ByLumiResetSwitch) {
40  // Fill separate MEs with only 10 LSs worth of stats
41  // Used to correctly fill Presample Trend plots:
42  // 1 pt:10 LS in Trend plots
43  mePedestalByLS = &MEs_.at("PedestalByLS");
44  if (timestamp_.iLumi % 10 == 0)
46  }
47 
48  MESet& mePedestalProjEtaG1(MEs_.at("PedestalProjEtaG1"));
49  MESet& mePedestalProjEtaG6(MEs_.at("PedestalProjEtaG6"));
50  MESet& mePedestalProjEtaG12(MEs_.at("PedestalProjEtaG12"));
51 
52  if (FillPedestal) {
53  const EcalPedestals* myped = &_es.getData(Pedtoken_);
54 
55  for (int i = 0; i < EBDetId::kSizeForDenseIndexing; i++) {
57  continue;
59  EcalPedestals::const_iterator it = myped->find(ebid.rawId());
60  if (it != myped->end()) {
61  mePedestalProjEtaG1.fill(getEcalDQMSetupObjects(), ebid, (*it).rms_x1);
62  mePedestalProjEtaG6.fill(getEcalDQMSetupObjects(), ebid, (*it).rms_x6);
63  mePedestalProjEtaG12.fill(getEcalDQMSetupObjects(), ebid, (*it).rms_x12);
64  }
65  }
66  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; i++) {
68  continue;
70  EcalPedestals::const_iterator it = myped->find(eeid.rawId());
71  if (it != myped->end()) {
72  mePedestalProjEtaG1.fill(getEcalDQMSetupObjects(), eeid, (*it).rms_x1);
73  mePedestalProjEtaG6.fill(getEcalDQMSetupObjects(), eeid, (*it).rms_x6);
74  mePedestalProjEtaG12.fill(getEcalDQMSetupObjects(), eeid, (*it).rms_x12);
75  }
76  }
77 
78  FillPedestal = false;
79  }
80  }
81 
82  template <typename DigiCollection>
84  MESet& mePedestal(MEs_.at("Pedestal")); // contains cumulative run stats => not suitable for Trend plots
85 
86  for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) {
87  DetId id(digiItr->id());
88 
89  // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor
90  EcalDataFrame dataFrame(*digiItr);
91 
92  // Check that the digi pulse maximum occurs on the 6th sample
93  // For cosmics: disable this check to preserve statistics
94  if (doPulseMaxCheck_) {
95  bool gainSwitch(false);
96  int iMax(-1);
97  int maxADC(0);
98  for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; ++iSample) {
99  int adc(dataFrame.sample(iSample).adc());
100  if (adc > maxADC) {
101  iMax = iSample;
102  maxADC = adc;
103  }
104  if (iSample < nSamples_ && dataFrame.sample(iSample).gainId() != 1) {
105  gainSwitch = true;
106  break;
107  }
108  } // iSample
109  if (iMax != pulseMaxPosition_ || gainSwitch)
110  continue;
111  } // PulseMaxCheck
112 
113  for (int iSample(0); iSample < nSamples_; ++iSample) {
114  mePedestal.fill(getEcalDQMSetupObjects(), id, double(dataFrame.sample(iSample).adc()));
115  mePedestalByLS->fill(getEcalDQMSetupObjects(), id, double(dataFrame.sample(iSample).adc()));
116  }
117 
118  } // _digis loop
119  } // runOnDigis
120 
122 } // namespace ecaldqm
EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:74
EcalDCCHeaderBlock::COSMICS_LOCAL
Definition: EcalDCCHeaderBlock.h:49
ecaldqm::PresampleTask::doPulseMaxCheck_
bool doPulseMaxCheck_
Definition: PresampleTask.h:32
mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm
Definition: DQWorker.h:37
edm::Run
Definition: Run.h:45
EBDetId
Definition: EBDetId.h:17
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
ecaldqm::MESet::fill
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
ecaldqm::PresampleTask::runOnDigis
void runOnDigis(DigiCollection const &)
Definition: PresampleTask.cc:83
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::PresampleTask::filterRunType
bool filterRunType(short const *) override
Definition: PresampleTask.cc:21
EcalDataFrame
Definition: EcalDataFrame.h:16
EcalCondObjectContainer
Definition: EcalCondObjectContainer.h:13
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
ecaldqm::PresampleTask::mePedestalByLS
MESet * mePedestalByLS
Definition: PresampleTask.h:35
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:118
DetId
Definition: DetId.h:17
EcalDCCHeaderBlock::PHYSICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:37
EEDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:213
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::PresampleTask::pulseMaxPosition_
int pulseMaxPosition_
Definition: PresampleTask.h:33
EEDetId::kSizeForDenseIndexing
Definition: EEDetId.h:329
ecaldqm::PresampleTask
Definition: PresampleTask.h:14
ecaldqm::PresampleTask::nSamples_
int nSamples_
Definition: PresampleTask.h:34
ecaldqm::PresampleTask::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: PresampleTask.cc:33
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
ecaldqm::PresampleTask::Pedtoken_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > Pedtoken_
Definition: PresampleTask.h:31
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:125
EEDetId
Definition: EEDetId.h:14
ecaldqm::PresampleTask::FillPedestal
bool FillPedestal
Definition: PresampleTask.h:36
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:14
ecaldqm::PresampleTask::PresampleTask
PresampleTask()
Definition: PresampleTask.cc:11
EcalDCCHeaderBlock::PHYSICS_LOCAL
Definition: EcalDCCHeaderBlock.h:48
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
EBDetId::validDenseIndex
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:105
EcalDCCHeaderBlock.h
edm::EventSetup
Definition: EventSetup.h:58
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:48
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
EcalDCCHeaderBlock::COSMICS_GLOBAL
Definition: EcalDCCHeaderBlock.h:38
siStripShotFilter_cfi.DigiCollection
DigiCollection
Definition: siStripShotFilter_cfi.py:6
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
EBDetId::kSizeForDenseIndexing
Definition: EBDetId.h:155
EcalDCCHeaderBlock::MTCC
Definition: EcalDCCHeaderBlock.h:25
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:128
EventSetup.h
ecaldqm::PresampleTask::setTokens
void setTokens(edm::ConsumesCollector &) override
Definition: PresampleTask.cc:19
EcalDCCHeaderBlock::COSMIC
Definition: EcalDCCHeaderBlock.h:22
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:91
EcalCondObjectContainer::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:162
PresampleTask.h
ParameterSet.h
ecaldqm::PresampleTask::beginEvent
void beginEvent(edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
Definition: PresampleTask.cc:35
edm::Event
Definition: Event.h:73
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:42