Geant4  10.03
ExGflashSensitiveDetector.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 // $Id: ExGflashSensitiveDetector.cc 94396 2015-11-13 13:37:16Z gcosmo $
27 //
30 //
31 // Created by Joanna Weng 26.11.2004
33 #include "ExGflashHit.hh"
34 #include "G4GFlashSpot.hh"
36 #include "G4VPhysicalVolume.hh"
37 #include "G4Step.hh"
38 #include "G4VTouchable.hh"
39 #include "G4TouchableHistory.hh"
40 
41 //WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
47  : G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), fHCID(-1)
48 {
49  G4String caloname="ExGflashCollection";
50  collectionName.insert(caloname);
51 }
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
56 {}
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61 {
62  if(fHCID<0){ fHCID = GetCollectionID(0); }
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {}
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 
76 {
78  if(e<=0.)return false;
79 
80  G4TouchableHistory* theTouchable
82 
83  // enrgy deposited -> make Hit
84  //const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
85  //G4TouchableHistory* theTouchable =
86  // (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
87  ExGflashHit* caloHit=new ExGflashHit();
88  caloHit->SetEdep(e);
89  caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
90  fCaloHitsCollection->insert(caloHit);
91  if (ROhist){;}
92  G4VPhysicalVolume* physVol = theTouchable->GetVolume();
93  G4int crystalnum=0;
94  for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
95  {
96  if(physVol == fDetector->GetCristal(i)) crystalnum= i;
97  }
98  caloHit->SetCrystalNum(crystalnum);
99 
100  return true;
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104 
105 // Separate GFLASH interface
107 { //cout<<"This is ProcessHits GFLASH"<<endl;
108  G4double e=aSpot->GetEnergySpot()->GetEnergy();
109  if(e<=0.)return false;
110 
111  G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
112 
113  ExGflashHit* caloHit=new ExGflashHit();
114  caloHit->SetEdep(e);
115  caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
116  fCaloHitsCollection->insert(caloHit);
117  if (ROhist){;}
118  //cout <<pCurrentVolume->GetName() << endl;
119  G4int crystalnum=0;
120  for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
121  {
122  if(pCurrentVolume == fDetector->GetCristal(i)) crystalnum= i;
123  }
124  caloHit->SetCrystalNum(crystalnum);
125 
126  return true;
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130 
const G4VPhysicalVolume * GetCristal(int num__crystal)
ExGflashHitsCollection * fCaloHitsCollection
G4TouchableHandle GetTouchableHandle() const
Definition: G4GFlashSpot.hh:62
ExGflashSensitiveDetector(G4String, ExGflashDetectorConstruction *det)
virtual void Initialize(G4HCofThisEvent *)
G4VPhysicalVolume * GetVolume(G4int depth=0) const
const GFlashEnergySpot * GetEnergySpot() const
Definition: G4GFlashSpot.hh:58
G4int insert(T *aHit)
const char * name(G4int ptype)
const G4VTouchable * GetTouchable() const
virtual G4bool ProcessHits(G4Step *, G4TouchableHistory *)
G4double GetEnergy() const
int G4int
Definition: G4Types.hh:78
void SetCrystalNum(G4int num)
Definition: ExGflashHit.hh:82
virtual G4int GetCollectionID(G4int i)
G4StepPoint * GetPreStepPoint() const
virtual void EndOfEvent(G4HCofThisEvent *)
const G4ThreeVector & GetPosition() const
bool G4bool
Definition: G4Types.hh:79
Definition: G4Step.hh:76
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
Definition of the ExGflashHit class.
G4THitsCollection< ExGflashHit > ExGflashHitsCollection
Definition: ExGflashHit.hh:99
Definition of the ExGflashSensitiveDetector class.
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
G4CollectionNameVector collectionName
double G4double
Definition: G4Types.hh:76
ExGflashDetectorConstruction * fDetector
Definition of the ExGflashDetectorConstruction class.
void SetEdep(G4double de)
Definition: ExGflashHit.hh:72
G4ThreeVector GetPosition() const
void SetPos(G4ThreeVector xyz)
Definition: ExGflashHit.hh:78