Permalink
Browse files

Implement tub detector, but not getting any hits from protons yet.

  • Loading branch information...
1 parent a779820 commit 20955e609ed7e8da470adfc2abf6b4b05f67d9ca @brettviren committed Aug 20, 2012
@@ -39,10 +39,12 @@
// this file then it causes the units to go undefined when they are
// later included by G4 files.
#undef HEP_SYSTEM_OF_UNITS_H
+#undef HEP_PHYSICAL_CONSTANTS_H
namespace units {
//#include "G4SystemOfUnits.hh"
-#include "CLHEP/Units/SystemOfUnits.h"
-
+// #include "CLHEP/Units/SystemOfUnits.h"
+// next one pulls this in
+#include "CLHEP/Units/PhysicalConstants.h"
}
namespace CowbellsInstantiations
@@ -14,7 +14,7 @@ namespace Cowbells {
class PhysicsConsEM : public G4VPhysicsConstructor
{
public:
- PhysicsConsEM(const G4String& name ="EM");
+ PhysicsConsEM();
virtual ~PhysicsConsEM();
public:
@@ -16,7 +16,7 @@ namespace Cowbells {
class PhysicsConsMuon : public G4VPhysicsConstructor
{
public:
- PhysicsConsMuon(const G4String& name="muon");
+ PhysicsConsMuon();
virtual ~PhysicsConsMuon();
public:
@@ -0,0 +1,55 @@
+/**
+ * \class PhysicsConsOp
+ *
+ * \brief Optical Physics
+ *
+ * taken from geant4.9.5.p01/examples/extended/optical/wls
+ *
+ * bv@bnl.gov Mon Aug 20 16:27:16 2012
+ *
+ */
+
+
+
+#ifndef PHYSICSCONSOP_H
+#define PHYSICSCONSOP_H
+
+#include "G4OpWLS.hh"
+#include "G4Cerenkov.hh"
+#include "G4Scintillation.hh"
+
+#include "G4OpMieHG.hh"
+#include "G4OpRayleigh.hh"
+#include "G4OpAbsorption.hh"
+#include "G4OpBoundaryProcess.hh"
+
+#include "G4VPhysicsConstructor.hh"
+
+namespace Cowbells {
+
+class PhysicsConsOp : public G4VPhysicsConstructor
+{
+public:
+ PhysicsConsOp();
+ virtual ~PhysicsConsOp();
+
+public:
+
+ virtual void ConstructParticle();
+ virtual void ConstructProcess();
+
+protected:
+
+ G4OpWLS* theWLSProcess;
+ G4Scintillation* theScintProcess;
+ G4Cerenkov* theCerenkovProcess;
+ G4OpBoundaryProcess* theBoundaryProcess;
+ G4OpAbsorption* theAbsorptionProcess;
+ G4OpRayleigh* theRayleighScattering;
+ G4OpMieHG* theMieHGScatteringProcess;
+
+};
+
+}
+
+#endif // PHYSICSCONSOP_H
@@ -4,6 +4,8 @@
cowbells simulation.
'''
-import water, wbls, acrylic, glass, vacuum
-propmods = [water, wbls, acrylic, glass, vacuum]
+# fixme: make this automatic....
+import water, wbls, acrylic, glass, vacuum, teflon
+propmods = [water, wbls, acrylic, glass, vacuum, teflon]
+
@@ -0,0 +1,182 @@
+#!/usr/bin/env python
+'''
+Generate a ROOT TGeometry file for the NSRL "tub" detector
+'''
+
+import cowbells
+import properties
+
+
+inch = cowbells.units.cm * 2.54
+meter = cowbells.units.meter
+
+import ROOT
+
+
+class TubDetBuilder(object):
+ '''
+ Build a "tub" detector geometry like used at the NSRL beam test.
+
+ This detector is a simple cylinder, open at the top with a wall
+ and bottom thickness. An inner diameter and height specify the
+ sample volume. On top is a lid of a given thickness with an
+ embeded and stepped window. The PMT photocathode is modeled by
+ embedding a disk of PC material just inside the top surface of the
+ window.
+
+ '''
+
+ # numbers taken from Harry's Rev02 drawing sent to the mailing
+ # list
+ # https://lists.bnl.gov/mailman/private/wbls-l/attachments/20120524/a0af1b4f/attachment-0003.bin
+ default_params = {
+ # Inner diameter of sample volume
+ 'inner_diameter': (6.0-2*0.25)*inch,
+ # Inner height of sample volume
+ 'inner_height': 6.0*inch,
+ # Thickness of wall and bottom
+ 'tub_thickness': 0.25*inch,
+ # Thickness of lid
+ 'lid_thickness': 0.75*inch,
+ # Fraction of distance from outside of window to step relative
+ # to lid/window thickness.
+ 'step_fraction': 2.0/3.0,
+ # Diameters of window before and after step
+ 'window_full_diameter': 2.750*inch,
+ 'window_step_diameter': 2.125*inch,
+ # Photocathode diameter and thickness
+ 'photocathode_diameter': 2.0*inch,
+ 'photocathode_thickness': 0.01*inch,
+
+ # materials:
+ 'Tub' : 'Teflon',
+ 'Lid' : 'Teflon',
+ 'Window' : 'Glass',
+ 'PhotoCathode': 'Glass',
+ #'Sample': 'Water',
+ 'Sample': 'WBLS',
+ 'World': 'Vacuum',
+ }
+
+
+ def __init__(self, geo, **params):
+ self.geo = geo
+ self.params = {}
+ self._top = None
+ self.params.update(TubDetBuilder.default_params)
+ self.params.update(params)
+ return
+
+ def get_med(self, mat_name):
+ '''
+ Return a medium for given material name
+ '''
+ med_name = self.params[mat_name]
+ med = geo.GetMedium(med_name)
+ if not med:
+ raise ValueError, 'Bogus medium name "%s"' % med_name
+ return med
+
+ def top(self):
+ '''
+ Build geometry, return top node.
+ '''
+
+ if self._top: return self._top
+
+ p = self.params
+
+ # bucket with lid
+ b_radius = 0.5*(p['inner_diameter']+2.0*p['tub_thickness'])
+ b_hheight = 0.5*(p['inner_height']+p['tub_thickness']+p['lid_thickness'])
+ tub = geo.MakeTube('Bucket', self.get_med('Tub'),
+ 0.0, b_radius, b_hheight)
+ tub.SetVisibility(1)
+ tub.SetLineColor(2)
+
+ # sample volume
+ s_radius = 0.5*(p['inner_diameter'])
+ s_hheight = 0.5*(p['inner_height'])
+ sam = geo.MakeTube('Sample', self.get_med('Sample'),
+ 0.0, s_radius, s_hheight)
+ sam.SetVisibility(1)
+ sam.SetLineColor(1)
+
+ # Window, from bottom to top
+ win = ROOT.TGeoPcon('Window', 0, 360, 4)
+ ROOT.SetOwnership(win,0)
+ # win = geo.MakePcon('Window', self.get_med('Window'), 0, 360, 4)
+ r_full = 0.5*p['window_full_diameter']
+ r_step = 0.5*p['window_step_diameter']
+ z_full = p['lid_thickness']
+ z_step = z_full * (1-p['step_fraction'])
+ win.DefineSection(0, 0.0, 0.0, r_step)
+ win.DefineSection(1, z_step, 0.0, r_step)
+ win.DefineSection(2, z_step, 0.0, r_full)
+ win.DefineSection(3, z_full, 0.0, r_full)
+ win = ROOT.TGeoVolume('Window', win, self.get_med('Window'))
+ ROOT.SetOwnership(win,0)
+ win.SetVisibility(1)
+ win.SetLineColor(4)
+
+ # wafer of PC
+ pc = geo.MakeTube('PC', self.get_med('PhotoCathode'),
+ 0.0, 0.5*p['photocathode_diameter'],
+ 0.5*p['photocathode_thickness'])
+ pc.SetVisibility(1)
+ pc.SetLineColor(7)
+
+ # put sample in bucket
+ s_shift = b_hheight - s_hheight - p['tub_thickness']
+ samintub = ROOT.TGeoTranslation(0, 0, -1*s_shift)
+ ROOT.SetOwnership(samintub,0)
+ tub.AddNode(sam, 1, samintub)
+
+ # put PC in window
+ pc_shift = p['lid_thickness'] - 0.5*p['photocathode_thickness']
+ pcinwin = ROOT.TGeoTranslation(0, 0, pc_shift)
+ ROOT.SetOwnership(pcinwin,0)
+ win.AddNode(pc, 1, pcinwin)
+
+ # put window in lid
+ w_shift = b_hheight - p['lid_thickness']
+ wininlid = ROOT.TGeoTranslation(0, 0, w_shift)
+ ROOT.SetOwnership(wininlid,0)
+ tub.AddNode(win, 1, wininlid)
+
+ self._top = geo.MakeBox("Top", self.get_med('World'), 10*meter, 10*meter, 10*meter)
+ self._top.AddNode(tub, 1)
+ self._top.SetVisibility(1)
+ return self._top
+
+def fill(geo, filename = 'tubdet.root'):
+ '''
+ Fill the given TGeo manager with geometry for the "tub" detector
+ given the parameters of the detector.
+ '''
+
+ tdb = TubDetBuilder(geo)
+
+ from cowbells.prep import propmods
+ for mod in propmods:
+ mod.materials(geo)
+
+ geo.SetTopVolume(tdb.top())
+
+ fp = ROOT.TFile.Open(filename, "update")
+ geo.Write("geometry")
+ fp.Close()
+
+ properties.fill(filename)
+
+ import os
+ gdmlfile = os.path.splitext(filename)[0] + '.gdml'
+ geo.Export(gdmlfile)
+
+ return
+
+if __name__ == '__main__':
+ import sys
+ geo = ROOT.TGeoManager('cowbells_geometry',
+ 'Geometry for COsmic WB(el)LS detector')
+ fill(geo, sys.argv[1])
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+'''
+Define Teflon
+'''
+name = 'Teflon'
+
+import cowbells
+import util
+
+
+gram = cowbells.units.gram
+cm = cowbells.units.cm
+mm = cowbells.units.mm
+cm3 = cowbells.units.cm3
+hbarc = cowbells.units.hbarc
+
+def materials(geo):
+ mat = util.make_mixture(geo, 'Teflon', [('Carbon',0.759814),
+ ('Fluorine',0.240186)], 2.2*gram/cm3)
+ util.make_medium(geo, mat)
+ return
+
+
+# IEEE TRANSACTIONS ON NUCLEAR SCIENCE, VOL. 59, NO. 3, JUNE 2012
+# Reflectivity Spectra for Commonly Used Reflectors
+# Martin Janecek
+# Figure 10.
+# 8-layers reflectivity: 90% @ 250nm, 96% @ 500nm, 87% @ 800 nm.
+
+energy = [hbarc/800., hbarc/500., hbarc/250.]
+rindex = [1.3]*3
+abslength = [1*mm]*3
+#reflectivity = [.87, .96, .90]
+
+
+def properties(pf):
+ # bulk
+ pf.add(name, 'RINDEX', zip(energy,rindex))
+ pf.add(name, 'ABSLENGTH', zip(energy,abslength))
+
+
+ #pf.add(name, 'REFLECTIVITY', zip(energy,reflectivity))
+ #pf.add(name, 'EFFICIENCY', zip(energy,reflectivity))
@@ -1,7 +1,7 @@
#include "Cowbells/PhysicsConsEM.h"
-Cowbells::PhysicsConsEM::PhysicsConsEM(const G4String& name)
- : G4VPhysicsConstructor(name)
+Cowbells::PhysicsConsEM::PhysicsConsEM()
+ : G4VPhysicsConstructor("EM")
{
}
@@ -1,7 +1,7 @@
#include "Cowbells/PhysicsConsMuon.h"
-Cowbells::PhysicsConsMuon::PhysicsConsMuon(const G4String& name)
- : G4VPhysicsConstructor(name)
+Cowbells::PhysicsConsMuon::PhysicsConsMuon()
+ : G4VPhysicsConstructor("muon")
{
}
Oops, something went wrong.

0 comments on commit 20955e6

Please sign in to comment.