DTResolutionAnalysisTest

Macros

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 89 90 91 92 93 94 95 96 97
#ifndef DTResolutionAnalysisTest_H
#define DTResolutionAnalysisTest_H

/** \class DTResolutionAnalysisTest
 * *
 *  DQM Test Client
 *
 *  \author  G. Mila - INFN Torino
 *
 *  threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
 *
 *   
 */

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

#include "FWCore/Framework/interface/ESHandle.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"

#include <string>
#include <map>

class DTGeometry;
class DTSuperLayerId;

class DTResolutionAnalysisTest : public DQMEDHarvester {
public:
  /// Constructor
  DTResolutionAnalysisTest(const edm::ParameterSet& ps);

  /// Destructor
  ~DTResolutionAnalysisTest() override;

  /// BeginRun
  void beginRun(const edm::Run& r, const edm::EventSetup& c) override;

  void bookHistos(DQMStore::IBooker&);
  void bookHistos(DQMStore::IBooker&, int wh);
  void bookHistos(DQMStore::IBooker&, int wh, int sect);

  /// Get the ME name
  std::string getMEName(const DTSuperLayerId& slID);

protected:
  void dqmEndJob(DQMStore::IBooker&, DQMStore::IGetter&) override;

private:
  void resetMEs();

  int nevents;
  unsigned int nLumiSegs;
  int prescaleFactor;
  int run;
  int percentual;

  // permitted test ranges
  double maxGoodMeanValue;
  double minBadMeanValue;
  double maxGoodSigmaValue;
  double minBadSigmaValue;

  bool doCalibAnalysis;

  edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
  const DTGeometry* muonGeom;

  // Histograms for tests
  std::map<std::pair<int, int>, MonitorElement*> MeanHistos;
  std::map<std::pair<int, int>, MonitorElement*> SigmaHistos;
  // wheel summary histograms
  std::map<int, MonitorElement*> wheelMeanHistos;
  std::map<int, MonitorElement*> wheelSigmaHistos;

  std::map<int, MonitorElement*> meanDistr;
  std::map<int, MonitorElement*> sigmaDistr;

  // wheel and ring mean histograms
  std::map<int, std::map<int, std::map<std::string, MonitorElement*> > > wheelRingHistos;

  // Compute the station from the bin number of mean and sigma histos
  int stationFromBin(int bin) const;
  // Compute the sl from the bin number of mean and sigma histos
  int slFromBin(int bin) const;

  double meanInRange(double mean) const;
  double sigmaInRange(double sigma) const;

  MonitorElement* globalResSummary;

  // top folder for the histograms in DQMStore
  std::string topHistoFolder;
};

#endif