CMS 3D CMS Logo

DebugHelpers.h
Go to the documentation of this file.
3 
4 #ifdef EDM_ML_DEBUG
5 
14 
15 namespace {
16  inline void dump(TrackingRecHit const& hit, int hitcounter, const std::string& msgCat) {
17  if (hit.isValid()) {
18  LogTrace(msgCat) << " ----------------- HIT #" << hitcounter << " (VALID)-----------------------\n"
19  << " HIT IS AT R " << hit.globalPosition().perp() << "\n"
20  << " HIT IS AT Z " << hit.globalPosition().z() << "\n"
21  << " HIT IS AT Phi " << hit.globalPosition().phi() << "\n"
22  << " HIT IS AT Loc " << hit.localPosition() << "\n"
23  << " WITH LocError " << hit.localPositionError() << "\n"
24  << " HIT IS AT Glo " << hit.globalPosition() << "\n"
25  << "SURFACE POSITION"
26  << "\n"
27  << hit.surface()->position() << "\n"
28  << "SURFACE ROTATION"
29  << "\n"
30  << hit.surface()->rotation() << "dimension " << hit.dimension();
31 
32  DetId hitId = hit.geographicalId();
33 
34  LogDebug(msgCat) << " hit det=" << hitId.rawId();
35 
36  if (hitId.det() == DetId::Tracker) {
37  switch (hitId.subdetId()) {
39  LogDebug(msgCat) << " I am TIB";
40  break;
42  LogDebug(msgCat) << " I am TOB";
43  break;
45  LogDebug(msgCat) << " I am TEC";
46  break;
48  LogDebug(msgCat) << " I am TID";
49  break;
51  LogDebug(msgCat) << " I am PixBar";
52  break;
54  LogDebug(msgCat) << " I am PixFwd";
55  break;
56  default:
57  LogDebug(msgCat) << " UNKNOWN TRACKER HIT TYPE ";
58  }
59  } else if (hitId.det() == DetId::Muon) {
60  if (hitId.subdetId() == MuonSubdetId::DT)
61  LogDebug(msgCat) << " I am DT " << DTWireId(hitId);
62  else if (hitId.subdetId() == MuonSubdetId::CSC)
63  LogDebug(msgCat) << " I am CSC " << CSCDetId(hitId);
64  else if (hitId.subdetId() == MuonSubdetId::RPC)
65  LogDebug(msgCat) << " I am RPC " << RPCDetId(hitId);
66  else if (hitId.subdetId() == MuonSubdetId::GEM)
67  LogDebug(msgCat) << " I am GEM " << GEMDetId(hitId);
68 
69  else if (hitId.subdetId() == MuonSubdetId::ME0)
70  LogDebug(msgCat) << " I am ME0 " << ME0DetId(hitId);
71  else
72  LogDebug(msgCat) << " UNKNOWN MUON HIT TYPE ";
73  } else
74  LogDebug(msgCat) << " UNKNOWN HIT TYPE ";
75 
76  } else {
77  LogDebug(msgCat) << " ----------------- INVALID HIT #" << hitcounter << " -----------------------";
78  }
79  }
80 #include <sstream>
81  inline void dump(TrajectoryStateOnSurface const& tsos, const char* header, const std::string& msgCat) {
82  std::ostringstream ss;
83  ss << " weights ";
84  for (auto const& c : tsos.components())
85  ss << c.weight() << '/';
86  ss << "\nmomentums ";
87  for (auto const& c : tsos.components())
88  ss << c.globalMomentum().mag() << '/';
89  ss << "\ndeltap/p ";
90  for (auto const& c : tsos.components())
91  ss << std::sqrt(tsos.curvilinearError().matrix()(0, 0)) / c.globalMomentum().mag() << '/';
92  LogTrace(msgCat) << header << "! size " << tsos.components().size() << ss.str() << "\n"
93  << " with local position " << tsos.localPosition() << "\n"
94  << tsos;
95  }
96 } // namespace
97 #else
98 namespace {
99  inline void dump(TrackingRecHit const &, int, const std::string &) {}
100  inline void dump(TrajectoryStateOnSurface const &, const char *, const std::string &) {}
101 } // namespace
102 #endif
#define LogDebug(id)
static constexpr auto TEC
virtual const Surface * surface() const
static constexpr int GEM
Definition: MuonSubdetId.h:14
T perp() const
Definition: PV3DBase.h:69
const CurvilinearTrajectoryError & curvilinearError() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
virtual GlobalPoint globalPosition() const
T sqrt(T t)
Definition: SSEVec.h:19
virtual int dimension() const =0
T z() const
Definition: PV3DBase.h:61
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr int ME0
Definition: MuonSubdetId.h:15
static constexpr auto TOB
virtual LocalPoint localPosition() const =0
#define LogTrace(id)
Definition: DetId.h:17
static constexpr auto TIB
static constexpr int RPC
Definition: MuonSubdetId.h:13
bool isValid() const
const AlgebraicSymMatrix55 & matrix() const
const RotationType & rotation() const
DetId geographicalId() const
static constexpr int DT
Definition: MuonSubdetId.h:11
virtual LocalError localPositionError() const =0
Components const & components() const
static constexpr int CSC
Definition: MuonSubdetId.h:12
const PositionType & position() const
static constexpr auto TID
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46