Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:14

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 //
0027 // Author: Ivana Hrivnacova, 30/10/2018  (ivana@ipno.in2p3.fr)
0028 
0029 #ifndef G4TScoreNtupleWriter_h
0030 #define G4TScoreNtupleWriter_h 1
0031 
0032 #include "G4VScoreNtupleWriter.hh"
0033 #include "G4HCofThisEvent.hh"
0034 #include "G4Threading.hh"
0035 #include "globals.hh"
0036 
0037 #include <memory>
0038 
0039 class G4HCofThisEvent;
0040 
0041 template <typename T>
0042 class G4TScoreNtupleWriterMessenger;
0043 class G4HCofThisEvent;
0044 
0045 // class description:
0046 //
0047 // This class implements storing hits collections of G4THitsMap<G4double>
0048 // type vith Geant4 analysis tools.
0049 // In order to avoid introducing dependency on the analysis category,
0050 // the analysis manager type is defined via template.
0051 //
0052 // An ntuple with three columns is created for each primitive scorer:
0053 // int column - eventNumber
0054 // int column - copyNumber
0055 // double column - scored value
0056 
0057 template <typename T>
0058 class G4TScoreNtupleWriter : public G4VScoreNtupleWriter
0059 {
0060  public:
0061   G4TScoreNtupleWriter();
0062   virtual ~G4TScoreNtupleWriter();
0063 
0064   // methods
0065   virtual G4bool Book(G4HCofThisEvent* hce);
0066   virtual void OpenFile();
0067   virtual void Fill(G4HCofThisEvent* hce, G4int eventNumber);
0068   virtual void Write();
0069 
0070   // set methods
0071   void SetDefaultFileType(const G4String& value);
0072   void SetFileName(const G4String& fileName);
0073   void SetVerboseLevel(G4int value);
0074   void SetNtupleMerging(G4bool value);
0075 
0076   // get methods
0077   G4String GetFileName() const { return fFileName; }
0078   G4int GetVerboseLevel() const { return fVerboseLevel; }
0079 
0080  protected:
0081   // methods
0082   virtual G4VScoreNtupleWriter* CreateInstance() const;
0083 
0084  private:
0085   // methods
0086   void CreateAnalysisManager();
0087 
0088   // data members
0089   G4TScoreNtupleWriterMessenger<T>* fMessenger;
0090   std::vector<G4int> fHCIds;
0091   T* fAnalysisManager;
0092   G4String fDefaultFileType;
0093   G4String fFileName;
0094   G4int fVerboseLevel;
0095   G4bool fMergeNtuples;
0096   G4bool fHasAnalysisFile;
0097   G4bool fIsBooked;
0098   G4bool fIsInitialized;
0099   G4int fFirstNtupleId;
0100 };
0101 
0102 #include "G4TScoreNtupleWriter.icc"
0103 
0104 #endif