ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflash1SensitiveDetector.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExGflash1SensitiveDetector.cc
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 //
29 //
30 // Created by Joanna Weng 26.11.2004
32 #include "ExGflashHit.hh"
33 #include "G4GFlashSpot.hh"
35 #include "G4VPhysicalVolume.hh"
36 #include "G4Step.hh"
37 #include "G4VTouchable.hh"
38 #include "G4TouchableHistory.hh"
39 
40 //WARNING : You have to use also G4VGFlashSensitiveDetector() as base class
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
46  : G4VSensitiveDetector(name), G4VGFlashSensitiveDetector(), fDetector(det), fHCID(-1)
47 {
48  G4String caloname="ExGflashCollection";
49  collectionName.insert(caloname);
50 }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 {}
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
61  if(fHCID<0){ fHCID = GetCollectionID(0); }
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
68 
70 {}
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
77  if(e<=0.)return false;
78 
79  G4TouchableHistory* theTouchable
81 
82  // enrgy deposited -> make Hit
83  //const G4VPhysicalVolume* physVol= aStep->GetPreStepPoint()->GetPhysicalVolume();
84  //G4TouchableHistory* theTouchable =
85  // (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
86  ExGflashHit* caloHit=new ExGflashHit();
87  caloHit->SetEdep(e);
88  caloHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
89  fCaloHitsCollection->insert(caloHit);
90  if (ROhist){;}
91  G4VPhysicalVolume* physVol = theTouchable->GetVolume();
92  G4int crystalnum=0;
93  for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
94  {
95  if(physVol == fDetector->GetCristal(i)) crystalnum= i;
96  }
97  caloHit->SetCrystalNum(crystalnum);
98 
99  return true;
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103 
104 // Separate GFLASH interface
106 { //cout<<"This is ProcessHits GFLASH"<<endl;
107  G4double e=aSpot->GetEnergySpot()->GetEnergy();
108  if(e<=0.)return false;
109 
110  G4VPhysicalVolume* pCurrentVolume = aSpot->GetTouchableHandle()->GetVolume();
111 
112  ExGflashHit* caloHit=new ExGflashHit();
113  caloHit->SetEdep(e);
114  caloHit->SetPos(aSpot->GetEnergySpot()->GetPosition());
115  fCaloHitsCollection->insert(caloHit);
116  if (ROhist){;}
117  //cout <<pCurrentVolume->GetName() << endl;
118  G4int crystalnum=0;
119  for(int i=0;i<100;i++) //@@@@@@@ ExGflashSensitiveDetector:vorsichty
120  {
121  if(pCurrentVolume == fDetector->GetCristal(i)) crystalnum= i;
122  }
123  caloHit->SetCrystalNum(crystalnum);
124 
125  return true;
126 }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129