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 // $Id: SimTracer.h,v 1.2 2005/12/08 21:37:49 chrjones Exp $
20 //
21 
22 // system include files
23 #include <iostream>
24 
25 // user include files
29 #include "G4Step.hh"
30 
31 // forward declarations
32 class DDDWorld;
33 class BeginOfJob;
34 class BeginOfRun;
35 class BeginOfEvent;
36 class BeginOfTrack;
37 class G4Step;
38 
39 class EndOfRun;
40 class EndOfEvent;
41 class EndOfTrack;
42 
43 #define OBSERVES(type) public Observer<const type*>
44 #define UPDATE(type) void update(const type*) { std::cout <<"++ signal " #type<<std::endl; }
45 class SimTracer : public SimWatcher,
46 OBSERVES(DDDWorld),
47 OBSERVES(BeginOfJob),
48 OBSERVES(BeginOfRun),
49 OBSERVES(BeginOfEvent),
50 OBSERVES(BeginOfTrack),
51 OBSERVES(G4Step),
52 OBSERVES(EndOfRun),
53 OBSERVES(EndOfEvent),
54 OBSERVES(EndOfTrack)
55 {
56 
57  public:
58  SimTracer(const edm::ParameterSet& pSet) :
59  m_verbose(pSet.getUntrackedParameter<bool>("verbose",false)) {
60  }
61  //virtual ~SimTracer();
62 
63  // ---------- const member functions ---------------------
64 
65  // ---------- static member functions --------------------
66 
67  // ---------- member functions ---------------------------
73  void update(const G4Step* iStep) {
74  std::cout <<"++ signal G4Step " ;
75  if(m_verbose) {
76  const G4StepPoint* post = iStep->GetPostStepPoint();
77  const G4ThreeVector pos = post->GetPosition();
78  std::cout << "( "<<pos.x()<<","<<pos.y()<<","<<pos.z()<<") ";
79  if(post->GetPhysicalVolume()) {
80  std::cout << post->GetPhysicalVolume()->GetName();
81  }
82  }
83  std::cout <<std::endl;
84 }
85 //UPDATE(G4Step)
89 
90  private:
91  //SimTracer(const SimTracer&); // stop default
92 
93  //const SimTracer& operator=(const SimTracer&); // stop default
94 
95  // ---------- member data --------------------------------
96  bool m_verbose;
97 };
98 
99 
100 #endif
#define OBSERVES(type)
Definition: SimTracer.h:43
SimTracer(const edm::ParameterSet &pSet)
Definition: SimTracer.h:58
bool m_verbose
Definition: SimTracer.h:96
#define UPDATE(type)
Definition: SimTracer.h:44
string const
Definition: compareJSON.py:14
void update(const G4Step *iStep)
Definition: SimTracer.h:73
#define private
Definition: FWFileEntry.h:18
tuple cout
Definition: gather_cfg.py:121