CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTSegmentSelector Class Reference

#include <DTSegmentSelector.h>

Public Member Functions

 DTSegmentSelector (edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
 
bool operator() (DTRecSegment4D const &, edm::Event const &, edm::EventSetup const &)
 
 ~DTSegmentSelector ()
 

Private Member Functions

bool checkNoisySegment (edm::ESHandle< DTStatusFlag > const &, std::vector< DTRecHit1D > const &)
 

Private Attributes

bool checkNoisyChannels_
 
double maxAnglePhi_
 
double maxAngleZ_
 
double maxChi2_
 
int minHitsPhi_
 
int minHitsZ_
 
edm::InputTag muonTags_
 
edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 

Detailed Description

Definition at line 24 of file DTSegmentSelector.h.

Constructor & Destructor Documentation

◆ DTSegmentSelector()

DTSegmentSelector::DTSegmentSelector ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC 
)

Definition at line 16 of file DTSegmentSelector.cc.

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 }

References edm::ConsumesCollector::consumes(), muonTags_, and muonToken_.

◆ ~DTSegmentSelector()

DTSegmentSelector::~DTSegmentSelector ( )
inline

Definition at line 27 of file DTSegmentSelector.h.

27 {}

Member Function Documentation

◆ checkNoisySegment()

bool DTSegmentSelector::checkNoisySegment ( edm::ESHandle< DTStatusFlag > const &  statusMap,
std::vector< DTRecHit1D > const &  dtHits 
)
private

Definition at line 125 of file DTSegmentSelector.cc.

126  {
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 }

References DTStatusFlag::cellStatus(), and LogTrace.

Referenced by operator()().

◆ operator()()

bool DTSegmentSelector::operator() ( DTRecSegment4D const &  segment,
edm::Event const &  event,
edm::EventSetup const &  setup 
)

Definition at line 27 of file DTSegmentSelector.cc.

29  {
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 }

References checkNoisyChannels_, checkNoisySegment(), DTRecSegment4D::chi2(), simKBmtfDigis_cfi::chiSquare, DTRecSegment4D::degreesOfFreedom(), flavorHistoryFilter_cfi::dr, PVValHelper::dx, PVValHelper::dy, get, DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), edm::InputTag::label(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), muonTagProbeFilters_cff::matched, maxAnglePhi_, maxAngleZ_, maxChi2_, minHitsPhi_, minHitsZ_, PDWG_BPHSkim_cff::muons, muonTags_, muonToken_, DTRecSegment4D::phiSegment(), Geom::pi(), edm::Handle< T >::product(), TrackingRecHit::rawId(), mps_fire::result, singleTopDQM_cfi::setup, DTRecSegment2D::specificRecHits(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

Member Data Documentation

◆ checkNoisyChannels_

bool DTSegmentSelector::checkNoisyChannels_
private

Definition at line 35 of file DTSegmentSelector.h.

Referenced by operator()().

◆ maxAnglePhi_

double DTSegmentSelector::maxAnglePhi_
private

Definition at line 39 of file DTSegmentSelector.h.

Referenced by operator()().

◆ maxAngleZ_

double DTSegmentSelector::maxAngleZ_
private

Definition at line 40 of file DTSegmentSelector.h.

Referenced by operator()().

◆ maxChi2_

double DTSegmentSelector::maxChi2_
private

Definition at line 38 of file DTSegmentSelector.h.

Referenced by operator()().

◆ minHitsPhi_

int DTSegmentSelector::minHitsPhi_
private

Definition at line 36 of file DTSegmentSelector.h.

Referenced by operator()().

◆ minHitsZ_

int DTSegmentSelector::minHitsZ_
private

Definition at line 37 of file DTSegmentSelector.h.

Referenced by operator()().

◆ muonTags_

edm::InputTag DTSegmentSelector::muonTags_
private

Definition at line 33 of file DTSegmentSelector.h.

Referenced by DTSegmentSelector(), and operator()().

◆ muonToken_

edm::EDGetTokenT<reco::MuonCollection> DTSegmentSelector::muonToken_
private

Definition at line 34 of file DTSegmentSelector.h.

Referenced by DTSegmentSelector(), and operator()().

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
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
edm::Handle::product
T const * product() const
Definition: Handle.h:70
DTSegmentSelector::maxAngleZ_
double maxAngleZ_
Definition: DTSegmentSelector.h:40
simKBmtfDigis_cfi.chiSquare
chiSquare
Definition: simKBmtfDigis_cfi.py:21
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
edm::Handle< reco::MuonCollection >
DTSegmentSelector::maxAnglePhi_
double maxAnglePhi_
Definition: DTSegmentSelector.h:39
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
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
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
DTStatusFlagRcd
Definition: DTStatusFlagRcd.h:5
DTSegmentSelector::maxChi2_
double maxChi2_
Definition: DTSegmentSelector.h:38
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
DTChamberRecSegment2D
Definition: DTChamberRecSegment2D.h:31
PVValHelper::dy
Definition: PVValidationHelpers.h:49
get
#define get
DTSegmentSelector::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: DTSegmentSelector.h:34
DTSegmentSelector::muonTags_
edm::InputTag muonTags_
Definition: DTSegmentSelector.h:33
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
DTRecSegment2D::specificRecHits
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
Definition: DTRecSegment2D.cc:104
mps_fire.result
result
Definition: mps_fire.py:303
DTChamberId
Definition: DTChamberId.h:14
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
edm::InputTag
Definition: InputTag.h:15
PVValHelper::dx
Definition: PVValidationHelpers.h:48
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27