CMS 3D CMS Logo

GEMEfficiencyAnalyzer.h
Go to the documentation of this file.
1 #ifndef DQM_GEM_GEMEfficiencyAnalyzer_h
2 #define DQM_GEM_GEMEfficiencyAnalyzer_h
3 
30 
32 public:
33  explicit GEMEfficiencyAnalyzer(const edm::ParameterSet &);
34  ~GEMEfficiencyAnalyzer() override;
36 
37  // currently only for STA muons
38  enum class StartingStateType {
43  };
44 
45  // Define the metric as the smaller the absolute value, the better the matching.
46  enum class MatchingMetric {
47  kDeltaPhi = 0, // computeDeltaPhi
48  kRdPhi, // computeRdPhi
49  };
50 
51  // https://github.com/cms-sw/cmssw/blob/CMSSW_12_4_0_pre3/Configuration/Applications/python/ConfigBuilder.py#L35
52  enum class ScenarioOption {
53  kPP = 0,
54  kCosmics,
55  kHeavyIons,
56  };
57 
58  struct GEMLayer {
59  GEMLayer(Disk::DiskPointer disk, std::vector<const GEMChamber *> chambers, GEMDetId id)
60  : disk(disk), chambers(chambers), id(id) {}
62  std::vector<const GEMChamber *> chambers;
64  };
65 
66  using StartingState = std::tuple<bool, TrajectoryStateOnSurface, DetId>;
67 
68 protected:
69  void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
70  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
71  void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override;
72 
73 private:
78 
79  void buildGEMLayers(const GEMGeometry *);
80 
81  bool checkPropagationDirection(const reco::Track *, const GEMLayer &);
82 
88 
89  // for kStateOnSurfaceWithCSCSegment and AlignmentStyle
90  const CSCSegment *findCSCSegment(const reco::Muon &, const reco::TransientTrack &, const GEMLayer &);
92  const CSCSegment *findCSCSegmentCosmics(const reco::Muon &, const GEMLayer &);
93  bool isMuonSubdetAllowed(const DetId &, const int);
94  bool isCSCAllowed(const CSCDetId &, const int);
95 
96  bool checkBounds(const Plane &, const GlobalPoint &);
97  bool checkBounds(const Plane &, const GlobalPoint &, const GlobalError &, float);
99  const GlobalError &,
100  const std::vector<const GEMChamber *> &);
101 
102  float computeRdPhi(const GlobalPoint &, const LocalPoint &, const GEMEtaPartition *);
103  float computeDeltaPhi(const GlobalPoint &, const LocalPoint &, const GEMEtaPartition *);
104  float computeMatchingMetric(const GlobalPoint &, const LocalPoint &, const GEMEtaPartition *);
105 
106  std::pair<const GEMRecHit *, float> findClosestHit(const GlobalPoint &,
108  const GEMEtaPartition *);
109 
110  // some helpers
111  inline bool isInsideOut(const reco::Track &);
112 
114  // const data members initialized in the member initializer list
115  // mainly retrieved from edm::ParameterSet
117  // ES
120  // ED
123  //
126  const TString kMuonName_;
129  // cuts
131  const std::vector<std::vector<int> > kMuonSubdetForGEM_;
132  const std::vector<std::vector<int> > kCSCForGEM_; // when using StartingStateType::kStateOnSurfaceWithCSCSegment
133  const float kMuonSegmentMatchDRCut_; // for cosmics
134 
135  const std::vector<double> kMuonPtMinCuts_; // station as index
136  const std::vector<double> kMuonEtaMinCuts_; // station as index
137  const std::vector<double> kMuonEtaMaxCuts_; // station as index
138  const float kPropagationErrorRCut_; // cm
139  const float kPropagationErrorPhiCut_; // degree
140  const float kBoundsErrorScale_; // TODO doc
141  // matching
143  const float kMatchingCut_;
144  // for MinotorElement
145  const std::vector<double> kMuonPtBins_; // station as index
146  const std::vector<int> kMuonEtaNbins_; // station as index
147  const std::vector<double> kMuonEtaLow_; // station as index
148  const std::vector<double> kMuonEtaUp_; // station as index
149 
150  // const
151  const bool kModeDev_;
152 
154  // const data members
155  // FIXME static?
157  // https://github.com/cms-sw/cmssw/blob/CMSSW_12_4_0_pre3/DataFormats/CSCRecHit/interface/CSCSegment.h#L60
158  const int kCSCSegmentDimension_ = 4;
159 
161  // non-const data members
163  std::unique_ptr<MuonServiceProxy> muon_service_;
164  std::vector<GEMLayer> gem_layers_;
165 
166  // montitor elements
167  // XXX how about introducing EffPair ?
172  MEMap me_residual_phi_; // in global
173  // dev mode
178  MEMap me_residual_x_; // in local
179  MEMap me_residual_y_; // in global
188 };
189 
190 #endif // DQM_GEM_GEMEfficiencyAnalyzer_h
bool isInsideOut(const reco::Track &)
StartingState buildStartingStateAlignmentStyle(const reco::Muon &, const reco::TransientTrack &, const GEMLayer &)
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
std::vector< const GEMChamber * > chambers
const std::vector< double > kMuonEtaLow_
std::tuple< bool, TrajectoryStateOnSurface, DetId > StartingState
std::unique_ptr< MuonServiceProxy > muon_service_
const std::vector< double > kMuonPtBins_
const std::vector< double > kMuonPtMinCuts_
void buildGEMLayers(const GEMGeometry *)
bool checkBounds(const Plane &, const GlobalPoint &)
float computeRdPhi(const GlobalPoint &, const LocalPoint &, const GEMEtaPartition *)
const edm::EDGetTokenT< GEMRecHitCollection > kGEMRecHitCollectionToken_
const edm::EDGetTokenT< edm::View< reco::Muon > > kMuonViewToken_
Definition: Plane.h:16
const MatchingMetric kMatchingMetric_
std::map< GEMDetId, MonitorElement * > MEMap
StartingStateType getStartingStateType(const std::string)
const CSCSegment * findCSCSegmentBeam(const reco::TransientTrack &, const GEMLayer &)
const reco::Muon::MuonTrackType kMuonTrackType_
reco::Muon::MuonTrackType getMuonTrackType(const std::string)
const std::vector< std::vector< int > > kCSCForGEM_
StartingState getOutermostMeasurementState(const reco::TransientTrack &)
const std::vector< std::vector< int > > kMuonSubdetForGEM_
const std::vector< double > kMuonEtaMaxCuts_
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > kGEMGeometryTokenBeginRun_
ScenarioOption getScenarioOption(const std::string)
const std::vector< double > kMuonEtaUp_
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
const GEMEtaPartition * findEtaPartition(const GlobalPoint &, const GlobalError &, const std::vector< const GEMChamber *> &)
const CSCSegment * findCSCSegment(const reco::Muon &, const reco::TransientTrack &, const GEMLayer &)
StartingState buildStartingState(const reco::Muon &, const reco::TransientTrack &, const GEMLayer &)
GEMLayer(Disk::DiskPointer disk, std::vector< const GEMChamber *> chambers, GEMDetId id)
GEMEfficiencyAnalyzer(const edm::ParameterSet &)
const std::vector< int > kMuonEtaNbins_
Definition: DetId.h:17
StartingState getInnermostMeasurementState(const reco::TransientTrack &)
const std::string kMuonTrackTypeName_
std::vector< GEMLayer > gem_layers_
static void fillDescriptions(edm::ConfigurationDescriptions &)
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > kTransientTrackBuilderToken_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
const ScenarioOption kScenario_
float computeDeltaPhi(const GlobalPoint &, const LocalPoint &, const GEMEtaPartition *)
bool isCSCAllowed(const CSCDetId &, const int)
float computeMatchingMetric(const GlobalPoint &, const LocalPoint &, const GEMEtaPartition *)
StartingState buildStateOnSurfaceWithCSCSegment(const reco::Muon &, const reco::TransientTrack &, const GEMLayer &)
bool checkPropagationDirection(const reco::Track *, const GEMLayer &)
MuonTrackType
map for Global Muon refitters
Definition: Muon.h:36
const std::vector< double > kMuonEtaMinCuts_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MatchingMetric getMatchingMetric(const std::string)
const StartingStateType kStartingStateType_
Definition: event.py:1
Definition: Run.h:45
std::pair< const GEMRecHit *, float > findClosestHit(const GlobalPoint &, const GEMRecHitCollection::range &, const GEMEtaPartition *)
bool isMuonSubdetAllowed(const DetId &, const int)
const CSCSegment * findCSCSegmentCosmics(const reco::Muon &, const GEMLayer &)