CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  }
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 }
82 
83 bool DTSegmentSelector::checkNoisySegment(edm::ESHandle<DTStatusFlag> const& statusMap, std::vector<DTRecHit1D> const& dtHits){
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 }
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
T y() const
Definition: PV3DBase.h:63
virtual int degreesOfFreedom() const
Degrees of freedom of the segment fit.
tuple result
Definition: mps_fire.py:95
virtual LocalVector localDirection() const
Local direction in Chamber frame.
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?
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#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.
const T & get() const
Definition: EventSetup.h:56
bool checkNoisySegment(edm::ESHandle< DTStatusFlag > const &, std::vector< DTRecHit1D > const &)
double pi()
Definition: Pi.h:31
virtual double chi2() const
Chi2 of the segment fit.
T x() const
Definition: PV3DBase.h:62
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")