Back to home page

EIC code displayed by LXR

 
 

    


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

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 runAndEvent/RE01/src/RE01TrackerSD.cc
0027 /// \brief Implementation of the RE01TrackerSD class
0028 //
0029 //
0030 
0031 #include "RE01TrackerSD.hh"
0032 
0033 #include "RE01TrackInformation.hh"
0034 #include "RE01TrackerHit.hh"
0035 
0036 #include "G4HCofThisEvent.hh"
0037 #include "G4Step.hh"
0038 #include "G4TouchableHistory.hh"
0039 #include "G4ios.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 RE01TrackerSD::RE01TrackerSD(G4String name) : G4VSensitiveDetector(name), fTrackerCollection(0)
0043 {
0044   G4String HCname;
0045   collectionName.insert(HCname = "trackerCollection");
0046 }
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 RE01TrackerSD::~RE01TrackerSD()
0050 {
0051   ;
0052 }
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 void RE01TrackerSD::Initialize(G4HCofThisEvent* HCE)
0056 {
0057   static int HCID = -1;
0058   fTrackerCollection = new RE01TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
0059   if (HCID < 0) {
0060     HCID = GetCollectionID(0);
0061   }
0062   HCE->AddHitsCollection(HCID, fTrackerCollection);
0063 }
0064 
0065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0066 G4bool RE01TrackerSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
0067 {
0068   G4double edep = aStep->GetTotalEnergyDeposit();
0069   if (edep == 0.) return false;
0070 
0071   RE01TrackerHit* newHit = new RE01TrackerHit();
0072   newHit->SetEdep(edep);
0073   newHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
0074   RE01TrackInformation* trackInfo =
0075     (RE01TrackInformation*)(aStep->GetTrack()->GetUserInformation());
0076   if (trackInfo->GetTrackingStatus() > 0) {
0077     newHit->SetTrackID(aStep->GetTrack()->GetTrackID());
0078   }
0079   else {
0080     newHit->SetTrackID(-1);
0081   }
0082   fTrackerCollection->insert(newHit);
0083 
0084   return true;
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 void RE01TrackerSD::EndOfEvent(G4HCofThisEvent*)
0089 {
0090   ;
0091 }