Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-05 09:42:46

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4TScoreNtupleWriter
0027 //
0028 // Class description:
0029 //
0030 // This class implements storing hits collections of G4THitsMap<G4double>
0031 // type vith Geant4 analysis tools.
0032 // In order to avoid introducing dependency on the analysis category,
0033 // the analysis manager type is defined via template.
0034 //
0035 // An n-tuple with three columns is created for each primitive scorer:
0036 //   G4int column - eventNumber
0037 //   G4int column - copyNumber
0038 //   G4double column - scored value
0039 //
0040 // Author: Ivana Hrivnacova, 30/10/2018
0041 // --------------------------------------------------------------------
0042 #ifndef G4TScoreNtupleWriter_h
0043 #define G4TScoreNtupleWriter_h 1
0044 
0045 #include "G4VScoreNtupleWriter.hh"
0046 #include "G4HCofThisEvent.hh"
0047 #include "G4Threading.hh"
0048 #include "globals.hh"
0049 
0050 #include <memory>
0051 
0052 class G4HCofThisEvent;
0053 
0054 template <typename T>
0055 class G4TScoreNtupleWriterMessenger;
0056 class G4HCofThisEvent;
0057 
0058 template <typename T>
0059 class G4TScoreNtupleWriter : public G4VScoreNtupleWriter
0060 {
0061  public:
0062 
0063   G4TScoreNtupleWriter();
0064   virtual ~G4TScoreNtupleWriter();
0065 
0066   // methods
0067   virtual G4bool Book(G4HCofThisEvent* hce);
0068   virtual void OpenFile();
0069   virtual void Fill(G4HCofThisEvent* hce, G4int eventNumber);
0070   virtual void Write();
0071 
0072   // set methods
0073   void SetDefaultFileType(const G4String& value);
0074   void SetFileName(const G4String& fileName);
0075   void SetVerboseLevel(G4int value);
0076   void SetNtupleMerging(G4bool value);
0077 
0078   // get methods
0079   const G4String& GetFileName() const { return fFileName; }
0080   G4int GetVerboseLevel() const { return fVerboseLevel; }
0081 
0082  protected:
0083 
0084   // methods
0085   virtual G4VScoreNtupleWriter* CreateInstance() const;
0086 
0087  private:
0088 
0089   // methods
0090   void CreateAnalysisManager();
0091 
0092   // data members
0093   G4TScoreNtupleWriterMessenger<T>* fMessenger;
0094   std::vector<G4int> fHCIds;
0095   T* fAnalysisManager;
0096   G4String fDefaultFileType;
0097   G4String fFileName;
0098   G4int fVerboseLevel;
0099   G4bool fMergeNtuples;
0100   G4bool fHasAnalysisFile;
0101   G4bool fIsBooked;
0102   G4bool fIsInitialized;
0103   G4int fFirstNtupleId;
0104 };
0105 
0106 #include "G4TScoreNtupleWriter.icc"
0107 
0108 #endif