CMS 3D CMS Logo

DTSegmentSelector.cc
Go to the documentation of this file.
2 
8 
15 
17  : muonTags_(pset.getParameter<edm::InputTag>("Muons")),
18  checkNoisyChannels_(pset.getParameter<bool>("checkNoisyChannels")),
19  minHitsPhi_(pset.getParameter<int>("minHitsPhi")),
20  minHitsZ_(pset.getParameter<int>("minHitsZ")),
21  maxChi2_(pset.getParameter<double>("maxChi2")),
22  maxAnglePhi_(pset.getParameter<double>("maxAnglePhi")),
23  maxAngleZ_(pset.getParameter<double>("maxAngleZ")) {
25 }
26 
28  edm::Event const& event,
29  edm::EventSetup const& setup) {
30  bool result = true;
31 
32  /* get the muon collection if one is specified
33  (not specifying a muon collection switches off muon matching */
34  if (!muonTags_.label().empty()) {
36  event.getByToken(muonToken_, muonH);
37  const std::vector<reco::Muon>* muons = muonH.product();
38  //std::cout << " Muon collection size: " << muons->size() << std::endl;
39  if (muons->empty())
40  return false;
41 
42  DTChamberId segId(segment.rawId());
43 
44  bool matched = false;
45  for (auto& imuon : *muons)
46  for (const auto& ch : imuon.matches()) {
47  DetId chId(ch.id.rawId());
48  if (chId != segId)
49  continue;
50  if (imuon.pt() < 15 || !imuon.isGlobalMuon())
51  continue;
52 
53  int nsegs = ch.segmentMatches.size();
54  if (!nsegs)
55  continue;
56 
57  LocalPoint posHit = segment.localPosition();
58  float dx = (posHit.x() ? posHit.x() - ch.x : 0);
59  float dy = (posHit.y() ? posHit.y() - ch.y : 0);
60  float dr = sqrt(dx * dx + dy * dy);
61  if (dr < 5)
62  matched = true;
63  }
64 
65  if (!matched)
66  result = false;
67  }
68 
71  setup.get<DTStatusFlagRcd>().get(statusMap);
72 
73  // Get the Phi 2D segment
74  int nPhiHits = -1;
75  bool segmentNoisyPhi = false;
76  if (segment.hasPhi()) {
77  const DTChamberRecSegment2D* phiSeg = segment.phiSegment(); // phiSeg lives in the chamber RF
78  std::vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
79  nPhiHits = phiRecHits.size();
81  segmentNoisyPhi = checkNoisySegment(statusMap, phiRecHits);
82  //} else result = false;
83  }
84  // Get the Theta 2D segment
85  int nZHits = -1;
86  bool segmentNoisyZ = false;
87  if (segment.hasZed()) {
88  const DTSLRecSegment2D* zSeg = segment.zSegment(); // zSeg lives in the SL RF
89  std::vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
90  nZHits = zRecHits.size();
92  segmentNoisyZ = checkNoisySegment(statusMap, zRecHits);
93  }
94 
95  // Segment selection
96  // Discard segment if it has a noisy cell
97  if (segmentNoisyPhi || segmentNoisyZ)
98  result = false;
99 
100  // 2D-segment number of hits
101  if (segment.hasPhi() && nPhiHits < minHitsPhi_)
102  result = false;
103 
104  if (segment.hasZed() && nZHits < minHitsZ_)
105  result = false;
106 
107  // Segment chi2
108  double chiSquare = segment.chi2() / segment.degreesOfFreedom();
109  if (chiSquare > maxChi2_)
110  result = false;
111 
112  // Segment angle
113  LocalVector segment4DLocalDir = segment.localDirection();
114  double angleZ = fabs(atan(segment4DLocalDir.y() / segment4DLocalDir.z()) * 180. / Geom::pi());
115  if (angleZ > maxAngleZ_)
116  result = false;
117 
118  double anglePhi = fabs(atan(segment4DLocalDir.x() / segment4DLocalDir.z()) * 180. / Geom::pi());
119  if (anglePhi > maxAnglePhi_)
120  result = false;
121 
122  return result;
123 }
124 
126  std::vector<DTRecHit1D> const& dtHits) {
127  bool segmentNoisy = false;
128 
129  std::vector<DTRecHit1D>::const_iterator dtHit = dtHits.begin();
130  std::vector<DTRecHit1D>::const_iterator dtHits_end = dtHits.end();
131  for (; dtHit != dtHits_end; ++dtHit) {
132  DTWireId wireId = dtHit->wireId();
133  // Check for noisy channels to skip them
134  bool isNoisy = false, isFEMasked = false, isTDCMasked = false, isTrigMask = false, isDead = false, isNohv = false;
135  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
136  if (isNoisy) {
137  LogTrace("Calibration") << "Wire: " << wireId << " is noisy, skipping!";
138  segmentNoisy = true;
139  break;
140  }
141  }
142  return segmentNoisy;
143 }
Vector3DBase< float, LocalTag >
muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
DTSLRecSegment2D
Definition: DTSLRecSegment2D.h:15
DTSegmentSelector::minHitsPhi_
int minHitsPhi_
Definition: DTSegmentSelector.h:36
DTRecSegment4D
Definition: DTRecSegment4D.h:23
electrons_cff.bool
bool
Definition: electrons_cff.py:372
DTRecSegment4D::localDirection
LocalVector localDirection() const override
Local direction in Chamber frame.
Definition: DTRecSegment4D.h:67
DTStatusFlag::cellStatus
int cellStatus(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool &noiseFlag, bool &feMask, bool &tdcMask, bool &trigMask, bool &deadFlag, bool &nohvFlag) const
get content
Definition: DTStatusFlag.h:88
MessageLogger.h
TrackingRecHit::rawId
id_type rawId() const
Definition: TrackingRecHit.h:119
edm::Handle::product
T const * product() const
Definition: Handle.h:70
DTSegmentSelector::maxAngleZ_
double maxAngleZ_
Definition: DTSegmentSelector.h:40
ESHandle.h
simKBmtfDigis_cfi.chiSquare
chiSquare
Definition: simKBmtfDigis_cfi.py:21
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DTRecSegment2D.h
DTRecHit1D.h
edm
HLT enums.
Definition: AlignableModifier.h:19
DTStatusFlagRcd.h
edm::Handle< reco::MuonCollection >
DTRecSegment4D::localPosition
LocalPoint localPosition() const override
Local position in Chamber frame.
Definition: DTRecSegment4D.h:61
DTRecSegment4D::zSegment
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
Definition: DTRecSegment4D.h:99
DTSegmentSelector::maxAnglePhi_
double maxAnglePhi_
Definition: DTSegmentSelector.h:39
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTSegmentSelector::DTSegmentSelector
DTSegmentSelector(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
Definition: DTSegmentSelector.cc:16
DTSegmentSelector::checkNoisyChannels_
bool checkNoisyChannels_
Definition: DTSegmentSelector.h:35
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
DetId
Definition: DetId.h:17
DTSegmentSelector::operator()
bool operator()(DTRecSegment4D const &, edm::Event const &, edm::EventSetup const &)
Definition: DTSegmentSelector.cc:27
DTWireId
Definition: DTWireId.h:12
reco::MuonCollection
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle
Definition: DTSurvey.h:22
Geom::pi
constexpr double pi()
Definition: Pi.h:31
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
Point3DBase< float, LocalTag >
DTSegmentSelector::minHitsZ_
int minHitsZ_
Definition: DTSegmentSelector.h:37
DTStatusFlag.h
DTRecSegment4D::degreesOfFreedom
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: DTRecSegment4D.cc:179
DTStatusFlagRcd
Definition: DTStatusFlagRcd.h:5
DTSegmentSelector::maxChi2_
double maxChi2_
Definition: DTSegmentSelector.h:38
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
DTSegmentSelector::checkNoisySegment
bool checkNoisySegment(edm::ESHandle< DTStatusFlag > const &, std::vector< DTRecHit1D > const &)
Definition: DTSegmentSelector.cc:125
createfilelist.int
int
Definition: createfilelist.py:10
DTChamberRecSegment2D
Definition: DTChamberRecSegment2D.h:31
PVValHelper::dy
Definition: PVValidationHelpers.h:49
edm::EventSetup
Definition: EventSetup.h:57
DTRecSegment4D.h
get
#define get
DTSegmentSelector::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: DTSegmentSelector.h:34
DTRecSegment4D::hasZed
bool hasZed() const
Does it have the Z projection?
Definition: DTRecSegment4D.h:93
DTSegmentSelector.h
DTSegmentSelector::muonTags_
edm::InputTag muonTags_
Definition: DTSegmentSelector.h:33
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
DTRecSegment4D::chi2
double chi2() const override
Chi2 of the segment fit.
Definition: DTRecSegment4D.cc:170
DTRecSegment2D::specificRecHits
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
Definition: DTRecSegment2D.cc:104
EventSetup.h
DTRecSegment4D::hasPhi
bool hasPhi() const
Does it have the Phi projection?
Definition: DTRecSegment4D.h:90
mps_fire.result
result
Definition: mps_fire.py:303
DTChamberId
Definition: DTChamberId.h:14
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
DTRecSegment4D::phiSegment
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
Definition: DTRecSegment4D.h:96
PVValHelper::dx
Definition: PVValidationHelpers.h:48
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DTRecSegment4DCollection.h