Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nested tube array geometry (optical fibers) #139

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion doc/users_guide/data_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Ratpac data structure is defined in the `src/ds` directory and lists
everything under the `RAT::DS` namespace. An instance of the data structure is
defined in the `RAT::DS::Root` object. The data structure is tree-like, with each
instance of `RAT::DS::Root` containing a list of `RAT::DS::MC` objects which contain
the Monte Carl truth infomration, and a list of `RAT::DS::EV` objects which contain
the Monte Carl truth information, and a list of `RAT::DS::EV` objects which contain
the reconstructed event information (usually after going through a processor that
simulates the detector response).

Expand Down
4 changes: 2 additions & 2 deletions doc/users_guide/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Normally, tables and fields are all you have to think about, but RATDB also
addresses an additional complication: overriding constants. It is a common use
case to have default values of constants, values which are only valid in
certain time intervals and can change (like the optical properties of the
scintilator), and user-specified values which are intended to override
scintillator), and user-specified values which are intended to override
everything.

RATDB handles this by internally grouping tables into three ''planes''. The
Expand All @@ -79,7 +79,7 @@ When an item is requested, RATDB will attempt to locate it in the user plane
first, then the time plane, and finally the default plane. Note that this is
all handled in the background. You simply request the index_of_refraction
field in the MEDIA[acrylic] table, and RATDB figures out the appropriate plane
from which to retreive the data.
from which to retrieve the data.

How do I load data into RATDB?
``````````````````````````````
Expand Down
26 changes: 25 additions & 1 deletion doc/users_guide/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ the volume. The common fields shared by all tables:
``mother`` ``string`` Name of the mother volume. The mother volume should fully contain this volume. The world volume has the mother "".
``enable`` ``int`` (optional) If set to zero, this volume is skipped and not constructed.
``type`` ``string`` Shape of this volume, see below for list.
``sensitive_detector`` ``string`` (optional) Name of sensitive detector if this volume should register hits. Limited to ''/mydet/pmt/inner'' and ''/mydet/veto/genericchamber''
``sensitive_detector`` ``string`` (optional) Name of sensitive detector if this volume should register hits. Limited to ''/mydet/pmt/inner'', ''/mydet/fibers'' and ''/mydet/veto/genericchamber''
====================== ====================== ===================

Allowed types:
Expand All @@ -80,6 +80,7 @@ Allowed types:
* tubearray - Array of tubes
* lgarray - Array of tubes where one end has the PMT face cut out
* pmtarray - Array of PMTs
* nestedtubearray - Array of three nested tubes. Useful to simulate optical fibers
* waterboxarray - Array of standard cubitainer water boxes
* extpolyarray - Array of extruded polygonal solids
* bubble - Collection of bubbles
Expand Down Expand Up @@ -147,6 +148,29 @@ PMTArray Fields:
``rescale_radius`` ``float`` (optional) Assumes all PMTs are spherically arranged around the center of the mother volume and rescales their positions to a particular radius. By default, no rescaling is done.
====================== ========================== ===================

NestedTubeArray Fields:

====================== ========================== ===================
**Field** **Type** **Description**
====================== ========================== ===================
``pos_table`` ``string`` Specifies the table containing position (and direction) arrays specifying how to place PMTs
``core_r`` ``float`` The radius of the core tube (mm)
``inner_r`` ``float`` The radius of the inner tube (mm)
``outer_r`` ``float`` The radius of the outer tube (mm)
``core_material`` ``string`` The material of the core tube
``inner_material`` ``string`` The material of the inner tube
``outer_material`` ``string`` The material of the outer tube
``Dz`` ``float`` Half-height of tube (mm)
``phi_start`` ``float`` (optional) Angle (deg) where tube segment starts. Default is 0.0
``phi_delta`` ``float`` (optional) Angle span (deg) of tube segment. Default is 360.0
``start_idx`` ``int`` (optional) Index to start building nested tubes in the ``NESTEDTUBEINFO`` table specified (inclusive, defaults to 0)
``end_idx`` ``int`` (optional) Index to stop building nested tubes in the ``NESTEDTUBEINFO`` table specified (inclusive, defaults to length-1)
``orientation`` ``string`` Method of determining nested tube direction. "point" will aim all nested tubes at a point in space. "manual" requires that the position table also contain dir_x, dir_y, and dir_z fields which define the direction vector for each PMT.
``orient_point`` ``float[3]`` (optional) Point (mm) in mother volume to aim all tubes toward.
``rescale_radius`` ``float`` (optional) Assumes all tubes are spherically arranged around the center of the mother volume and rescales their positions to a particular radius. By default, no rescaling is done.
``sensitive_detector`` ``string`` (optional) Name of sensitive detector if this volume should register hits. Limited to ''/mydet/fibers''.'
====================== ========================== ===================

Creating a parameterized geometry
`````````````````````````````````
Using a ``DetectorFactory`` one can build a DB defined geometry on the fly
Expand Down
57 changes: 57 additions & 0 deletions macros/vis_nestedTubeArrays.mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/glg4debug/glg4param omit_muon_processes 0.0
/glg4debug/glg4param omit_hadronic_processes 0.0


#set the detector parameters
/rat/db/set DETECTOR experiment "Validation"
/rat/db/set DETECTOR geo_file "Validation/NestedTubeArray.geo"

# Colors
/rat/db/set GEO[world] invisible 1
/rat/db/set GEO[outer_vessel] invisible 1
/rat/db/set GEO[outer_tank] invisible 1
#/rat/db/set GEO[outer_vessel] color [0.1,0.1,0.6,0.95]
#/rat/db/set GEO[outer_tank] color [0.42,0.47,0.57,0.3]
#/rat/db/set GEO[fiber_1_inner] color [0.0,0.8,0.0,0.10]

/run/initialize

/tracking/storeTrajectory 1

##### Visualization ##########################

/vis/open OGLSQt
/vis/scene/create
/vis/scene/add/trajectories rich smooth
/tracking/storeTrajectory 1
/tracking/FillPointCont 1
/vis/scene/add/volume
/vis/scene/add/hits
/vis/sceneHandler/attach
/vis/viewer/set/upVector 0.0 0.0 1.0
/vis/viewer/set/viewpointThetaPhi -90 135
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/setRGBA 0 0.236 0.240 0.002 1
/vis/viewer/set/style s
/vis/viewer/flush

/rat/proc count
/rat/procset update 10


#add ntuple tracking
/rat/proc outntuple
/rat/procset include_tracking 0
/rat/procset include_mcparticles 1
/rat/procset include_pmthits 1
/rat/procset include_nestedtubehits 1
/rat/procset include_untriggered_events 1
#/rat/proc outroot
/rat/physics/setOpWLS g4
##### GENERATORS #################
/generator/add combo pbomb:point:poisson
/generator/vtx/set 1000 350 # 1000 photons, 350nm
/generator/pos/set 0.0 0.0 0.0

##### RUN ###########
/run/beamOn 1
171 changes: 171 additions & 0 deletions ratdb/Validation/NestedTubeArray.geo
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
{
name: "GEO",
index: "world",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "",
type: "box",
size: [20000.0,20000.0,20000.0],
material: "air",
}

{
name: "GEO",
index: "outer_vessel",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "world",
type: "box",
size: [10.0,10.0,10.0],
position: [0.0, 0.0, 0.0],
rotation: [0.0, 0.0, 0.0],
material: "aluminum",
color: [0.02,0.2,0.2,0.03],
}

{
name: "GEO",
index: "outer_tank",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "outer_vessel",
type: "box",
size: [9.0,9.0,9.0],
position: [0.0, 0.0, 0.0],
rotation: [0.0, 0.0, 0.0],
material: "air",
#color: [0.02,0.2,0.2,0.1],
}

// here we place nested tubes manually
{
name: "GEO",
index: "fiber_0_outer",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "outer_tank",
type: "tube",
r_max: 0.5,
size_z: 49.5,
position: [-5.0, 0.0, -5.0],
rotation: [-90.0, 0.0, 0.0],
material: "Fpolyethylene",
color: [0.0,0.8,0.0,0.01],
}

{
name: "GEO",
index: "fiber_0_inner",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "fiber_0_outer",
type: "tube",
r_max: 0.485,
size_z: 49.5,
position: [0.0, 0.0, 0.0],
rotation: [0.0, 0.0, 0.0],
material: "PMMA",
color: [0.0,0.8,0.0,0.05],
}

{
name: "GEO",
index: "fiber_0_core",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "fiber_0_inner",
type: "tube",
r_max: 0.47,
size_z: 49.5,
position: [0.0, 0.0, 0.0],
rotation: [0.0, 0.0, 0.0],
material: "WLSExample",
color: [0.0,0.8,0.0,0.1],
}
{
name: "GEO",
index: "fiber_1_outer",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "outer_tank",
type: "tube",
r_max: 0.5,
size_z: 29.5,
position: [-5.0, 0.0, 5.0],
rotation: [-90.0, 0.0, 0.0],
material: "Fpolyethylene",
color: [0.0,0.8,0.0,0.01],
}

{
name: "GEO",
index: "fiber_1_inner",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "fiber_1_outer",
type: "tube",
r_max: 0.485,
size_z: 29.5,
position: [0.0, 0.0, 0.0],
rotation: [0.0, 0.0, 0.0],
material: "PMMA",
color: [0.0,0.8,0.0,0.05],
}

{
name: "GEO",
index: "fiber_1_core",
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "fiber_1_inner",
type: "tube",
r_max: 0.47,
size_z: 29.5,
position: [0.0, 0.0, 0.0],
rotation: [0.0, 0.0, 0.0],
material: "WLSExample",
color: [0.0,0.8,0.0,0.1],
}
// manual nested tubes ends here

// this table is the information
// about where to place the nested tubes
// in the array
{
name: "cable_pos",
valid_begin: [0],
valid_end: [0],
x: [5, 5]
y: [0, 0],
z: [5, -5],
dir_x: [0, 0],
dir_y: [1, 1],
dir_z: [0, 0],
Dz: [49.5, 29.5]
}

// this is the definition of the
// nested tube 'properties'
// note that we reference the pos_table
// by name, also the pos_table
// doesn't have to be in the .geo file
{
name: "GEO",
index: "fibers",
enable: 1,
valid_begin: [0, 0],
valid_end: [0, 0],
mother: "outer_tank",
type: "nestedtubearray",
core_r: 0.47,
inner_r: 0.485,
outer_r: 0.5,
pos_table: "cable_pos",
orientation: "manual",
outer_material: "Fpolyethylene",
inner_material: "PMMA",
core_material: "WLSExample",
#drawstyle: "solid",
color: [0.0,0.8,0.0,0.2],
sensitive_detector: "/mydet/fibers"
}
Loading