CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
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_
 

Detailed Description

Definition at line 19 of file DTSegmentSelector.h.

Constructor & Destructor Documentation

DTSegmentSelector::DTSegmentSelector ( edm::ParameterSet const &  pset)
inline

Definition at line 21 of file DTSegmentSelector.h.

21  :
22  checkNoisyChannels_(pset.getParameter<bool>("checkNoisyChannels")),
23  minHitsPhi_(pset.getParameter<int>("minHitsPhi")),
24  minHitsZ_(pset.getParameter<int>("minHitsZ")),
25  maxChi2_(pset.getParameter<double>("maxChi2")),
26  maxAnglePhi_(pset.getParameter<double>("maxAnglePhi")),
27  maxAngleZ_(pset.getParameter<double>("maxAngleZ")) {
28  }
DTSegmentSelector::~DTSegmentSelector ( )
inline

Definition at line 29 of file DTSegmentSelector.h.

29 {}

Member Function Documentation

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

Definition at line 83 of file DTSegmentSelector.cc.

References LogTrace.

Referenced by operator()().

83  {
84 
85  bool segmentNoisy = false;
86 
87  std::vector<DTRecHit1D>::const_iterator dtHit = dtHits.begin();
88  std::vector<DTRecHit1D>::const_iterator dtHits_end = dtHits.end();
89  for(; dtHit != dtHits_end; ++dtHit){
90  //DTRecHit1D const* dtHit1D = dynamic_cast<DTRecHit1D const*>(*recHit);
91  DTWireId wireId = dtHit->wireId();
92  // Check for noisy channels to skip them
93  bool isNoisy = false, isFEMasked = false, isTDCMasked = false, isTrigMask = false,
94  isDead = false, isNohv = false;
95  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
96  if(isNoisy) {
97  LogTrace("Calibration") << "Wire: " << wireId << " is noisy, skipping!";
98  segmentNoisy = true; break;
99  }
100  }
101  return segmentNoisy;
102 }
#define LogTrace(id)
bool DTSegmentSelector::operator() ( DTRecSegment4D const &  segment,
edm::Event const &  event,
edm::EventSetup const &  setup 
)

Definition at line 16 of file DTSegmentSelector.cc.

References checkNoisyChannels_, checkNoisySegment(), DTRecSegment4D::chi2(), DTRecSegment4D::degreesOfFreedom(), edm::EventSetup::get(), DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), DTRecSegment4D::localDirection(), maxAnglePhi_, maxAngleZ_, maxChi2_, minHitsPhi_, minHitsZ_, DTRecSegment4D::phiSegment(), Geom::pi(), mps_fire::result, DTRecSegment2D::specificRecHits(), crabStatusFromReport::statusMap, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

16  {
17 
18  bool result = true;
19 
20  /*
21  // Get the DT Geometry
22  ESHandle<DTGeometry> dtGeom;
23  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
24  */
25 
27  if(checkNoisyChannels_) setup.get<DTStatusFlagRcd>().get(statusMap);
28 
29  // Get the Phi 2D segment
30  int nPhiHits = -1;
31  bool segmentNoisyPhi = false;
32  if( segment.hasPhi() ){
33  const DTChamberRecSegment2D* phiSeg = segment.phiSegment(); // phiSeg lives in the chamber RF
34  //LocalPoint phiSeg2DPosInCham = phiSeg->localPosition();
35  //LocalVector phiSeg2DDirInCham = phiSeg->localDirection();
36  std::vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
37  nPhiHits = phiRecHits.size();
38  if(checkNoisyChannels_) segmentNoisyPhi = checkNoisySegment(statusMap,phiRecHits);
39  }
40  // Get the Theta 2D segment
41  int nZHits = -1;
42  bool segmentNoisyZ = false;
43  if( segment.hasZed() ){
44  const DTSLRecSegment2D* zSeg = segment.zSegment(); // zSeg lives in the SL RF
45  //const DTSuperLayer* sl = chamber->superLayer(zSeg->superLayerId());
46  //LocalPoint zSeg2DPosInCham = chamber->toLocal(sl->toGlobal((*zSeg).localPosition()));
47  //LocalVector zSeg2DDirInCham = chamber->toLocal(sl->toGlobal((*zSeg).localDirection()));
48  std::vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
49  nZHits = zRecHits.size();
50  if(checkNoisyChannels_) segmentNoisyZ = checkNoisySegment(statusMap,zRecHits);
51  }
52 
53  // Segment selection
54  // Discard segment if it has a noisy cell
55  if(segmentNoisyPhi || segmentNoisyZ)
56  result = false;
57 
58  // 2D-segment number of hits
59  if(segment.hasPhi() && nPhiHits < minHitsPhi_)
60  result = false;
61 
62  if(segment.hasZed() && nZHits < minHitsZ_)
63  result = false;
64 
65  // Segment chi2
66  double chiSquare = segment.chi2()/segment.degreesOfFreedom();
67  if(chiSquare > maxChi2_)
68  result = false;
69 
70  // Segment angle
71  LocalVector segment4DLocalDir = segment.localDirection();
72  double angleZ = fabs( atan(segment4DLocalDir.y()/segment4DLocalDir.z())*180./Geom::pi() );
73  if( angleZ > maxAngleZ_)
74  result = false;
75 
76  double anglePhi = fabs( atan(segment4DLocalDir.x()/segment4DLocalDir.z())*180./Geom::pi() );
77  if( anglePhi > maxAnglePhi_)
78  result = false;
79 
80  return result;
81 }
T y() const
Definition: PV3DBase.h:63
tuple result
Definition: mps_fire.py:84
T z() const
Definition: PV3DBase.h:64
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
bool checkNoisySegment(edm::ESHandle< DTStatusFlag > const &, std::vector< DTRecHit1D > const &)
constexpr double pi()
Definition: Pi.h:31
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

bool DTSegmentSelector::checkNoisyChannels_
private

Definition at line 35 of file DTSegmentSelector.h.

Referenced by operator()().

double DTSegmentSelector::maxAnglePhi_
private

Definition at line 39 of file DTSegmentSelector.h.

Referenced by operator()().

double DTSegmentSelector::maxAngleZ_
private

Definition at line 40 of file DTSegmentSelector.h.

Referenced by operator()().

double DTSegmentSelector::maxChi2_
private

Definition at line 38 of file DTSegmentSelector.h.

Referenced by operator()().

int DTSegmentSelector::minHitsPhi_
private

Definition at line 36 of file DTSegmentSelector.h.

Referenced by operator()().

int DTSegmentSelector::minHitsZ_
private

Definition at line 37 of file DTSegmentSelector.h.

Referenced by operator()().