Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // $Id: H02MuonSD.cc 77801 2013-11-28 13:33:20Z gcosmo $
30 //
31 #include "G4HCofThisEvent.hh"
32 #include "G4TouchableHistory.hh"
33 #include "G4Track.hh"
34 #include "G4Step.hh"
35 #include "G4VPhysicalVolume.hh"
36 #include "H02MuonHit.hh"
37 #include "H02MuonSD.hh"
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41  : G4VSensitiveDetector(name)
42 {
43  G4String HCname;
44  collectionName.insert("muonHit");
45 }
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 {
50 }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 {
55  static int HCID=-1;
57  collectionName[0]);
58  if(HCID<0) HCID= GetCollectionID(0);
59  HCE-> AddHitsCollection(HCID, hitCollection);
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  hitCollection-> insert(aHit);
83  return true;
84 
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 {
90 }
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= hitCollection-> entries();
106  G4cout << "------------------------------------------" << G4endl
107  << "*** Muon System Hit (#hits=" << nHit << ")" << G4endl;
108  hitCollection-> PrintAllHits();
109 }
virtual G4bool ProcessHits(G4Step *astep, G4TouchableHistory *ROhist)
Definition: H02MuonSD.cc:63
virtual void DrawAll()
Definition: H02MuonSD.cc:98
~H02MuonSD()
Definition: H02MuonSD.cc:48
virtual void PrintAll()
Definition: H02MuonSD.cc:103
const XML_Char * name
G4THitsCollection< H02MuonHit > H02MuonHitsCollection
Definition: H02MuonHit.hh:98
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)
G4GLOB_DLL std::ostream G4cout
H02MuonSD(G4String name)
Definition: H02MuonSD.cc:40
bool G4bool
Definition: G4Types.hh:79
virtual void EndOfEvent(G4HCofThisEvent *HCE)
Definition: H02MuonSD.cc:88
Definition: G4Step.hh:76
#define G4endl
Definition: G4ios.hh:61
G4CollectionNameVector collectionName
double G4double
Definition: G4Types.hh:76
virtual void Initialize(G4HCofThisEvent *HCE)
Definition: H02MuonSD.cc:53
Definition of the H02MuonHit class.
tuple astep
Definition: test1.py:13
Definition of the H02MuonSD class.
virtual void clear()
Definition: H02MuonSD.cc:93