Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 /// \file ExGflashEventAction.cc 28 /// \brief Implementation of the ExGflashEvent 29 // 30 // Created by Joanna Weng 26.11.2004 31 32 #include "ExGflashEventAction.hh" 33 34 #include "ExGflashHit.hh" 35 36 #include "G4Event.hh" 37 #include "G4EventManager.hh" 38 #include "G4SDManager.hh" 39 #include "G4SystemOfUnits.hh" 40 #include "G4TrajectoryContainer.hh" 41 #include "G4UImanager.hh" 42 // std 43 #include <algorithm> 44 #include <iostream> 45 // Gflash 46 using namespace std; 47 48 //....oooOO0OOooo........oooOO0OOooo........oo 49 50 ExGflashEventAction::ExGflashEventAction() = d 51 52 //....oooOO0OOooo........oooOO0OOooo........oo 53 54 ExGflashEventAction::~ExGflashEventAction() 55 { 56 if (fNevent > 0) { 57 G4cout << "Internal Real Elapsed Time /eve 58 } 59 } 60 61 //....oooOO0OOooo........oooOO0OOooo........oo 62 63 void ExGflashEventAction::BeginOfEventAction(c 64 { 65 fTimerIntern.Start(); 66 G4cout << " ------ Start ExGflashEventAction 67 fNevent = evt->GetEventID(); 68 G4cout << " Start generating event Nr " << f 69 } 70 71 //....oooOO0OOooo........oooOO0OOooo........oo 72 73 void ExGflashEventAction::EndOfEventAction(con 74 { 75 fTimerIntern.Stop(); 76 G4cout << G4endl; 77 G4cout << "********************************* 78 G4cout << G4endl; 79 G4cout << "Internal Real Elapsed Time is: " 80 G4cout << G4endl; 81 G4cout << "Internal System Elapsed Time: " < 82 G4cout << G4endl; 83 G4cout << "Internal GetUserElapsed Time: " < 84 G4cout << G4endl; 85 G4cout << "********************************* 86 fDtime += fTimerIntern.GetRealElapsed(); 87 G4cout << " ------ ExGflashEventAction::End 88 89 G4SDManager* SDman = G4SDManager::GetSDMpoin 90 G4String colNam; 91 fCalorimeterCollectionId = SDman->GetCollect 92 if (fCalorimeterCollectionId < 0) return; 93 G4HCofThisEvent* HCE = evt->GetHCofThisEvent 94 ExGflashHitsCollection* THC = nullptr; 95 G4double totE = 0; 96 // Read out of the crysta ECAL 97 THC = (ExGflashHitsCollection*)(HCE->GetHC(f 98 if (THC) { 99 /// Hits in sensitive Detector 100 int n_hit = THC->entries(); 101 G4cout << " " << n_hit << " hits are stor 102 G4PrimaryVertex* pvertex = evt->GetPrimary 103 /// Computing (x,y,z) of vertex of initial 104 G4ThreeVector vtx = pvertex->GetPosition() 105 G4PrimaryParticle* pparticle = pvertex->Ge 106 // direction of the Shower 107 G4ThreeVector mom = pparticle->GetMomentum 108 109 //@@@ ExGflashEventAction: Magicnumber 110 G4double energyincrystal[100]; 111 G4int hitsincrystal[100]; 112 for (int i = 0; i < 100; i++) 113 energyincrystal[i] = 0.; 114 for (int i = 0; i < 100; i++) 115 hitsincrystal[i] = 0.; 116 117 //@@@ ExGflashEventAction: Magicnumber 118 /// For all Hits in sensitive detector 119 for (int i = 0; i < n_hit; i++) { 120 G4double estep = (*THC)[i]->GetEdep() / 121 if (estep > 0.0) { 122 totE += (*THC)[i]->GetEdep() / GeV; 123 G4int num = (*THC)[i]->GetCrystalNum() 124 125 energyincrystal[num] += (*THC)[i]->Get 126 hitsincrystal[num]++; 127 // G4cout << num << G4endl; 128 // G4cout << " Crystal Nummer " << 129 // G4cout << (*THC)[i]->GetCrystalN 130 // " "<<(*THC)[i]->GetCrystalNum()%1 131 132 G4ThreeVector hitpos = (*THC)[i]->GetP 133 G4ThreeVector l(hitpos.x(), hitpos.y() 134 // distance from shower start 135 l = l - vtx; 136 // projection on shower axis = longitu 137 G4ThreeVector longitudinal = l; 138 // shower profiles (Radial) 139 G4ThreeVector radial = vtx.cross(l); 140 } 141 } 142 G4double max = 0; 143 G4int index = 0; 144 // Find crystal with maximum energy 145 for (int i = 0; i < 100; i++) { 146 // G4cout << i <<" " << energyincrystal 147 if (max < energyincrystal[i]) { 148 max = energyincrystal[i]; 149 index = i; 150 } 151 } 152 // G4cout << index <<" NMAX " << index << 153 154 // 3x3 matrix of crystals around the cryst 155 G4double e3x3 = energyincrystal[index] + e 156 + energyincrystal[index - 157 + energyincrystal[index - 158 + energyincrystal[index + 159 160 // 5x5 matrix of crystals around the cryst 161 G4double e5x5 = 162 energyincrystal[index] + energyincrystal 163 + energyincrystal[index + 2] + energyinc 164 + energyincrystal[index - 9] + energyinc 165 + energyincrystal[index - 12] + energyin 166 + energyincrystal[index + 9] + energyinc 167 168 // 3x3 matrix of crystals around the cryst 169 G4int num3x3 = hitsincrystal[index] + hits 170 + hitsincrystal[index - 10] 171 + hitsincrystal[index - 11] 172 + hitsincrystal[index + 11] 173 174 // 5x5 matrix of crystals around the cryst 175 G4int num5x5 = hitsincrystal[index] + hits 176 + hitsincrystal[index + 2] 177 + hitsincrystal[index - 9] 178 + hitsincrystal[index - 12] 179 + hitsincrystal[index + 11] 180 + hitsincrystal[index + 12] 181 182 G4cout << " e1 " << energyincrystal[ind 183 << G4endl; 184 185 G4cout << " num1 " << hitsincrystal[ind 186 << num5x5 << G4endl; 187 } 188 189 G4cout << " Total energy deposited in the ca 190 G4TrajectoryContainer* trajectoryContainer = 191 G4int n_trajectories = 0; 192 if (trajectoryContainer) { 193 n_trajectories = trajectoryContainer->entr 194 } 195 G4cout << " " << n_trajectories << " traj 196 } 197 198 //....oooOO0OOooo........oooOO0OOooo........oo 199