Data

SiStripCorrelateNoise

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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
// -*- C++ -*-
//
// Package:    SiStripCorrelateNoise
// Class:      SiStripCorrelateNoise
//
/**\class SiStripCorrelateNoise SiStripCorrelateNoise.cc
 DQM/SiStripMonitorSummary/plugins/SiStripCorrelateNoise.cc

 Description: <one line class summary>

 Implementation:
     <Notes on implementation>
*/
//
// Original Author:  Domenico GIORDANO
//         Created:  Mon Aug 10 10:42:04 CEST 2009
//
//

// system include files
#include <memory>

// user include files
#include "CalibTracker/Records/interface/SiStripDependentRecords.h"
#include "CommonTools/TrackerMap/interface/TrackerMap.h"
#include "CondFormats/SiStripObjects/interface/SiStripApvGain.h"
#include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

// ROOT includes
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"

//
// class decleration
//

class TrackerTopology;
class SiStripCorrelateNoise : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
public:
  explicit SiStripCorrelateNoise(const edm::ParameterSet &);
  ~SiStripCorrelateNoise() override = default;

private:
  void beginRun(const edm::Run &run, const edm::EventSetup &es) override;
  void analyze(const edm::Event &, const edm::EventSetup &) override {}
  void endRun(const edm::Run &run, const edm::EventSetup &es) override {}
  void endJob() override;

  void DoPlots();
  void DoAnalysis(const edm::EventSetup &, const SiStripNoises &, SiStripNoises &);
  void getHistos(const uint32_t &detid, const TrackerTopology *tTopo, std::vector<TH1F *> &histos);
  TH1F *getHisto(const long unsigned int &index);

  void checkGainCache(const edm::EventSetup &es);

  float getGainRatio(const uint32_t &detid, const uint16_t &apv);

  // ----------member data ---------------------------

  struct Data {
    uint32_t detid;
    std::vector<float> values;
  };

  edm::ESWatcher<SiStripNoisesRcd> noiseWatcher_;
  edm::ESWatcher<SiStripApvGainRcd> gainWatcher_;
  edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noiseToken_;
  edm::ESGetToken<SiStripApvGain, SiStripApvGainRcd> gainToken_;
  edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;

  uint32_t theRun;
  std::unique_ptr<SiStripNoises> refNoise;
  std::unique_ptr<SiStripApvGain> oldGain, newGain;
  bool equalGain;

  TFile *file;
  std::vector<TH1F *> vTH1;

  TrackerMap *tkmap;
};