Professional Documents
Culture Documents
Supervisors:
Prof. Jenny Thomas
Dr. Ryan J Nichols
Abstract:
Muon Tomography is an imaging method that can be used to detect High Z materials based
on the idea of multiple coulomb scattering of muons as they traverse matter. A passive
Muon Tomography setup, using scintillator strips arranged in planes that are stacked
orthogonally and in pairs is used by the CREAMTEA group. Only planes with strips aligned
and parallel to each other were used for all work done related to this thesis, due to a lack of
available hardware to obtain data with. The architecture and hardware of the whole setup
was re-assembled and checked for physical flaws (light leakages, faulty connections etc.)
that were potentially showing up as noise on data readings. An algorithm modelling the
influx of Cosmic ray muons was written, to simulate ‘real’ muon hits as they would appear
on the setup described above, and another written to process this information and draw a
2-dimensional image. Both algorithms work well, and the imaging algorithm may be further
developed upon to display fully functional 3-dimensional images from real muon hit data
obtained from this apparatus.
2
Introduction
Nuclear weapons and the materials required to build them may not be readily available to
many nations or potential terrorist groups; however, it is a very real risk that they may come
to be in possession of such resources. One way to limit the threat of a nuclear attack within
the borders of a country such as the US or the UK is by checking all incoming and outgoing
traffic via land, sea and air. The reason for this is that we not only make sure that no such
Weapons of Mass Destruction (henceforth referred to as WMD) enter the borders of the
country, reducing the risk of an attack, but we also limit the amount of special nuclear
materials (SNM) being smuggled out of the country; henceforth reducing the access to and
availability of these material. [4][10]
Every year there are approximately 120 million vehicles that enter the US, a huge
proportion of which can easily transport nuclear materials. Apart from this there is also a
huge portion of freight and cargo transport that occurs over sea. In the UK alone, it is
estimated that there is about 600 million tonnes of sea freight export and import, 1 billion
rail journeys and about 140 million tonnes of rail freight every year. Air freight is of concern
as well, seeing as there are nearly 11 billion tonnes of cargo coming in to the US via air per
year, a significant portion of which is still not thoroughly scanned. [21][22][12]
Currently the main methods for scanning vehicles at border checkpoints and scanning cargo
all make use of Photon (X-ray or Gamma radiation) radiography along with the aid of a
radiation detector[1]. However this has several limitations. First and foremost, nuclear
materials can be hidden from a setup such as this with relative ease. A small amount of
nuclear (high Z) material such as Lead or Tungsten when combined with hydrogenous
polyethylene and neutron absorbing (Boron or Lithium) shielding will completely mask all
signals and are able to fool even the best of passive detector systems. Secondly there are
also, practical counting time limitations and the issue of natural background count rates that
further hinder the usefulness of such systems. Lastly, for vehicles with passengers inside,
the maximum radiation dosage limitations put an upper limit on practical scanning times
and beam energies being used. Even newer methods of radiography incorporating the use
of neutron scatter and radiography along with X-ray back scatter are deemed useless in the
3
majority of scenarios due to the adverse health effects of high radiation dosage on both
operators and passengers in and around the vehicle.[1][3][2]
To counter all of these limitations and problems, and to find a solution to this problem, a
new technique based on Muon Tomography has been developed. This is the focus of the
research being done in the CREAMTEA group, and the above points are all key reasons and
motivations to carry out this research.
The Physics goal of this project was to develop an algorithm that would be able to
reconstruct 2D images of objects being scanned via cosmic ray muons, from muon hits
detected via scintillator strips arranged in planes above and below the object. The exact
details of this setup and the nature of the investigation will be discussed in much greater
depth later on in this document.
Cosmic Rays
What we call Cosmic ‘Rays’ (the term ‘Rays’ actually being a historical mistake) are actually
very highly energetic particles originating in various parts of the cosmos, that are constantly
bombarding the earth from all directions. The rays are primarily constituted of highly
energetic hadrons (protons) and the nuclei of various atoms; it has only very recently been
uncovered that these rays are primarily formed due to the supernovae of giant stars [13][24].
The rays are of two types, Primary and secondary; primary rays originating outside the Solar
system and consisting mainly of protons and atomic nuclei (mainly helium nuclei with a very
small proportion being the nuclei of heavier elements), and a very small fraction of stable
anti particles (antiprotons and positrons). Secondary rays are formed when these primary
cosmic ray particles undergo collisions with particles (molecules of Oxygen and Nitrogen
mainly) in our upper atmosphere. These secondary rays consist of Neutrons, and Pions and
4
Kaons (both positively and negatively charged) [13]. The charged mesons then tend to decay
into Muons, and it is the Muon that we are most interested in for our research, there being
several reasons for this. The exact rate at which galactic cosmic rays reach the upper part of
the earth’s atmosphere is not a constant; rather it is dependent on the strength of the solar
wind, Earth’s magnetic field and the ray’s intrinsic energies. Due to the changing nature of
the solar wind and the sun itself, it has been noted that there is a direct relationship
between the cosmic ray flux and solar activity (which is known to have an alternating
eleven-year cycle)[23].
Fig.1: Overview of the space weather conditions over several solar cycles shows the
relationship between sunspot numbers and cosmic rays. [23]
Even though the flux seems to vary a lot in the outer atmosphere (very much time and
location dependent), at the surface of the Earth, the greatest amount of rays arrive with
energies of approximately ~1GeV. On occasion there are particles that arrive with much
greater energies (orders of 1020eV), but these are much rarer occurrences [13].
Muons
Muons are unstable elementary particles (leptons) with a unitary negative electric charge (-
1), but with a rest mass of 105.7MeV, they are nearly 200 times heavier than electrons
(0.51MeV) which have the same charge. After the birth of the Muons in the upper
5
atmosphere, they travel to Earth’s surface at near the speed of light (relativistic speeds) in
almost the same trajectory as the primary incoming cosmic ray particle that created them.
Even though they only have a mean life time of 2.2µs[14], due to their relativistic speeds they
manage to survive this journey because of the effects of time dilation/length contraction
(depending on which rest frame we choose to observe from; the Muon’s or Earth’s). The
average flux of Muons at sea level is about 10000m-2min-1 (or 70m-2s-1sr-1)[25]. The angular
distribution of muons reaching the surface is approximately a cos2Ɵ distribution focussed
near the vertical (at higher energies, and angles greater than 70o from the vertical, the
distribution goes towards secƟ) [17][18][19]. Upon reaching the surface Muons penetrate quite
deep within the earth before finally being attenuated by the local environment. The reason
they are able to do this is because Muons have no strong nuclear interactions and mainly
lose energy via Coulomb interactions. Muons that reach the surface of the earth usually
have a mean energy of ~4GeV[14][13], and this conveniently falls in within the range of 1 –
100GeV energy range, where we can take full advantage of the particle’s penetrative
properties. The average amount of energy lost per unit time by a heavy charged particle
moving at speeds close to that of light, is described in a clear way by the Bethe-Bloch
equation[14] (Or “Bethe” equation) which states that
( )
〈 〉 [ ]
This equation successfully describes the average energy loss rate within the 0.1≤ ≤1000
area (refer to fig.2 below) for materials with a moderate Z (atomic number) within an
acceptable accuracy. For definition of all terms used in the above equation, please refer to
appendix A. The units of dE/dx are MeV g-1 cm2. In the figure below at the lower limits the
velocity of the projectile is relatable to atomic electron velocities, whereas at the upper limit
radiative effects start to show more significance. Both the upper and lower limits are reliant
on the atomic number (Z) of the absorber. Even though there is a small reliance on M at the
greatest energies, portrayed through Tmax (maximum Kinetic Energy that may be passed on
to a free electron via a single collision), for all intents and purposes the stopping power is a
function of only β. Fig.2 shows us the energy loss behaviour of muons in copper, in the
6
Bethe region. It is only here that 〈 〉 is dependent on β alone. The role of mass in the
Fig.2: Stopping power (= < –dE/dx>) for positive muons in copper as a function of
βγ = p/Mc over nine orders of magnitude in momentum (12 orders of magnitude in kinetic
energy). [14]
As seen above from Fig.2 the muons with energies within the range of 1 – 100GeV, have an
almost constant stopping power. While passing through matter, muons with these energies
lose a very small amount of energy per unit of distance traversed through the material.
What is advantageous here is that even though the muon may lose energy (and hence
momentum) while passing through an object, the rate of energy loss does not change by a
great deal; it is this linear relationship between the amount of energy lost and distance
travelled through a certain material, that makes muons so useful for our imaging method.
By contrast, if the muon momentums were in any other region of the graph, we can see
from fig.2 that a small change in momentum would result in a large corresponding change in
the rate of energy lost per unit distance travelled. This would lead to a non-linear
relationship between the amount of energy lost and distance travelled, which is not ideal for
our purposes.
7
Muon Tomography
Muon Tomography is an imaging method that makes use of the multiple coulomb scattering
of cosmic ray muons that are constantly passing through us at all times. Muons are highly
penetrative particles and because of their intrinsic characteristics, they pass almost straight
through most matter depositing very little energy in the objects they go through. As a muon
passes through an object it undergoes many small deflections due to the interactions with
neighbouring positively charged nuclei, the sum of these angular and positional deflections
can be represented as an overall angle of deflection from its original incoming trajectory.
These particles have little or no nuclear interaction and lose most of their energy due to the
coulomb scattering effect. Substances with a high Z number (atomic number/proton
number), because of their greater positive charge, tend to produce much larger deflections
than materials made of lighter elements (Steel, carbon, plastics etc.)[1][11].
Fig.3: Diagram of how a vehicle holding a potential threat (nuclear material or a nuclear
weapon) may be scanned, and the behaviour of muons as they pass through objects of
different density and Z number[8].
As shown in Fig.3, a container made of shielding material such as lead, housing radioactive
content such as weapons grade Uranium or Plutonium (or some sort of nuclear weapon),
would create far greater deflections than surrounding material and would be very easily
distinguishable from neighbouring objects within the vehicle. The scattering angle of the
muons that emerge is proportional to the Z number of the element it passes through,
making it easy to distinguish between nuclear and regular material[3][1]. The angles of
8
deflection of muons that have passed through objects made of an element with charge (or
proton number) Z tends to be an approximately Gaussian distribution centred on zero with a
variance of [16]
√ ⁄ [ ( ⁄ )]
In the above expressionβc is muon velocity, p is momentum, and x/X0 is the material
thickness in units of radiation length. To express the dependence of width of the scattering
angle distribution with Z to a greater degree one may implement Dahl’s expression [16]
( ) ( ⁄ )
√
Where A is the atomic mass. The value of the variance is found to be within 11% accuracy
for 10−3 < x/X0 < 100, for all Z and for βc = 1. Therefore the distribution of scattering angles
is greater for materials made of elements with high atomic numbers and having short
radiation lengths. Furthermore, this allows us to use the root mean square (RMS) of the
angles of deflection of scattered muons as a means to differentiate between materials with
different Z numbers[16].
Imaging Method
In muon tomography the paths of the muons, as they enter and exit the target object are
tracked. The point of intersection of these two paths, or their point of closest approach
(POCA) is treated as the exact location of where the Muon was deflected. As more muons
pass through our target object and we record more hits, the points of deflection are all
plotted together to rebuild a 3D image of the target object [3].
9
this line segment is treated a single representative point, known as the POCA point, and it is
here that we assume the path of the Muon gets deflected inside the target object [3]. These
points are then all plotted together to construct a 3D reproduction of the object being
scanned. Areas of differing densities are usually made to show up in different colours as an
indicator of density in that location. A lot of large deflections in a certain region will indicate
a potential threat or ‘hot spot’ that needs to be investigated further [3].
[ ]
( )
for each voxel, where (βcp) is the product of the muon speed and momentum, and
(βcp)0 the average speed times momentum for cosmic ray muons. The ML/EM algorithm
takes into account the probability function, or log likelihood, of the scattering density
function versus the measured scattering density of each muon in voxels enclosed inside the
volume under inspection. For more information and greater detail about this method, refer
to the paper by Schultz et al., 2004. [16]
10
Fig.4: A schematic diagram of the CREAMTEA test stand being used in this investigation.[26]
11
then impinge on the WLS fibre and are converted to visible light, which is then
ultimately read out as a signal by the PMT.
The planes are connected by fibre optic cables to ports on the outside of the PMT housing.
Inside the PMT housing, the fibres are then mapped onto the face of the 64 bit PMT non-
sequentially in order to reduce ‘cross talk’ between the channels. It is important to
reduce/eliminate ‘cross talk’ between channels, so that when there is a muon hit, we are
able to clearly and accurately locate which plane the hit took place in.
There was a lack of available hardware and electronics, namely the Photo Multiplier Tubes
(PMT’s) that are needed to convert and amplify the light signals from hits in the planes into
electrical signals that can be stored as data in the computer system. Due to this shortage we
were restricted to using only one detector plane from each pair available, as there were
only four usable PMT’s. Four planes with all the strips aligned and parallel in one direction
were connected to the four available PMT’s.
12
fashioned for the cable heads that were attached to the ports on the plane. Although this
had reduced the noise somewhat, upon further investigation light leaks were discovered in
a couple of the PMT housings. The leaks appeared to be near the edges of the box. A cloth
was draped over all the PMT boxes during test runs, but this was an insufficient measure, as
there was still a lot of light noise entering the system. Due to a lack of time, not much more
could be done about this at that point. For photographs of the hardware setup, refer to
appendix B.
Algorithm Development
Due to software triggering issues and a lack of hardware, it was not possible to get a full set
of real data that could be used to develop an imaging and muon path reconstruction
algorithm. For the programme to work, with our set up, eight muon hits (two from each
plane) were needed but due to software and hardware faults this was never the case –
hence making this data useless. However, with the available set up, efforts were made to
create a 2D reconstruction algorithm that would work on almost the same concept as the
3D reconstruction program.
Due to the software triggering and hardware issue mentioned earlier, no real muon hit data
could be obtained for use. To counter this obstacle, an algorithm called writecode1.C was
developed that would write out a simulated muon hit data file to imitate a potential real
data set that could be obtained from the apparatus available to us. The code,
“writecode1.C”, writes out a root file called SimData.root. The file SimData.root was made
to contain certain data – namely the module and channel number as well as the ‘peakArea’
13
and ‘peakTime’. The Module number represents which plane the hit took place, while the
channel numbers indicate which strips were hit by the muon. The peakArea represented the
area under a certain peak which could be physically translated as the energy that was
dissipated by the muon upon passing through a certain distance in the scintillator strip.
Lastly the peakTime was the time that that hit occurred within the 500ns event window. To
view the full algorithm refer to appendix C.
The SimData.root file that is written out by writecode1 is then read by the reconstruction
algorithm that was developed, called “readcode1.C”. Essentially readcode1 takes the data
available in the SimData.root file and reconstructs both the incoming and outgoing paths of
the muon hits, and because we are dealing with only two dimensions these two lines always
intersect, conveniently giving us a scatter point.
To construct the incoming and outgoing trajectories, the coordinates of the points through
which they go through are first calculated. To accurately obtain a coordinate on a plane a
weighted average is calculated using the peakAreas of two adjacent strips (found in
SimData.root created by writecode1) on that plane. This is repeated for all four planes to
obtain the plane coordinates of the points through which the incoming and outgoing rays
pass. The heights of these planes are constant and hence treated as the second set of
coordinates. Together the plane coordinates and heights form the points through which the
trajectories pass. Once the points are obtained, a line equation is calculated for the
incoming track by using the two points from the planes above the target volume. The same
is done for the outgoing track by using the set of points from the planes below. These two
linear equations are then equated to calculate the point of deflection of the muon within
our target object. The gradients of the two lines are used to calculate the angles of their
trajectories, and finally the angle of deflection.
14
The various points of deflection that are obtained are then plotted together in a 3D
histogram to obtain a density map. Effectively what we obtain is a 2D image or ‘slice’ of our
3D object. To view the full algorithm, readcode1.C, refer to appendix D.
In Fig.7 above we can see an object roughly 10cm across in width and of height
approximately 30cm. The varying colours are indicators of density with the red being the
greatest and violet/blue being on the lower end of the spectrum. The area of higher density
is one where there is a greater number of muon with large scattering angles, as would be
expected in a real scenario where such an object is being scanned and an image
reconstructed. The irregularity and the blue spots present outside the main volume are a
result of the Gaussian random generator function that was used to generate the peak areas
in writecode1.
15
Fig.8: 2D image of a second simulated object created by writecode1 and reconstructed by
readcode1. The units in the axes are all in Metres.
The above is another image of a simulated object, similar to the one shown in Fig.7 but with
slightly different dimensions and in a different part of the image-able volume. The reason
for the blue spots outside the main volume is the same as for previous object.
Fig.9: Histogram of scattering angles for object shown in Fig.8 above. The units of the
angles on the horizontal axis are in radians. Vertical axis represents frequency density.
16
The histogram in Fig.9 shows the scattering angles from the data set used to draw up the
object in Fig.8 and the symmetric distribution of angles around the mean value should be
noted. This is as expected because of the objects design, positioning (centre of the image-
able volume) and geometry of the detector planes. When the object is placed on either side
of the centre of the detector plane, it was found that scattering angle histogram was
asymmetric. The reason for the asymmetry was that, when the position of the object was
non-centred, we would miss a number of muon hits and potential tracks reducing our
imaging capacity. Placing the object in the centre allowed for maximum usage of the muon
hits.
17
Conclusions and Future Thoughts
The aim of this research project was to investigate the potential of using Cosmic Ray muons
to further develop a new imaging technique based on Muon Tomography. The motivation
for this was to easily and efficiently allow the spotting of High Z nuclear materials and
nuclear weapons being trafficked illegally across international borders. If imaging
techniques are perfected and implemented ultimately it would ideally lead to the complete
halting of such activities, greatly increasing global security.
Our simulation and reconstruction algorithms have shown and confirmed yet again, that it is
very possible to obtain images of good resolution using simple and cheap equipment.
Although it was beyond the scope of our time and ability to use real muon hit data due to
several obstacles, every effort was made to develop a reconstruction algorithm that could
be used to image objects accurately and would work with a real set of muon hit data. The
2D images that we obtained were exactly as had been hoped for, confirming that our
developed code worked well.
For future use, the readcode1 algorithm can quite easily be altered to use the point of
closest approach (POCA) method such that it can start reconstructing objects in 3D from real
hit data. However this will only be possible with the use of all 8 planes, for which more
PMT’s will be required. Unfortunately it was not possible for us to overcome the above
concerns within the limited scope of this project.
18
References and Bibliography
[1]
Tomographic Imaging with Cosmic Ray Muons; C.L.Morris, C.C.Alexander,
J.D.Bacon et al. (2008)
[2]
http://www.slideserve.com/eden/muon-tomography-algorithms-for-nuclear-
threat-detection
[3]
GEANT4 Simulation of a Cosmic Ray Muon Tomography System with Micro-Pattern
Gas Detectors for the Detection of High-Z Materials; Marcus Hohlmann, Patrick Ford,
Kondo Gnanvo et al.
[4]
http://www.scientificamerican.com/article.cfm?id=muons-for-peace
[5]
http://www.bo.infn.it/sminiato/sm10/presentations/s3/s-pesente.pdf
[6]
Large Vessel Imaging Using Cosmic-ray Muons; Jenneson P.M. ; Nuclear
Instruments and Methods in Physics Research Section A, Volume 525, Issue 1-2, p.
346-351
[7]
DRDC, Technology Investment Strategy 2002 for the Evolving Global Security
Environment. (Defence Research and Development Canada, 2002).
[8]
http://pheloniusfriar.dreamwidth.org/15339.html
[9]
D.C. Maurer, Nuclear Detection: Preliminary Observations on the Domestic
Nuclear Detection Office's Efforts to Develop a Global Nuclear Detection
Architecture (United States Government Accountability Office, 2008).
[10]
Nuclear Trafficking: A Radioactive Subject, The Economist 382, 60-61 (2007).
[11]
B. Fishbine, Muon Radiography, Detecting Nuclear Contraband, Los Alamos
Research Quarterly 12-16 (Spring 2003).
[12]
http://edition.cnn.com/2012/02/16/travel/cargo-terror-concerns
[13]
Gaisser. Thomas K., 1990, Cosmic Rays and Particle Physics, Cambridge,
Cambridge University Press.
[14]
J. Beringer et al. (Particle Data Group), Phys. Rev. D 86, 010001 (2012).
[15]
http://www.kip.uni-
heidelberg.de/~coulon/Lectures/Detectors/Free_PDFs/Lecture2.pdf
[16]
Nuclear waste imaging and spent fuel verification by muon tomography;
Jonkmans, G. ; Anghel, V.N.P. ; Jewett, C. ; Thompson, M.
Annals of Nuclear Energy, 2013, Vol.53, pp.267-273 [Peer Reviewed Journal]
19
[17]
Zenith distribution and flux of atmospheric muons measured with the 5-line ANTARES
detector, J. A. Aguilar et al. (ANTARES), Astropart. Phys. 34 (2010) 179-184, arXiv:1007.1777.
[18]
Measurement of the atmospheric muon flux with the ANTARES detector, Marco
Bazzotti et al. (ANTARES), arXiv:0911.3055, 2009. 31st ICRC, Lodz 2009.
[19]
http://dspace.mit.edu/bitstream/handle/1721.1/61208/701107722.pdf?sequence=1
[20]
Personal Communications, Dr. Anna Holin (UCL, 2012)
[21]
Institution of Civil Engineers, Freight policy position statement,
http://www.ice.org.uk/Information-resources/Document-Library/Freight-policy-position-
statement,10/03/2013.
[22]
RAILWAY TECHNICAL,Railway statistics for britain, http://www.railway-
technical.com/statistics.shtml, 10/03/2013.
[23]
"Extreme Space Weather Events". National Geophysical Data Center.
[24]
Gibb, Meredith (3 February 2010). “Cosmic Rays”. Imagine the Universe. NASA Goddard
Space Flight Center. Retrieved 17th March 2013.
[25]
T.Gaisser and T. Stanev, Particle Data Group, Astrophysics and Cosmology, Physics
Letters B 592, 228-234 (2002).
[26]
CREAMTEA presentation.ppt; Ralph Moors (MSci, 4th year) UCL 2013
20
Appendix A – Constants, values and variables
used specifically in the Bethe equation
21
Appendix B – Photographs of Experimental Setup
and Apparatus
22
23
Appendix C – writecode1.C (The Full Algorithm)
#include <TFile.h>
#include <TBranch.h>
#include <TRandom.h>
#include <TMath.h>
#include <TNtuple.h>
#include <TH1.h>
#include <TF1.h>
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TCut.h>
#include <TMath.h>
#include <fstream>
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <string>
#include <cstdlib>
#include <assert.h>
using namespace std;
int main()
{
//ofstream fp;
//fp.open("fakedata.dat");
//fp<<" here "<<std::endl;
TFile *f = TFile::Open("SimData.root","RECREATE");
TH2D *Pic1 = new TH2D("Pic1","2D-obj-slice",50,0,1,50,0.5,1.6);
vector<int> module;
vector<int> channel;
vector<double> peakArea;
vector<int> peakTime;
float pi=3.14159;
int hits[8];
double ph[8];
double zplane1, zplane2, zplane3, zplane4;
zplane1 = 2.36;
zplane2 = 1.543;
zplane3 = 0.816;
zplane4 = 0.00;
double planeWidth=1.00;
24
module.clear();
channel.clear();
peakArea.clear();
peakTime.clear();
outgoingangle = Gran->Gaus(incomingangle,0.2);
}
Pic1->Fill(yintersect,xintersect);
std::cout<<xintersect<<"\t"<<yintersect<<endl;
float m1 = tan(incomingangle);
float m2 = tan(outgoingangle);
//std::cout<<m1<<"\t"<<m2<<endl;
float c1 = yintersect-(m1*xintersect);
float c2 = yintersect-(m2*xintersect);
//std::cout<<i<<"\t"<<m1<<"\t"<<c1<<endl;
// std::cout m1<<"\t"<<c1<<"\t"<<zplane1<<endl;
hits[0] = (int)(((m1*zplane1)+c1)/(0.033*0.5));
//std::cout<<m1<<"\t"<<c1<<"\t"<<zplane1<<endl;
ph[0] = Gran->Gaus(500,100);
hits[1] = hits[0]+1;
ph[1] = Gran->Gaus(500,100);
hits[2] = (int)(((m1*zplane2)+c1)/(0.033*0.5));
ph[2] = Gran->Gaus(500,100);
hits[3] = hits[2]+1;
ph[3] = Gran->Gaus(500,100);
hits[4] = (int)(((m2*zplane3)+c2)/(0.033*0.5));
ph[4] = Gran->Gaus(500,100);
hits[5] = hits[4]+1;
ph[5] = Gran->Gaus(500,100);
hits[6] = (int)(((m2*zplane4)+c2)/(0.033*0.5));
ph[6] = Gran->Gaus(500,100);
hits[7] = hits[6]+1;
ph[7] = Gran->Gaus(500,100);
// std::cout<<hits[0]<<endl;
int keep = 1;
for(int j=0;j<8;j++){
if((hits[j]<0) || (hits[j]>64))
{
keep = 0;
}
25
}
if(keep == 1){
for (int j=0;j<8;j++)
{
module.push_back((int)j/2);
peakArea.push_back(ph[j]);
channel.push_back(hits[j]);
peakTime.push_back(0);
//fp<<j/2<<"\t"<<hits[j]<<"\t"<<ph[j]<<endl;
//std::cout<<hits[j]<<endl;
}
tree->Fill();
return 0;
26
Appendix D – readcode1.C (The Full Algorithm)
#include <TTree.h>
#include <TFile.h>
#include <TBranch.h>
#include <TMath.h>
#include <TNtuple.h>
#include <TH1.h>
#include <TF1.h>
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TCut.h>
#include <TMath.h>
#include <fstream>
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <string>
#include <cstdlib>
#include <assert.h>
int main()
vector<int> module;
vector<int> channel;
vector<double> peakArea;
vector<int> peakTime;
hitTree->SetBranchAddress("module", &modulep);
hitTree->SetBranchAddress("channel", &channelp);
hitTree->SetBranchAddress("peakArea", &peakAreap);
hitTree->SetBranchAddress("peakloc", &peakTimep);
27
int entries = (int) hitTree->GetEntries();
std::cout<<entries<<endl;
double x[4];
x[0]=2.36;
x[1]=1.543;
x[2]=0.816;
x[3]=0.0;
double c1,c2;
double m1,m2;
double xi,yi;
if (module.size()==8)
{
for (int i=0;i<module.size();i+=2)
{
y[i/2] =
(((channel[i]*peakArea[i]+channel[i+1]*peakArea[i+1])/(peakArea[i]+peakArea
[i+1]))*(0.5*0.033));
m1 = (y[0]-y[1])/(x[0]-x[1]);
m2 = (y[2]-y[3])/(x[2]-x[3]);
c1 = -(m1*x[0])+y[0];
c2 = -(m2*x[2])+y[2];
xi = (c2-c1)/(m1-m2);
yi = m1*xi+c1;
std::cout<< " x-int = "<< xi<<" y-int = "<<yi<<endl;
geom1->Fill(xi);
//Pic1->Fill(xint[i]);
//}.q
//
geom2->Fill(yi);
if((DeflectionAngle>0.05||DeflectionAngle<-0.05)){
geom3->Fill(DeflectionAngle);
Pic1->Fill(yi,xi);
28
}
}
}
//readtext.close();
hitTree->Delete();
// TFile* newfile = new TFile("hazeez.root","RECREATE");
newfile->Write();
newfile->Close();
return 0;
29