Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 08:30:57

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 RE05MuonSD.cc
0027 /// \brief Implementation of the RE05MuonSD class
0028 
0029 #include "RE05MuonSD.hh"
0030 
0031 #include "RE05MuonHit.hh"
0032 
0033 #include "G4HCofThisEvent.hh"
0034 #include "G4Step.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4TouchableHistory.hh"
0037 #include "G4Track.hh"
0038 #include "G4ios.hh"
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 RE05MuonSD::RE05MuonSD(G4String name)
0043   : G4VSensitiveDetector(name), fMuonCollection(0), fPositionResolution(0.)
0044 {
0045   G4String HCname;
0046   collectionName.insert(HCname = "muonCollection");
0047   fPositionResolution = 5 * cm;
0048 }
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 
0052 RE05MuonSD::~RE05MuonSD() {}
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 void RE05MuonSD::Initialize(G4HCofThisEvent* HCE)
0057 {
0058   static int HCID = -1;
0059   fMuonCollection = new RE05MuonHitsCollection(SensitiveDetectorName, collectionName[0]);
0060   if (HCID < 0) {
0061     HCID = GetCollectionID(0);
0062   }
0063   HCE->AddHitsCollection(HCID, fMuonCollection);
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 G4bool RE05MuonSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
0069 {
0070   G4double edep = aStep->GetTotalEnergyDeposit();
0071 
0072   if (edep == 0.) return true;
0073 
0074   RE05MuonHit* aHit;
0075   int nHit = fMuonCollection->entries();
0076   G4ThreeVector hitpos = aStep->GetPreStepPoint()->GetPosition();
0077   for (int i = 0; i < nHit; i++) {
0078     aHit = (*fMuonCollection)[i];
0079     G4ThreeVector pos = aHit->GetPos();
0080     G4double dist2 =
0081       sqr(pos.x() - hitpos.x()) + sqr(pos.y() - hitpos.y()) + sqr(pos.z() - hitpos.z());
0082     if (dist2 <= sqr(fPositionResolution)) aHit->AddEdep(edep);
0083     return true;
0084   }
0085 
0086   aHit = new RE05MuonHit();
0087   aHit->SetEdep(edep);
0088   aHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
0089   fMuonCollection->insert(aHit);
0090 
0091   return true;
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void RE05MuonSD::EndOfEvent(G4HCofThisEvent*) {}
0097 
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0099 
0100 void RE05MuonSD::clear() {}
0101 
0102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0103 
0104 void RE05MuonSD::DrawAll() {}
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0107 
0108 void RE05MuonSD::PrintAll() {}
0109 
0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......