Geant4  10.01
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 72372 2013-07-16 14:30:39Z gcosmo $
27 //
30 //
31 // Created by Joanna Weng 26.11.2004
34 #include "ExGflashHit.hh"
35 #include "G4VPhysicalVolume.hh"
36 #include "G4Step.hh"
37 #include "G4VTouchable.hh"
38 #include "G4TouchableHistory.hh"
39 #include "G4SDManager.hh"
40 #include <iostream>
41 using namespace std;
42 
43 //WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
44 
47  G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), HCID(-1)
48 {
49  G4String caloname="ExGflashCollection";
50  collectionName.insert(caloname);
51 }
52 
54 
56 {
57  if(HCID<0){ HCID = GetCollectionID(0); }
61 }
62 
64 {
65  if (HCE){;}
66  // No Hadronic
67  // cout<<"IEndOfEvent " << HCID << endl;
68 }
69 
71 {
73  if(e<=0.)return false;
74 
75  G4TouchableHistory* theTouchable
77 
78  // enrgy deposited -> make Hit
79  //const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
80  //G4TouchableHistory* theTouchable =
81  // (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
82  ExGflashHit* caloHit=new ExGflashHit();
83  caloHit->SetEdep(e);
84  caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
85  fCaloHitsCollection->insert(caloHit);
86  if (ROhist){;}
87  G4VPhysicalVolume* physVol = theTouchable->GetVolume();
88  G4int crystalnum=0;
89  for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
90  {
91  if(physVol == fDetector->GetCristal(i)) crystalnum= i;
92  }
93  caloHit->SetCrystalNum(crystalnum);
94 
95  return true;
96 }
97 
98 // Separate GFLASH interface
100 { //cout<<"This is ProcessHits GFLASH"<<endl;
101  G4double e=aSpot->GetEnergySpot()->GetEnergy();
102  if(e<=0.)return false;
103 
104  G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
105 
106  ExGflashHit* caloHit=new ExGflashHit();
107  caloHit->SetEdep(e);
108  caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
109  fCaloHitsCollection->insert(caloHit);
110  if (ROhist){;}
111  //cout <<pCurrentVolume->GetName() << endl;
112  G4int crystalnum=0;
113  for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
114  {
115  if(pCurrentVolume == fDetector->GetCristal(i)) crystalnum= i;
116  }
117  caloHit->SetCrystalNum(crystalnum);
118 
119  return true;
120 }
const G4VPhysicalVolume * GetCristal(int num__crystal)
ExGflashHitsCollection * fCaloHitsCollection
G4TouchableHandle GetTouchableHandle() const
Definition: G4GFlashSpot.hh:62
ExGflashSensitiveDetector(G4String, ExGflashDetectorConstruction *det)
void Initialize(G4HCofThisEvent *)
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4String name
Definition: TRTMaterials.hh:40
const GFlashEnergySpot * GetEnergySpot() const
Definition: G4GFlashSpot.hh:58
G4int insert(T *aHit)
const G4VTouchable * GetTouchable() const
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
G4double GetEnergy() const
int G4int
Definition: G4Types.hh:78
void SetCrystalNum(G4int num)
Definition: ExGflashHit.hh:83
virtual G4int GetCollectionID(G4int i)
G4StepPoint * GetPreStepPoint() const
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:101
Definition of the ExGflashSensitiveDetector class.
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
Definition of the ExGflashHitsCollection class.
G4CollectionNameVector collectionName
double G4double
Definition: G4Types.hh:76
ExGflashDetectorConstruction * fDetector
void SetEdep(G4double de)
Definition: ExGflashHit.hh:73
G4ThreeVector GetPosition() const
void SetPos(G4ThreeVector xyz)
Definition: ExGflashHit.hh:79