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