Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:01

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 /// \file PhysAnalysis.hh
0028 /// \brief Definition of the PhysAnalysis class
0029 
0030 #ifndef PHYSANALYSIS_h
0031 #define PHYSANALYSIS_h 1
0032 
0033 #include "G4ThreeVector.hh"
0034 #include <map>
0035 #include "G4AnalysisManager.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
0040     TypeName(const TypeName&);               \
0041     void operator=(const TypeName&)
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 struct InfoForChemGeo // store info for creating input files for chem stage
0046 {
0047     G4double fType{0.}; // water: 1; solvated electron=2
0048     G4double fState{-99.}; // no state for solvated electron
0049     G4double fElectronicLevel{-99.}; // no electronic level for solvated electron
0050     G4double fX{0.}; // position of the incoming track
0051     G4double fY{0.}; // position of the incoming track
0052     G4double fZ{0.}; // position of the incoming track
0053     G4double fParentTrackID{-1.};
0054     G4double fEventNumber{-1.};
0055     G4double fVolume{-1.};
0056     G4double fVolumeCopyNumber{-1.};
0057     G4double fMotherVolume{-1.};
0058     G4double fMotherVolumeCopyNumber{-1.};
0059     G4double fRelX{-1.};
0060     G4double fRelY{-1.};
0061     G4double fRelZ{-1.};
0062 };
0063 
0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0065 
0066 struct InfoInPhysStage // store info created in Physical stage
0067 {
0068     G4double fFlagParticle{-1.};
0069     G4double fFlagParentID{-1.};
0070     G4double fFlagProcess{-1.};
0071     G4double fX{-1.};
0072     G4double fY{-1.};
0073     G4double fZ{-1.};
0074     G4double fEdep{-1.};
0075     G4double fEventNumber{-1.};
0076     G4double fVolumeName{-1.};
0077     G4double fCopyNumber{-1.};
0078     G4double fLastMetVoxelCopyNum{-1.};
0079 };
0080 
0081 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0082 
0083 class PhysAnalysis
0084 {
0085 public:
0086     ~PhysAnalysis() = default;
0087     static PhysAnalysis* GetAnalysis();
0088 
0089     void OpenFile(const G4String& fname);
0090     void Save();
0091     void Close(G4bool reset = true);
0092 
0093     void Book();
0094     G4AnalysisManager* GetAnalysisManager();
0095     void ClearVector() ; // being called in Beginofeventaction
0096     void AddInfoForChemGeo(InfoForChemGeo);
0097     void AddInfoInPhysStage(InfoInPhysStage);
0098     void UpdateChemInputDataAndFillNtuple(); // being called in Endofeventaction
0099 private:
0100     PhysAnalysis() = default;
0101     G4String CreateChemInputFile(G4int eventNum,G4int volumeCopyNumber,const G4String &voxelName);
0102     void UpdatingChemInputFile(InfoForChemGeo);
0103     void UpdatingChemInputFile(InfoInPhysStage);
0104     std::vector<InfoForChemGeo> fInfoForChemGeoVector;
0105     std::vector<InfoInPhysStage> fInfoInPhysStageVector;
0106     std::map<G4double, std::map<G4double, G4String> > fOutputFiles;
0107     G4String fOutputFolder="";
0108     DISALLOW_COPY_AND_ASSIGN(PhysAnalysis);
0109 };
0110 
0111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0112 
0113 #endif