Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MJOutputRoot.hh

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------//
00002 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00003 //                                                                           //
00004 //                         MAJORANA Simulation                               //
00005 //                                                                           //
00006 //      This code implementation is the intellectual property of the         //
00007 //      MAJORANA Collaboration. It is based on Geant4, an intellectual       //
00008 //      property of the RD44 GEANT4 collaboration.                           //
00009 //                                                                           //
00010 //                        *********************                              //
00011 //                                                                           //
00012 //    Neither the authors of this software system, nor their employing       //
00013 //    institutes, nor the agencies providing financial support for this      //
00014 //    work  make  any representation or  warranty, express or implied,       //
00015 //    regarding this software system or assume any liability for its use.    //
00016 //    By copying, distributing or modifying the Program (or any work based   //
00017 //    on on the Program) you indicate your acceptance of this statement,     //
00018 //    and all its terms.                                                     //
00019 //                                                                           //
00020 //bb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nubb0nu//
00021 //---------------------------------------------------------------------------//
00032 // Begin description of class here
00039 // End class description
00040 //
00045 // 
00046 // --------------------------------------------------------------------------//
00060 // --------------------------------------------------------------------------//
00061 
00062 #ifndef _MJOUTPUTROOT_HH
00063 #define _MJOUTPUTROOT_HH 1
00064 
00065 //---------------------------------------------------------------------------//
00066 
00067 //CLHEP
00068 #include <CLHEP/Units/SystemOfUnits.h>
00069 
00070 // Root
00071 #include "TFile.h"
00072 #include "TObject.h"
00073 #include "TTree.h"
00074 
00075 // Geant 4
00076 #include "globals.hh"
00077 #include "G4ios.hh"
00078 #include "G4Event.hh"
00079 #include "G4Step.hh"
00080 
00081 //base class
00082 #include "io/MJVOutputManager.hh"
00083 
00084 //---------------------------------------------------------------------------//
00085 
00086 class MJOutputRoot : public MJVOutputManager
00087 //class MJOutputRoot 
00088 {
00089 public:
00090 
00091   //default constructor
00092   MJOutputRoot(G4bool isMother);
00093 
00094   //copy constructor
00095   MJOutputRoot(const MJOutputRoot &);
00096 
00097   //destructor
00098   virtual ~MJOutputRoot();
00099 
00100   //These two methods are just used for interface with the general class: 
00101   //they simply call the specific OpenRootFile and CloseRootFile
00102   void OpenFile(const char* RootFileName);
00103   void CloseFile();
00104 
00109   void OpenRootFile(const char* RootFileName);
00110 
00114   void CloseRootFile();
00115 
00118   void FillTree() { fTree->Fill(); }
00119 
00124   virtual void DefineSchema() = 0;
00125 
00131   virtual void BeginOfEventAction(const G4Event *event) {;}
00132   virtual void BeginOfRunAction() {;}
00133   virtual void EndOfEventAction(const G4Event *event) {;}
00134   virtual void EndOfRunAction() {;}
00135   void SteppingAction(const G4Step* step) {RootSteppingAction(step);}
00136 
00142   virtual void RootSteppingAction(const G4Step* step) = 0;
00143 
00144   // Overloaded Conversion Methods: Root --> Geant 4
00145   G4double  RootToG4(Double_t XX) { return (G4double) XX; }
00146   G4float   RootToG4(Float_t XX) { return (G4float) XX; }
00147   G4int     RootToG4(Int_t XX) { return (G4int) XX; }
00148   G4long    RootToG4(Long_t XX) { return (G4long) XX; }
00149 
00150   // Overloaded Conversion Methods: Geant4 --> Root
00151   Double_t  G4ToRoot(G4double XX) { return (Double_t) XX; }
00152   Float_t   G4ToRoot(G4float XX) { return (Float_t) XX; }
00153   Int_t     G4ToRoot(G4int XX) { return (Int_t) XX; }
00154   Long_t    G4ToRoot(G4long XX) { return (Long_t) XX; }
00155 
00156   // Overloaded conversion methods: CLHEP --> Root
00157   Double_t CLHEPtoROOT(HepDouble XX) { return (Double_t) XX; }
00158   Float_t  CLHEPtoROOT(HepFloat XX) { return (Float_t) XX; }
00159   Int_t    CLHEPtoROOT(HepInt XX) { return (Int_t) XX; }
00160 
00161   // Overloaded conversion methods: Root --> CLHEP
00162   HepDouble ROOTtoCLHEP(Double_t XX) { return (HepDouble) XX; }
00163   HepFloat  ROOTtoCLHEP(Float_t XX) { return (HepFloat) XX; }
00164   HepInt    ROOTtoCLHEP(Int_t XX) { return (HepInt) XX; }
00165 
00166   // Setters and Getters.
00167   // G4String GetFileName() { return fFileName; }
00168   TFile *GetRootFile() { return fRootFile; }
00169   TTree *GetTree() { return fTree; }
00170   G4bool IsMother() { return fIsMother; }
00171   void SetRootFileName(G4String name) { SetFileName(name);}
00172   void SetRootFile(TFile *rfile) { fRootFile = rfile; }
00173   void SetTree(TTree *XtalTree) { fTree = XtalTree; }
00174 
00175   //protected members
00176 protected:
00177 
00180   static TTree *fTree; 
00181 
00182   //private  members
00183 private:
00184 
00185 
00189   static TFile *fRootFile;
00190 
00193   G4String *fDetectorName;
00194 
00197   G4String *fDetectorVersion;
00198 
00199   G4bool   fIsMother;  // true if this instation is the mother of all other
00200                        // MJOutputRoot object.
00201 };
00202 
00203 #endif
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 

Generated on Mon Nov 29 16:58:52 2004 for Majorana Simulation by  doxygen 1.3.9.1