Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 /// \file runAndEvent/RE01/src/RE01Calorimeter << 23 // $Id: RE01CalorimeterSD.cc,v 1.1 2004/11/26 07:37:41 asaim Exp $ 27 /// \brief Implementation of the RE01Calorimet << 24 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 28 // << 29 // 25 // 30 26 31 #include "RE01CalorimeterSD.hh" << 32 27 >> 28 #include "RE01CalorimeterSD.hh" 33 #include "RE01CalorimeterHit.hh" 29 #include "RE01CalorimeterHit.hh" 34 << 30 #include "G4VPhysicalVolume.hh" 35 #include "G4LogicalVolume.hh" 31 #include "G4LogicalVolume.hh" 36 #include "G4ParticleDefinition.hh" << 37 #include "G4Step.hh" << 38 #include "G4TouchableHistory.hh" << 39 #include "G4Track.hh" 32 #include "G4Track.hh" 40 #include "G4VPhysicalVolume.hh" << 33 #include "G4Step.hh" >> 34 #include "G4ParticleDefinition.hh" 41 #include "G4VTouchable.hh" 35 #include "G4VTouchable.hh" >> 36 #include "G4TouchableHistory.hh" 42 #include "G4ios.hh" 37 #include "G4ios.hh" 43 38 44 //....oooOO0OOooo........oooOO0OOooo........oo << 45 RE01CalorimeterSD::RE01CalorimeterSD(G4String 39 RE01CalorimeterSD::RE01CalorimeterSD(G4String name) 46 : G4VSensitiveDetector(name), fCalCollection << 40 :G4VSensitiveDetector(name), >> 41 numberOfCellsInZ(20),numberOfCellsInPhi(48) 47 { 42 { 48 // Initialize data member. << 49 for (G4int j = 0; j < fNumberOfCellsInZ; j++ << 50 for (G4int k = 0; k < fNumberOfCellsInPhi; << 51 fCellID[j][k] = -1; << 52 } << 53 // << 54 G4String HCname; 43 G4String HCname; 55 collectionName.insert(HCname = "calCollectio << 44 collectionName.insert(HCname="calCollection"); 56 } 45 } 57 46 58 //....oooOO0OOooo........oooOO0OOooo........oo << 59 RE01CalorimeterSD::~RE01CalorimeterSD() 47 RE01CalorimeterSD::~RE01CalorimeterSD() 60 { << 48 {;} 61 ; << 62 } << 63 49 64 //....oooOO0OOooo........oooOO0OOooo........oo << 65 void RE01CalorimeterSD::Initialize(G4HCofThisE 50 void RE01CalorimeterSD::Initialize(G4HCofThisEvent* HCE) 66 { 51 { 67 fCalCollection = new RE01CalorimeterHitsColl << 52 CalCollection = new RE01CalorimeterHitsCollection 68 for (G4int j = 0; j < fNumberOfCellsInZ; j++ << 53 (SensitiveDetectorName,collectionName[0]); 69 for (G4int k = 0; k < fNumberOfCellsInPhi; << 54 for(G4int j=0;j<numberOfCellsInZ;j++) 70 fCellID[j][k] = -1; << 55 for(G4int k=0;k<numberOfCellsInPhi;k++) 71 } << 56 { >> 57 CellID[j][k] = -1; >> 58 } 72 59 73 static G4int HCID = -1; 60 static G4int HCID = -1; 74 if (HCID < 0) { << 61 if(HCID<0) 75 HCID = GetCollectionID(0); << 62 { HCID = GetCollectionID(0); } 76 } << 63 HCE->AddHitsCollection( HCID, CalCollection ); 77 HCE->AddHitsCollection(HCID, fCalCollection) << 78 } 64 } 79 65 80 //....oooOO0OOooo........oooOO0OOooo........oo << 66 G4bool RE01CalorimeterSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) 81 G4bool RE01CalorimeterSD::ProcessHits(G4Step* << 82 { 67 { 83 //***** RE05CalorimeterSD has been migrated << 68 if(!ROhist) return false; 84 //***** support Readout Geometry in multi-th << 85 //***** is assigned to a dedicaed parallel w << 86 //***** a G4Step object for the parallel wor << 87 << 88 G4double edep = aStep->GetTotalEnergyDeposit 69 G4double edep = aStep->GetTotalEnergyDeposit(); 89 if (edep == 0.) return false; << 70 if(edep==0.) return false; 90 71 91 const G4VTouchable* ROhist = aStep->GetPreSt << 72 G4VPhysicalVolume* physVol = ROhist->GetVolume(); >> 73 //ROhist->MoveUpHistory(); >> 74 //G4VPhysicalVolume* mothVol = ROhist->GetVolume(1); 92 G4int copyIDinZ = ROhist->GetReplicaNumber() 75 G4int copyIDinZ = ROhist->GetReplicaNumber(); 93 G4int copyIDinPhi = ROhist->GetReplicaNumber 76 G4int copyIDinPhi = ROhist->GetReplicaNumber(1); 94 77 95 if (fCellID[copyIDinZ][copyIDinPhi] == -1) { << 78 if(CellID[copyIDinZ][copyIDinPhi]==-1) 96 RE01CalorimeterHit* calHit = << 79 { 97 new RE01CalorimeterHit(ROhist->GetVolume << 80 RE01CalorimeterHit* calHit 98 calHit->SetEdep(edep); << 81 = new RE01CalorimeterHit 99 G4AffineTransform aTrans = ROhist->GetHist << 82 (physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi); 100 aTrans.Invert(); << 83 G4RotationMatrix rotM; 101 calHit->SetPos(aTrans.NetTranslation()); << 84 if(physVol->GetObjectRotation()) rotM = *(physVol->GetObjectRotation()); 102 calHit->SetRot(aTrans.NetRotation()); << 85 calHit->SetEdep( edep ); >> 86 calHit->SetPos( physVol->GetTranslation() ); >> 87 calHit->SetRot( rotM ); 103 calHit->SetTrackInformation(aStep->GetTrac 88 calHit->SetTrackInformation(aStep->GetTrack()); 104 G4int icell = fCalCollection->insert(calHi << 89 G4int icell = CalCollection->insert( calHit ); 105 fCellID[copyIDinZ][copyIDinPhi] = icell - << 90 CellID[copyIDinZ][copyIDinPhi] = icell - 1; 106 if (verboseLevel > 0) { << 91 if(verboseLevel>0) 107 G4cout << " New Calorimeter Hit on CellI << 92 { G4cout << " New Calorimeter Hit on CellID " 108 } << 93 << copyIDinZ << " " << copyIDinPhi << G4endl; } 109 } 94 } 110 else { << 95 else 111 (*fCalCollection)[fCellID[copyIDinZ][copyI << 96 { 112 (*fCalCollection)[fCellID[copyIDinZ][copyI << 97 (*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->AddEdep(edep); 113 if (verboseLevel > 0) { << 98 (*CalCollection)[CellID[copyIDinZ][copyIDinPhi]]->SetTrackInformation(aStep->GetTrack()); 114 G4cout << " Energy added to CellID " << << 99 if(verboseLevel>0) 115 } << 100 { G4cout << " Energy added to CellID " >> 101 << copyIDinZ << " " << copyIDinPhi << G4endl; } 116 } 102 } 117 103 118 return true; 104 return true; 119 } 105 } >> 106 >> 107 void RE01CalorimeterSD::EndOfEvent(G4HCofThisEvent*) >> 108 { >> 109 } >> 110 >> 111 void RE01CalorimeterSD::clear() >> 112 { >> 113 } >> 114 >> 115 void RE01CalorimeterSD::DrawAll() >> 116 { >> 117 } >> 118 >> 119 void RE01CalorimeterSD::PrintAll() >> 120 { >> 121 } >> 122 120 123