Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:39

0001 // -*- C++ -*-
0002 //
0003 // Package:    Calibration/EcalCalibAlgos
0004 // Class:      ECALpedestalPCLHarvester
0005 //
0006 /**\class ECALpedestalPCLHarvester ECALpedestalPCLHarvester.cc 
0007 
0008  Description: Fill DQM histograms with pedestals. Intended to be used on laser data from the TestEnablesEcalHcal dataset
0009 
0010  
0011 */
0012 //
0013 // Original Author:  Stefano Argiro
0014 //         Created:  Wed, 22 Mar 2017 14:46:48 GMT
0015 //
0016 //
0017 
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/ServiceRegistry/interface/Service.h"
0020 #include "DQMServices/Core/interface/DQMEDHarvester.h"
0021 #include "DQMServices/Core/interface/DQMStore.h"
0022 
0023 #include "FWCore/Framework/interface/Event.h"
0024 #include "FWCore/Framework/interface/MakerMacros.h"
0025 
0026 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0027 
0028 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0029 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0030 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
0031 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0032 #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
0033 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
0034 
0035 class ECALpedestalPCLHarvester : public DQMEDHarvester {
0036 public:
0037   explicit ECALpedestalPCLHarvester(const edm::ParameterSet& ps);
0038   void endRun(edm::Run const& run, edm::EventSetup const& isetup) override;
0039   static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0040 
0041 private:
0042   void dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) override;
0043 
0044   void dqmPlots(const EcalPedestals& newpeds, DQMStore::IBooker& ibooker);
0045 
0046   bool checkVariation(const EcalPedestalsMap& oldPedestals, const EcalPedestalsMap& newPedestals);
0047   bool checkStatusCode(const DetId& id);
0048   bool isGood(const DetId& id);
0049 
0050   std::vector<int> chStatusToExclude_;
0051   const int minEntries_;
0052 
0053   int entriesEB_[EBDetId::kSizeForDenseIndexing];
0054   int entriesEE_[EEDetId::kSizeForDenseIndexing];
0055   const bool checkAnomalies_;        // whether or not to avoid creating sqlite file in case of many changed pedestals
0056   const double nSigma_;              // threshold in sigmas to define a pedestal as changed
0057   const double thresholdAnomalies_;  // threshold (fraction of changed pedestals) to avoid creation of sqlite file
0058   const std::string dqmDir_;         // DQM directory where histograms are stored
0059   const std::string labelG6G1_;      // DB label from which pedestals for G6 and G1 are to be copied
0060   const float threshDiffEB_;         // if the new pedestals differs more than this from old, keep old
0061   const float threshDiffEE_;         // same as above for EE. Stray channel protection
0062   const float threshChannelsAnalyzed_;  // threshold for minimum percentage of channels analized to produce DQM plots
0063 
0064   // ES token
0065   const edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> channelsStatusToken_;
0066   const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> pedestalsToken_;
0067   const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> g6g1PedestalsToken_;
0068 
0069   const EcalPedestals* currentPedestals_;
0070   const EcalPedestals* g6g1Pedestals_;
0071   const EcalChannelStatus* channelStatus_;
0072 };