CMS 3D CMS Logo

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