CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
28 #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) public Observer<const type*>
43 #define UPDATE(type) void update(const type*) { std::cout <<"++ signal " #type<<std::endl; }
44 class SimTracer : public SimWatcher,
45 OBSERVES(DDDWorld),
46 OBSERVES(BeginOfJob),
47 OBSERVES(BeginOfRun),
48 OBSERVES(BeginOfEvent),
49 OBSERVES(BeginOfTrack),
50 OBSERVES(G4Step),
51 OBSERVES(EndOfRun),
52 OBSERVES(EndOfEvent),
53 OBSERVES(EndOfTrack)
54 {
55 
56  public:
57  SimTracer(const edm::ParameterSet& pSet) :
58  m_verbose(pSet.getUntrackedParameter<bool>("verbose",false)) {
59  }
60  //virtual ~SimTracer();
61 
62  // ---------- const member functions ---------------------
63 
64  // ---------- static member functions --------------------
65 
66  // ---------- member functions ---------------------------
72  void update(const G4Step* iStep) {
73  std::cout <<"++ signal G4Step " ;
74  if(m_verbose) {
75  const G4StepPoint* post = iStep->GetPostStepPoint();
76  const G4ThreeVector pos = post->GetPosition();
77  std::cout << "( "<<pos.x()<<","<<pos.y()<<","<<pos.z()<<") ";
78  if(post->GetPhysicalVolume()) {
79  std::cout << post->GetPhysicalVolume()->GetName();
80  }
81  }
82  std::cout <<std::endl;
83 }
84 //UPDATE(G4Step)
88 
89  private:
90  //SimTracer(const SimTracer&); // stop default
91 
92  //const SimTracer& operator=(const SimTracer&); // stop default
93 
94  // ---------- member data --------------------------------
95  bool m_verbose;
96 };
97 
98 
99 #endif
#define OBSERVES(type)
Definition: SimTracer.h:42
SimTracer(const edm::ParameterSet &pSet)
Definition: SimTracer.h:57
bool m_verbose
Definition: SimTracer.h:95
#define UPDATE(type)
Definition: SimTracer.h:43
string const
Definition: compareJSON.py:14
#define private
Definition: FWFileEntry.h:17
void update(const DDDWorld *)
This routine will be called when the appropriate signal arrives.
Definition: SimTracer.h:67
tuple cout
Definition: gather_cfg.py:121
volatile std::atomic< bool > shutdown_flag false