Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
+24 -24
View File
@@ -37,7 +37,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorimeterSD::B4cCalorimeterSD(
const G4String& name,
const G4String& name,
const G4String& hitsCollectionName,
G4int nofCells)
: G4VSensitiveDetector(name),
@@ -49,8 +49,8 @@ B4cCalorimeterSD::B4cCalorimeterSD(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorimeterSD::~B4cCalorimeterSD()
{
B4cCalorimeterSD::~B4cCalorimeterSD()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -58,16 +58,16 @@ B4cCalorimeterSD::~B4cCalorimeterSD()
void B4cCalorimeterSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new B4cCalorHitsCollection(SensitiveDetectorName, collectionName[0]);
fHitsCollection
= new B4cCalorHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
auto hcID
auto hcID
= G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
hce->AddHitsCollection( hcID, fHitsCollection );
hce->AddHitsCollection( hcID, fHitsCollection );
// Create hits
// fNofCells for cells + one more for total sums
// fNofCells for cells + one more for total sums
for (G4int i=0; i<fNofCells+1; i++ ) {
fHitsCollection->insert(new B4cCalorHit());
}
@@ -75,42 +75,42 @@ void B4cCalorimeterSD::Initialize(G4HCofThisEvent* hce)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
G4TouchableHistory*)
{
{
// energy deposit
auto edep = step->GetTotalEnergyDeposit();
// step length
G4double stepLength = 0.;
if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
stepLength = step->GetStepLength();
}
if ( edep==0. && stepLength == 0. ) return false;
if ( edep==0. && stepLength == 0. ) return false;
auto touchable = (step->GetPreStepPoint()->GetTouchable());
// Get calorimeter cell id
// Get calorimeter cell id
auto layerNumber = touchable->GetReplicaNumber(1);
// Get hit accounting data for this cell
auto hit = (*fHitsCollection)[layerNumber];
if ( ! hit ) {
G4ExceptionDescription msg;
msg << "Cannot access hit " << layerNumber;
msg << "Cannot access hit " << layerNumber;
G4Exception("B4cCalorimeterSD::ProcessHits()",
"MyCode0004", FatalException, msg);
}
}
// Get hit for total accounting
auto hitTotal
auto hitTotal
= (*fHitsCollection)[fHitsCollection->entries()-1];
// Add values
hit->Add(edep, stepLength);
hitTotal->Add(edep, stepLength);
hitTotal->Add(edep, stepLength);
return true;
}
@@ -118,11 +118,11 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
void B4cCalorimeterSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
if ( verboseLevel>1 ) {
auto nofHits = fHitsCollection->entries();
G4cout
<< G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< G4endl
<< "-------->Hits Collection: in this event they are " << nofHits
<< " hits in the tracker chambers: " << G4endl;
for ( std::size_t i=0; i<nofHits; ++i ) (*fHitsCollection)[i]->Print();
}