MuonRecoAnalyzer

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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
#ifndef DQMOffline_Muon_MuonRecoAnalyzer_h
#define DQMOffline_Muon_MuonRecoAnalyzer_h
/** \class MuRecoAnalyzer
 *
 *  DQM monitoring source for muon reco track
 *
 *  \author G. Mila - INFN Torino
 */

#include <memory>
#include <fstream>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ServiceRegistry/interface/Service.h"

#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"

#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/Scalers/interface/DcsStatus.h"

class MuonRecoAnalyzer : public DQMEDAnalyzer {
public:
  /// Constructor
  MuonRecoAnalyzer(const edm::ParameterSet&);

  /// Destructor
  ~MuonRecoAnalyzer() override;

  /// Inizialize parameters for histo binning
  void analyze(const edm::Event&, const edm::EventSetup&) override;
  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;

  //calculate residual & pull:
  void GetRes(reco::TrackRef t1, reco::TrackRef t2, std::string par, float& res, float& pull);

  //Functions needed by the SoftMuon MVA monitoring
  double getDeltaR(reco::Track track1, reco::Track track2);

  int getPv(int tidx, const reco::VertexCollection* vc);

private:
  // ----------member data ---------------------------
  edm::ParameterSet parameters;

  edm::EDGetTokenT<edm::View<reco::Muon> > theMuonCollectionLabel_;
  edm::EDGetTokenT<reco::VertexCollection> theVertexLabel_;
  edm::EDGetTokenT<reco::BeamSpot> theBeamSpotLabel_;
  edm::EDGetTokenT<DcsStatusCollection> dcsStatusCollection_;

  // Switch for verbosity
  std::string metname;
  bool doMVA;
  bool useGEM;
  int maxGEMhitsSoftMuonMVA;

  //histo binning parameters
  int etaBin;
  double etaMin;
  double etaMax;

  int thetaBin;
  double thetaMin;
  double thetaMax;

  int phiBin;
  double phiMin;
  double phiMax;

  int chi2Bin;
  double chi2Min;
  double chi2Max;

  int pBin;
  double pMin;
  double pMax;

  int ptBin;
  double ptMin;
  double ptMax;

  int pResBin;
  double pResMin;
  double pResMax;

  int rhBin;
  double rhMin;
  double rhMax;

  int tunePBin;
  double tunePMin;
  double tunePMax;

  //the histos
  MonitorElement* muReco;
  // global muon
  std::vector<MonitorElement*> etaGlbTrack;
  std::vector<MonitorElement*> etaResolution;
  std::vector<MonitorElement*> thetaGlbTrack;
  std::vector<MonitorElement*> thetaResolution;
  std::vector<MonitorElement*> phiGlbTrack;
  std::vector<MonitorElement*> phiResolution;
  std::vector<MonitorElement*> chi2OvDFGlbTrack;
  std::vector<MonitorElement*> probchi2GlbTrack;
  std::vector<MonitorElement*> pGlbTrack;
  std::vector<MonitorElement*> ptGlbTrack;
  std::vector<MonitorElement*> qGlbTrack;
  std::vector<MonitorElement*> qOverpResolution;
  std::vector<MonitorElement*> qOverptResolution;
  std::vector<MonitorElement*> oneOverpResolution;
  std::vector<MonitorElement*> oneOverptResolution;
  std::vector<MonitorElement*> rhAnalysis;
  std::vector<MonitorElement*> muVStkSytemRotation;
  std::vector<MonitorElement*> phiVsetaGlbTrack;
  std::vector<MonitorElement*> phiVsetaGlbTrack_badlumi;

  //Soft MVA Muon
  MonitorElement* ptSoftMuonMVA;
  MonitorElement* deltaRSoftMuonMVA;
  MonitorElement* gNchi2SoftMuonMVA;
  MonitorElement* vMuHitsSoftMuonMVA;
  MonitorElement* mNuStationsSoftMuonMVA;
  MonitorElement* dxyRefSoftMuonMVA;
  MonitorElement* dzRefSoftMuonMVA;
  MonitorElement* LWHSoftMuonMVA;
  MonitorElement* valPixHitsSoftMuonMVA;
  MonitorElement* innerChi2SoftMuonMVA;
  MonitorElement* outerChi2SoftMuonMVA;
  MonitorElement* iValFracSoftMuonMVA;
  MonitorElement* segCompSoftMuonMVA;
  MonitorElement* chi2LocMomSoftMuonMVA;
  MonitorElement* chi2LocPosSoftMuonMVA;
  MonitorElement* glbTrackTailProbSoftMuonMVA;
  MonitorElement* NTrkVHitsSoftMuonMVA;
  MonitorElement* kinkFinderSoftMuonMVA;
  MonitorElement* vRPChitsSoftMuonMVA;
  MonitorElement* glbKinkFinderSoftMuonMVA;
  MonitorElement* glbKinkFinderLogSoftMuonMVA;
  MonitorElement* staRelChi2SoftMuonMVA;
  MonitorElement* glbDeltaEtaPhiSoftMuonMVA;
  MonitorElement* trkRelChi2SoftMuonMVA;
  MonitorElement* vDThitsSoftMuonMVA;
  MonitorElement* vCSChitsSoftMuonMVA;
  MonitorElement* vGEMhitsSoftMuonMVA;
  MonitorElement* timeAtIpInOutSoftMuonMVA;
  MonitorElement* timeAtIpInOutErrSoftMuonMVA;
  MonitorElement* getMuonHitsPerStationSoftMuonMVA;
  MonitorElement* QprodSoftMuonMVA;

  MonitorElement* tunePResolution;

  MonitorElement* etaPull;
  MonitorElement* thetaPull;
  MonitorElement* phiPull;
  MonitorElement* qOverpPull;
  MonitorElement* qOverptPull;
  MonitorElement* oneOverpPull;
  MonitorElement* oneOverptPull;

  // tracker muon
  MonitorElement* etaTrack;
  MonitorElement* thetaTrack;
  MonitorElement* phiTrack;
  MonitorElement* chi2OvDFTrack;
  MonitorElement* probchi2Track;
  MonitorElement* pTrack;
  MonitorElement* ptTrack;
  MonitorElement* qTrack;
  // sta muon
  MonitorElement* etaStaTrack;
  MonitorElement* thetaStaTrack;
  MonitorElement* phiStaTrack;
  MonitorElement* chi2OvDFStaTrack;
  MonitorElement* probchi2StaTrack;
  MonitorElement* pStaTrack;
  MonitorElement* ptStaTrack;
  MonitorElement* qStaTrack;
  // efficiency
  std::vector<MonitorElement*> etaEfficiency;
  std::vector<MonitorElement*> phiEfficiency;

  bool IsminiAOD;
  std::string theFolder;
};
#endif  // DQMOffline_Muon_MuonRecoAnalyzer_h