CMS 3D CMS Logo

DTSegmentSelector.cc
Go to the documentation of this file.
2 
8 
15 
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  //} else result = false;
40  }
41  // Get the Theta 2D segment
42  int nZHits = -1;
43  bool segmentNoisyZ = false;
44  if( segment.hasZed() ){
45  const DTSLRecSegment2D* zSeg = segment.zSegment(); // zSeg lives in the SL RF
46  //const DTSuperLayer* sl = chamber->superLayer(zSeg->superLayerId());
47  //LocalPoint zSeg2DPosInCham = chamber->toLocal(sl->toGlobal((*zSeg).localPosition()));
48  //LocalVector zSeg2DDirInCham = chamber->toLocal(sl->toGlobal((*zSeg).localDirection()));
49  std::vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
50  nZHits = zRecHits.size();
51  if(checkNoisyChannels_) segmentNoisyZ = checkNoisySegment(statusMap,zRecHits);
52  }
53 
54  // Segment selection
55  // Discard segment if it has a noisy cell
56  if(segmentNoisyPhi || segmentNoisyZ)
57  result = false;
58 
59  // 2D-segment number of hits
60  if(segment.hasPhi() && nPhiHits < minHitsPhi_)
61  result = false;
62 
63  if(segment.hasZed() && nZHits < minHitsZ_)
64  result = false;
65 
66  // Segment chi2
67  double chiSquare = segment.chi2()/segment.degreesOfFreedom();
68  if(chiSquare > maxChi2_)
69  result = false;
70 
71  // Segment angle
72  LocalVector segment4DLocalDir = segment.localDirection();
73  double angleZ = fabs( atan(segment4DLocalDir.y()/segment4DLocalDir.z())*180./Geom::pi() );
74  if( angleZ > maxAngleZ_)
75  result = false;
76 
77  double anglePhi = fabs( atan(segment4DLocalDir.x()/segment4DLocalDir.z())*180./Geom::pi() );
78  if( anglePhi > maxAnglePhi_)
79  result = false;
80 
81  return result;
82 }
83 
84 bool DTSegmentSelector::checkNoisySegment(edm::ESHandle<DTStatusFlag> const& statusMap, std::vector<DTRecHit1D> const& dtHits){
85 
86  bool segmentNoisy = false;
87 
88  std::vector<DTRecHit1D>::const_iterator dtHit = dtHits.begin();
89  std::vector<DTRecHit1D>::const_iterator dtHits_end = dtHits.end();
90  for(; dtHit != dtHits_end; ++dtHit){
91  //DTRecHit1D const* dtHit1D = dynamic_cast<DTRecHit1D const*>(*recHit);
92  DTWireId wireId = dtHit->wireId();
93  // Check for noisy channels to skip them
94  bool isNoisy = false, isFEMasked = false, isTDCMasked = false, isTrigMask = false,
95  isDead = false, isNohv = false;
96  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
97  if(isNoisy) {
98  LogTrace("Calibration") << "Wire: " << wireId << " is noisy, skipping!";
99  segmentNoisy = true; break;
100  }
101  }
102  return segmentNoisy;
103 }
LocalVector localDirection() const override
Local direction in Chamber frame.
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
double chi2() const override
Chi2 of the segment fit.
T y() const
Definition: PV3DBase.h:63
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
bool operator()(DTRecSegment4D const &, edm::Event const &, edm::EventSetup const &)
T z() const
Definition: PV3DBase.h:64
bool hasPhi() const
Does it have the Phi projection?
#define LogTrace(id)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
bool hasZed() const
Does it have the Z projection?
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
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:100
bool checkNoisySegment(edm::ESHandle< DTStatusFlag > const &, std::vector< DTRecHit1D > const &)
T get() const
Definition: EventSetup.h:62
constexpr double pi()
Definition: Pi.h:31
T x() const
Definition: PV3DBase.h:62
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: event.py:1