Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-10 07:53:56

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 /// \file ExGflash1SensitiveDetector.cc
0027 /// \brief Implementation of the ExGflash1SensitiveDetector class
0028 
0029 // Created by Joanna Weng 26.11.2004
0030 #include "ExGflash1SensitiveDetector.hh"
0031 
0032 #include "ExGflash1DetectorConstruction.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 ExGflash1SensitiveDetector::ExGflash1SensitiveDetector(G4String name,
0046                                                        ExGflash1DetectorConstruction* det)
0047   : G4VSensitiveDetector(name), fDetector(det)
0048 {
0049   G4String caloname = "ExGflashCollection";
0050   collectionName.insert(caloname);
0051 }
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0054 
0055 ExGflash1SensitiveDetector::~ExGflash1SensitiveDetector() = default;
0056 
0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0058 
0059 void ExGflash1SensitiveDetector::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 ExGflash1SensitiveDetector::EndOfEvent(G4HCofThisEvent*) {}
0072 
0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0074 
0075 G4bool ExGflash1SensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
0076 {
0077   G4double e = aStep->GetTotalEnergyDeposit();
0078   if (e <= 0.) return false;
0079 
0080   auto theTouchable = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
0081 
0082   // enrgy deposited -> make Hit
0083   // const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
0084   // G4TouchableHistory* theTouchable =
0085   // (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
0086   auto caloHit = new ExGflashHit();
0087   caloHit->SetEdep(e);
0088   caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
0089   fCaloHitsCollection->insert(caloHit);
0090   if (ROhist) {
0091     ;
0092   }
0093   G4VPhysicalVolume* physVol = theTouchable->GetVolume();
0094   G4int crystalnum = 0;
0095   for (int i = 0; i < 100; i++)  //@@@@@@@ ExGflashSensitiveDetector:vorsichty
0096   {
0097     if (physVol == fDetector->GetCristal(i)) crystalnum = i;
0098   }
0099   caloHit->SetCrystalNum(crystalnum);
0100 
0101   return true;
0102 }
0103 
0104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0105 
0106 // Separate GFLASH interface
0107 G4bool ExGflash1SensitiveDetector::ProcessHits(G4GFlashSpot* aSpot, G4TouchableHistory* ROhist)
0108 {  // cout<<"This is ProcessHits GFLASH"<<endl;
0109   G4double e = aSpot->GetEnergySpot()->GetEnergy();
0110   if (e <= 0.) return false;
0111 
0112   G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
0113 
0114   auto caloHit = new ExGflashHit();
0115   caloHit->SetEdep(e);
0116   caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
0117   fCaloHitsCollection->insert(caloHit);
0118   if (ROhist) {
0119     ;
0120   }
0121   // cout <<pCurrentVolume->GetName()   << endl;
0122   G4int crystalnum = 0;
0123   for (int i = 0; i < 100; i++)  //@@@@@@@ ExGflashSensitiveDetector:vorsichty
0124   {
0125     if (pCurrentVolume == fDetector->GetCristal(i)) crystalnum = i;
0126   }
0127   caloHit->SetCrystalNum(crystalnum);
0128 
0129   return true;
0130 }
0131 
0132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......