Skip to content

Commit

Permalink
Merge pull request #234 from paolafer/print-pmt-pos
Browse files Browse the repository at this point in the history
Add printout of PMTs
  • Loading branch information
paolafer authored Feb 13, 2024
2 parents b5dfa74 + 71dcf39 commit 6922c91
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
10 changes: 8 additions & 2 deletions source/geometries/Next100.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace nexus {

msg_->DeclareProperty("lab_walls", lab_walls_, "Placement of Hall A walls.");

msg_->DeclareProperty("print_sipms", print_, "Print SiPM positions.");
msg_->DeclareProperty("print_sns_pos", print_, "Print sensor positions.");

// The following methods must be invoked in this particular
// order since some of them depend on the previous ones
Expand Down Expand Up @@ -182,11 +182,17 @@ namespace nexus {
}

if (print_) {
std::vector<G4ThreeVector> pmt_pos = inner_elements_->GetPMTPosInGas();
for (unsigned int i=0; i<pmt_pos.size(); i++) {
G4ThreeVector pos = pmt_pos[i] - coord_origin_;
G4cout << "PMT " << i << ": " << pos.x() << ", "<< pos.y() << G4endl;
}

std::vector<G4ThreeVector> sipm_pos = inner_elements_->GetSiPMPosInGas();
G4int n_sipm = 0;
G4int b = 1;
for (unsigned int i=0; i<sipm_pos.size(); i++) {
G4ThreeVector pos = sipm_pos[i] - coord_origin_;;
G4ThreeVector pos = sipm_pos[i] - coord_origin_;
G4int id = 1000 * b + n_sipm;
G4cout << "SiPM " << id << ": " << pos.x() << ", "<< pos.y() << G4endl;
n_sipm++;
Expand Down
11 changes: 7 additions & 4 deletions source/geometries/Next100EnergyPlane.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ namespace nexus {
// Builder
void Construct();

// Return the position of PMTs in xenon gas
std::vector<G4ThreeVector> GetPMTPosInGas() const;


private:
void GeneratePositions();
Expand Down Expand Up @@ -102,11 +105,11 @@ namespace nexus {

};

inline void Next100EnergyPlane::SetELtoSapphireWDWdistance(G4double z) {
gate_sapphire_wdw_dist_ = z;}
inline void Next100EnergyPlane::SetELtoSapphireWDWdistance(G4double z) { gate_sapphire_wdw_dist_ = z;}

inline void Next100EnergyPlane::SetMotherLogicalVolume(G4LogicalVolume* mother_logic) { mother_logic_ = mother_logic;}

inline void Next100EnergyPlane::SetMotherLogicalVolume(G4LogicalVolume* mother_logic) {
mother_logic_ = mother_logic;}
inline std::vector<G4ThreeVector> Next100EnergyPlane::GetPMTPosInGas() const { return pmt_positions_;}

} //end namespace nexus
#endif
2 changes: 2 additions & 0 deletions source/geometries/Next100InnerElements.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ namespace nexus {
energy_plane_->SetELtoSapphireWDWdistance(gate_sapphire_wdw_distance_);
energy_plane_->Construct();

pmt_pos_ = energy_plane_->GetPMTPosInGas();

// Tracking plane
tracking_plane_->SetMotherPhysicalVolume(mother_phys_);
tracking_plane_->SetCoordOrigin(coord_origin);
Expand Down
14 changes: 13 additions & 1 deletion source/geometries/Next100InnerElements.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#ifndef NEXT100_INNER_ELEMENTS_H
#define NEXT100_INNER_ELEMENTS_H

#include "GeometryBase.h"

#include <G4ThreeVector.hh>
#include <vector>
#include "GeometryBase.h"

class G4LogicalVolume;
class G4VPhysicalVolume;
Expand Down Expand Up @@ -48,6 +49,9 @@ namespace nexus {
/// Return the positions of the SiPMs in their mother volume (gas)
std::vector<G4ThreeVector> GetSiPMPosInGas() const;

/// Return the positions of the PMTs in their mother volume (gas)
std::vector<G4ThreeVector> GetPMTPosInGas() const;

/// Generate a vertex within a given region of the geometry
G4ThreeVector GenerateVertex(const G4String& region) const;

Expand Down Expand Up @@ -79,6 +83,9 @@ namespace nexus {
// Positions of the SiPMs in their mother volume (gas)
std::vector<G4ThreeVector> sipm_pos_;

// Positions of the PMTs in their mother volume (gas)
std::vector<G4ThreeVector> pmt_pos_;

};

inline void Next100InnerElements::SetELtoTPdistance(G4double distance){
Expand All @@ -94,6 +101,11 @@ namespace nexus {
return sipm_pos_;
}

inline std::vector<G4ThreeVector> Next100InnerElements::GetPMTPosInGas() const
{
return pmt_pos_;
}

} // end namespace nexus

#endif

0 comments on commit 6922c91

Please sign in to comment.