ECALpedestalPCLworker

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
// -*- C++ -*-
//
// Package:    Calibration/EcalCalibAlgos
// Class:      ECALpedestalPCLworker
//
/**\class ECALpedestalPCLworker ECALpedestalPCLworker.cc 

   Description: Fill DQM histograms with pedestals. Intended to be used on laser data from the TestEnablesEcalHcal dataset

 
*/
//
// Original Author:  Stefano Argiro
//         Created:  Wed, 22 Mar 2017 14:46:48 GMT
//
//

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "CondFormats/EcalObjects/interface/EcalPedestals.h"
#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
#include "DataFormats/TCDS/interface/BSTRecord.h"
#include "DataFormats/TCDS/interface/TCDSRecord.h"
//
// class declaration
//

class ECALpedestalPCLworker : public DQMEDAnalyzer {
public:
  explicit ECALpedestalPCLworker(const edm::ParameterSet &);

  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);

private:
  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
  void analyze(const edm::Event &, const edm::EventSetup &) override;

  edm::EDGetTokenT<EBDigiCollection> digiTokenEB_;
  edm::EDGetTokenT<EEDigiCollection> digiTokenEE_;
  edm::EDGetTokenT<TCDSRecord> tcdsToken_;
  const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> pedestalToken_;

  std::vector<MonitorElement *> meEB_;
  std::vector<MonitorElement *> meEE_;

  uint32_t pedestalSamples_;  // number of presamples to be used for pedestal determination
  bool checkSignal_;          // avoid frames containing a signal
  uint32_t sThresholdEB_;     // if checkSignal = true threshold (in adc count) above which we'll assume
                              // there's signal and not just pedestal

  uint32_t sThresholdEE_;

  bool dynamicBooking_;        // use old pedestal to book histograms
  int fixedBookingCenterBin_;  // if dynamicBooking_ = false, use this as bin center
  int nBins_;                  // number of bins per histogram
  std::string dqmDir_;         // DQM directory where histograms are stored

  bool requireStableBeam_;

  // compare ADC values
  static bool adc_compare(uint16_t a, uint16_t b) { return (a & 0xFFF) < (b & 0xFFF); }
};