Back to home page

EIC code displayed by LXR

 
 

    


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

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