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