CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SimTracer.h
Go to the documentation of this file.
1 #ifndef HelpfulWatchers_SimTracer_h
2 #define HelpfulWatchers_SimTracer_h
3 // -*- C++ -*-
4 //
5 // Package: HelpfulWatchers
6 // Class : SimTracer
7 //
16 //
17 // Original Author:
18 // Created: Tue Nov 22 16:41:33 EST 2005
19 //
20 
21 // system include files
22 #include <iostream>
23 
24 // user include files
26 #include "G4Step.hh"
29 
30 // forward declarations
31 class DDDWorld;
32 class BeginOfJob;
33 class BeginOfRun;
34 class BeginOfEvent;
35 class BeginOfTrack;
36 class G4Step;
37 
38 class EndOfRun;
39 class EndOfEvent;
40 class EndOfTrack;
41 
42 #define OBSERVES(type) \
43 public \
44  Observer<const type *>
45 #define UPDATE(type) \
46  void update(const type *) override { std::cout << "++ signal " #type << std::endl; }
47 class SimTracer : public SimWatcher,
48  OBSERVES(DDDWorld),
49  OBSERVES(BeginOfJob),
50  OBSERVES(BeginOfRun),
51  OBSERVES(BeginOfEvent),
52  OBSERVES(BeginOfTrack),
53  OBSERVES(G4Step),
54  OBSERVES(EndOfRun),
55  OBSERVES(EndOfEvent),
56  OBSERVES(EndOfTrack) {
57 public:
58  SimTracer(const edm::ParameterSet &pSet) : m_verbose(pSet.getUntrackedParameter<bool>("verbose", false)) {}
59  // virtual ~SimTracer();
60 
61  // ---------- const member functions ---------------------
62 
63  // ---------- static member functions --------------------
64 
65  // ---------- member functions ---------------------------
71  void update(const G4Step *iStep) override {
72  std::cout << "++ signal G4Step ";
73  if (m_verbose) {
74  const G4StepPoint *post = iStep->GetPostStepPoint();
75  const G4ThreeVector &pos = post->GetPosition();
76  std::cout << "( " << pos.x() << "," << pos.y() << "," << pos.z() << ") ";
77  if (post->GetPhysicalVolume()) {
78  std::cout << post->GetPhysicalVolume()->GetName();
79  }
80  }
81  std::cout << std::endl;
82  }
83  // UPDATE(G4Step)
87 
88 private:
89  // SimTracer(const SimTracer&); // stop default
90 
91  // const SimTracer& operator=(const SimTracer&); // stop default
92 
93  // ---------- member data --------------------------------
94  bool m_verbose;
95 };
96 
97 #endif
#define OBSERVES(type)
Definition: SimTracer.h:42
void update(const DDDWorld *) override
This routine will be called when the appropriate signal arrives.
Definition: SimTracer.h:66
SimTracer(const edm::ParameterSet &pSet)
Definition: SimTracer.h:58
bool m_verbose
Definition: SimTracer.h:94
#define UPDATE(type)
Definition: SimTracer.h:45
tuple cout
Definition: gather_cfg.py:144