Hello dear GEANT users,
I have a scintillator created in geant4 I also want to make an SIPM for that scintillator or at least something that would give the same results as it does, but I was not succesfull at make an such SIPM like system and I need advice. I share the parts of my .cc files relevant to SIPM creation. But I am told that they are hard to read so let me explain them. First of all I wrapped the scintillator with aluminum except for 6mm x 6mm part of it(SIPM will be put to that part). Then I made a 6mm x 6mmx0.41mm silicon cube to resemble an Sensl 30065. Then I created a logical border surface with silicon and scintillator like this:
//------------------------------Optical Surface of sipm-scint------------------
G4OpticalSurface* OpSurface_for_sipm = new G4OpticalSurface("scintillator_sipm_Surface");
//G4LogicalBorderSurface* Surface = new G4LogicalBorderSurface("Scint1Surface", phys_scint1, phys_surface_scint1, OpSurface);
OpSurface_for_sipm->SetType(dielectric_dielectric);
//OpSurface->SetFinish(polishedfrontpainted);
OpSurface_for_sipm->SetFinish(polished);
OpSurface_for_sipm->SetModel(unified);
OpSurface_for_sipm->SetSigmaAlpha(0.1*deg); // no known
std::vector<G4double> pp_of_Si = { 2.0 * eV, 3.47 * eV };//taken from: /examples/extended/optical/wls/src/WLSMaterials.cc
std::vector<G4double> rindex_of_Si = {1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46 };
//std::vector<G4double> reflectivity = { 1.0, 1.0 };
//std::vector<G4double> efficiency = { 1.0, 1.0 };
G4MaterialPropertiesTable* opSurfaceProperty_for_sipm = new G4MaterialPropertiesTable();
opSurfaceProperty->AddProperty("REFLECTIVITY", photonEnergy, efficiency);
opSurfaceProperty->AddProperty("EFFICIENCY", photonEnergy, reflectivity);
opSurfaceProperty_for_sipm->AddProperty("RINDEX", photonEnergy, rindex_of_Si);
//opSurfaceProperty_for_sipm->AddProperty("ABSLENGTH", pp_of_Si, absClad);
OpSurface_for_sipm->SetMaterialPropertiesTable(opSurfaceProperty_for_sipm);
G4LogicalBorderSurface* Surface_sipm = new G4LogicalBorderSurface("Scint1Surface", phys_scint1, phys_sipm1, OpSurface_for_sipm);
//------------------------------End of Optical Surface of Simp-scint-------------------------
then I kind of tried to replicate what an SIPM does and few extra stuff with SIPMSD.cc and SIPMHit.cc . At the end of SIPMSD.cc I tried to print out all of scintillators results but nothing gets printed even the numbers I put for control. This is how I print stuff out(I tried root files before this that did not work either):
G4bool SipmSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
// energy deposit
G4double h = 4.13566733e-15*eV*s;
G4double c = 299792458.*m/s;
G4cout << "1" << G4endl;
if(aStep->GetTrack()->GetDefinition()->GetParticleName() != (G4String)"opticalphoton") return false; //idea stolen from: LXePMTSD.cc
G4cout << "2" << G4endl;
G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
G4cout << "3" << G4endl;
G4TouchableHistory* touchable = (G4TouchableHistory*)(preStepPoint->GetTouchable());
G4cout << "4" << G4endl;
G4VPhysicalVolume* pv = aStep->GetPostStepPoint()->GetPhysicalVolume();
if(pv->GetName() != "PVsipm1")return false;
G4cout << "5" << G4endl;
G4double edep = aStep->GetTotalEnergyDeposit();
G4double totalEn = aStep->GetTrack()->GetTotalEnergy();
G4double wavelength = (h*c)/totalEn;
G4double preTime = aStep->GetPreStepPoint()->GetGlobalTime();
G4double postTime = aStep->GetPostStepPoint()->GetGlobalTime();
G4cout << "6" << G4endl;
G4cout << "wavelength of photon: " << wavelength << "\n Post time of photon: " << postTime << "\n Pre time of photon: " << preTime << G4endl;
G4cout << "7" << G4endl;
G4cout.flush();
//G4cout << 1 << G4endl;
//if (edep==0.) return false;
auto newHit = new SipmHit();
G4cout << "8" << G4endl;
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
G4cout << "9" << G4endl;
G4int number=-1;
G4int copyno=-1;
if(collectionName[0] == "DetCollection1") number=0;
//if(collectionName[0] == "DetCollection2") number=1;
//if(collectionName[0] == "DetCollection3") number=2;
//copyno = aStep->GetPreStepPoint()->GetTouchableHandle()->GetCopyNumber();
G4cout << "10" << G4endl;
newHit->SetChamberNb(number);
newHit->SetEdep(edep);
//newHit->SetCopyNumber(copyno);
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
newHit->SetTime(postTime);
newHit->SetTime(preTime);
newHit->SetWavelength(wavelength);
newHit->SetTotalEnergy(totalEn);
G4cout << "11" << G4endl;
fHitsCollection->insert( newHit );
G4cout << "12" << G4endl;
aStep->GetTrack()->SetTrackStatus(fStopAndKill);
G4cout << "13" << G4endl;
return true;
}
Well at this point I am out of ideas and require assistance.
DetectorConstruction.cc (15.2 KB)
SipmSD.cc (6.1 KB)
_Geant4 Version:_11.1
_Operating System:_Ubuntu 20.04
_Compiler/Version:_9.4.0
_CMake Version:_3.25.1