Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:32

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 //
0026 /// \file ExGflashSensitiveDetector.cc
0027 /// \brief Implementation of the ExGflashSensitiveDetector class
0028 //
0029 // Created by Joanna Weng 26.11.2004
0030 #include "ExGflashSensitiveDetector.hh"
0031 
0032 #include "ExGflashDetectorConstruction.hh"
0033 #include "ExGflashHit.hh"
0034 
0035 #include "G4GFlashSpot.hh"
0036 #include "G4Step.hh"
0037 #include "G4TouchableHistory.hh"
0038 #include "G4VPhysicalVolume.hh"
0039 #include "G4VTouchable.hh"
0040 
0041 // WARNING :  You have to use also  G4VGFlashSensitiveDetector() as base class
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 ExGflashSensitiveDetector::ExGflashSensitiveDetector(G4String name,
0046                                                      ExGflashDetectorConstruction* /* det */)
0047   : G4VSensitiveDetector(name)
0048 {
0049   G4String caloname = "ExGflashCollection";
0050   collectionName.insert(caloname);
0051 }
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0054 
0055 ExGflashSensitiveDetector::~ExGflashSensitiveDetector() = default;
0056 
0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0058 
0059 void ExGflashSensitiveDetector::Initialize(G4HCofThisEvent* HCE)
0060 {
0061   if (fHCID < 0) {
0062     fHCID = GetCollectionID(0);
0063   }
0064   fCaloHitsCollection =
0065     new ExGflashHitsCollection(SensitiveDetectorName, collectionName[0]);  // first collection
0066   HCE->AddHitsCollection(fHCID, fCaloHitsCollection);
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 void ExGflashSensitiveDetector::EndOfEvent(G4HCofThisEvent*) {}
0072 
0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0074 
0075 G4bool ExGflashSensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory* /* ROhist */)
0076 {
0077   G4double e = aStep->GetTotalEnergyDeposit();
0078   if (e <= 0.) return false;
0079 
0080   auto caloHit = new ExGflashHit();
0081   caloHit->SetEdep(e);
0082   caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
0083   fCaloHitsCollection->insert(caloHit);
0084 
0085   return true;
0086 }
0087 
0088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0089 
0090 // Separate GFLASH interface
0091 G4bool ExGflashSensitiveDetector::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory* /* ROhist */)
0092 {
0093   // cout<<"This is ProcessHits GFLASH"<<endl;
0094   G4double e = aSpot->GetEnergySpot()->GetEnergy();
0095   if (e <= 0.) return false;
0096 
0097   //  G4VPhysicalVolume* pCurrentVolume =
0098   //  aSpot->GetTouchableHandle()->GetVolume();
0099 
0100   auto caloHit = new ExGflashHit();
0101   caloHit->SetEdep(e);
0102   caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
0103   fCaloHitsCollection->insert(caloHit);
0104   //  if (ROhist){;}
0105 
0106   return true;
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......