CMS 3D CMS Logo

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