CMS 3D CMS Logo

DebugHelpers.h
Go to the documentation of this file.
1 #ifdef EDM_ML_DEBUG
2 
15 
16 namespace {
17  inline
18  void dump(TrackingRecHit const & hit, int hitcounter) {
19  if (hit.isValid()) {
20  LogTrace("GsfTrackFitters")<< " ----------------- 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" << "\n"
28  << hit.surface()->position()<<"\n"
29  << "SURFACE ROTATION" << "\n"
30  << hit.surface()->rotation()
31  << "dimension " << hit.dimension();
32 
33  DetId hitId = hit.geographicalId();
34 
35  LogDebug("GsfTrackFitters") << " hit det=" << hitId.rawId();
36 
37  if(hitId.det() == DetId::Tracker) {
38  if (hitId.subdetId() == StripSubdetector::TIB )
39  LogDebug("GsfTrackFitters") << " I am TIB " << TIBDetId(hitId).layer();
40  else if (hitId.subdetId() == StripSubdetector::TOB )
41  LogDebug("GsfTrackFitters") << " I am TOB " << TOBDetId(hitId).layer();
42  else if (hitId.subdetId() == StripSubdetector::TEC )
43  LogDebug("GsfTrackFitters") << " I am TEC " << TECDetId(hitId).wheel();
44  else if (hitId.subdetId() == StripSubdetector::TID )
45  LogDebug("GsfTrackFitters") << " I am TID " << TIDDetId(hitId).wheel();
46  else if (hitId.subdetId() == (int) PixelSubdetector::PixelBarrel )
47  LogDebug("GsfTrackFitters") << " I am PixBar " << PXBDetId(hitId).layer();
48  else if (hitId.subdetId() == (int) PixelSubdetector::PixelEndcap )
49  LogDebug("GsfTrackFitters") << " I am PixFwd " << PXFDetId(hitId).disk();
50  else
51  LogDebug("GsfTrackFitters") << " UNKNOWN TRACKER HIT TYPE ";
52  }
53  else if(hitId.det() == DetId::Muon) {
54  if(hitId.subdetId() == MuonSubdetId::DT)
55  LogDebug("GsfTrackFitters") << " I am DT " << DTWireId(hitId);
56  else if (hitId.subdetId() == MuonSubdetId::CSC )
57  LogDebug("GsfTrackFitters") << " I am CSC " << CSCDetId(hitId);
58  else if (hitId.subdetId() == MuonSubdetId::RPC )
59  LogDebug("GsfTrackFitters") << " I am RPC " << RPCDetId(hitId);
60  else if (hitId.subdetId() == MuonSubdetId::GEM )
61  LogDebug("GsfTrackFitters") << " I am GEM " << GEMDetId(hitId);
62 
63  else if (hitId.subdetId() == MuonSubdetId::ME0 )
64  LogDebug("GsfTrackFitters") << " I am ME0 " << ME0DetId(hitId);
65  else
66  LogDebug("GsfTrackFitters") << " UNKNOWN MUON HIT TYPE ";
67  }
68  else
69  LogDebug("GsfTrackFitters") << " UNKNOWN HIT TYPE ";
70 
71  } else {
72  LogDebug("GsfTrackFitters")
73  << " ----------------- INVALID HIT #" << hitcounter << " -----------------------";
74  }
75  }
76 }
77 #include <sstream>
78  inline void dump(TrajectoryStateOnSurface const & tsos, const char * header) {
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("GsfTrackFitters")
86  << header << "! size " << tsos.components().size() << ss.str() << "\n"
87  <<" with local position " << tsos.localPosition() << "\n"
88  << tsos;
89  }
90 #else
91 namespace {
92  inline void dump(TrackingRecHit const &, int) {}
93  inline void dump(TrajectoryStateOnSurface const &, const char *){}
94 }
95 #endif
96 
#define LogDebug(id)
virtual const Surface * surface() const
T perp() const
Definition: PV3DBase.h:72
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
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
unsigned int layer() const
layer id
Definition: PXBDetId.h:35
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)
unsigned int disk() const
disk id
Definition: PXFDetId.h:43
Definition: DetId.h:18
bool isValid() const
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
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
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50