Loading...
Searching...
No Matches
H02MuonSD.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file eventgenerator/HepMC/HepMCEx02/src/H02MuonSD.cc
27/// \brief Implementation of the H02MuonSD class
28//
29//
30#include "G4HCofThisEvent.hh"
31#include "G4TouchableHistory.hh"
32#include "G4Track.hh"
33#include "G4Step.hh"
34#include "G4VPhysicalVolume.hh"
35#include "H02MuonHit.hh"
36#include "H02MuonSD.hh"
37
38//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 fHitCollection(0)
42{
43 G4String HCname;
44 collectionName.insert("muonHit");
45}
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54{
55 static int HCID=-1;
56 fHitCollection= new H02MuonHitsCollection(SensitiveDetectorName,
57 collectionName[0]);
58 if(HCID<0) HCID= GetCollectionID(0);
59 HCE-> AddHitsCollection(HCID, fHitCollection);
60}
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64{
65 G4ParticleDefinition* particle= astep-> GetTrack()-> GetDefinition();
66 if(particle-> GetPDGCharge() == 0.) return false;
67
68 G4StepPoint* prestep= astep-> GetPreStepPoint();
69
70 if(prestep-> GetStepStatus() != fGeomBoundary) return false;
71
72 G4ThreeVector vmom= prestep-> GetMomentum();
73 G4ThreeVector vpos= prestep-> GetPosition();
74 G4double tof= prestep-> GetGlobalTime();
75
76 G4VPhysicalVolume* volume= prestep-> GetPhysicalVolume();
77 G4int id= volume-> GetCopyNo();
78 if(volume-> GetName() == "ENDCAP_MUON_PV") id +=10;
79
80 H02MuonHit* aHit=
81 new H02MuonHit(id, particle-> GetParticleName(), vmom, vpos, tof);
82 fHitCollection-> insert(aHit);
83 return true;
84
85}
86
87//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91
92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94{
95}
96
97//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
99{
100}
101
102//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104{
105 G4int nHit= fHitCollection-> entries();
106 G4cout << "------------------------------------------" << G4endl
107 << "*** Muon System Hit (#hits=" << nHit << ")" << G4endl;
108 fHitCollection-> PrintAllHits();
109}
Definition of the H02MuonHit class.
G4THitsCollection< H02MuonHit > H02MuonHitsCollection
Definition H02MuonHit.hh:97
Definition of the H02MuonSD class.
virtual void EndOfEvent(G4HCofThisEvent *HCE)
Definition H02MuonSD.cc:88
virtual G4bool ProcessHits(G4Step *astep, G4TouchableHistory *ROhist)
Definition H02MuonSD.cc:63
H02MuonHitsCollection * fHitCollection
Definition H02MuonSD.hh:53
H02MuonSD(G4String name)
Definition H02MuonSD.cc:39
virtual void Initialize(G4HCofThisEvent *HCE)
Definition H02MuonSD.cc:53
virtual void DrawAll()
Definition H02MuonSD.cc:98
virtual void clear()
Definition H02MuonSD.cc:93
virtual void PrintAll()
Definition H02MuonSD.cc:103

Applications | User Support | Publications | Collaboration