// // ******************************************************************** // * License and Disclaimer * // * * // * The Geant4 software is copyright of the Copyright Holders of * // * the Geant4 Collaboration. It is provided under the terms and * // * conditions of the Geant4 Software License, included in the file * // * LICENSE and available at http://cern.ch/geant4/license . These * // * include a list of copyright holders. * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. Please see the license in the file LICENSE and URL above * // * for the full disclaimer and the limitation of liability. * // * * // * This code implementation is the result of the scientific and * // * technical work of the GEANT4 collaboration. * // * By using, copying, modifying or distributing the software (or * // * any work based on the software) you agree to acknowledge its * // * use in resulting scientific publications, and indicate your * // * acceptance of all terms of the Geant4 Software license. * // ******************************************************************** // // // -------------------------------------------------------------- // GEANT 4 - SoLid // // For information related to this code contact: Mariangela Settimo // e-mail: mariangela.settimo@gmail.com // -------------------------------------------------------------- // Comments // // // by Mariangela Settimo - Subatech // (14th April 2017) // // PVTSD (PVT sensitive detector definition) // -------------------------------------------------------------- #include "SolidPVTSD.hh" #include "SolidPVTHit.hh" #include "Phase1DetectorConstruction.hh" #include "SolidDetectorConstruction.hh" #include "G4VPhysicalVolume.hh" #include "G4HCofThisEvent.hh" #include "G4Step.hh" #include "G4SDManager.hh" #include "G4ParticleDefinition.hh" #include "G4ParticleTypes.hh" #include "G4VProcess.hh" #include "G4ProcessType.hh" #include "G4Ions.hh" #include "G4ios.hh" #include #include "G4OpticalPhoton.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... SolidPVTSD::SolidPVTSD(G4String name) :G4VSensitiveDetector(name) { G4String HCname; if (name == "/SolidDet/ScintSD") HCname="pvtCollection"; //if (name == "/SolidDet/Li6SD") // HCname="liCollection"; collectionName.insert(HCname); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... SolidPVTSD::~SolidPVTSD(){ } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void SolidPVTSD::Initialize(G4HCofThisEvent*) { pvtCollection = new SolidPVTHitsCollection(SensitiveDetectorName,collectionName[0]); // liCollection = new SolidPVTHitsCollection(SensitiveDetectorName,collectionName[1]); HitID = -1; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... G4bool SolidPVTSD::ProcessHits(G4Step* aStep, G4TouchableHistory*) { // G4cout << " Process Hits for " << aStep->GetTrack()->GetTrackID() << G4endl; //================================== // info for T5 - info cube-wise //================================== G4int trackID = aStep->GetTrack()->GetTrackID(); G4int motherID = aStep->GetTrack()->GetParentID(); G4ParticleDefinition* particle = aStep->GetTrack()->GetDefinition(); G4int particlePDG = particle->GetPDGEncoding(); G4double edep = aStep->GetTotalEnergyDeposit(); G4double trkLength = aStep->GetStepLength(); G4StepPoint* thePrePoint = aStep->GetPreStepPoint(); G4double time = thePrePoint->GetGlobalTime(); if (edep<=0) return false; if (aStep->GetPreStepPoint()->GetWeight()>0) { edep *= aStep->GetPreStepPoint()->GetWeight(); trkLength *= aStep->GetPreStepPoint()->GetWeight(); } /**************************************************************** * get the correct cube id ****************************************************************/ G4int cubeID = -100; // G4int LiID = 0; G4TouchableHandle thePrePointTouch = thePrePoint->GetTouchableHandle(); G4String endvol = aStep->GetTrack()->GetVolume()->GetName(); G4String layer = ""; if (endvol == "physPVT" || endvol == "physBacking" || endvol == "physTyvek") layer = "PVT"; else if (endvol == "physLi") layer = "Li"; if( endvol == "physPVT" || endvol == "physLi" || endvol == "physBacking" || endvol == "physTyvek" ) { G4int moduleID = thePrePointTouch->GetCopyNumber(3); // it is zero for NEMENIX & SM1 G4int planeID = thePrePointTouch->GetCopyNumber(2); // it is zero for NEMENIX G4int detModID = thePrePointTouch->GetCopyNumber(1); cubeID = 10000*(10*moduleID + planeID) + detModID; // LiID = aStep->GetTrack()->GetVolume()->GetCopyNo(); // 0 for punched LiF:ZnS, 1 for plain LiF:ZnS // printf("%12s, Li: %d, module: %d, plane: %d, detMod: %4d ==> cube: %6d \n", endvol.data(), LiID, moduleID, planeID, detModID, cubeID); } /****************************************************************/ // fill in hit SolidPVTHit* newHit = new SolidPVTHit(); newHit->SetTrackID(trackID); newHit->SetEdep(edep); newHit->SetTime(time); newHit->SetLayerName(layer); newHit->SetParticlePDG(particlePDG); newHit->SetCubeID(cubeID); newHit->SetTrackLength(trkLength); newHit->SetMotherID(motherID); //if( endvol == "physPVT" || endvol == "physBacking" || endvol == "physTyvek" ) HitID = pvtCollection->insert(newHit); //else if( endvol == "physLi") // HitID = liCollection->insert(newHit); return true; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void SolidPVTSD::EndOfEvent(G4HCofThisEvent* HCE) { // G4AnalysisManager* man = G4AnalysisManager::Instance(); G4String HCname = collectionName[0]; static G4int HCID = -1; if(HCID<0) HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname); HCE->AddHitsCollection(HCID,pvtCollection); G4int nHits = pvtCollection->entries(); if (verboseLevel>=1) G4cout << " PVT collection: " << nHits << " hits" << G4endl; if (verboseLevel>=2) pvtCollection->PrintAllHits(); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void SolidPVTSD::clear() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void SolidPVTSD::DrawAll() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... void SolidPVTSD::PrintAll() {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....