Skip to content
Open
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
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ set(TOP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
#Add the include directories.
include(${Geant4_USE_FILE})
include_directories(include)
include_directories(dict/include)
include_directories(olaInclude)
include_directories(dict/include)
include_directories(/opt/CADmesh/geant4.10.3.3/include)

#Add the root dictionary directory.
add_subdirectory(dict)

#Add the source directories.
add_subdirectory(source)
#add_subdirectory(olaSrc)

if(BUILD_TOOLS)
option(BUILD_TOOLS_NISTLIST "Build NIST library list program." OFF)
Expand All @@ -118,4 +118,4 @@ if(BUILD_TOOLS_CONVERTER)
endif(BUILD_TOOLS_CONVERTER)

#Build/install the miscellaneous stuff
add_subdirectory(share)
add_subdirectory(share)
23 changes: 23 additions & 0 deletions dict/def.struct
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,29 @@ short photonComRow Segmented PMT anode row corresponding to the photon center-of
END_TYPES
END_CLASS

#####################################################################
# nDetImplantOutputStructure
#####################################################################

BEGIN_CLASS nDetImplantOutput
SHORT Container for NEXTSim simulation variable output
LONG Structure for storing information about NEXTSim primary particles and optical photons produced by scattering
BEGIN_TYPES
u_int nPhotonsTot Total number of scintillation photons produced
u_int nPhotonsDetTot Total number of optical photons detected by both PMTs
double lightBalance Ratio of the difference of left and right TQDC to the sum of left and right TQDC
double photonDetEff Ratio of optical photons detected by a PMT to the total number of photons generated
double barTOF Average of the left and right dynode light pulse phases computed using PolyCFD (in ns)
double barQDC Average of the left and right dynode light pulse integrals
double barMaxADC Average of the left and right dynode light pulse maxima (in ADC channels)
double photonComX Average of the left and right photon center-of-mass X position (in mm)
double photonComY Average of the left and right photon center-of-mass Y position (in mm)
double reconComX Left and right PMT photon center-of-mass along the X-axis computed using Anger Logic reconstruction
double reconComY Left and right PMT photon center-of-mass along the Y-axis computed using Anger Logic reconstruction
short photonComCol Segmented PMT anode column corresponding to the photon center-of-mass for the left and right PMT
short photonComRow Segmented PMT anode row corresponding to the photon center-of-mass for the left and right PMT
END_CLASS

#####################################################################
# nDetMultiOutputStructure
#####################################################################
Expand Down
1 change: 1 addition & 0 deletions dict/include/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma link C++ class nDetEventStructure+;
#pragma link C++ class nDetOutputStructure+;
#pragma link C++ class nDetMultiOutputStructure+;
#pragma link C++ class nDetImplantOutputStructure+;
#pragma link C++ class nDetDebugStructure+;
#pragma link C++ class nDetTraceStructure+;

Expand Down
57 changes: 57 additions & 0 deletions dict/include/nDetStructures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,61 @@ class nDetOutputStructure : public TObject {
};


class nDetImplantOutputStructure : public TObject {
public:
unsigned int nPhotonsTot; ///< Total number of scintillation photons produced
unsigned int nPhotonsDet; ///< Total number of optical photons detected by both PMTs
double lightBalance; ///< Ratio of the difference of left and right TQDC to the sum of left and right TQDC
double tdiff; ///< Time difference between left and right PolyCFD phase (in ns)
double photonTdiff; ///< Time differnence between average photon arrival time for each detector.
double photonDetEff; ///< Ratio of optical photons detected by a PMT to the total number of photons generated
double barTOF; ///< Average of the left and right dynode light pulse phases computed using PolyCFD (in ns)
double barQDC; ///< Average of the left and right dynode light pulse integrals
double barMaxADC; ///< Average of the left and right dynode light pulse maxima (in ADC channels)
bool barTrig; ///< Flag to register if both PMT's would have triggered a digitizer filter
double photonTOF; ///< Average of left and right average photon arrival time (in ns)
double photonComX; ///< Average of the left and right photon center-of-mass X position (in mm)
double photonComY; ///< Average of the left and right photon center-of-mass Y position (in mm)
double reconComX; ///< Left and right PMT photon center-of-mass along the X-axis computed using Anger Logic reconstruction
double reconComY; ///< Left and right PMT photon center-of-mass along the Y-axis computed using Anger Logic reconstruction
short photonComCol; ///< Segmented PMT anode column corresponding to the photon center-of-mass for the left and right PMT
short photonComRow; ///< Segmented PMT anode row corresponding to the photon center-of-mass for the left and right PMT

// Default constructor
nDetImplantOutputStructure();

// Destructor
~nDetImplantOutputStructure(){}

/** Set single entry data fields
* @param nPhotonsTot_ Total number of scintillation photons produced
* @param nPhotonsDet_ Total number of optical photons detected by both PMTs
* @param lightBalance_ Ratio of the difference of left and right TQDC to the sum of left and right TQDC
* @param photonDetEff_ Ratio of optical photons detected by a PMT to the total number of photons generated
* @param barTOF_ Average of the left and right dynode light pulse phases computed using PolyCFD (in ns)
* @param barQDC_ Average of the left and right dynode light pulse integrals
* @param barMaxADC_ Average of the left and right dynode light pulse maxima (in ADC channels)
* @param photonComX_ Average of the left and right photon center-of-mass X position (in mm)
* @param photonComY_ Average of the left and right photon center-of-mass Y position (in mm)
* @param reconComX_ Left and right PMT photon center-of-mass along the X-axis computed using Anger Logic reconstruction
* @param reconComY_ Left and right PMT photon center-of-mass along the Y-axis computed using Anger Logic reconstruction
* @param photonComCol_ Segmented PMT anode column corresponding to the photon center-of-mass for the left and right PMT
* @param photonComRow_ Segmented PMT anode row corresponding to the photon center-of-mass for the left and right PMT
*/

void SetValues(const unsigned int &nPhotonsTot_, const unsigned int &nPhotonsDet_, const double &lightBalance_, const double &tdiff_, const double &photonTdiff_, const double &photonDetEff_, const double &barTOF_, const double &barQDC_, const double &barMaxADC_, const bool &barTrig_, const double &photonTOF_, const double &photonComX_, const double &photonComY_, const double &reconComX_, const double &reconComY_, const short &photonComCol_, const short &photonComRow_);

// Push back with data
void Append();

// Zero all variables
void Zero();

/// @cond DUMMY
ClassDef(nDetImplantOutputStructure, 1); // nDetImplantOutput
/// @endcond
};

/*! \class nDetDebugStructure
* \brief Container for NEXTSim simulation variable output
* \author Cory R. Thornsbery
Expand Down Expand Up @@ -362,6 +417,8 @@ class nDetMultiOutputStructure : public TObject {
*/
void Append(const nDetOutputStructure &output, const short &detID_);

void Append(const nDetImplantOutputStructure &output, const short &detID_);

void Append(const nDetDebugStructure &debug, const short nScatters_);

/** Zero all variables
Expand Down
88 changes: 88 additions & 0 deletions dict/source/nDetStructures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,71 @@ void nDetOutputStructure::Zero(){
photonComRow = 0;
}

///////////////////////////////////////////////////////////
// nDetImplantOutputStructure
///////////////////////////////////////////////////////////

nDetImplantOutputStructure::nDetImplantOutputStructure(){
nPhotonsTot = 0;
nPhotonsDet = 0;
lightBalance = 0;
tdiff = 0;
photonDetEff = 0;
barTOF = 0;
barQDC = 0;
barMaxADC = 0;
barTrig = false;
photonTOF = 0;
photonComX = 0;
photonComY = 0;
reconComX = 0;
reconComY = 0;
photonComCol = 0;
photonComRow = 0;
}

void nDetImplantOutputStructure::SetValues(const unsigned int &nPhotonsTot_, const unsigned int &nPhotonsDet_, const double &lightBalance_, const double &tdiff_, const double &photonTdiff_, const double &photonDetEff_, const double &barTOF_, const double &barQDC_, const double &barMaxADC_, const bool &barTrig_, const double &photonTOF_, const double &photonComX_, const double &photonComY_, const double &reconComX_, const double &reconComY_, const short &photonComCol_, const short &photonComRow_){
nPhotonsTot = nPhotonsTot_;
nPhotonsDet = nPhotonsDet_;
lightBalance = lightBalance_;
tdiff = tdiff_;
photonTdiff = photonTdiff_;
photonDetEff = photonDetEff_;
barTOF = barTOF_;
barQDC = barQDC_;
barMaxADC = barMaxADC_;
barTrig = barTrig_;
photonTOF = photonTOF_;
photonComX = photonComX_;
photonComY = photonComY_;
reconComX = reconComX_;
reconComY = reconComY_;
photonComCol = photonComCol_;
photonComRow = photonComRow_;
}

void nDetImplantOutputStructure::Append(){
}

void nDetImplantOutputStructure::Zero(){
nPhotonsTot = 0;
nPhotonsDet = 0;
lightBalance = 0;
tdiff = 0;
photonTdiff = 0;
photonDetEff = 0;
barTOF = 0;
barQDC = 0;
barMaxADC = 0;
barTrig = false;
photonTOF = 0;
photonComX = 0;
photonComY = 0;
reconComX = 0;
reconComY = 0;
photonComCol = 0;
photonComRow = 0;
}

///////////////////////////////////////////////////////////
// nDetMultiOutputStructure
Expand Down Expand Up @@ -184,6 +249,29 @@ void nDetMultiOutputStructure::Append(const nDetOutputStructure &output, const s
multiplicity++;
}

void nDetMultiOutputStructure::Append(const nDetImplantOutputStructure &output, const short &detID_){
nPhotonsTot.push_back(output.nPhotonsTot);
nPhotonsDet.push_back(output.nPhotonsDet);
lightBalance.push_back(output.lightBalance);
tdiff.push_back(output.tdiff);
photonTdiff.push_back(output.photonTdiff);
photonDetEff.push_back(output.photonDetEff);
barTOF.push_back(output.barTOF);
barQDC.push_back(output.barQDC);
barMaxADC.push_back(output.barMaxADC);
barTrig.push_back(output.barTrig);
photonTOF.push_back(output.photonTOF);
photonComX.push_back(output.photonComX);
photonComY.push_back(output.photonComY);
reconComX.push_back(output.reconComX);
reconComY.push_back(output.reconComY);
photonComCol.push_back(output.photonComCol);
photonComRow.push_back(output.photonComRow);
detID.push_back(detID_);
multiplicity++;
}


void nDetMultiOutputStructure::Append(const nDetDebugStructure &debug, const short nScatters_){
for(short iv=0; iv < nScatters_; iv++){
nScatterX.push_back(debug.nScatterX.at(iv));
Expand Down
10 changes: 9 additions & 1 deletion include/centerOfMass.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class centerOfMass{
public:
/** Default constructor
*/
centerOfMass() : Ncol(-1), Nrow(-1), Npts(0), NnotDetected(0), totalMass(0), t0(std::numeric_limits<double>::max()), tSum(0), lambdaSum(0),
centerOfMass() : Ncol(1), Nrow(1), Npts(0), NnotDetected(0), totalMass(0), t0(std::numeric_limits<double>::max()), tSum(0), lambdaSum(0),
activeWidth(0), activeHeight(0), pixelWidth(0), pixelHeight(0), center(0, 0, 0), response() { }

/** Destructor
Expand Down Expand Up @@ -147,6 +147,14 @@ class centerOfMass{
/** Get the vertical photon center-of-mass position computed from the Anger Logic currents
*/
double getReconstructedY() const ;

/** Get the horizontal photon center-of-mass position computed from the Sipm Logic
*/
double getSipmX() const ;

/** Get the vertical photon center-of-mass position computed from the Sipm Logic
*/
double getSipmY() const ;

/** Get the anode gain matrix
*/
Expand Down
37 changes: 37 additions & 0 deletions include/nDetConstruction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@ class nDetConstruction : public G4VUserDetectorConstruction{
*/
G4VPhysicalVolume* ConstructDetector();

/** Build the world volume and place all implants defined in the detector list
* @return A pointer to the world physical volume
*/
G4VPhysicalVolume* ConstructImplant();

/** Add a detector geometry to the list of detectors
* @note See nDetDetector::setGeometry() for accepted geometry names
* @return True if the specified type is recognized and return false otherwise
*/
bool AddGeometry(const G4String &geom);

bool AddImplantGeometry(const G4String &geom);

/** Setup segmented PMTs
*/
void setSegmentedPmt();
Expand Down Expand Up @@ -92,6 +99,10 @@ class nDetConstruction : public G4VUserDetectorConstruction{
*/
centerOfMass *GetCenterOfMassR(){ return &center[1]; }

/** Return a pointer to the optical photon center-of-mass calculator for the left PMT
*/
centerOfMass *GetCenterOfMass(){ return &center[0]; } //This is for the implant detector

/** Return a pointer to the PMT response for the left PMT
*/
pmtResponse *GetPmtResponseL(){ return center[0].getPmtResponse(); }
Expand All @@ -100,10 +111,18 @@ class nDetConstruction : public G4VUserDetectorConstruction{
*/
pmtResponse *GetPmtResponseR(){ return center[1].getPmtResponse(); }

/** Return a pointer to the PMT response for the left PMT
*/
pmtResponse *GetPmtResponse(){ return center[0].getPmtResponse(); } //This is for the implant detector

/** Get a copy of the current vector of detectors
*/
std::vector<nDetDetector*> GetUserDetectors() const { return userDetectors; }

/** Get a copy of the current vector of implants
*/
std::vector<nDetImplant*> GetUserImplants() const { return userImplants; }

/** Get the current user defined detector parameters
*/
nDetDetectorParams GetDetectorParameters() const { return params; }
Expand All @@ -112,10 +131,18 @@ class nDetConstruction : public G4VUserDetectorConstruction{
*/
nDetDetector *getCurrentDetector(){ return currentDetector; }

/** Get a pointer to the current detector
*/
nDetImplant *getCurrentImplant(){ return currentImplant; }

/** Clear all volumes, surfaces, and detectors
*/
void ClearGeometry();

/** Clear all volumes, surfaces, and detectors
*/
void ClearImplantGeometry();

/** Place all detectors into the world and copy the list of detectors to all user run actions
*/
void UpdateGeometry();
Expand All @@ -139,6 +166,8 @@ class nDetConstruction : public G4VUserDetectorConstruction{
* @note See nDetDetector::addLightGuideLayer(const G4String &) for input string syntax
*/
void AddLightGuide(const G4String &input);

void AddSegmentedLightGuide(const G4String &input);

/** Add an array of detectors in a cylindrical setup
* @note String syntax: <geom> <r0> <startTheta> <stopTheta> <Ndet> <br>
Expand All @@ -152,6 +181,8 @@ class nDetConstruction : public G4VUserDetectorConstruction{
*/
void AddDetectorArray(const G4String &input);

void AddImplantArray(const G4String &input);

/** Set the light yield multiplier for scintillator photon production
* @param yield The fraction of the light yield to use for optical photon production in scintillators (default is 1)
*/
Expand All @@ -164,6 +195,10 @@ class nDetConstruction : public G4VUserDetectorConstruction{
/** Get clones of all currently defined detectors
*/
void GetCopiesOfDetectors(std::vector<nDetDetector> &detectors) const ;

/** Get clones of all currently defined detectors
*/
void GetCopiesOfImplants(std::vector<nDetImplant> &implants) const ;

/** Set the experimental setup name for construction
*/
Expand All @@ -177,8 +212,10 @@ class nDetConstruction : public G4VUserDetectorConstruction{
G4bool fCheckOverlaps; ///< Flag indicating that Geant should check for overlaps between all placed objects

std::vector<nDetDetector*> userDetectors; ///< Vector of all detectors added by the user
std::vector<nDetImplant*> userImplants; ///< Vector of all implants added by the user

nDetDetector *currentDetector; ///< Pointer to the current detector added by the user
nDetImplant *currentImplant; ///< Pointer to the current Implant added by the user

centerOfMass center[2]; ///< Objects used to compute the detected optical photon center-of-mass position for the left and right PMT

Expand Down
11 changes: 6 additions & 5 deletions include/nDetDataPack.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ class nDetDataPack{
public:
/** Default constructor
*/
nDetDataPack() : evtData(NULL), outData(NULL), multData(NULL), debugData(NULL), traceData(NULL) { }
nDetDataPack() : evtData(NULL), outData(NULL), outImplantData(NULL), multData(NULL), debugData(NULL), traceData(NULL) { }

/** Data structure constructor
*/
nDetDataPack(nDetEventStructure *evt, nDetOutputStructure *out, nDetMultiOutputStructure *mult, nDetDebugStructure *debug, nDetTraceStructure *trace) :
evtData(evt), outData(out), multData(mult), debugData(debug), traceData(trace) { }
nDetDataPack(nDetEventStructure *evt, nDetOutputStructure *out, nDetImplantOutputStructure *outImp, nDetMultiOutputStructure *mult, nDetDebugStructure *debug, nDetTraceStructure *trace) :
evtData(evt), outData(out), outImplantData(outImp), multData(mult), debugData(debug), traceData(trace) { }

void setDataAddresses(nDetEventStructure *evt, nDetOutputStructure *out, nDetMultiOutputStructure *mult, nDetDebugStructure *debug, nDetTraceStructure *trace);
void setDataAddresses(nDetEventStructure *evt, nDetOutputStructure *out, nDetImplantOutputStructure *outImp, nDetMultiOutputStructure *mult, nDetDebugStructure *debug, nDetTraceStructure *trace);

void copyData(nDetEventStructure *evt, nDetOutputStructure *out, nDetMultiOutputStructure *mult, nDetDebugStructure *debug, nDetTraceStructure *trace) const ;
void copyData(nDetEventStructure *evt, nDetOutputStructure *out, nDetImplantOutputStructure *outImp, nDetMultiOutputStructure *mult, nDetDebugStructure *debug, nDetTraceStructure *trace) const ;

/** Return true if the current event is a good detection event, meaning that optical photons
* were detected at the photo-sensitive surfaces of the detector, and return false otherwise
Expand All @@ -44,6 +44,7 @@ class nDetDataPack{
private:
nDetEventStructure *evtData;
nDetOutputStructure *outData;
nDetImplantOutputStructure *outImplantData;
nDetMultiOutputStructure *multData;
nDetDebugStructure *debugData;
nDetTraceStructure *traceData;
Expand Down
Loading