| 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // RecorderBase.hh
|
|---|
| 27 | // 1-Sep-1999 Bill Seligman
|
|---|
| 28 |
|
|---|
| 29 | // This is an abstract base class to be used with Geant 4.0.1 (and
|
|---|
| 30 | // possibly higher, if the User classes don't change).
|
|---|
| 31 |
|
|---|
| 32 | // The concept of a Recorder object is that it records the activities of
|
|---|
| 33 | // Geant in a manner that is useful to a physicist. Perhaps this record
|
|---|
| 34 | // takes the form of histograms, or ntuples, or entries in an Objectivity
|
|---|
| 35 | // database. This class does not care HOW the information is recorded; it
|
|---|
| 36 | // abstracts the behavior of a generalized recorder of Geant variables.
|
|---|
| 37 |
|
|---|
| 38 | // No object should be instantiated from the Recorder class (in fact, any such
|
|---|
| 39 | // object won't do anything). The user must define a new class (say, a class
|
|---|
| 40 | // that creates histograms) and overload the methods of this class.
|
|---|
| 41 |
|
|---|
| 42 | // Why do this? First of all, it keeps all record-keeping in a single class:
|
|---|
| 43 | // the class that inherits Recorder. The original Geant documentation suggests
|
|---|
| 44 | // that recording activities should be split among many different classes
|
|---|
| 45 | // (initialization in G4UserRunAction, recording in G4UserSteppingAction, etc.).
|
|---|
| 46 | // If you use a Recorder class, than all the record-keeping details are kept in
|
|---|
| 47 | // a single class instead of being spread out among many different classes.
|
|---|
| 48 |
|
|---|
| 49 | // Secondly, by using an abstract Recorder class, you hide the implementation
|
|---|
| 50 | // details from the rest of Geant. If you change a couple of histograms, only
|
|---|
| 51 | // the Recorder-derived class and main() re-compile. No other class knows or
|
|---|
| 52 | // cares what or how you record.
|
|---|
| 53 |
|
|---|
| 54 | // The only time this class (i.e., this header file) changes is if new
|
|---|
| 55 | // user action classes are added to Geant.
|
|---|
| 56 |
|
|---|
| 57 | #ifndef RECORDER_BASE_H_
|
|---|
| 58 | #define RECORDER_BASE_H_
|
|---|
| 59 |
|
|---|
| 60 | // The following objects are the arguments to the methods
|
|---|
| 61 | // invoked in the user action classes. In other words, they
|
|---|
| 62 | // contain the variables that we are normally able to record
|
|---|
| 63 | // in Geant.
|
|---|
| 64 |
|
|---|
| 65 | #include "G4Run.hh"
|
|---|
| 66 | #include "G4Event.hh"
|
|---|
| 67 | #include "G4Track.hh"
|
|---|
| 68 | #include "G4Step.hh"
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 | class RecorderBase {
|
|---|
| 72 |
|
|---|
| 73 | public:
|
|---|
| 74 |
|
|---|
| 75 | virtual ~RecorderBase() {};
|
|---|
| 76 |
|
|---|
| 77 | // The following a list of methods that correspond to the available
|
|---|
| 78 | // user action classes in Geant 4.0.1. In this base class, the
|
|---|
| 79 | // methods are defined to do nothing.
|
|---|
| 80 |
|
|---|
| 81 | virtual void RecordBeginOfRun(const G4Run*) = 0;
|
|---|
| 82 | virtual void RecordEndOfRun(const G4Run*) = 0;
|
|---|
| 83 | virtual void RecordBeginOfEvent(const G4Event*) {};
|
|---|
| 84 | virtual void RecordEndOfEvent(const G4Event*) {};
|
|---|
| 85 | virtual void RecordTrack(const G4Track*) {};
|
|---|
| 86 | virtual void RecordStep(const G4Step*) {};
|
|---|
| 87 |
|
|---|
| 88 | };
|
|---|
| 89 |
|
|---|
| 90 | #endif
|
|---|