Import Geant4 10.7.2 source tree

This commit is contained in:
Gabriele Cosmo
2021-06-14 10:01:31 +02:00
parent 3dfcdb544e
commit c968e26a39
271 changed files with 26365 additions and 21942 deletions
+5
View File
@@ -16,6 +16,11 @@ committal in the SVN repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
February 26, 2021 I. Hrivnacova (analysis-V10-06-14)
- Fixed ntuple indexing when FinishNtuple is called in different order
than CreateNtuple.
Addressing the problem report #2335.
February 2, 2021 I. Hrivnacova (analysis-V10-06-13)
- Fixed the problem with merging ntuples with columns of vector type
reported by Riccardo Pilato in G4 Forum.
@@ -42,12 +42,14 @@ struct G4NtupleBooking
{
G4NtupleBooking()
: fNtupleBooking(),
fNtupleId(-1),
fFileName(),
fActivation(true) {}
~G4NtupleBooking() {}
tools::ntuple_booking fNtupleBooking;
G4int fNtupleId;
G4String fFileName;
G4bool fActivation;
};
@@ -152,12 +152,39 @@ G4bool G4TNtupleManager<TN, TF>::FillNtupleTColumn(
template <typename TN, typename TF>
G4int G4TNtupleManager<TN, TF>::CreateNtuple(G4NtupleBooking* ntupleBooking)
{
// This ntuple id
auto ntupleId = G4int(fNtupleDescriptionVector.size()) + fFirstId;
#ifdef G4VERBOSE
if ( fState.GetVerboseL4() ) {
fState.GetVerboseL4()
->Message("create from booking", "ntuple",
ntupleBooking->fNtupleBooking.name());
}
#endif
// The ntuple index
auto index = ntupleBooking->fNtupleId - fFirstId;
// Check if the ntuple description of this id already exists
// (what should normally never happen)
// delete it and print a warning
if ( index < G4int(fNtupleDescriptionVector.size()) &&
fNtupleDescriptionVector[index] ) {
delete fNtupleDescriptionVector[index];
G4ExceptionDescription description;
description
<< "Ntuple description " << ntupleBooking->fNtupleId << " already exists.";
G4Exception("G4TNtupleManager::CreateNtuple",
"Analysis_W002", JustWarning, description);
}
// Allocate the vector element(s)
while ( index >= G4int(fNtupleDescriptionVector.size()) ) {
fNtupleDescriptionVector.push_back(nullptr);
}
// Create ntuple description from ntuple booking.
auto ntupleDescription = new G4TNtupleDescription<TN, TF>(ntupleBooking);
fNtupleDescriptionVector.push_back(ntupleDescription);
fNtupleDescriptionVector[index] = ntupleDescription;
// Do not create ntuple if it is inactivated
if ( fState.GetIsActivation() &&
@@ -167,19 +194,12 @@ G4int G4TNtupleManager<TN, TF>::CreateNtuple(G4NtupleBooking* ntupleBooking)
if ( ntupleDescription->fNtuple ) {
G4ExceptionDescription description;
description
<< "Ntuple " << ntupleId << " already exists.";
<< "Ntuple " << ntupleBooking->fNtupleId << " already exists.";
G4Exception("G4TNtupleManager::CreateNtuple",
"Analysis_W002", JustWarning, description);
return ntupleId;
return ntupleBooking->fNtupleId;
}
#ifdef G4VERBOSE
if ( fState.GetVerboseL4() )
fState.GetVerboseL4()
->Message("create from booking", "ntuple",
ntupleDescription->fNtupleBooking.name());
#endif
// create ntuple
CreateTNtupleFromBooking(ntupleDescription);
@@ -191,13 +211,12 @@ G4int G4TNtupleManager<TN, TF>::CreateNtuple(G4NtupleBooking* ntupleBooking)
if ( fState.GetVerboseL3() )
fState.GetVerboseL3()
->Message("create from booking", "ntuple",
ntupleDescription->fNtupleBooking.name());
ntupleBooking->fNtupleBooking.name());
#endif
return ntupleId;
return ntupleBooking->fNtupleId;
}
//_____________________________________________________________________________
template <typename TN, typename TF>
void G4TNtupleManager<TN, TF>::CreateNtuplesFromBooking(
@@ -101,6 +101,7 @@ G4int G4NtupleBookingManager::CreateNtuple(
// Save name & title in ntuple booking
ntupleBooking->fNtupleBooking.set_name(name);
ntupleBooking->fNtupleBooking.set_title(title);
ntupleBooking->fNtupleId = G4int(index + fFirstId);
// Create ntuple
fLockFirstId = true;
@@ -108,12 +109,12 @@ G4int G4NtupleBookingManager::CreateNtuple(
#ifdef G4VERBOSE
if ( fState.GetVerboseL2() ) {
G4ExceptionDescription description;
description << name << " ntupleId " << index + fFirstId;
description << name << " ntupleId " << ntupleBooking->fNtupleId;
fState.GetVerboseL2()->Message("create", "ntuple booking", description);
}
#endif
return G4int(index + fFirstId);
return ntupleBooking->fNtupleId;
}
//_____________________________________________________________________________