File indexing completed on 2024-04-06 12:08:55
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "FWCore/Framework/interface/ESHandle.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 #include "FWCore/ServiceRegistry/interface/Service.h"
0015
0016 #include "DataFormats/Common/interface/Handle.h"
0017
0018 #include "DQM/SiStripCommon/interface/ExtractTObject.h"
0019 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
0020 #include "DQM/SiStripCommon/interface/SiStripHistoId.h"
0021 #include "DQMServices/Core/interface/DQMStore.h"
0022
0023 #include "DQM/SiStripMonitorSummary/interface/SiStripClassToMonitorCondData.h"
0024
0025 #include "DQM/SiStripMonitorSummary/interface/SiStripApvGainsDQM.h"
0026 #include "DQM/SiStripMonitorSummary/interface/SiStripBackPlaneCorrectionDQM.h"
0027 #include "DQM/SiStripMonitorSummary/interface/SiStripCablingDQM.h"
0028 #include "DQM/SiStripMonitorSummary/interface/SiStripLorentzAngleDQM.h"
0029 #include "DQM/SiStripMonitorSummary/interface/SiStripNoisesDQM.h"
0030 #include "DQM/SiStripMonitorSummary/interface/SiStripPedestalsDQM.h"
0031 #include "DQM/SiStripMonitorSummary/interface/SiStripQualityDQM.h"
0032 #include "DQM/SiStripMonitorSummary/interface/SiStripThresholdDQM.h"
0033
0034 #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
0035 #include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h"
0036 #include "CondFormats/SiStripObjects/interface/SiStripLorentzAngle.h"
0037 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0038 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0039
0040 #include "CondFormats/DataRecord/interface/SiStripApvGainRcd.h"
0041 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0042 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
0043
0044 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0045 #include "CalibTracker/Records/interface/SiStripQualityRcd.h"
0046
0047
0048 #include <cstdlib>
0049 #include <algorithm>
0050
0051 SiStripClassToMonitorCondData::SiStripClassToMonitorCondData(edm::ParameterSet const& iConfig,
0052 edm::ConsumesCollector iC)
0053 : conf_(iConfig) {
0054 const auto& mPSet = iConfig.getParameter<edm::ParameterSet>("MonitorSiStrip_PSet");
0055 monitorPedestals_ = mPSet.getParameter<bool>("MonitorSiStripPedestal");
0056 monitorNoises_ = mPSet.getParameter<bool>("MonitorSiStripNoise");
0057 monitorQuality_ = mPSet.getParameter<bool>("MonitorSiStripQuality");
0058 monitorApvGains_ = mPSet.getParameter<bool>("MonitorSiStripApvGain");
0059 monitorLorentzAngle_ = mPSet.getParameter<bool>("MonitorSiStripLorentzAngle");
0060 monitorBackPlaneCorrection_ = mPSet.getParameter<bool>("MonitorSiStripBackPlaneCorrection");
0061 monitorLowThreshold_ = mPSet.getParameter<bool>("MonitorSiStripLowThreshold");
0062 monitorHighThreshold_ = mPSet.getParameter<bool>("MonitorSiStripHighThreshold");
0063 monitorCabling_ = mPSet.getParameter<bool>("MonitorSiStripCabling");
0064
0065 tkDetMapToken_ = iC.esConsumes<edm::Transition::BeginRun>();
0066 tTopoToken_ = iC.esConsumes<edm::Transition::BeginRun>();
0067 if (monitorPedestals_) {
0068 pedestalsToken_ = iC.esConsumes();
0069 }
0070 if (monitorNoises_) {
0071 noiseToken_ = iC.esConsumes();
0072 const auto& hPSet = iConfig.getParameter<edm::ParameterSet>("SiStripNoisesDQM_PSet");
0073 if (hPSet.getParameter<bool>("SimGainRenormalisation")) {
0074 simGainToken_ = iC.esConsumes<edm::Transition::BeginRun>();
0075 } else if (hPSet.getParameter<bool>("GainRenormalisation")) {
0076 gainTokenForNoise_ = iC.esConsumes<edm::Transition::BeginRun>();
0077 }
0078 }
0079 if (monitorQuality_) {
0080 const auto& fPSet = conf_.getParameter<edm::ParameterSet>("FillConditions_PSet");
0081 const auto& qualityLabel = fPSet.getParameter<std::string>("StripQualityLabel");
0082 qualityToken_ = iC.esConsumes(edm::ESInputTag{"", qualityLabel});
0083 }
0084 if (monitorApvGains_) {
0085 gainToken_ = iC.esConsumes();
0086 }
0087 if (monitorLorentzAngle_) {
0088 lorentzAngleToken_ = iC.esConsumes();
0089 }
0090 if (monitorBackPlaneCorrection_) {
0091 backplaneCorrectionToken_ = iC.esConsumes();
0092 }
0093 if (monitorLowThreshold_ || monitorHighThreshold_) {
0094 thresholdToken_ = iC.esConsumes();
0095 }
0096 if (monitorCabling_) {
0097 detCablingToken_ = iC.esConsumes();
0098 }
0099 }
0100
0101 SiStripClassToMonitorCondData::~SiStripClassToMonitorCondData() {}
0102
0103 void SiStripClassToMonitorCondData::beginRun(edm::RunNumber_t iRun, edm::EventSetup const& eSetup) {
0104 const auto tTopo = &eSetup.getData(tTopoToken_);
0105 const auto& fPSet = conf_.getParameter<edm::ParameterSet>("FillConditions_PSet");
0106 const TkDetMap* tkDetMap{nullptr};
0107 if (fPSet.getParameter<bool>("HistoMaps_On")) {
0108 tkDetMap = &eSetup.getData(tkDetMapToken_);
0109 }
0110 if (monitorPedestals_) {
0111 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripPedestalsDQM_PSet");
0112 pedestalsDQM_ = std::make_unique<SiStripPedestalsDQM>(pedestalsToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0113 }
0114
0115 if (monitorNoises_) {
0116 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripNoisesDQM_PSet");
0117 const SiStripApvGain* gain = nullptr;
0118 if (hPSet.getParameter<bool>("SimGainRenormalisation")) {
0119 gain = &eSetup.getData(simGainToken_);
0120 } else if (hPSet.getParameter<bool>("GainRenormalisation")) {
0121 gain = &eSetup.getData(gainTokenForNoise_);
0122 }
0123 noisesDQM_ = std::make_unique<SiStripNoisesDQM>(noiseToken_, iRun, hPSet, fPSet, tTopo, tkDetMap, gain);
0124 }
0125
0126 if (monitorQuality_) {
0127 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripQualityDQM_PSet");
0128 qualityDQM_ = std::make_unique<SiStripQualityDQM>(qualityToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0129 }
0130
0131 if (monitorApvGains_) {
0132 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripApvGainsDQM_PSet");
0133 apvgainsDQM_ = std::make_unique<SiStripApvGainsDQM>(gainToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0134 }
0135
0136 if (monitorLorentzAngle_) {
0137 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripLorentzAngleDQM_PSet");
0138 lorentzangleDQM_ =
0139 std::make_unique<SiStripLorentzAngleDQM>(lorentzAngleToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0140 }
0141
0142 if (monitorBackPlaneCorrection_) {
0143 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripBackPlaneCorrectionDQM_PSet");
0144 bpcorrectionDQM_ =
0145 std::make_unique<SiStripBackPlaneCorrectionDQM>(backplaneCorrectionToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0146 }
0147
0148 if (monitorLowThreshold_) {
0149 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripLowThresholdDQM_PSet");
0150 lowthresholdDQM_ = std::make_unique<SiStripThresholdDQM>(thresholdToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0151 }
0152
0153 if (monitorHighThreshold_) {
0154 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripHighThresholdDQM_PSet");
0155 highthresholdDQM_ = std::make_unique<SiStripThresholdDQM>(thresholdToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0156 }
0157
0158 if (monitorCabling_) {
0159 const auto& hPSet = conf_.getParameter<edm::ParameterSet>("SiStripCablingDQM_PSet");
0160 cablingDQM_ = std::make_unique<SiStripCablingDQM>(detCablingToken_, iRun, hPSet, fPSet, tTopo, tkDetMap);
0161 }
0162 }
0163
0164 void SiStripClassToMonitorCondData::getModMEsOnDemand(edm::EventSetup const& eSetup, uint32_t requestedDetId) {
0165 if (monitorPedestals_) {
0166 pedestalsDQM_->analysisOnDemand(eSetup, requestedDetId);
0167 }
0168 if (monitorNoises_) {
0169 noisesDQM_->analysisOnDemand(eSetup, requestedDetId);
0170 }
0171 if (monitorQuality_) {
0172 qualityDQM_->analysisOnDemand(eSetup, requestedDetId);
0173 qualityDQM_->fillGrandSummaryMEs();
0174 }
0175 if (monitorApvGains_) {
0176 apvgainsDQM_->analysisOnDemand(eSetup, requestedDetId);
0177 }
0178 if (monitorLorentzAngle_) {
0179 lorentzangleDQM_->analysisOnDemand(eSetup, requestedDetId);
0180 }
0181 if (monitorBackPlaneCorrection_) {
0182 bpcorrectionDQM_->analysisOnDemand(eSetup, requestedDetId);
0183 }
0184 if (monitorCabling_) {
0185 cablingDQM_->analysisOnDemand(eSetup, requestedDetId);
0186 }
0187 if (monitorLowThreshold_) {
0188 lowthresholdDQM_->analysisOnDemand(eSetup, requestedDetId);
0189 }
0190 if (monitorHighThreshold_) {
0191 highthresholdDQM_->analysisOnDemand(eSetup, requestedDetId);
0192 }
0193 }
0194
0195
0196
0197
0198
0199 void SiStripClassToMonitorCondData::getLayerMEsOnDemand(edm::EventSetup const& eSetup,
0200 std::string requestedSubDetector,
0201 uint32_t requestedSide,
0202 uint32_t requestedLayer) {
0203 if (monitorPedestals_) {
0204 pedestalsDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0205 }
0206 if (monitorNoises_) {
0207 noisesDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0208 }
0209 if (monitorQuality_) {
0210 qualityDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0211 qualityDQM_->fillGrandSummaryMEs();
0212 }
0213 if (monitorApvGains_) {
0214 apvgainsDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0215 }
0216 if (monitorLorentzAngle_) {
0217 lorentzangleDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0218 }
0219 if (monitorBackPlaneCorrection_) {
0220 bpcorrectionDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0221 }
0222 if (monitorCabling_) {
0223 cablingDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0224 }
0225 if (monitorLowThreshold_) {
0226 lowthresholdDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0227 }
0228 if (monitorHighThreshold_) {
0229 highthresholdDQM_->analysisOnDemand(eSetup, requestedSubDetector, requestedSide, requestedLayer);
0230 }
0231 }
0232
0233
0234
0235
0236 void SiStripClassToMonitorCondData::analyseCondData(edm::EventSetup const& eSetup) {
0237 if (monitorPedestals_) {
0238 pedestalsDQM_->analysis(eSetup);
0239 }
0240 if (monitorNoises_) {
0241 noisesDQM_->analysis(eSetup);
0242 }
0243 if (monitorQuality_) {
0244 qualityDQM_->analysis(eSetup);
0245 qualityDQM_->fillGrandSummaryMEs();
0246 }
0247 if (monitorApvGains_) {
0248 apvgainsDQM_->analysis(eSetup);
0249 }
0250 if (monitorLorentzAngle_) {
0251 lorentzangleDQM_->analysis(eSetup);
0252 }
0253 if (monitorBackPlaneCorrection_) {
0254 bpcorrectionDQM_->analysis(eSetup);
0255 }
0256 if (monitorCabling_) {
0257 cablingDQM_->analysis(eSetup);
0258 }
0259 if (monitorLowThreshold_) {
0260 lowthresholdDQM_->analysis(eSetup);
0261 }
0262 if (monitorHighThreshold_) {
0263 highthresholdDQM_->analysis(eSetup);
0264 }
0265
0266 }
0267
0268
0269 void SiStripClassToMonitorCondData::end() {
0270 if (monitorPedestals_) {
0271 pedestalsDQM_->end();
0272 }
0273 if (monitorNoises_) {
0274 noisesDQM_->end();
0275 }
0276 if (monitorLowThreshold_) {
0277 lowthresholdDQM_->end();
0278 }
0279 if (monitorHighThreshold_) {
0280 highthresholdDQM_->end();
0281 }
0282 if (monitorApvGains_) {
0283 apvgainsDQM_->end();
0284 }
0285 if (monitorLorentzAngle_) {
0286 lorentzangleDQM_->end();
0287 }
0288 if (monitorBackPlaneCorrection_) {
0289 bpcorrectionDQM_->end();
0290 }
0291 if (monitorQuality_) {
0292 qualityDQM_->end();
0293 }
0294 if (monitorCabling_) {
0295 cablingDQM_->end();
0296 }
0297 }
0298
0299 void SiStripClassToMonitorCondData::save() {
0300 bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
0301 std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
0302
0303 DQMStore* dqmStore_ = edm::Service<DQMStore>().operator->();
0304
0305 if (outputMEsInRootFile) {
0306 dqmStore_->save(outputFileName);
0307 }
0308 }