File indexing completed on 2024-04-06 12:09:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0021
0022 #include "FWCore/Framework/interface/LuminosityBlock.h"
0023 #include "FWCore/ServiceRegistry/interface/Service.h"
0024 #include "FWCore/ParameterSet/interface/FileInPath.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026
0027 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0028
0029 #include "DQM/SiStripCommon/interface/SiStripFolderOrganizer.h"
0030 #include "DQM/TrackingMonitorClient/interface/TrackingActionExecutor.h"
0031
0032 #include "DQM/TrackingMonitorClient/plugins/TrackingOfflineDQM.h"
0033
0034
0035 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0036 #include "CondFormats/RunInfo/interface/RunSummary.h"
0037 #include "CondFormats/RunInfo/interface/RunInfo.h"
0038
0039
0040 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0041 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0042
0043 #include <iomanip>
0044 #include <cstdio>
0045 #include <string>
0046 #include <sstream>
0047 #include <cmath>
0048
0049
0050
0051
0052
0053
0054
0055
0056 TrackingOfflineDQM::TrackingOfflineDQM(edm::ParameterSet const& pSet)
0057 : configPar_(pSet), runInfoToken_(esConsumes<RunInfo, RunInfoRcd, edm::Transition::BeginRun>()) {
0058
0059 actionExecutor_ = new TrackingActionExecutor(pSet);
0060
0061 usedWithEDMtoMEConverter_ = configPar_.getUntrackedParameter<bool>("UsedWithEDMtoMEConverter", false);
0062 inputFileName_ = configPar_.getUntrackedParameter<std::string>("InputFileName", "");
0063 outputFileName_ = configPar_.getUntrackedParameter<std::string>("OutputFileName", "");
0064 globalStatusFilling_ = configPar_.getUntrackedParameter<int>("GlobalStatusFilling", 1);
0065 }
0066
0067
0068
0069
0070
0071 TrackingOfflineDQM::~TrackingOfflineDQM() {}
0072
0073
0074
0075
0076
0077
0078
0079 void TrackingOfflineDQM::beginJob() { edm::LogInfo("BeginJobDone") << "TrackingOfflineDQM::beginJob done"; }
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 void TrackingOfflineDQM::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) {
0090 edm::LogInfo("BeginRun") << " Begining of Run";
0091
0092 int nFEDs = 0;
0093 int nPixelFEDs = 0;
0094 edm::ESHandle<RunInfo> runInfoRec = eSetup.getHandle(runInfoToken_);
0095 if (runInfoRec.isValid()) {
0096 sumFED_ = runInfoRec.product();
0097 if (sumFED_ != nullptr) {
0098 const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
0099 const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
0100 const int siPixelFedIdMin = FEDNumbering::MINSiPixelFEDID;
0101 const int siPixelFedIdMax = FEDNumbering::MAXSiPixelFEDID;
0102
0103 std::vector<int> FedsInIds = sumFED_->m_fed_in;
0104 for (auto fedID : FedsInIds) {
0105 if (fedID >= siPixelFedIdMin && fedID <= siPixelFedIdMax) {
0106 ++nPixelFEDs;
0107 ++nFEDs;
0108 }
0109 if (fedID >= siStripFedIdMin && fedID <= siStripFedIdMax)
0110 ++nFEDs;
0111 }
0112 }
0113 }
0114 const int siPixelFedN = (FEDNumbering::MAXSiPixelFEDID - FEDNumbering::MINSiPixelFEDID + 1);
0115 allpixelFEDsFound_ = (nPixelFEDs == siPixelFedN);
0116 trackerFEDsFound_ = (nFEDs > 0);
0117 }
0118
0119
0120
0121
0122
0123
0124
0125 void TrackingOfflineDQM::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker_,
0126 DQMStore::IGetter& igetter_,
0127 edm::LuminosityBlock const& lumiSeg,
0128 edm::EventSetup const& iSetup) {
0129 edm::LogInfo("TrackingOfflineDQM") << "dqmBeginLuminosityBlock";
0130
0131 if (globalStatusFilling_ > 0) {
0132 actionExecutor_->createLSStatus(ibooker_, igetter_);
0133
0134 if (trackerFEDsFound_)
0135 actionExecutor_->fillStatusAtLumi(ibooker_, igetter_);
0136 else
0137 actionExecutor_->fillDummyLSStatus();
0138 }
0139 }
0140
0141
0142
0143
0144
0145
0146 void TrackingOfflineDQM::dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) {
0147 edm::LogInfo("TrackingOfflineDQM") << "dqmEndJob";
0148
0149 if (globalStatusFilling_ > 0) {
0150 actionExecutor_->createGlobalStatus(ibooker_, igetter_);
0151
0152 if (!trackerFEDsFound_) {
0153 actionExecutor_->fillDummyGlobalStatus();
0154 return;
0155 } else {
0156 actionExecutor_->fillGlobalStatus(ibooker_, igetter_);
0157 }
0158 }
0159 }
0160
0161 #include "FWCore/Framework/interface/MakerMacros.h"
0162 DEFINE_FWK_MODULE(TrackingOfflineDQM);