Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ old
analysis/
condor_photons/
build/
data
.ssh
16 changes: 10 additions & 6 deletions Pinpoint/src/generators/GFaserGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void GFaserGenerator::LoadData()
fGfaserTree->SetBranchAddress("W", &fW);
fGfaserTree->SetBranchAddress("x", &fX);
fGfaserTree->SetBranchAddress("y", &fY);
fGfaserTree->SetBranchAddress("xsec", &xsec);
fGfaserTree->SetBranchAddress("XSec", &xsec);
fGfaserTree->SetBranchAddress("intType", &fIntType);
fGfaserTree->SetBranchAddress("scatteringType", &fScatType);
fGfaserTree->SetBranchAddress("cc", &fIsCc);
Expand Down Expand Up @@ -151,6 +151,13 @@ void GFaserGenerator::GeneratePrimaries(G4Event* event)
if (fUseFixedZPosition) {
fVz = GenerateRandomZVertex(fLayerId);
}

auto *runManager = G4RunManager::GetRunManager();
auto detector = (DetectorConstruction*) (runManager->GetUserDetectorConstruction());
if (fVz < 0 || fVz > detector->GetNumberOfLayers() * detector->GetLayerThickness()) {
G4cerr << "** vertex z position out of range !! **" << G4endl;
}

G4ThreeVector vertexPosition(fVx * m, fVy * m, fVz * m);

G4PrimaryVertex* vertex = new G4PrimaryVertex(vertexPosition, 0.);
Expand Down Expand Up @@ -260,11 +267,8 @@ G4double GFaserGenerator::GenerateRandomZVertex(G4int layerIndex) const {

G4double layerThickness = detector->GetLayerThickness();
G4double tungstenThickness = detector->GetTungstenThickness();
G4int nLayers = detector->GetNumberOfLayers();
G4double startZ = -0.5 * nLayers * layerThickness;
G4double z = startZ + layerIndex * layerThickness + tungstenThickness * G4UniformRand();

G4cout << "Generated random Z vertex at: " << z/m << " m in layer " << layerIndex << G4endl;
G4double z = layerIndex * layerThickness + tungstenThickness * G4UniformRand();
G4cout << "Generated random Z vertex at: " << z << " mm = " << z/m << " m in layer " << layerIndex << G4endl;

return z/m; // convert to meters
}
Expand Down
Loading