Back to home page

EIC code displayed by LXR

 
 

    


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

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