CMS 3D CMS Logo

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