ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflash3SensitiveDetector.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExGflash3SensitiveDetector.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"
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++) //@@@@@@@ ExGflash3SensitiveDetector: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++) //@@@@@@@ ExGflash3SensitiveDetector: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