Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:45

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 #include "G4AnalysisManagerState.hh"
0028 #include "G4AnalysisUtilities.hh"
0029 
0030 //
0031 // private functions
0032 //
0033 
0034 //_____________________________________________________________________________
0035 template <typename T>
0036 G4int G4NtupleBookingManager::CreateNtupleTColumn(
0037   G4int ntupleId, const G4String& name, std::vector<T>* vector)
0038 {
0039   if (! CheckName(name, "NtupleColumn")) return G4Analysis::kInvalidId;
0040 
0041   Message(G4Analysis::kVL4, "create", "ntuple T column",
0042     " ntupleId " + std::to_string(ntupleId));
0043 
0044   auto g4NtupleBooking
0045     = GetNtupleBookingInFunction(ntupleId, "CreateNtupleTColumn");
0046   if ( ! g4NtupleBooking )  return G4Analysis::kInvalidId;
0047 
0048   // Save column info in booking
0049   auto& ntupleBooking = g4NtupleBooking->fNtupleBooking;
0050   auto index = ntupleBooking.columns().size();
0051   if (! vector) {
0052     ntupleBooking.template add_column<T>(name);
0053   }
0054   else {
0055     ntupleBooking.template add_column<T>(name, *vector);
0056   }
0057 
0058   // Create column if ntuple already exists
0059   // CreateTColumnInNtuple<T>(ntupleBooking, name, vector);
0060   fLockFirstNtupleColumnId = true;
0061 
0062   Message(G4Analysis::kVL2, "create", "ntuple T column",
0063     name + " ntupleId " + std::to_string(ntupleId));
0064 
0065   return G4int(index + fFirstNtupleColumnId);
0066 }
0067 
0068 //_____________________________________________________________________________
0069 inline G4int G4NtupleBookingManager::GetNofNtuples(G4bool onlyIfExist) const
0070 {
0071   return (onlyIfExist) ? G4int(fNtupleBookingVector.size() - fFreeIds.size())
0072                        : G4int(fNtupleBookingVector.size());
0073 }
0074 
0075 //_____________________________________________________________________________
0076 inline G4int  G4NtupleBookingManager::GetCurrentNtupleId() const
0077 {
0078   return fCurrentNtupleId;
0079 }
0080 
0081 //
0082 // public functions
0083 //
0084 
0085 //_____________________________________________________________________________
0086 inline const std::vector<G4NtupleBooking*>&
0087 G4NtupleBookingManager::GetNtupleBookingVector() const
0088 {
0089   return fNtupleBookingVector;
0090 }
0091 
0092 //_____________________________________________________________________________
0093 inline G4int G4NtupleBookingManager::GetFirstNtupleColumnId() const {
0094   return fFirstNtupleColumnId;
0095 }
0096 
0097 //_____________________________________________________________________________
0098 inline G4String G4NtupleBookingManager::GetFileType() const
0099 {
0100   return fFileType;
0101 }