Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:09

0001 // -*- C++ -*-
0002 //
0003 // Package:    TrackingMonitorClient
0004 // Class:      TrackingOfflineDQM
0005 //
0006 /**\class TrackingOfflineDQM TrackingOfflineDQM.cc DQM/TrackingMonitorCluster/src/TrackingOfflineDQM.cc
0007 
0008  Description: <one line class summary>
0009 
0010  Implementation:
0011      <Notes on implementation>
0012 */
0013 //
0014 // Original Author:  Samvel Khalatyan (ksamdev at gmail dot com)
0015 //         Created:  Wed Oct  5 16:42:34 CET 2006
0016 // $Id: TrackingOfflineDQM.cc,v 1.42 2013/01/02 17:41:51 wmtan Exp $
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 //Run Info
0035 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0036 #include "CondFormats/RunInfo/interface/RunSummary.h"
0037 #include "CondFormats/RunInfo/interface/RunInfo.h"
0038 
0039 // Cabling
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 * @brief 
0051 *   Construct object
0052 * 
0053 * @param roPARAMETER_SET 
0054 *   Regular Parameter Set that represent read configuration file
0055 */
0056 TrackingOfflineDQM::TrackingOfflineDQM(edm::ParameterSet const& pSet)
0057     : configPar_(pSet), runInfoToken_(esConsumes<RunInfo, RunInfoRcd, edm::Transition::BeginRun>()) {
0058   // Action Executor
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 * @brief 
0068 *   Destructor
0069 * 
0070 */
0071 TrackingOfflineDQM::~TrackingOfflineDQM() {}
0072 /** 
0073 * @brief 
0074 *   Executed at the begining of application
0075 * 
0076 * @param eSetup
0077 *   Event Setup object
0078 */
0079 void TrackingOfflineDQM::beginJob() { edm::LogInfo("BeginJobDone") << "TrackingOfflineDQM::beginJob done"; }
0080 /** 
0081 * @brief 
0082 *   Executed at the begining a Run
0083 * 
0084 * @param run
0085 *   Run  object
0086 * @param eSetup
0087 *  Event Setup object with Geometry, Magnetic Field, etc.
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  * @brief 
0121  * 
0122  * End Lumi
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  * @brief 
0142  * 
0143  * End Run
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);