Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 08:32:51

0001 // ********************************************************************
0002 // * License and Disclaimer                                           *
0003 // *                                                                  *
0004 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0005 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0006 // * conditions of the Geant4 Software License,  included in the file *
0007 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0008 // * include a list of copyright holders.                             *
0009 // *                                                                  *
0010 // * Neither the authors of this software system, nor their employing *
0011 // * institutes,nor the agencies providing financial support for this *
0012 // * work  make  any representation or  warranty, express or implied, *
0013 // * regarding  this  software system or assume any liability for its *
0014 // * use.  Please see the license in the file  LICENSE  and URL above *
0015 // * for the full disclaimer and the limitation of liability.         *
0016 // *                                                                  *
0017 // * This  code  implementation is the result of  the  scientific and *
0018 // * technical work of the GEANT4 collaboration.                      *
0019 // * By using,  copying,  modifying or  distributing the software (or *
0020 // * any work based  on the software)  you  agree  to acknowledge its *
0021 // * use  in  resulting  scientific  publications,  and indicate your *
0022 // * acceptance of all terms of the Geant4 Software license.          *
0023 // ********************************************************************
0024 //
0025 /// \file ExGflashSensitiveDetector.cc
0026 /// \brief Implementation of the ExGflashSensitiveDetector class
0027 
0028 // Created by Joanna Weng 26.11.2004
0029 #include "ExGflashSensitiveDetector.hh"
0030 
0031 #include "ExGflashDetectorConstruction.hh"
0032 #include "ExGflashHit.hh"
0033 
0034 #include "G4GFlashSpot.hh"
0035 #include "G4Step.hh"
0036 #include "G4TouchableHistory.hh"
0037 #include "G4VPhysicalVolume.hh"
0038 #include "G4VTouchable.hh"
0039 
0040 // WARNING :  You have to use also  G4VGFlashSensitiveDetector() as base class
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name,
0045                                                      ExGflashDetectorConstruction* /* det */)
0046   : G4VSensitiveDetector(name)
0047 {
0048   G4String caloname = "ExGflashCollection";
0049   collectionName.insert(caloname);
0050 }
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 ExGflashSensitiveDetector::~ExGflashSensitiveDetector() = default;
0055 
0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0057 
0058 void ExGflashSensitiveDetector::Initialize(G4HCofThisEvent* HCE)
0059 {
0060   if (fHCID < 0) {
0061     fHCID = GetCollectionID(0);
0062   }
0063   fCaloHitsCollection =
0064     new ExGflashHitsCollection(SensitiveDetectorName, collectionName[0]);  // first collection
0065   HCE->AddHitsCollection(fHCID, fCaloHitsCollection);
0066 }
0067 
0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0069 
0070 void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*) {}
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0073 
0074 G4bool ExGflashSensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory* /* ROhist */)
0075 {
0076   G4double e = aStep->GetTotalEnergyDeposit();
0077   if (e <= 0.) return false;
0078 
0079   auto caloHit = new ExGflashHit();
0080   caloHit->SetEdep(e);
0081   caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
0082   fCaloHitsCollection->insert(caloHit);
0083 
0084   return true;
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 // Separate GFLASH interface
0090 G4bool ExGflashSensitiveDetector::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory* /* ROhist */)
0091 {
0092   // cout<<"This is ProcessHits GFLASH"<<endl;
0093   G4double e = aSpot->GetEnergySpot()->GetEnergy();
0094   if (e <= 0.) return false;
0095 
0096   //  G4VPhysicalVolume* pCurrentVolume =
0097   //  aSpot->GetTouchableHandle()->GetVolume();
0098 
0099   auto caloHit = new ExGflashHit();
0100   caloHit->SetEdep(e);
0101   caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
0102   fCaloHitsCollection->insert(caloHit);
0103 
0104   return true;
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......