Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Structure containing the information related to Root pntuple.
0028 //
0029 // Author: Ivana Hrivnacova, 04/10/2016  (ivana@ipno.in2p3.fr)
0030 
0031 #ifndef G4RootPNtupleDescription_h
0032 #define G4RootPNtupleDescription_h 1
0033 
0034 #include "G4TNtupleDescription.hh"
0035 #include "G4RootFileDef.hh"
0036 #include "globals.hh"
0037 
0038 #include "tools/ntuple_booking"
0039 #include "tools/wroot/mt_ntuple_row_wise"
0040 #include "tools/wroot/mt_ntuple_column_wise"
0041 
0042 #include <fstream>
0043 
0044 namespace tools {
0045 namespace wroot {
0046 class branch;
0047 class ntuple;
0048 }
0049 }
0050 
0051 using RootNtupleDescription = G4TNtupleDescription<tools::wroot::ntuple, G4RootFile>;
0052 
0053 class G4RootPNtupleDescription
0054 {
0055   public:
0056     G4RootPNtupleDescription(G4NtupleBooking* g4NtupleBooking)
0057       :  fDescription(g4NtupleBooking) {}
0058 
0059     ~G4RootPNtupleDescription()
0060       {
0061         if ( fDescription.GetIsNtupleOwner() ) delete fNtuple;
0062       }
0063 
0064     // Set methods
0065     void SetNtuple(tools::wroot::imt_ntuple* intuple);
0066     void SetBasePNtuple(tools::wroot::base_pntuple* basePNtuple);
0067     void Reset();
0068 
0069     // Get methods
0070     RootNtupleDescription& GetDescription();
0071     tools::wroot::imt_ntuple* GetNtuple() const;
0072     tools::wroot::base_pntuple* GetBasePNtuple() const;
0073     std::vector<tools::wroot::branch*>& GetMainBranches();
0074 
0075   private:
0076     RootNtupleDescription fDescription;
0077     tools::wroot::imt_ntuple* fNtuple { nullptr };
0078     tools::wroot::base_pntuple* fBasePNtuple { nullptr };
0079     std::vector<tools::wroot::branch*> fMainBranches;
0080 };
0081 
0082 // inline function
0083 
0084 inline void G4RootPNtupleDescription::SetNtuple(
0085   tools::wroot::imt_ntuple* intuple)
0086 { fNtuple = intuple; }
0087 
0088 inline void G4RootPNtupleDescription::SetBasePNtuple(
0089   tools::wroot::base_pntuple* basePNtuple)
0090 { fBasePNtuple = basePNtuple; }
0091 
0092 inline void G4RootPNtupleDescription::Reset()
0093 {
0094   if ( fDescription.GetIsNtupleOwner() ) delete fNtuple;
0095   fNtuple = nullptr;
0096 }
0097 
0098 inline RootNtupleDescription&
0099 G4RootPNtupleDescription::GetDescription()
0100 { return fDescription; }
0101 
0102 inline tools::wroot::imt_ntuple*
0103 G4RootPNtupleDescription::GetNtuple() const
0104 { return fNtuple; }
0105 
0106 inline tools::wroot::base_pntuple*
0107 G4RootPNtupleDescription::GetBasePNtuple() const
0108 { return fBasePNtuple; }
0109 
0110 inline std::vector<tools::wroot::branch*>&
0111 G4RootPNtupleDescription::GetMainBranches()
0112 { return fMainBranches; }
0113 
0114 #endif