6.5.2011 Kamil Sedlak

1) Adding/improving the simulation of light signals and APD
2) Many small changes and improvements
3) Adding manual to musrSimAna to the svn repository
4) Adding some example files for musrSim
This commit is contained in:
sedlak 2011-05-06 15:16:49 +00:00
parent 9bc0d53074
commit cb18486947
22 changed files with 11942 additions and 173 deletions

Binary file not shown.

View File

@ -23,7 +23,7 @@
%\title{GEANT Simulation Program for the
%$\mathbf{\mu}$SR Instruments}
\author{Kamil Sedl\'ak$^1$, Toni Shiroka$^1$, Zaher Salman$^1$, Tom Lancaster$^2$, Thomas Prokscha$^1$, Taofiq Paraiso$^1$}
\author{Kamil Sedl\'ak$^1$, Toni Shiroka$^1$, Zaher Salman$^1$, Jose Rodriguez$^1$, Tom Lancaster$^2$, Thomas Prokscha$^1$, Taofiq Paraiso$^1$}
\address{{$^1$ Laboratory for Muon Spin Spectroscopy, Paul Scherrer Institut, CH-5232 Villigen PSI, Switzerland}\\
$^2$ Clarendon Laboratory, Department of Physics, Oxford University, Parks Road, Oxford OX1 3PU, UK}
@ -1292,6 +1292,176 @@ scintillator tiles.}
illustrates a simple geometry made of an electron source and two blocks
of scintilator tiles with the dimensions of $3 \times 3 \times 2\,$mm,
which is defined in the macro file ``101.mac''.
The primary particles are electrons with the energy of 2.15\,MeV shooted
into the first scintillator. There the electron can be scattered, and therefore
it may or may not hit the second scintillator. We have used the command\\[2ex]
{\tt /musr/command storeOnlyEventsWithHitInDetID 11}\\[2ex]
and therefore only the events, in which there was some energy deposited
in the second collimator, will be saved into the output Root file.
To run this example, do the following:
\begin{enumerate}
\item Change to the directory {\tt musrSim/run/}
\item If the subdirectory {\tt data} does not exist, create it.
\item Run your Geant4 initialisation script (typically something like \\
{\tt source /home/install/geant4.9.4/env.sh}\\
where the path to the {\tt env.sh} script depends on the directory where Geant4
is installed on your computer.
\item Execute the command {\tt musrSim 101.mac}
\item The example file {\tt 101.mac} will try to visualise the events using the
Dawn graphics program. To simulate some data (without the visualisation),
uncomment the line {\tt /vis/disable}, comment the line
{\tt /control/execute visDawn101.mac} and change number of generated events
to e.g.\ 1000 (by command {\tt /run/beamOn 1000}).
\item Look at the output using Root, e.g.\ by commands \\
{\tt \$ root} \\
{\tt root [0] TFile* f2=new TFile("data/musr\_101.root") } \\
{\tt root [1] .ls } \\
{\tt root [2] t1->Print() } \\
{\tt root [3] t1->Draw("det\_edep","det\_ID==10") } \emph{\small //energy deposited in the first scintillator}\\
{\tt root [4] t1->Draw("det\_edep","det\_ID==11") } \emph{\small //energy deposited in the second scintillator}\\
{\tt root [5] t1->Draw("det\_time\_start[0]-det\_time\_start[1]")} \emph{\small //T.O.F. between the two scint.} \\
{\tt root [6] .q}\\
Note that the hits in one event are ordered according to the deposited energy, and therefore the
first hit sometimes corresponds to the hit in scintillator counter 10, sometimes to the hit in counter 11.
Therefore the histogram created by the command {\tt t1->Draw("det\_time\_start[0]-det\_time\_start[1]")}
has two peaks -- at a positive and at a negative time.
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Example 2 -- Sr decay electrons passing through two scintillator tiles (102.mac)}
This example is very similar to the previous one. The only difference is that initial
particles are decay electrons from a $^{90}$Sr source. Because $^{90}$Sr decays to $^{90}$Y,
which in turn also decays emitting an electron, we have in fact two decay electrons per event
(two emission spectra from the strontium source).
The data for the strontium and yttrium decay are taken
from the Geant4 data files, namely\\
{\tt /home/install/data\_geant4.9.4/RadioactiveDecay3.3/z38.a90}~~~~ and\\
{\tt /home/install/data\_geant4.9.4/RadioactiveDecay3.3/z39.a90}. \\
There is, however, one problem in musrSim -- it has to handle times with picoseond precission,
and the \emph{double} precision used in the c{\tt ++} program is then not enough to deal with
the $^{90}$Sr decay time of 29 years.
For this reason, one has to modify the decay times in the two data files, i.e.\
in the file {\tt z38.a90}, one should replace the line\\
\hspace*{1cm}{\tt P~~~~~~~0.0000~~~9.0820e+08}\\
by the line\\
\hspace*{1cm}{\tt P~~~~~~~0.0000~~~9.0820e-08}\\[2ex]
and in the file {\tt z39.a90}, one should replace the lines\\
\hspace*{1cm}{\tt P~~~~~~~0.0000~~~2.3080e+05}\\
\hspace*{1cm}{\tt P~~~~~682.0300~~~1.1480e+04}\\
by the lines\\
\hspace*{1cm}{\tt P~~~~~~~0.0000~~~2.3080e-05}\\
\hspace*{1cm}{\tt P~~~~~682.0300~~~1.1480e-04}\\
This way, the decay times are reasonably short, and musrSim can handle them.
Another complication comes from the fact, that the decay electrons are emitted
isotropically from the Sr source. In principle, it is possible to restrict the
emission angles in the GPS (General Particle Source), but we have not done this
intentionally, because we did not want to exclude events in which the decay electron
enters a counter after scattering in the air. In the end only a very small fraction
of events hits the second counter, and is written out to the output file.
(In any case -- the events in which electron does not enter any counter are simulated in a much
shorter time than the ``interesting'' events.)
The example {\tt 102.mac} is based on the results published in~\cite{kkkkk}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Example 3 -- Simulation of the light transport (103.mac)}
This example is similar to example~1, and extended by the simulation of light (``optical
photons''). The light simulation slows down the execution of musrSim dramatically.
The simulation of light is a new feature in musrSim, and it is being tested. Once
this is finished, we will improve this example. However, it seems to be running fine
in its current implementation, so you can start using it. A lot of usefull information
about the optical photons is given in chapter ``Optical Photon Processes'' in
the Geant4 User Manual~\cite{geantUserManual}.\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Example 4 -- GPD instrument (201.mac)}
%
The General Purpose Decay-Channel Spectrometer (GPD)
instrument~\cite{GPD} at PSI, more or less as implemented in reality in the year 2010, is exemplified in
run {\tt 201.mac}. GPD instrument is optimised for the measurements of pressuarised samples
in a special pressure cells.
The detector system is relatively simple -- it consist of a rectangular muon counter (10x10x2\,mm),
two backward positron counters, three forward positron counters, cylidrical sample in a cylindrical
sample holder, two lead collimators, one copper collimator, GPD magnet, and some additional ``dead'' material.
The GPD geometry is illustrated in Fig.~\ref{fig:vis_201_1}-\ref{fig:vis_201_4},
where some of the elements present in the simulation (beampipe, magnet, aluminium profiles) are not displayed
for simplicity.
The most important parameters of the simulation are summarised in table~\ref{dimensions}.
%
\begin{figure}[tbp]\centering
\epsfig{file=pict/vis_201_1.eps,width=0.5\linewidth,%
bbllx=70pt,bblly=270pt,bburx=455pt,bbury=640pt,clip=}
\caption{3D view at the GPD detector system (run 201). Blue colour indicates the positron counters,
magenta stands for collimators, red is the muon counter. GPD magnet, some Aluminium U-profiles and beampipe
are not shown in the plot, however they are included in the simulation.}
\label{fig:vis_201_1}
\end{figure}
%
%
\begin{figure}[tbp]\centering
\epsfig{file=pict/vis_201_2.eps,width=0.8\linewidth,%
bbllx=90pt,bblly=310pt,bburx=450pt,bbury=525pt,clip=}
\caption{Side view of the GPD detector.}
\label{fig:vis_201_2}
\end{figure}
%
%
\begin{figure}[tbp]\centering
\epsfig{file=pict/vis_201_3.eps,width=0.4\linewidth,%
bbllx=210pt,bblly=320pt,bburx=380pt,bbury=525pt,clip=}
\caption{Front view of the GPD detector.}
\label{fig:vis_201_3}
\end{figure}
%
%
\begin{figure}[tbp]\centering
\epsfig{file=pict/vis_201_4.eps,width=0.9\linewidth,%
bbllx=70pt,bblly=309pt,bburx=485pt,bbury=513pt,clip=}
\caption{Top view of the GPD detector.}
\label{fig:vis_201_4}
\end{figure}
%
\begin{table}[htbp]\centering
\renewcommand{\arraystretch}{1.05}
\begin{tabular}{|l|c|c|}
\hline
\lower 1mm \hbox{\textbf{Component}} & \lower 1mm \hbox{\textbf{Dimension}} & \lower 1mm \hbox{\textbf{Material}} \\[5pt]
\hline
positron counter scintillator & $26 \times 90 \times 5$\,mm & plastic vinyltoluene \\
middle forw. positron counter scint. & $14 \times 90 \times 5$\,mm & plastic vinyltoluene \\
muon counter & $10 \times 10 \times 2$\,mm & plastic vinyltoluene \\
sample & R=3.5\,mm, L=14\,mm & Cu \\
sample cell & R=12\,mm, L=100\,mm & Cu \\
Cu collimator & $80 \times 120 \times (\sim 20 - 30)$\,mm & Cu \\
Cu collimator opening & $5 \times 12$\,mm & \\
Pb collimator & $140 \times 140 \times 30$ & Pb \\
Pb collimator opening & $4 \times 10$\,mm & \\
Collimator 1 & R=100\,mm, L=30\,mm & Pb \\
Collimator 1 opening & R$_{opening}$=8\,mm & \\
distance sample -- Pb collimator & 90\,mm (centre -- centre) & \\
distance sample -- collimator1 & 250\,mm (centre -- centre) & \\
distance sample -- beampipe window & 600\,mm & \\ \hline
muon initial momentum & $100 \pm 3$\,MeV/c & \\
muon initial $z$-coordinate & -1.0\,m with respect to sample & \\
muon initial $x$ and $y$ coordinate & Gaussian smearing, $\sigma_x=\sigma_y=25$\,mm & \\
magnetic field & 300 gauss & \\
\hline
\end{tabular}
\caption{Main parameters of the simulation.}
\label{dimensions}
\end{table}
%
A non-standard feature of this simulation is the muon momentum, which is $~sim$100\,MeV/c.
The copper collimator used in GPD has a bit complicate shape, which required to use subtraction
of logical volumes in Geant\,4. This operation can not be specified through the macro file,
and therefore a special kind of volume called {\tt GPDcollimator} has been hard-coded into
the source code (namely in the routine {\tt musrDetectorConstruction.cc}), and it is
then activated in the macro file using the command \\[2ex]
{\tt /musr/command construct GPDcollimator \ldots}\\[2ex]
%
The results of this GPD simulation are described in the \emph{musrSimAna} manual~\cite{musrSimAna}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -1332,7 +1502,7 @@ in~\cite{Aktas:2004px}.
\bibitem{AlexeyTestAPD} A.~Stoykov {\it et al.}, ``First experience with G-APDs in $\mu$SR instrumentation'',
NDIP08, to be published in Nucl. Instrum. Meth. A.
\bibitem{geant} S.~Agostinelli, et al., Nucl. Instr. and Meth. A 506 (2003) 250.\\ %-303. \\
\bibitem{geant} S.~Agostinelli {\it et al.}, Nucl. Instr. and Meth. A 506 (2003) 250.\\ %-303. \\
J.~Allison, et al., IEEE Trans. Nucl.\ Sci.\ 53 (2006) 270. %-278.
\bibitem{root} R.~Brun, F.~Rademakers ``ROOT - An Object Oriented Data Analysis Framework'',
%Proceedings AIHENP'96 Workshop, Lausanne, Sep. 1996,
@ -1357,9 +1527,12 @@ A.~Aktas {\it et al.} [H1 Collaboration],
Submitted to Eur.\,Phys.\,J.\,{\bf C}, [hep-ex/0401010].
%%CITATION = HEP-EX 0401010;%%
\bibitem{GPD}
http://lmu.web.psi.ch/facilities/gpd/gpd.html
\bibitem{musrSimAna}
K.Sedlak, ``Manual of musrSimAna''.
\end{thebibliography}
\end{document}
\end{document}

BIN
doc/musrSimAna.pdf Normal file

Binary file not shown.

745
doc/musrSimAna.tex Normal file
View File

@ -0,0 +1,745 @@
\documentclass[twoside]{dis04}
\usepackage{epsfig}
\def\runauthor{PSI}
\def\shorttitle{musrSimAna}
\begin{document}
\newcommand{\musr}{\ensuremath{\mu}SR}
\newcommand{\musrSim}{\emph{musrSim}}
\newcommand{\musrSimAna}{\emph{musrSimAna}}
\title{Manual of musrSimAna}
\author{Kamil Sedl\'ak$^1$}
\address{{$^1$ Laboratory for Muon Spin Spectroscopy, Paul Scherrer Institut, CH-5232 Villigen PSI, Switzerland}}
\maketitle
\abstracts{
``musrSimAna'' is an analysis program, which helps the user to analyse and interpret the output of the
``musrSim'' simulation.}
%========================================================================================================
\section{Introduction}
\label{introduction}
The purpose of the \musrSimAna\ program is to analyse the Root tree, the output
of the \musrSim\ program.
In general, the event-by-event information stored in the Root tree can be easily used only for
a very quick and rough tests -- e.g.\ to see, where the muons stop and decay irrespective
of whether they were triggered in the M-counter or not, or to have an idea what energy
spectrum was deposited in a given counter. Typically, however, one is more interested
to study \musr\ signal amplitude, time-independent background, or where the muons decay
only for the ``stopped'' muons (e.g.\ muons triggered by M-counter and not detected
by a veto counter), or only for triggered muons which actually stopped in a cryostat
rather than in a sample. Such a study requires some kind of analysis program, which
loops over all events stored in the Root tree (output of \musrSim), and implements the
logic of the required \musr\ experiment.
One way to do such analysis is to start from a Root command {\tt MakeClass(``MyAnalysis'')},
which creates some sort of skeleton c++ class for the given Root tree. This allows the user
to make his/her own and very specific analysis program tailored to his/her needs. On the other
hand, it requires special program for each detector set-up.
A second possibility is to use \musrSimAna, which is intended to be a general analysis
program for \musr\ instruments.
At the moment, however, \musrSimAna\ is tuned to the needs of continuous muon beam facilities.
Some modifications might be necessary for the pulsed muon beams.
As in the case of \musrSim, the user of \musrSimAna\ specifies all parameters
required by the analysis in an input text file (steering file). The initial structure
of the steering file was taken over from the TDC setup files used by real \musr\ instruments
at PSI~\cite{acquisitionProkscha,TDCsetup}. This setup file defines the ``logic'' of a given experiment,
namely the coincidences and anti-coincidences of different counters and veto detectors, as well as some
timing parameters.
The setup file for the case of simulation had to be extended by the definitions of
histograms, cuts, fitting, etc. The description of the setup file will be
presented in chapter~\ref{howToAnalyse}-\ref{description}, the chapter~\ref{sec:GPD}
illustrates the whole concept of \musrSimAna\ on the example of an existing \musr\ instrument.
\section{The main components of the \musrSimAna\ setup file}
\label{howToAnalyse}
The parameters for the analysis are stored in the setup file ``{\tt RUNxxx.v1190}'', whose name
typically consists of the run number ({\tt RUN}),
some further identifier ({\tt xxx}), and ends with ``{\tt .v1190}''.
One of the following commands can be used to execute \musrSimAna: \\[1em]
{\tt
\$> musrSimAna RUN RUNxxx \\
\$> musrSimAna RUN RUNxxx nographic > data/RUN.RUNxxx.out
}\\[1em]
where the first {\tt RUN} stands for the run number (more precisely, it specifies
the \musrSim\ output, which is expected to be stored as ``{\tt data/musr\_RUN.root}'')
and {\tt RUNxxx} specifies the \musrSimAna\ setup file without the ending, which is
expected to be stored in the current directory. The output file of \musrSimAna,
containing the result histograms, will be stored as ``{\tt data/his\_RUN\_RUNxxx.v1190.root}''.
The syntax of the setup file in \musrSimAna\ is based on the experimental one,
defined in~\cite{TDCsetup}.
At the beginning of this file, some timing parameters are defined:\\[1em]
\begin{tabular}{ll}
{\tt RESOLUTION=100 } & \emph{\ldots one TDC bin corresponds to 100\,ps} \\[0.7em]
{\tt MCOINCIDENCEW=50 } & \emph{\ldots time interval (in TDC bins) to find coincidences with M-counter} \\
{\tt PCOINCIDENCEW=50 } & \emph{\ldots time interval (in TDC bins) to find coincidences with P-counter} \\
{\tt VCOINCIDENCEW=100 } & \emph{\ldots time interval (in TDC bins) to find anti-coincidences with M-counter} \\[0.7em]
{\tt MUONRATEFACTOR=0.089 } & \emph{\ldots will be described in section~\ref{sec:eventMixing}} \\[0.7em]
{\tt DATAWINDOWMIN=-2.0 } & \emph{\ldots data interval (in $\mu$s) in which positrons are detected} \\
{\tt DATAWINDOWMAX=10.0 } & \\[0.7em]
{\tt PILEUPWINDOWMIN=-10.0 } & \emph{\ldots the pileup interval (in $\mu$s) for muons} \\
{\tt PILEUPWINDOWMAX=10.0 } & \\[1em]
\end{tabular}
%
A good event has exactly one hit in the M-counter within the pile-up window, and exactly
one hit in the positron counters within the data window. Both windows are defined relative to $t_0$,
which is the time of the currently analysed M-counter hit.
The coincidence and anti-coincidence logic between the different counters
(the detector logic) is also specified in the setup file.
An example may look like this:\\
\begin{verbatim}
102; "M up"; M; 0.4; 2005; -401;
1; "B1"; P; 0.4; 2005; 21 -401; B1; 1485; 1515; 50995;
2; "B2"; P; 0.4; 2005; 22 -401; B2; 1485; 1515; 50995;
11; "F1"; P; 0.4; 2005; -401 -21 -22; F11; 1485; 1515; 50995;
12; "F2"; P; 0.4; 2005; -401 -21 -22; F12; 1485; 1515; 50995;
13; "F3"; P; 0.4; 2005; -401 -21 -22; F13; 1485; 1515; 50995;
21; "Coinc B1" K; 0.4; 2005;
22; "Coinc B2" K; 0.4; 2005;
401; "Active Veto" V; 0.1; 2005;
\end{verbatim}
\mbox{} \\
%
In each row, the first number stands for the detector ID (defined in the steering file
of the \musrSim), the second variable is the name of the counter,
the third variable identifies the type of the counter (M = muon, P = positron,
K = coincidence and V = veto counters, respectively), the forth variable is the threshold in MeV applied
to the energy deposited in the counter, the fifth variable is a time delay (in units
of bin-width) applied to the given counter, the sixth set of parameters defines
which other detectors have to be in coincidence (positive ID) or anti-coincidence
(negative ID) with the given counter, and in the case of positron counters, the
last four parameters define a special histogram for the given counter. (Note
that this histogram is used for a compatibility with the experimental steering file, however
there is a different and more powerful way of how to define histograms, which is
defined later). The only difference with respect to the experimental steering
file is the presence of threshold definition in the fourth column.
In the example above, the M-counter is the volume which has ID 102 in the simulation,
and a valid hit has to have energy in the counter above 0.4\,MeV, and no signal
above 0.1\,MeV in the ``Active Veto'' (ID=401) within a time interval defined by
{\tt VCOINCIDENCEW}. The detailed description of *.v1190 steering files can be found
in chapter~\ref{description} and in~\cite{TDCsetup}.
The main output of the simulation is generated in the form of histograms.
The histograms are defined in the steering file. For example, the following
line defines 1-dimensional histogram of the $z$-position of where the muons stop and decay:\\[1em]
{\tt
musrTH1D hMuDecayPosZ "Where the muons stop;z[mm];N" 100 -5. 5. muDecayPosZ
}\\[1em]
This histogram has 100 bins, spans from -5\,mm to 5\,mm, and the variable filled
in the histogram is {\tt muDecayPosZ}.
In fact, this line does not create one histogram, but an array of histograms -- one
histogram for each ``condition''. An example of five conditions reads:\\[1em]
{\tt
condition 1 oncePerEvent \\
condition 2 muonDecayedInSample\_gen \\
condition 4 muonTriggered\_det \\
condition 6 goodEvent\_det \\
condition 9 pileupEvent
}\\[1em]
where integer numbers (1,2,4,6 and 9) denote the condition number, and the string at the end
describes the condition -- e.g.\ ``{\tt muonDecayedInSample\_gen}'' specifies that muon
has stopped and decayed in the sample, and ``{\tt muonTriggered\_det}'' specifies that
there had to be a good muon candidate triggered in the M-counter.
The ending ``{\tt \_gen}'' indicates that the variable used in the condition
was ``generated'', i.e.\ it is known in the simulation, but can not be directly
measured experimentally.
On the other hand the ending ``{\tt \_det}'' specifies that the given condition
is based on measurable variables, as e.g.\ energy deposits in a counter.
There can be up to
30 conditions requested, and for each of them a separate histogram will be filled.
In the output file of \musrSimAna, the histograms corresponding to the previous
set of conditions would be saved as
{\tt hMuDecayPosZ\_1, hMuDecayPosZ\_2, hMuDecayPosZ\_4, hMuDecayPosZ\_6, hMuDecayPosZ\_9}.
The {\tt hMuDecayPosZ\_1} shows where the muons stop irrespective whether they were
detected or not. The {\tt hMuDecayPosZ\_6} contains ``good'' muons, i.e.\ muons that would
be saved in the final histograms in the experiment. The {\tt hMuDecayPosZ\_9} shows
the muons, which contribute to the time-independent background. Note that there are always
two muons, $\mu_1$ and $\mu_2$, contributing to the time-independent background, and {\tt hMuDecayPosZ\_9}
shows the one ($\mu_1$) that started the M-counter. More to this topic is presented
in chapter~\ref{sec:eventMixing}. Here we just mention that in order
to see the $z$-coordinate of the second muon ($\mu_2$),
which was not triggered by the M-counter but whose decay positron hit the positron counter,
the histogram {\tt hpileup\_muDecayPosZ\_9} must be used:\\[1em]
{\tt
musrTH1D hpileup\_muDecayPosZ "Pileup muons;z[mm];N" 100 -5.0 5. pileup\_muDecayPosZ
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Event mixing -- an unavoidable complication}
\label{sec:eventMixing}
The output of \musrSim\ is stored in a Root tree named ``{\tt t1}''. One event corresponds
to one simulated muon, and it is saved as one row of the tree. The only information that
relates one event (muon) to any other one is the variable {\tt timeToNextEvent},
which is a randomly generated time difference between two subsequent events.
The \musrSimAna\ allows one to study the ``time-independent background'', which is
due to mixing of two different events. A simple example of the event mixing affecting
the \musr\ measurement is the following: the first muon, $\mu_1$, hits the M-counter,
and subsequently stops and decays in the sample, however the decay positron escapes
undetected -- most likely because of the limited angular acceptance of positron counters.
The second muon, $\mu_2$, arrives around the same time, misses the M-counter,
and stops and decays in a collimator wall or elsewhere.
Its decay positron hits a positron counter. Thus there are good-looking muon and positron
hits, which however arise from two uncorrelated muons.
This fake (background) event is experimentally treated as a good event,
and contributes to the time-independent background.
Events can be mixed in \musrSimAna, allowing us to study sources of
the time-independent background.
%\emph{MusrSimAna} loops over the events and checks whether the conditions defining
%the detector logic in the steering file have been fulfilled. However, to take event
%mixing properly into account, the conditions have to be veryfied on several subsequent
%events. Therefore, at the beginning of the analysis of
Before analysing a given event, arrays of hits are filled
for all counters (M, positron, veto, coincidence counters), which store the hits occurring in the
future up to the time equal to $ 3\, \cdot $ pileup window or $ 3\, \cdot $ data window,
whatever is larger\footnote{The data and pile-up windows defined by parameters
{\tt DATAWINDOWMIN, DATAWINDOWMAX, PILEUPWINDOWMIN} and {\tt PILEUPWINDOWMAX}
are applied later on in the analysis.}.
There is one such array for every counter. After this initial filling,
there might be several hits in every array, originating from one or more events.
The fraction of the time-independent background to good events depends on the incoming muon rate
measured by the trigger, possibly in the anti-coincidence with a backward veto detector, if
used in the experiment.
Typically, the experimentalists set the incoming muon rate (rate of \emph{stopped muons})
to $\sim 30\,000\,\mu/s$. The same should be done in the simulation.
However, the rate of stopped muons is known only after the analysis is done,
because, for example, many simulated muons stop and decay in collimators or elsewhere
in the beam-pipe without producing any signal in the M-counter.
Therefore the simulation is normally started with an initial rate of generated muons
of $30\,000\,\mu/s$, which in practise can correspond to much lower rate of \emph{stopped muons}.
The rate of stopped muons is calculated at the end of the \musrSimAna\ execution, and
it is printed out in the \musrSimAna\ output. The user can use this information and rescale the
initial muon rate by changing parameter {\tt MUONRATEFACTOR} in the {\tt *.v1190} setup file.
This is done without the necessity to re-run the CPU consuming
simulation -- only the \musrSimAna\ has to be repeated. The complete simulation and analysis
chain therefore usually consists of three steps:
%
\begin{enumerate}
\item \musrSim\ (takes typically 10 hours).
\item \musrSimAna\ with {\tt MUONRATEFACTOR=1.0} (takes typically 10 minutes).
\item \musrSimAna\ with {\tt MUONRATEFACTOR} determined in step 2.
\end{enumerate}
%
The {\tt MUONRATEFACTOR} specifies a multiplicative factor applied to
the variable {\tt timeToNextEvent}
(the randomly generated time difference between two subsequent events).
{\bf IMPORTANT NOTE:} In order to get the pile-up effects correctly analysed by \musrSimAna,
it is probably necessary to run the \musrSim\ with no event reweighting (i.e.\
the command ``{\tt /musr/command logicalVolumeToBeReweighted \ldots}'' must {\bf not} be used).
All events should/have to be (?) saved in the Root tree
(i.e.\ the command ``{\tt /musr/command storeOnlyEventsWithHits false}'' must be used).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Detailed list of steering file parameters}
\label{description}
\begin{description}
% \item{\bf INSTRUMENT=\emph{string}} \\
% ignored
% \item{\bf DESCRIPTION=\emph{string}} \\
% ignored
% \item{\bf TYPE=\emph{string}} \\
% ignored
\item{\bf RESOLUTION=\emph{value}} \\
width of the TDC bin in picoseconds.
\item{\bf MDELAY=\emph{value}} \\
currently not used (probably not needed in the case of simulation).
\item{\bf PDELAY=\emph{value}} \\
currently not used (probably not needed in the case of simulation).
\item{\bf MCOINCIDENCEW=\emph{value}} \\
time window for the coincidences of the coincidence detectors (``K'')
with the M-counter. The \emph{value} is given in TDC bins (see {\tt RESOLUTION} above).
\item{\bf PCOINCIDENCEW=\emph{value}} \\
time window for the coincidences of the coincidence detectors (``K'')
with positron counters. The \emph{value} is given in TDC bins.
\item{\bf VCOINCIDENCEW=\emph{value}} \\
time window for the coincidences of the anti-coincidence detectors (``V'')
with any other counter. The \emph{value} is given in TDC bins.
\item{\bf MUONRATEFACTOR=\emph{value}} \\
a multiplicative factor which is used to rescale time differences between subsequent muons.
Setting \emph{value} larger than 1 artificially prolongs the time difference between
two subsequently generated muons, and therefore decreases the incoming muon rate
(number of muons per second). This parameter should be changed in order to set the
incoming muon rate to a given required value, typically to 30\,000\,$\mu/$s.\\
See also variable ``INFINITELYLOWMUONRATE''.
\item{\bf INFINITELYLOWMUONRATE} \\
If INFINITELYLOWMUONRATE is specified, each event is treated independently of any other
event. This corresponds to a situation of infinitely low rate of incoming muons, and
no pileup can be observed. The variable ``MUONRATEFACTOR'' becomes irrelevant when
INFINITELYLOWMUONRATE is specified.
\item{\bf DATAWINDOWMIN=\emph{value}} \\
Beginning of the data interval for the positron counters in $\mu$s.
\item{\bf DATAWINDOWMAX=\emph{value}} \\
End of the data interval for the positron counters in $\mu$s.
\item{\bf PILEUPWINDOWMIN=\emph{value}} \\
Beginning of the pileup interval for the M-counter in $\mu$s.
\item{\bf PILEUPWINDOWMAX=\emph{value}} \\
End of the pileup interval for the M-counter in $\mu$s.
\item{\bf MUSRMODE=\emph{string}} \\
Defines the mode of \musr\ experiment -- presently only ``D'', corresponding to
the time differential mode is implemented.
\item{\bf REWINDTIMEBINS=\emph{value}} \\
A technical parameter specifying when a roll-over of all hits has to be done.
It is specified in TDC bins, and normally there should be no need to change this parameter.
\item{\bf DEBUGEVENT \emph{eventID} \emph{debugLevel}}\\
Prints out debug information about the event with the ID \emph{``eventID''}.
The higher the \emph{debugLevel}, the more details are printed.
(Both \emph{eventID} and \emph{debugLevel} are integers).
\item{\bf CLONECHANNEL \emph{ID1} \emph{ID2}}\\
Clones the hits detected in counter \emph{ID1} into a new counter \emph{ID2}.
A different (even a lower) threshold can be applied to the cloned counter.
This way the same counter can be used as two independent counters -- e.g.\ once as a veto
detector for the M-counter, and simultaneously as a coincidence detector for
a P-counter. In both cases the energy threshold and time windows are defined independently.
\item{\bf musrTH1D \emph{histoName} \emph{histoTitle} \emph{nBins} \emph{min} \emph{max} \emph{variable}
[{\tt rotreference} $\nu_{\rm RRF}$ $\phi_{\rm RRF}$]} \\
Defines a histogram (or more precisely an array of histograms, where the number of histograms
in the array is given by the number of conditions, see section~\ref{howToAnalyse}).
The name of the histogram is defined by \emph{histoName} + the number of the condition.
The string variable \emph{histoTitle} specifies the title of the histogram,
\emph{nBins}, \emph{min} and \emph{max} stand for the number of bins and minimum and maximum
of the $x$-axis of the histogram. \\
The optional keyword ``{\tt rotreference}'' signals that the given histogram will be filled in
rotating reference frame (RRF) with the frequency of $\nu_{\rm RRF}$ and a phase shift of $\phi_{\rm RRF}$.
\\
The \emph{variable} stands for the variable that will be
filled into the histogram. The \emph{variable} can be any variable from the output Root tree
of musrSim (see ``Manual of musrSim'') (except for the array variables like
{\tt det\_*[], save*[], odet\_*[]}). In addition, it can be also one of the following:
\begin{description}
\item[muDecayPosR] \ldots $\sqrt{ {\rm muDecayPosX}^2 + {\rm muDecayPosY}^2}$.
\item[wght] \ldots weight of the event.
\item[det\_m0edep] \ldots energy deposited in the M-counter that gives the muon signal.
\item[det\_posEdep] \ldots energy deposited in the P-counter that gives the positron signal.
\item[pos\_Momentum] \ldots magnitude of the momentum of the decay positron (``generated'', not measurable variable).
\item[pos\_Trans\_Momentum] \ldots transverse momentum of the decay positron.
\item[pos\_Radius] \ldots positron radius calculated from the decay positron momentum and magnetic
field at the point of decay.
\item[pos\_Theta] \ldots polar angle of the decay positron.
\item[pos\_Phi] \ldots azimuth angle of the decay positron.
\item[det\_time10] \ldots time difference between the positron and muon counters
(measured by the respective counters).
\item[gen\_time10] \ldots the time difference between the muon decay and the first muon hit
in the M-counter (i.e.\ {\tt muDecayTime - muM0Time}).
\item[det\_time10\_MINUS\_gen\_time10] \ldots {\tt det\_time10 - gen\_time10} in picoseconds.
\item[det\_time20] \ldots very similar to {\tt det\_time10}, however taking into
account ``counter phase shift'' defined by {\tt counterPhaseShifts}
variable. This gives the user a possibility to sum up backward and
forward histograms into one histogram (this of course make sense
only in the simulation, where there is ``no physics'' happening
in the sample, just the muon spin rotation).
\item[pileup\_eventID] \ldots eventID of the $\mu_2$, where $\mu_2$ stands for the muon,
which did not give signal in the M-counter, but whose
decay positron gave signal in the positron counter around the time
when a different muon ($\mu_1$) triggered the M-counter.
\item[pileup\_muDecayDetID] \ldots detector ID, in which $\mu_2$ stopped and decayed.
\item[pileup\_muDecayPosZ] \ldots $z$-coordinate of where the $\mu_2$ stopped and decayed.
\item[pileup\_muDecayPosR] \ldots radius of where the $\mu_2$ stopped and decayed.
\end{description}
Variables are usually set to -1000 if they can not be calculated (e.g.\ {\tt det\_posEdep} = -1000
if there was no hit in any positron counter).
\item{\bf musrTH2D \emph{histoName} \emph{histoTitle} \emph{nBins} \emph{min} \emph{max} \emph{nBins2} \emph{min2} \emph{max2} \emph{variable}} \\
Similar to \emph{musrTH1D}, but for a 2-D histogram.
\item{\bf humanDecayHistograms \emph{hist\_decay\_detID} \emph{hist\_decay\_detID\_pileup} \emph{id$_1$} \emph{name$_1$} \ldots \emph{id$_n$} \emph{name$_n$} } \\
This is a special kind of histogram, which converts two histograms
(\emph{hist\_decay\_detID} \emph{hist\_decay\_detID\_pileup})
into a human-friendly histograms, where detector ID on the $x$-axis is converted into a string label.
The \emph{id$_i$} is the detector id, and the \emph{name$_i$} is the corresponding label name.
If \emph{name$_i$ = name$_j$}, the corresponding bins of the original histograms will
be summed up together into the same bin.
The \emph{hist\_decay\_detID} and \emph{hist\_decay\_detID\_pileup} have to be defined before
(by the command {\tt musrTH1D}).
\item{\bf condition \emph{conditionID} \emph{conditionName}} \\
Definition of a condition, which is then used when filling histograms. The \emph{conditionID}
specifies the number of the condition, and must be between 0 and 30 (0 and 30 are also possible).
The \emph{conditionName} is one of the following:
\begin{description}
\item[alwaysTrue] \ldots true for every hit in the m-counter (there can be more than one M-counter hit per event).
\item[oncePerEvent] \ldots true once for every event (the first hit in M-counter, if any, is considered).
\item[muonDecayedInSample\_gen] \ldots true if muon stopped and decayed in the sample.
\item[muonTriggered\_gen] \ldots true if muon passed through the M-counter (irrespective of the deposited energy)
-- not a measurable variable.
\item[muonTriggered\_det] \ldots true if a good muon candidate was found in the M-counter (using coincidences, vetoes, ...).
Double hits within the pileup window are excluded.
\item[positronHit\_det] \ldots true if a good positron candidate was found in the positron counter.
Double hits within the data window are excluded.
\item[goodEvent\_det] \ldots true if {\tt muonTriggered\_det} and {\tt positronHit\_det}.
\item[goodEvent\_gen] \ldots true if muon passed through the M-counter, and the muon stopped anywhere
(i.e.\ did not leave the World volume of the simulation). No requirement
on the positron is implied, i.e.\ the positron may or may not be detected.
Not a measurable variable.
\item[goodEvent\_det\_AND\_goodEvent\_gen]
\item[pileupEventCandidate] \ldots M-counter hit and positron counter hit both come from two different events.
\item[pileupEvent] \ldots {\tt pileupEventCandidate} and {\tt goodEvent\_det}.
\item[goodEvent\_det\_AND\_muonDecayedInSample\_gen]
\item[goodEvent\_F\_det] \ldots {\tt goodEvent\_det}, where the positron was detected in the forward detectors
defined by the command {\tt counterGrouping}.
\item[goodEvent\_B\_det] \ldots like {\tt goodEvent\_F\_det} but for backward positron counters.
\item[goodEvent\_U\_det] \ldots like {\tt goodEvent\_F\_det} but for upper positron counters.
\item[goodEvent\_D\_det] \ldots like {\tt goodEvent\_F\_det} but for lower positron counters.
\item[goodEvent\_L\_det] \ldots like {\tt goodEvent\_F\_det} but for left positron counters.
\item[goodEvent\_R\_det] \ldots like {\tt goodEvent\_F\_det} but for right positron counters.
\item[goodEvent\_F\_det\_AND\_pileupEvent] \ldots {\tt goodEvent\_F\_det} and {\tt pileupEvent}.
\item[goodEvent\_B\_det\_AND\_pileupEvent] \ldots {\tt goodEvent\_B\_det} and {\tt pileupEvent}.
\item[goodEvent\_U\_det\_AND\_pileupEvent] \ldots {\tt goodEvent\_U\_det} and {\tt pileupEvent}.
\item[goodEvent\_D\_det\_AND\_pileupEvent] \ldots {\tt goodEvent\_D\_det} and {\tt pileupEvent}.
\item[goodEvent\_L\_det\_AND\_pileupEvent] \ldots {\tt goodEvent\_L\_det} and {\tt pileupEvent}.
\item[goodEvent\_R\_det\_AND\_pileupEvent] \ldots {\tt goodEvent\_R\_det} and {\tt pileupEvent}.
\end{description}
Additional conditions may be implemented on request.
\item{\bf draw \emph{histogramName} \emph{conditionID} } \\
Plot histogram (for a given condition) at the end of the analysis. Note that all histograms
are saved into the output file irrespective whether they are plotted or not.
\item{\bf counterPhaseShifts \emph{ID$_1$} \emph{$\phi_1$} \emph{ID$_2$} \emph{$\phi_2$} \ldots \emph{ID$_n$} \emph{$\phi_n$} }\\
Defines relative phase shifts of signal between different positron counters, which is used
for calculation variable {\tt det\_time20}. \emph{ID$_i$} is the ID number of the positron counter,
\emph{$\phi_i$} is its phase shift. This gives the user a possibility to sum up backward and
forward histograms into one histogram.
\item{\bf counterGrouping \emph{group} \emph{ID$_1$ ID$_2$ \ldots ID$_n$} } \\
This defines a group of detectors, where \emph{group} stands for ``B'' (backward),
``F'' (forward), ``U'' (up), ``D'' (down), ``L'' (left) and ``R'' (right) detectors.
This grouping is used in the definition of some conditions.
\item{\bf setSpecialAnticoincidenceTimeWindow \emph{detectorID} \emph{timeMin} \emph{timeMax} \emph{unit}} \\
This command sets a special anti-coincidence time window for a detector \emph{detectorID}.
Normally, the anti-coincidence time window is defined by {\tt VCOINCIDENCEW}, and is the same for all anti-coincidence
detectors. However, sometimes it might be interesting to set the anti-coincidence time window
differently for a specific detector (e.g.\ one might test an anti-coincidence of a veto detector with
the M-counter for the whole pile-up time window of $\sim$\,10\,$\mu s$.
Unlike in the case of {\tt VCOINCIDENCEW}, here the \emph{units} are not TDC bins, but
rather time in ``nanosecond'' or ``microsecond''.
\item{\bf fit \emph{histogramName} \emph{function} \emph{min} \emph{max} \emph{p$_1$} \ldots \emph{p$_n$}} \\
Fits the histogram by a given function, where \emph{min}, \emph{max} define the range of the fit
on the $x$-axis of the histogram, and \emph{p$_1$} \ldots \emph{p$_n$} are (typically, with some exceptions)
the initial values of the function parameters. The following functions are currently predefined:
\begin{description}
\item[pol0] $=p_0$ \ldots a constant (1 parameter) - typically used to fit background.
\item[simpleExpoPLUSconst] $=p_0 \exp(-x/2.19703)+p_1$
\item[rotFrameTime20] $= p_2 \cos(p_0 x+p_1)$
\item[funct1] $=p_3 \exp((p_4 - x)/2.19703) \cdot (1+p_2 \cos(p_0 x+p_1))$
\item[funct2] $=p_3 \exp((p_4 - x)/2.19703) \cdot (1+p_2 \cos(p_0 x+p_1)) + p_5$
% \item[funct3] the same as {\tt funct2}
\item[funct4] $=p_3 \exp((- x)/2.19703) \cdot (1+p_2 \cos(p_0 x+p_1)) + p_4$
\end{description}
\end{description}
%========================================================================================================
\section{A real-life example: GPD instrument}
\label{sec:GPD}
The simulation of the General Purpose Decay-Channel Spectrometer (GPD)
instrument~\cite{GPD} installed at PSI has been exemplified
in the \musrSim\ manual~\cite{musrSim}.
Here we analyse the output of this simulation using \musrSimAna.
The run number of this simulation is 201, therefore the steering
file names are ``{\tt 201.mac}'' for \musrSim, and ``{\tt 201.v1190}'' for
\musrSimAna, respectively, and the output file name of \musrSim\ is saved as
``{\tt data/musr\_201.root}''.
The detector system is very simple with only six counters -- M-counter,
two backward positron counters and three forward positron counters.
The reader is strongly recommended to see the illustration of the GPD
geometry in the \musrSim\ manual~\cite{musrSim}.
8\,000\,000 of events were simulated
(i.e.\ 8\,000\,000 of muons were generated 100\,cm in front of
the GPD sample).
In only 949\,759 events (11.9\% out of the 8 million) there was a signal detected
in one or more counters. The remaining muons stopped somewhere (most
often in collimator, as we will see later), decayed, and the decay positron
(and any other particles created thereof) missed the counters.
This is illustrated in more details in Fig.~\ref{det_n},
%
\begin{figure}[tbp]\centering
\epsfig{file=pict/det_n_infititely_low_muon_rate.eps,width=0.8\linewidth,clip=}
\caption{Number of hits in all counters per event, assuming infinitely low incoming muon
rate. The same detector may be hit more than once (e.g.\ if both the muon and its decay
positron pass through the M-counter).}
\label{det_n}
\end{figure}
%
where number of detector hit per event, assuming infinitely low incoming muon
rate, is shown. This plot was created in Root by executing:\\[1em]
{\tt
root [0] TFile* ff=new TFile("data/musr\_201.root") \\
root [1] t1->Print() \\
root [2] t1->Print("det\_n","det\_n>0") \\
}\\[1em]
%
It has to be pointed out, that the ratio of muons passing through the opening
in collimators to the number of all generated muons strongly depends on the
beam properties -- beam profile, beam convergence, etc. Typically, if we have
too broad muon beam, we simulate
many ``useless'' events. However, the other extreme (simulating too narrow
beam) can lead to underestimating the time-independent background.
It took approximately 12 hours of the CPU (on PC bought in 2010, where 1 out
of 4 processor cores was running) to simulate these 8\,000\,000 events.
Assuming the 30\,000\,$\mu/$s trigger rate, this corresponds to 26 seconds
of real experimental running.
\subsection{Where the muons stop and decay}
\label{sect_muons}
The positions, or more precisely the components of the GPD instrument, where the muons
stop and decay, are shown in Fig.~\ref{humanDecayHistograms_1}:
%
\begin{figure}[tbp]\centering
\epsfig{file=pict/Plot201_1.eps,width=0.9\linewidth,%
%%bbllx=83pt,bblly=330pt,bburx=538pt,bbury=513pt,clip=}
clip=}
\caption{This plot indicates, where the muons stopped and decayed.
The dashed histogram shows all generated muons. The full-line histograms show
where stopped the muons, for which either the muon itself or its secondary
particle ($e^+, \gamma$) triggered the M-counter: black histogram stands for
all such muons, corresponding to infinitely low incoming muon rate, while
the red histogram stands for the incoming muon rate of 30\,000\,$\mu/$s.
8\,000\,000 of events were simulated.}
\label{humanDecayHistograms_1}
\end{figure}
%
%Notes to Fig.~\ref{humanDecayHistograms_1}:
\begin{itemize}
\item Figure~\ref{humanDecayHistograms_1} was generated by Root macro file ``Plot201.C''.
\item The labels on the $x$-axis are defined in the file {\tt 201.v1190} by the
command \\
{\tt humanDecayHistograms \ldots}
\item The dashed-line histogram in Fig.~\ref{humanDecayHistograms_1}
shows where the muons stopped and decayed if no preselection
criteria are applied on the muons, i.e.\ if all generated muons are considered.
This is histogram ``{\tt humanDecayHistograms\_1}''.
\item The full-line histograms show
where stopped the muons, for which either the muon itself or its secondary
particle ($e^+, \gamma$) triggered the M-counter: black histogram stands for
all such muons, corresponding to infinitely low incoming muon rate, while
the red histogram represents the case for the 30\,000\,$\mu/$s incoming muon rate.
An energy deposit of at least 0.4\,MeV in the M-counter is required to fire the trigger.
The number of triggered events decreases with the incoming muon rate,
because some of the events are rejected due to the 10\,$\mu$s pileup gate.
The histogram name is in both cases ``{\tt humanDecayHistograms\_4}'',
where the black histogram was calculated using the setup file ``{\tt 201a.v1190}''
with the keyword {\tt INFINITELYLOWMUONRATE}, while the red histogram
was calculated using the setup file ``{\tt 201.v1190}''
with {\tt MUONRATEFACTOR=0.0965819}.
\item The $\pm 10\,\mu$s pile-up gate at the incoming muon rate of 30\,000$\,\mu/$s
rejects approx.\ 45\% of the triggered events. This number can be calulated
in Root as the ratio of the ``{\tt Integral}'' of the red and black histograms
in Fig.~\ref{humanDecayHistograms_1}:\\[1em]
{\tt \small
root [0] TFile* file1 = new TFile("data/his\_201\_201a.v1190.root") \\
root [1] humanDecayHistograms\_4->Integral() \\
root [0] TFile* file2 = new TFile("data/his\_201\_201.v1190.root") \\
root [1] humanDecayHistograms\_4->Integral() \\
}
\item The muon sample fraction (ratio of muons stopped in the sample over all muons that fired
the trigger) for the triggered events (full-line histograms)
is 65\%, and it is practically the same
for both infinitely low and 30\,000\,$\mu/$s incoming rate.
This number can be obtained in Root by dividing the first column of histogram
{\tt humanDecayHistograms\_4} by the sum of all entries in this histogram:\\[1em]
{\tt \small
root [0] TFile* file = new TFile("data/his\_201\_201.v1190.root") \\
root [1] (humanDecayHistograms\_4->GetBinContent(1))/(humanDecayHistograms\_4->Integral()) \\
}
\item The largest fraction of generated muons (dashed-line histogram) stopped in collimators.
Only a small fraction of them caused a hit in the M-counter (full-line histograms).
\item Despite the high initial muon momentum of $100 \pm 3\,$GeV/c, muons are
significantly scattered in the last 50\,cm region of air. This can be
clearly seen if the magnetic field is off and a point-like muon beam
is used (which can be done by modifying the {\tt 201.mac} file)
-- only 77\% of the muons stop in the sample cell or in the sample, while the
remaining 23\% of the mouns are scattered so much in the air, that they
end up in collimators or elsewhere (not shown here).
\item ``World'' in the histogram label means that the muon decayed in the beampipe vacuum
or somewhere else in the air (on the fly).
\item ``Escaped'' means that the muon left the simulated instrument (more precisely the
``world'' volume) prior its decay.
\end{itemize}
Figure~\ref{humanDecayHistograms_9} shows the ``pile-up events''.
%
\begin{figure}[htbp]\centering
\epsfig{file=pict/Plot201_2_new.eps,width=0.9\linewidth,%
%%bbllx=83pt,bblly=330pt,bburx=538pt,bbury=513pt,clip=}
clip=}
\caption{Pile-up events, i.e.\ the events in which one muon ($\mu_1$) fired the
trigger, while the hit in a positron counter is due to a decay positron from
a different muon ($\mu_2$). Pile-up events look like a good events, and contribute
to the time-independent background.}
\label{humanDecayHistograms_9}
\end{figure}
%
These are events, in which one muon ($\mu_1$) is triggered by the m-counter,
while a positron from a different muon ($\mu_2$) was detected by
a positron counter\footnote{In fact, the trigger may also be triggered by
the decay positron of $\mu_1$ and/or a positron counter may detect
directly $\mu_2$, not its decay positron. Such cases are rare, but they
are implicitly included in the simulation.}.
In addition to this requirement, the decay positron of $\mu_1$ must
escape undetected (e.g.\ it must miss positron counters) and $\mu_2$ must not trigger the m-counter
-- otherwise the event would be rejected.
Pile-up events are the source of the time independent background.
Usually $\mu_1$ is a good-looking muon that stops in the sample or in the sample cell
(red histogram in Fig.~\ref{humanDecayHistograms_9}), while $\mu_2$ stops and decays at different places,
mainly in the collimators (green histogram in Fig.~\ref{humanDecayHistograms_9}).
A nice visualisation of where the background-contributing muons $\mu_2$ stop and decay
is presented in Fig.~\ref{Pileup_muon_decay_map} (histogram ``{\tt hMuDecayMappileup\_9}'').
%
\begin{figure}[htbp]\centering
\epsfig{file=pict/Pileup_muon_decay_map.eps,width=0.7\linewidth,%
%%bbllx=83pt,bblly=330pt,bburx=538pt,bbury=513pt,clip=}
clip=}
\caption{Positions of where the $\mu_2$ stop and decay.}
\label{Pileup_muon_decay_map}
\end{figure}
%
In this two dimensional histogram, different components of the GPD instrument,
like the lead collimator, the copper collimator and the sample cell, can be recognised.
The lead collimator is located at the $z$-position between -115\,mm and -85\,mm.
Due to the high initial muon momentum of $\sim 100\,$MeV/c,
the maximum of muons in Fig.~\ref{Pileup_muon_decay_map} stop quite deep in the
lead collimator, at around $z=-103$\,mm. This might be a little bit surprising to the
\musr\ scientists who are used to work with the surface muons with momentum of 28\,MeV/c.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The $\mu$SR signal}
%
Figure~\ref{hdet_time10_10}
%
\begin{figure}[htbp]\centering
\epsfig{file=pict/hdet_time10_10.eps,width=0.495\linewidth,%
bbllx=13pt,bblly=5pt,bburx=520pt,bbury=351pt,clip=}
\epsfig{file=pict/hdet_time10_11.eps,width=0.495\linewidth,%
bbllx=13pt,bblly=5pt,bburx=520pt,bbury=351pt,clip=}
%%clip=}
\caption{MuSR signal for the run 201 (TF$=300\,$gauss). The tree forward positron counters
are summed up in the left histogram, and the two backward counters in the right histogram.}
\label{hdet_time10_10}
\end{figure}
%
shows the $\mu$SR spectra for the same run,
i.e.\ for the transverse field of 300\,gauss, integrated over the three forward positron
counters (left histogram called {\tt hdet\_time10\_10})
and over the two backward positron counters (right histogram called {\tt hdet\_time10\_11}).
Zero on the time axis corresponds to $t_0$, i.e.\ time of the m-counter hit.
One can see a prompt peak at $t_0$, time independent background at negative times
and an oscillating signal at positive times.
The following function has been fitted to the oscillating part of the signal:
%
\begin{equation}
f=p_3 \cdot e^{-t/2.19703} \cdot (1+p_2 \cdot \cos(t \cdot p_0+p_1))+p_4
\label{eq_simple}
\end{equation}
The fits were restricted to the time interval of $(t_0+0.05 \mu\rm{s},t_0+9.95\mu\rm{s})$,
and the parameter $p_0$ was fixed (e.g. not fitted).
The fitted amplitude of asymmetry are $p_2 = 0.307 \pm 0.009$ and
$p_2 = 0.290 \pm 0.009$ for the forward and backward counters respectively.
Parts of the spectra from Fig.~\ref{hdet_time10_10} are shown
in detail in Fig.~\ref{hdet_time10_10_detail}.
%
\begin{figure}[htbp]\centering
\epsfig{file=pict/hdet_time10_10_detail.eps,width=0.495\linewidth,%
bbllx=13pt,bblly=5pt,bburx=520pt,bbury=351pt,clip=}
\epsfig{file=pict/hdet_time10_11_pileup.eps,width=0.495\linewidth,%
bbllx=13pt,bblly=5pt,bburx=520pt,bbury=351pt,clip=}
%%clip=}
\caption{MuSR signal for the run 201 (TF$=300\,$gauss) -- details of
Fig.~\ref{hdet_time10_10}. The left plot shows the signal in the forward counters around $t_0$,
the right plot shows the (time-independent background) signal at negative times in the
backward counters.}
\label{hdet_time10_10_detail}
\end{figure}
%
The left plot in Fig.~\ref{hdet_time10_10_detail} shows the signal
in the forward counters around $t_0$, the right plot shows the
(time-independent background) signal at negative times in the backward counters.
An important characteristic of a \musr\ instrument is the time-independent
background. It is usually expressed as
%
\begin{equation}
{\rm Bgr} = p_{-} / p_3 ~~~,
\label{eq_background}
\end{equation}
%
where $p_{-}$ is the fit to the time-independent background, i.e.\ signal at negative times,
and $p_3$ is the parameter from eq.(\ref{eq_simple}), which specifies what the
size of the signal would be at $t_0$ in the absence of oscillations.
In the case of backward counters ${\rm Bgr}_{\rm backw} = 14.47/262 = 5.5\,\%$,
in the case of forward counters ${\rm Bgr}_{\rm forw} = 6.88/267.9 = 2.6\,\%$.
Note that the histogram on right hand side of Fig.~\ref{hdet_time10_10_detail}
is labelled ``{\tt hdet\_time10\_Bgr\_11}'', not ``{\tt hdet\_time10\_11}''.
In fact, the two histograms are identical, as one can see in the setup file
{\tt 201.v1190}. The only difference is in the fitting -- the same data stored in
both histograms are fitted by different functions in different time ranges.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The $\mu$SR signal from individual counters}
%
Figure~\ref{F11} shows the observed signal in the
forward counter\ No.~11 (FW11).
%
\begin{figure}[htbp]\centering
\epsfig{file=pict/F11_rebinned.eps,width=0.495\linewidth,%
bbllx=13pt,bblly=5pt,bburx=520pt,bbury=351pt,clip=}
\epsfig{file=pict/F11_B11_prompt_peak_thicker.eps,width=0.495\linewidth,%
bbllx=13pt,bblly=5pt,bburx=520pt,bbury=351pt,clip=}
\caption{\musr\ signal in the forward positron counter\ No.~11 (run 201, TF$=300\,$gauss).
The left plot shows the (rebinned) signal in the counter,
the right plot shows the detail of the \emph{prompt peak}, i.e.\ the region
around $t_0$ in the same counter (black line),
compared with the prompt peak in the backward positron counter\ No.~1 (magenta line).}
\label{F11}
\end{figure}
%
Originally, the histogram F11 was defined with the bin width of 100\,ps.
The number of bins was 50995, covering the time interval of approx.\ (-0.2\,$\mu$s, 4.9\,$\mu$s).
In the left hand side plot, however, the histogram was rebinned
(200 bins were summed up into 1 bin).
The right hand side plot shows the detail of the \emph{prompt peak}, i.e.\ the region
around $t_0$, of one forward and one backward positron counters, prior to the rebinning.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Conclusion of the GPD analysis example}
%
The purpose of the example analysis of the GPD simulation was to illustrate
the potential of \musrSim\ and \musrSimAna\ programs to investigate features
like time-independent background, sample muon fraction, prompt peak, \ldots
This information can be used in design and optimisation of \musr\ instruments.
%========================================================================================================
\begin{thebibliography}{0}
\bibitem{acquisitionProkscha} T.~Prokscha {\it et al.} ``A novel VME based \musr\ data acquisition system at PSI'',
Physica {\bf B~404}, (2009) 1007-1009.
\bibitem{TDCsetup} ``TDC Manual -- Setting up the required logic'',
http://lmu.web.psi.ch/facilities/electronics/TDC/set\_logic.html
\bibitem{GPD}
http://lmu.web.psi.ch/facilities/gpd/gpd.html
\bibitem{musrSim}
K.Sedlak {\it et al.}, ``Manual of musrSim''.
\end{thebibliography}
\end{document}

View File

@ -82,6 +82,7 @@ class musrRootOutput {
void SetOPSAinfo (G4int nDetectors, G4int ID, G4int nPhot, G4double timeFirst, G4double timeA,
G4double timeB, G4double timeC, G4double timeD, G4double timeMean, G4double timeLast,
G4double timeCFD, G4double amplCFD);
void SetCFDSpecialInfo (G4int n, G4double time);
void SetSaveDetectorInfo (G4int ID, G4int particleID, G4double ke, G4double x, G4double y, G4double z, G4double time,
G4double px, G4double py, G4double pz, G4double polx, G4double poly, G4double polz) ;
@ -225,6 +226,7 @@ class musrRootOutput {
static G4bool store_odet_timeLast;
static G4bool store_odet_timeCFD;
static G4bool store_odet_amplCFD;
static G4bool store_odet_timeCFDarray;
static G4int oldEventNumberInG4EqEMFieldWithSpinFunction;
@ -333,6 +335,71 @@ class musrRootOutput {
G4double odet_timeLast[odet_nMax];
G4double odet_timeCFD[odet_nMax];
G4double odet_amplCFD[odet_nMax];
G4double odet_timeCFD100[odet_nMax];
G4double odet_timeCFD101[odet_nMax];
G4double odet_timeCFD102[odet_nMax];
G4double odet_timeCFD103[odet_nMax];
G4double odet_timeCFD104[odet_nMax];
G4double odet_timeCFD105[odet_nMax];
G4double odet_timeCFD106[odet_nMax];
G4double odet_timeCFD107[odet_nMax];
G4double odet_timeCFD108[odet_nMax];
G4double odet_timeCFD109[odet_nMax];
G4double odet_timeCFD110[odet_nMax];
G4double odet_timeCFD111[odet_nMax];
G4double odet_timeCFD112[odet_nMax];
G4double odet_timeCFD200[odet_nMax];
G4double odet_timeCFD201[odet_nMax];
G4double odet_timeCFD202[odet_nMax];
G4double odet_timeCFD203[odet_nMax];
G4double odet_timeCFD204[odet_nMax];
G4double odet_timeCFD205[odet_nMax];
G4double odet_timeCFD206[odet_nMax];
G4double odet_timeCFD207[odet_nMax];
G4double odet_timeCFD208[odet_nMax];
G4double odet_timeCFD209[odet_nMax];
G4double odet_timeCFD210[odet_nMax];
G4double odet_timeCFD211[odet_nMax];
G4double odet_timeCFD212[odet_nMax];
G4double odet_timeCFD300[odet_nMax];
G4double odet_timeCFD301[odet_nMax];
G4double odet_timeCFD302[odet_nMax];
G4double odet_timeCFD303[odet_nMax];
G4double odet_timeCFD304[odet_nMax];
G4double odet_timeCFD305[odet_nMax];
G4double odet_timeCFD306[odet_nMax];
G4double odet_timeCFD307[odet_nMax];
G4double odet_timeCFD308[odet_nMax];
G4double odet_timeCFD309[odet_nMax];
G4double odet_timeCFD310[odet_nMax];
G4double odet_timeCFD311[odet_nMax];
G4double odet_timeCFD312[odet_nMax];
G4double odet_timeCFD400[odet_nMax];
G4double odet_timeCFD401[odet_nMax];
G4double odet_timeCFD402[odet_nMax];
G4double odet_timeCFD403[odet_nMax];
G4double odet_timeCFD404[odet_nMax];
G4double odet_timeCFD405[odet_nMax];
G4double odet_timeCFD406[odet_nMax];
G4double odet_timeCFD407[odet_nMax];
G4double odet_timeCFD408[odet_nMax];
G4double odet_timeCFD409[odet_nMax];
G4double odet_timeCFD410[odet_nMax];
G4double odet_timeCFD411[odet_nMax];
G4double odet_timeCFD412[odet_nMax];
G4double odet_timeCFD500[odet_nMax];
G4double odet_timeCFD501[odet_nMax];
G4double odet_timeCFD502[odet_nMax];
G4double odet_timeCFD503[odet_nMax];
G4double odet_timeCFD504[odet_nMax];
G4double odet_timeCFD505[odet_nMax];
G4double odet_timeCFD506[odet_nMax];
G4double odet_timeCFD507[odet_nMax];
G4double odet_timeCFD508[odet_nMax];
G4double odet_timeCFD509[odet_nMax];
G4double odet_timeCFD510[odet_nMax];
G4double odet_timeCFD511[odet_nMax];
G4double odet_timeCFD512[odet_nMax];
public:
static const Int_t save_nMax=1000;

View File

@ -35,13 +35,22 @@ class signalInfo {
public:
signalInfo(G4int id, G4int nP, G4double tFirst,
G4double tA, G4double tB, G4double tC, G4double tD, G4double tE, G4double tLast,
G4double tCFD, G4double aCFD) {
detID=id; nPhot=nP; timeFirst=tFirst;
timeA=tA; timeB=tB; timeC=tC; timeD=tD; timeE=tE; timeLast=tLast;
timeCFD=tCFD; amplCFD=aCFD;}
G4double tCFD, G4double aCFD, G4double tCFDarray[1000])
{
detID=id; nPhot=nP; timeFirst=tFirst;
timeA=tA; timeB=tB; timeC=tC; timeD=tD; timeE=tE; timeLast=tLast;
timeCFD=tCFD; amplCFD=aCFD;
if (musrRootOutput::store_odet_timeCFDarray) {for(int i=0;i<1000;i++) {timeCFDarray[i]=tCFDarray[i];}}
}
~signalInfo() {}
void transferDataToRoot(musrRootOutput* myRootOut, G4int nn) {
myRootOut->SetOPSAinfo(nn,detID,nPhot,timeFirst,timeA,timeB,timeC,timeD,timeE,timeLast,timeCFD,amplCFD);
for (Int_t kk=0; kk<13; kk++) {
for (Int_t ll=0; ll<5; ll++) {
int index = (ll+1)*100+kk;
myRootOut -> SetCFDSpecialInfo(index,timeCFDarray[index]);
}
}
}
private:
@ -59,6 +68,7 @@ class signalInfo {
G4double timeLast;
G4double timeCFD;
G4double amplCFD;
G4double timeCFDarray[1000];
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@ -95,6 +105,7 @@ class musrScintSD : public G4VSensitiveDetector
void ProcessOpticalPhoton(G4Step*);
void EndOfEvent_OptiacalPhotons();
void ReadInPulseShapeArray(const char* filename);
void FindCFDtime(G4double& OPSA_CFD_time, G4double& OPSA_CFD_ampl, G4double timeOfFirstPhoton);
G4int FindAPDcellID(G4Step* aStep);
void SetAPDcellSizes(G4int nx, G4int ny, G4int nz, G4double half_ax, G4double half_ay, G4double half_az) {
APDcellsEffectRequested = true;

160
musrSimAna/201.v1190 Normal file
View File

@ -0,0 +1,160 @@
# TDC V1190 Set up file generated by Deltat : 16-Apr-2008 10:30:27
# bins are always in TDC channel units (195.3125 ps/channel)
INSTRUMENT=GPS
DESCRIPTION=No Veto -- 1port
TYPE=TDCV1190
RESOLUTION=100
MDELAY=0
PDELAY=2000
#REWINDTIMEBINS=10000000
MCOINCIDENCEW=50
PCOINCIDENCEW=50
VCOINCIDENCEW=100
# 30000 mu/s
MUONRATEFACTOR=0.0965819
#INFINITELYLOWMUONRATE
DATAWINDOWMIN=-2.
DATAWINDOWMAX=10.0
PILEUPWINDOWMIN=-10.0
PILEUPWINDOWMAX=10.0
102; "M up"; M; 0.4; 2005; ;
1; "B1"; P; 0.4; 2005; ; B1; 1485; 1515; 50995;
2; "B2"; P; 0.4; 2005; ; B2; 1485; 1515; 50995;
11; "F1"; P; 0.4; 2005; ; F11; 1485; 1515; 50995;
12; "F2"; P; 0.4; 2005; ; F12; 1485; 1515; 50995;
13; "F3"; P; 0.4; 2005; ; F13; 1485; 1515; 50995;
! 21; "Coinc B1" K; 0.4; 2005;
! 22; "Coinc B2" K; 0.4; 2005;
!401; "Act Veto" V; 0.1; 2005;
! 3; "F right"; K; 0.4; 1263;
! 4; "B left"; P; 0.2; 1311; 5 -10 -11 -12 -13; Back; 1485; 1515; 50995;
! 5; "B right"; K; 0.2; 1262;
! 6; Up; P; 0.2; 1306; -10 -11 -12 -13; Up; 1490; 1520; 51000;
! 7; Down; P; 0.2; 1264; -10 -11 -12 -13; Down; 1525; 1555; 51035;
! 8; "R int"; P; 0.2; 1309; -10 -11 -12 -13; R_int; 1480; 1510; 50990;
! 9; "R ext"; P; 0.3; 1267; -10 -11 -12 -13; R_ext; 1520; 1550; 51020; 8; Rite
!10; "Bveto up"; V; 0.3; 2085;
!11; "Bveto down"; V; 0.3; 2089;
!12; "Bveto left"; V; 0.3; 2080;
!13; "Bveto right"; V; 0.3; 2079;
!14; "F center"; P; 0.2; 2073; -10 -11 -12 -13; F_cntr; 720; 750; 50230; 2; Forw
!15; Clock; C;
!16; Rejected; R;
!17; Ch17; N;
!18; Ch18; N;
!19; Ch19; N;
!20; Ch20; N;
!21; Ch21; N;
!22; Ch22; N;
!23; Ch23; N;
!24; Ch24; N;
!25; Ch25; N;
!26; Ch26; N;
!27; Ch27; N;
!28; Ch28; N;
!29; Ch29; N;
!30; Ch30; N;
!31; Ch31; N;
#DEBUGEVENT 704 10
#DEBUGEVENT 1427 10
#DEBUGEVENT 3222 10
#DEBUGEVENT 5223 10
#DEBUGEVENT 8351 10
#DEBUGEVENT 8581 10
#DEBUGEVENT 9041 10
#DEBUGEVENT 9645 10
counterPhaseShifts 1 0 2 0 11 180 12 180 13 180
counterGrouping B 1 2
counterGrouping F 11 12 13
musrTH2D hMuDecayMap "Muon decay map;z [mm]; r[mm]" 100 -80. 20. 40 0. 20. muDecayPosZ muDecayPosR
musrTH2D hMuDecayMap_a "Muon decay map;z (mm); x (mm)" 400 -300. 100. 400 -200. 200. muDecayPosZ muDecayPosX
musrTH2D hMuDecayMappileup "Pileup muon decay map;z (mm); r (mm)" 400 -300. 100. 200 0. 200. pileup_muDecayPosZ pileup_muDecayPosR
musrTH2D hMuDecayMappileup_a "Pileup muon decay map;z (mm); x (mm)" 400 -300. 100. 400 -200. 200. pileup_muDecayPosZ pileup_muDecayPosX
musrTH1D hMuDecayPosZ "Penetration of muons into the sample;z (mm);N" 100 -5.0 5. muDecayPosZ
musrTH1D hMuDecayPosZpileup "Decay of the muons contributing to pileup bgr.;z[mm];N" 400 -300 100 pileup_muDecayPosZ
musrTH1D hMuDecayPosX "X of decayed muons;x[mm];N" 100 -5.0 5. muDecayPosX
musrTH1D hdet_m0edep "Energy deposited in the trigger;E[MeV];N" 100 0. 2 det_m0edep
musrTH1D hdet_posEdep "Energy deposited in the positron Counters;E[MeV];N" 100 0. 2 det_posEdep
#musrTH1D hdet_time0 "detected muSR spectra;time[#mus];N" 220 -11. 11. det_time0
#musrTH1D hdet_time1 "detected muSR spectra;time[#mus];N" 220 -11. 11. det_time1
#musrTH1D hdet_time10 "detected muSR spectra;time[#mus];N" 220 -11. 11. det_time10
musrTH1D hgen_time10 "generated muSR spectra;time[#mus];N" 220 -11. 11. gen_time10
musrTH1D hdet_time10_MINUS_gen_time10 "detected - generated ;time_{det}-time_{gen} [ps];N" 100 -500. 500. det_time10_MINUS_gen_time10
#musrTH1D hMuDecayDetID "Detector ID where the muons decay;Detector ID; N" 4000 -2000. 2000. muDecayDetID
musrTH1D hdet_time10 "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time10
musrTH1D hdet_time10_Bgr "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time10
musrTH1D hdet_time20 "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time20
musrTH1D hdet_time20_Bgr "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time20
musrTH1D hMuDecayDetID "Detector ID where the muons decay;Detector ID; N" 2002 -1001. 1001. muDecayDetID
musrTH1D hMuDecayDetIDpileup "Detector ID where the pileup muons decay;Detector ID; N" 2002 -1001. 1001. pileup_muDecayDetID
humanDecayHistograms hMuDecayDetID hMuDecayDetIDpileup 201 Sample 211 SampleCell 300 Holder 301 Holder 302 Holder 303 Holder 304 Holder 305 Holder 306 Holder 307 Holder 308 Holder 309 Holder 310 Holder 313 Holder 314 Holder 315 Holder 316 Holder 251 Col_Cu 255 Col_1 257 Col_1 261 Col_2 263 Col_2 265 Al_Plate 102 M0 103 M0Holder 1 BC 2 BC 11 FC 12 FC 13 FC -1 World 291 Magnet 292 Magnet 293 Al_Uprof 230 Elsewhere 231 Elsewhere 232 Elsewhere 233 Elsewhere 256 Elsewhere 262 Elsewhere 267 Elsewhere -1000 Escaped
condition 0 alwaysTrue
condition 1 oncePerEvent
condition 2 muonDecayedInSample_gen
condition 3 muonTriggered_gen
condition 4 muonTriggered_det
condition 5 positronHit_det
condition 6 goodEvent_det
condition 7 goodEvent_gen
condition 8 goodEvent_det_AND_goodEvent_gen
condition 9 pileupEvent
condition 10 goodEvent_F_det
condition 11 goodEvent_B_det
condition 12 goodEvent_F_det_AND_pileupEvent
condition 13 goodEvent_B_det_AND_pileupEvent
fit hdet_time20_Bgr pol0 WW -1.9 -0.1 0
fit hdet_time20 funct4 "" 0.2 9.8 0 0 0.3 100 0
fit hdet_time10 funct4 "" 0.05 9.95 0 0 0.3 100 0
fit hdet_time10_Bgr pol0 WW -1.95 -0.05 0
#draw hMuDecayPosZ 0
draw hMuDecayPosZ 1
#draw hMuDecayPosZ 2
#draw hMuDecayPosZ 3
#draw hMuDecayPosZ 4
###draw hMuDecayMap 0
###draw hMuDecayMap 1
draw hdet_m0edep 0
draw hdet_m0edep 1
draw hdet_m0edep 2
draw hdet_m0edep 3
draw hdet_m0edep 4
draw hdet_m0edep 5
draw hdet_m0edep 6
draw hdet_time10 6
#draw hdet_time20 10
#draw hdet_time20 11
#draw hdet_time20_Bgr 10
#draw hdet_time20_Bgr 11
draw hgen_time10 7
draw hdet_time10_MINUS_gen_time10 8
draw hdet_posEdep 5
draw hMuDecayDetID 1
draw hdet_m0edep 9
draw hdet_time10 9
draw hMuDecayDetIDpileup 1
draw hMuDecayDetIDpileup 6
draw hMuDecayDetIDpileup 9
draw humanDecayHistograms 1
draw humanDecayHistograms 6
draw humanDecayHistograms 9
draw humanDecayPileupHistograms 1
draw humanDecayPileupHistograms 6
draw humanDecayPileupHistograms 9
draw hdet_time20 4
draw hdet_time20 6
$

158
musrSimAna/201a.v1190 Normal file
View File

@ -0,0 +1,158 @@
# TDC V1190 Set up file generated by Deltat : 16-Apr-2008 10:30:27
# bins are always in TDC channel units (195.3125 ps/channel)
INSTRUMENT=GPS
DESCRIPTION=No Veto -- 1port
TYPE=TDCV1190
RESOLUTION=100
MDELAY=0
PDELAY=2000
#REWINDTIMEBINS=10000000
MCOINCIDENCEW=50
PCOINCIDENCEW=50
VCOINCIDENCEW=100
# 30000 mu/s
#MUONRATEFACTOR=0.0965819
INFINITELYLOWMUONRATE
DATAWINDOWMIN=-2.
DATAWINDOWMAX=10.0
PILEUPWINDOWMIN=-10.0
PILEUPWINDOWMAX=10.0
102; "M up"; M; 0.4; 2005; ;
1; "B1"; P; 0.4; 2005; ; B1; 1485; 1515; 50995;
2; "B2"; P; 0.4; 2005; ; B2; 1485; 1515; 50995;
11; "F1"; P; 0.4; 2005; ; F11; 1485; 1515; 50995;
12; "F2"; P; 0.4; 2005; ; F12; 1485; 1515; 50995;
13; "F3"; P; 0.4; 2005; ; F13; 1485; 1515; 50995;
! 21; "Coinc B1" K; 0.4; 2005;
! 22; "Coinc B2" K; 0.4; 2005;
!401; "Act Veto" V; 0.1; 2005;
! 3; "F right"; K; 0.4; 1263;
! 4; "B left"; P; 0.2; 1311; 5 -10 -11 -12 -13; Back; 1485; 1515; 50995;
! 5; "B right"; K; 0.2; 1262;
! 6; Up; P; 0.2; 1306; -10 -11 -12 -13; Up; 1490; 1520; 51000;
! 7; Down; P; 0.2; 1264; -10 -11 -12 -13; Down; 1525; 1555; 51035;
! 8; "R int"; P; 0.2; 1309; -10 -11 -12 -13; R_int; 1480; 1510; 50990;
! 9; "R ext"; P; 0.3; 1267; -10 -11 -12 -13; R_ext; 1520; 1550; 51020; 8; Rite
!10; "Bveto up"; V; 0.3; 2085;
!11; "Bveto down"; V; 0.3; 2089;
!12; "Bveto left"; V; 0.3; 2080;
!13; "Bveto right"; V; 0.3; 2079;
!14; "F center"; P; 0.2; 2073; -10 -11 -12 -13; F_cntr; 720; 750; 50230; 2; Forw
!15; Clock; C;
!16; Rejected; R;
!17; Ch17; N;
!18; Ch18; N;
!19; Ch19; N;
!20; Ch20; N;
!21; Ch21; N;
!22; Ch22; N;
!23; Ch23; N;
!24; Ch24; N;
!25; Ch25; N;
!26; Ch26; N;
!27; Ch27; N;
!28; Ch28; N;
!29; Ch29; N;
!30; Ch30; N;
!31; Ch31; N;
#DEBUGEVENT 704 10
#DEBUGEVENT 1427 10
#DEBUGEVENT 3222 10
#DEBUGEVENT 5223 10
#DEBUGEVENT 8351 10
#DEBUGEVENT 8581 10
#DEBUGEVENT 9041 10
#DEBUGEVENT 9645 10
counterPhaseShifts 1 0 2 0 11 180 12 180 13 180
counterGrouping B 1 2
counterGrouping F 11 12 13
musrTH2D hMuDecayMap "Muon decay map;z [mm]; r[mm]" 100 -80. 20. 40 0. 20. muDecayPosZ muDecayPosR
musrTH2D hMuDecayMappileup "Pileup muon decay map;z [mm]; r[mm]" 400 -300. 100. 200 0. 200. pileup_muDecayPosZ pileup_muDecayPosR
musrTH1D hMuDecayPosZ "Penetration of muons into the sample;z[mm];N" 100 -5.0 5. muDecayPosZ
musrTH1D hMuDecayPosZpileup "Decay of the muons contributing to pileup bgr.;z[mm];N" 400 -300 100 pileup_muDecayPosZ
musrTH1D hMuDecayPosX "X of decayed muons;x[mm];N" 100 -5.0 5. muDecayPosX
musrTH1D hdet_m0edep "Energy deposited in the trigger;E[MeV];N" 100 0. 2 det_m0edep
musrTH1D hdet_posEdep "Energy deposited in the positron Counters;E[MeV];N" 100 0. 2 det_posEdep
#musrTH1D hdet_time0 "detected muSR spectra;time[#mus];N" 220 -11. 11. det_time0
#musrTH1D hdet_time1 "detected muSR spectra;time[#mus];N" 220 -11. 11. det_time1
#musrTH1D hdet_time10 "detected muSR spectra;time[#mus];N" 220 -11. 11. det_time10
musrTH1D hgen_time10 "generated muSR spectra;time[#mus];N" 220 -11. 11. gen_time10
musrTH1D hdet_time10_MINUS_gen_time10 "detected - generated ;time_{det}-time_{gen} [ps];N" 100 -500. 500. det_time10_MINUS_gen_time10
#musrTH1D hMuDecayDetID "Detector ID where the muons decay;Detector ID; N" 4000 -2000. 2000. muDecayDetID
musrTH1D hdet_time10 "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time10
musrTH1D hdet_time10_Bgr "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time10
musrTH1D hdet_time20 "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time20
musrTH1D hdet_time20_Bgr "detected muSR spectra (phase shifted);time[#mus];N" 700 -2.0 12.0 det_time20
musrTH1D hMuDecayDetID "Detector ID where the muons decay;Detector ID; N" 2002 -1001. 1001. muDecayDetID
musrTH1D hMuDecayDetIDpileup "Detector ID where the pileup muons decay;Detector ID; N" 2002 -1001. 1001. pileup_muDecayDetID
humanDecayHistograms hMuDecayDetID hMuDecayDetIDpileup 201 Sample 211 SampleCell 300 Holder 301 Holder 302 Holder 303 Holder 304 Holder 305 Holder 306 Holder 307 Holder 308 Holder 309 Holder 310 Holder 313 Holder 314 Holder 315 Holder 316 Holder 251 Col_Cu 255 Col_1 257 Col_1 261 Col_2 263 Col_2 265 Al_Plate 102 M0 103 M0Holder 1 BC 2 BC 11 FC 12 FC 13 FC -1 World 291 Magnet 292 Magnet 293 Al_Uprof 230 Elsewhere 231 Elsewhere 232 Elsewhere 233 Elsewhere 256 Elsewhere 262 Elsewhere 267 Elsewhere -1000 Escaped
condition 0 alwaysTrue
condition 1 oncePerEvent
condition 2 muonDecayedInSample_gen
condition 3 muonTriggered_gen
condition 4 muonTriggered_det
condition 5 positronHit_det
condition 6 goodEvent_det
condition 7 goodEvent_gen
condition 8 goodEvent_det_AND_goodEvent_gen
condition 9 pileupEvent
condition 10 goodEvent_F_det
condition 11 goodEvent_B_det
condition 12 goodEvent_F_det_AND_pileupEvent
condition 13 goodEvent_B_det_AND_pileupEvent
fit hdet_time20_Bgr pol0 WW -1.9 -0.1 0
fit hdet_time20 funct4 "" 0.2 9.8 0 0 0.3 100 0
fit hdet_time10 funct4 "" 0.05 9.95 0 0 0.3 100 0
fit hdet_time10_Bgr pol0 WW -1.95 -0.05 0
#draw hMuDecayPosZ 0
draw hMuDecayPosZ 1
#draw hMuDecayPosZ 2
#draw hMuDecayPosZ 3
#draw hMuDecayPosZ 4
###draw hMuDecayMap 0
###draw hMuDecayMap 1
draw hdet_m0edep 0
draw hdet_m0edep 1
draw hdet_m0edep 2
draw hdet_m0edep 3
draw hdet_m0edep 4
draw hdet_m0edep 5
draw hdet_m0edep 6
draw hdet_time10 6
#draw hdet_time20 10
#draw hdet_time20 11
#draw hdet_time20_Bgr 10
#draw hdet_time20_Bgr 11
draw hgen_time10 7
draw hdet_time10_MINUS_gen_time10 8
draw hdet_posEdep 5
draw hMuDecayDetID 1
draw hdet_m0edep 9
draw hdet_time10 9
draw hMuDecayDetIDpileup 1
draw hMuDecayDetIDpileup 6
draw hMuDecayDetIDpileup 9
draw humanDecayHistograms 1
draw humanDecayHistograms 6
draw humanDecayHistograms 9
draw humanDecayPileupHistograms 1
draw humanDecayPileupHistograms 6
draw humanDecayPileupHistograms 9
draw hdet_time20 4
draw hdet_time20 6
$

View File

@ -503,8 +503,9 @@ void musrAnalysis::ReadInInputParameters(char* charV1190FileName) {
}
}
else if (strcmp(tmpString0,"fit")==0) {
char histoName[100]; char functionName[100]; float xMin; float xMax; float p0, p1, p2, p3, p4, p5, p6;
sscanf(&line[0],"%*s %s %s %g %g %g %g %g %g %g",histoName,functionName,&xMin,&xMax,&p0,&p1,&p2,&p3,&p4,&p5,&p6);
char histoName[100]; char functionName[100]; char functOption[100]; float xMin; float xMax; float p0, p1, p2, p3, p4, p5, p6;
sscanf(&line[0],"%*s %s %s %s %g %g %g %g %g %g %g",histoName,functionName,functOption,&xMin,&xMax,&p0,&p1,&p2,&p3,&p4,&p5,&p6);
if (strcmp(functOption,"\"\"")==0) strcpy(functOption,"");
TF1 *funct;
@ -576,7 +577,7 @@ void musrAnalysis::ReadInInputParameters(char* charV1190FileName) {
exit(1);
}
tmpHistograms->AssignFunction(funct, xMin, xMax);
tmpHistograms->AssignFunction(funct, functOption, xMin, xMax);
}
else {
@ -957,6 +958,8 @@ void musrAnalysis::FillHistograms(Int_t iiiEntry) {
// Long64_t dataBinMax = (mCounterHitExistsForThisEventID) ? timeBin0+dataWindowBinMax : timeBinOfThePreviouslyProcessedHit+100000000;
pileup_eventID = -1001;
pileup_muDecayDetID_double = -1001;
pileup_muDecayPosX = -1000000000;
pileup_muDecayPosY = -1000000000;
pileup_muDecayPosZ = -1000000000;
pileup_muDecayPosR = -1000000000;
if (mCounterHitExistsForThisEventID) {
@ -970,6 +973,8 @@ void musrAnalysis::FillHistograms(Int_t iiiEntry) {
fChain->GetEntry(posEntry);
pileup_eventID = eventID;
pileup_muDecayDetID_double = muDecayDetID;
pileup_muDecayPosX = muDecayPosX;
pileup_muDecayPosY = muDecayPosY;
pileup_muDecayPosZ = muDecayPosZ;
pileup_muDecayPosR = sqrt(muDecayPosX*muDecayPosX+muDecayPosY*muDecayPosY);
// if (pileup_muDecayDetID_double==-1000) {

View File

@ -208,6 +208,8 @@ public :
Double_t det_time20;
Double_t pileup_eventID;
Double_t pileup_muDecayDetID_double;
Double_t pileup_muDecayPosX;
Double_t pileup_muDecayPosY;
Double_t pileup_muDecayPosZ;
Double_t pileup_muDecayPosR;
@ -443,6 +445,8 @@ musrAnalysis::musrAnalysis(TTree *tree)
variableMap["det_time10_MINUS_gen_time10"]=&det_time10_MINUS_gen_time10;
variableMap["pileup_eventID"]=&pileup_eventID;
variableMap["pileup_muDecayDetID"]=&pileup_muDecayDetID_double;
variableMap["pileup_muDecayPosX"]=&pileup_muDecayPosX;
variableMap["pileup_muDecayPosY"]=&pileup_muDecayPosY;
variableMap["pileup_muDecayPosZ"]=&pileup_muDecayPosZ;
variableMap["pileup_muDecayPosR"]=&pileup_muDecayPosR;
variableMap["det_time20"]=&det_time20;

View File

@ -16,6 +16,7 @@ musrTH::musrTH(char* dimension, char* histoName, char* histoTitle, Int_t nrOfBin
bool_rotating_reference_frame=false;
rot_ref_frequency=0;
rot_ref_phase=0;
strcpy(funct_option,"");
// std::cout<<"hojhoj variableName1="<<variableName1<<" variableToBeFilled_X="<<variableToBeFilled_X<<std::endl;
char nameHist[500];
@ -189,10 +190,12 @@ void musrTH::FillHumanDecayArray(musrTH* decayMapHistos, humanDecayMapType myMap
}
}
//==============================================================================================
void musrTH::AssignFunction(TF1* function, Double_t xMin, Double_t xMax) {
void musrTH::AssignFunction(TF1* function, char* functOption, Double_t xMin, Double_t xMax) {
funct = function;
strcpy(funct_option,functOption);
funct_xMin = xMin;
funct_xMax = xMax;
std::cout<<"musrTH::AssignFunction: "<<funct->GetName()<<", option="<<funct_option<<", xMin="<<xMin<<", xMax="<<xMax<<std::endl;
}
//==============================================================================================
@ -218,13 +221,16 @@ void musrTH::FitHistogramsIfRequired(Double_t omega) {
}
}
Double_t ppp[100];
std::cout<<" Initial parameter setting: ";
for (Int_t i=0; i<(funct->GetNumberFreeParameters()); i++) std::cout<<funct->GetParameter(i)<<", ";
Int_t n_ppp = funct->GetNumberFreeParameters();
for (Int_t i=0; i<n_ppp; i++) {ppp[i]=funct->GetParameter(i); std::cout<<ppp[i]<<", ";}
std::cout<<std::endl;
for (Int_t i=0; i<musrAnalysis::nrConditions; i++) {
// std::cout<<"fitted histogram pointer="<<histArray1D[i]<<std::endl;
histArray1D[i]->Fit(funct,"WW","",funct_xMin,funct_xMax);
for (Int_t j=0; j<n_ppp; j++) {funct->SetParameter(j,ppp[j]);}
histArray1D[i]->Fit(funct,funct_option,"",funct_xMin,funct_xMax);
// histArray1D[i]->Fit(funct,"LL","",funct_xMin,funct_xMax);
}
// if (strcmp(funct->GetName(),"simpleExpoPLUSconst")==0) {

View File

@ -37,7 +37,7 @@ public:
Int_t GetNbinsX1D();
Int_t GetNbinsX2D();
Int_t GetNbinsY2D();
void AssignFunction(TF1* function, Double_t xMin, Double_t xMax);
void AssignFunction(TF1* function, char* functOption, Double_t xMin, Double_t xMax);
void FitHistogramsIfRequired(Double_t omega);
void SetRotatingReferenceFrame(Double_t frequency, Double_t phase) {bool_rotating_reference_frame=true;
rot_ref_frequency=frequency; rot_ref_phase=phase;}
@ -52,6 +52,7 @@ private:
std::list<int> drawList;
TF1* funct;
Double_t funct_xMin, funct_xMax;
char funct_option[100];
Bool_t bool_rotating_reference_frame;
Double_t rot_ref_frequency, rot_ref_phase;
// Double_t N0_FromLastFit;

View File

@ -18,67 +18,32 @@
#
#============================================================
/musr/command visattributes log_World invisible
/musr/command visattributes log_source red
#/musr/command visattributes log_source red
/musr/command visattributes G4_PLASTIC_SC_VINYLTOLUENE lightblue
###################################################################################
######################### P H Y S I C S P R O C E S S E S ##################
###################################################################################
# --- Low Energy (default) ---
/musr/command process addDiscreteProcess gamma G4LowEnergyPhotoElectric
/musr/command process addDiscreteProcess gamma G4LowEnergyCompton
/musr/command process addDiscreteProcess gamma G4LowEnergyGammaConversion
/musr/command process addDiscreteProcess gamma G4LowEnergyRayleigh
/musr/command process addProcess e- G4MultipleScattering -1 1 1
#/musr/command process addDiscreteProcess e- G4CoulombScattering
/musr/command process addProcess e- G4LowEnergyIonisation -1 2 2
/musr/command process addProcess e- G4LowEnergyBremsstrahlung -1 -1 3
/musr/command process addProcess e+ G4MultipleScattering -1 1 1
#/musr/command process addDiscreteProcess e+ G4CoulombScattering
/musr/command process addProcess e+ G4eIonisation -1 2 2
/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
# Geant 4.9.4
/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
/musr/command process addDiscreteProcess gamma G4ComptonScattering
/musr/command process addDiscreteProcess gamma G4GammaConversion
/musr/command process addDiscreteProcess gamma G4RayleighScattering
/musr/command process addProcess e- G4eMultipleScattering -1 1 1
/musr/command process addProcess e- G4eIonisation -1 2 2
/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eMultipleScattering -1 1 1
/musr/command process addProcess e+ G4eIonisation -1 2 2
/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
#/musr/command process addProcess mu- G4MuMultipleScattering -1 1 1
#/musr/command process addProcess mu- G4MuIonisation -1 2 2
#/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu- G4MuPairProduction -1 4 4
#/musr/command process addProcess mu+ G4MuMultipleScattering -1 1 1
#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
#
# --- High Energy ---
#/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
#/musr/command process addDiscreteProcess gamma G4ComptonScattering
#/musr/command process addDiscreteProcess gamma G4GammaConversion
#/musr/command process addProcess e- G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e- G4CoulombScattering
#/musr/command process addProcess e- G4eIonisation -1 2 2
#/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
#/musr/command process addProcess e+ G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e+ G4CoulombScattering
#/musr/command process addProcess e+ G4eIonisation -1 2 2
#/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
#/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
#
# --- Penelope ---
#/musr/command process addDiscreteProcess gamma G4PenelopePhotoElectric
#/musr/command process addDiscreteProcess gamma G4PenelopeCompton
#/musr/command process addDiscreteProcess gamma G4PenelopeGammaConversion
#/musr/command process addDiscreteProcess gamma G4PenelopeRayleigh
#/musr/command process addProcess e- G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e- G4CoulombScattering
#/musr/command process addProcess e- G4PenelopeIonisation -1 2 2
#/musr/command process addProcess e- G4PenelopeBremsstrahlung -1 -1 3
#/musr/command process addProcess e+ G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e+ G4CoulombScattering
#/musr/command process addProcess e+ G4PenelopeIonisation, -1 2 2
#/musr/command process addProcess e+ G4PenelopeBremsstrahlung, -1 -1 3
#/musr/command process addProcess e+ G4PenelopeAnnihilation, 0 -1 4
#
# --- Muons ---
#/musr/command process addProcess mu+ G4MultipleScattering -1 1 1
##/musr/command process addProcess mu+ MultipleAndCoulombScattering -1 1 1 goulombRegion
##/musr/command process addDiscreteProcess mu+ G4CoulombScattering
#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
#/musr/command process addProcess mu- G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess mu- G4CoulombScattering
#/musr/command process addProcess mu- G4MuIonisation -1 2 2
#/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu- G4MuPairProduction -1 4 4
###################################################################################
################## S O M E O T H E R P A R A M E T E R S ##################
###################################################################################
@ -165,6 +130,19 @@
/musr/command rootOutput det_VvvProcID off
/musr/command rootOutput det_VvvTrackID off
/musr/command rootOutput det_VvvParticleID off
/musr/command rootOutput odet_ID off
/musr/command rootOutput nOptPhot off
/musr/command rootOutput odet_nPhot off
/musr/command rootOutput odet_timeFirst off
/musr/command rootOutput odet_timeA off
/musr/command rootOutput odet_timeB off
/musr/command rootOutput odet_timeC off
/musr/command rootOutput odet_timeD off
/musr/command rootOutput odet_timeE off
/musr/command rootOutput odet_timeMean off
/musr/command rootOutput odet_timeLast off
/musr/command rootOutput odet_timeCFD off
/musr/command rootOutput odet_amplCFD off
### Root variables that are not written out by default, but can be switched on:
#/musr/command rootOutput fieldIntegralBx on
#/musr/command rootOutput fieldIntegralBy on
@ -177,7 +155,7 @@
###################################################################################
#/vis/disable
#/control/execute visFromToni.mac
/control/execute visDawn102.mac
/control/execute visDawn101.mac
#/control/execute visVRML.mac
###################################################################################
######################### P A R T I C L E G U N #################################
@ -200,4 +178,5 @@
#/gps/ang/maxtheta 2 deg
#/gps/ang/maxphi 2 deg
######################## B E A M O N #######################################
/run/beamOn 10
#/run/beamOn 1000
/run/beamOn 5

View File

@ -23,62 +23,27 @@
###################################################################################
######################### P H Y S I C S P R O C E S S E S ##################
###################################################################################
# --- Low Energy (default) ---
/musr/command process addDiscreteProcess gamma G4LowEnergyPhotoElectric
/musr/command process addDiscreteProcess gamma G4LowEnergyCompton
/musr/command process addDiscreteProcess gamma G4LowEnergyGammaConversion
/musr/command process addDiscreteProcess gamma G4LowEnergyRayleigh
/musr/command process addProcess e- G4MultipleScattering -1 1 1
#/musr/command process addDiscreteProcess e- G4CoulombScattering
/musr/command process addProcess e- G4LowEnergyIonisation -1 2 2
/musr/command process addProcess e- G4LowEnergyBremsstrahlung -1 -1 3
/musr/command process addProcess e+ G4MultipleScattering -1 1 1
#/musr/command process addDiscreteProcess e+ G4CoulombScattering
/musr/command process addProcess e+ G4eIonisation -1 2 2
/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
# Geant 4.9.4
/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
/musr/command process addDiscreteProcess gamma G4ComptonScattering
/musr/command process addDiscreteProcess gamma G4GammaConversion
/musr/command process addDiscreteProcess gamma G4RayleighScattering
/musr/command process addProcess e- G4eMultipleScattering -1 1 1
/musr/command process addProcess e- G4eIonisation -1 2 2
/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eMultipleScattering -1 1 1
/musr/command process addProcess e+ G4eIonisation -1 2 2
/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
#/musr/command process addProcess mu- G4MuMultipleScattering -1 1 1
#/musr/command process addProcess mu- G4MuIonisation -1 2 2
#/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu- G4MuPairProduction -1 4 4
#/musr/command process addProcess mu+ G4MuMultipleScattering -1 1 1
#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
#
# --- High Energy ---
#/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
#/musr/command process addDiscreteProcess gamma G4ComptonScattering
#/musr/command process addDiscreteProcess gamma G4GammaConversion
#/musr/command process addProcess e- G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e- G4CoulombScattering
#/musr/command process addProcess e- G4eIonisation -1 2 2
#/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
#/musr/command process addProcess e+ G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e+ G4CoulombScattering
#/musr/command process addProcess e+ G4eIonisation -1 2 2
#/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
#/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
#
# --- Penelope ---
#/musr/command process addDiscreteProcess gamma G4PenelopePhotoElectric
#/musr/command process addDiscreteProcess gamma G4PenelopeCompton
#/musr/command process addDiscreteProcess gamma G4PenelopeGammaConversion
#/musr/command process addDiscreteProcess gamma G4PenelopeRayleigh
#/musr/command process addProcess e- G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e- G4CoulombScattering
#/musr/command process addProcess e- G4PenelopeIonisation -1 2 2
#/musr/command process addProcess e- G4PenelopeBremsstrahlung -1 -1 3
#/musr/command process addProcess e+ G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess e+ G4CoulombScattering
#/musr/command process addProcess e+ G4PenelopeIonisation, -1 2 2
#/musr/command process addProcess e+ G4PenelopeBremsstrahlung, -1 -1 3
#/musr/command process addProcess e+ G4PenelopeAnnihilation, 0 -1 4
#
# --- Muons ---
#/musr/command process addProcess mu+ G4MultipleScattering -1 1 1
##/musr/command process addProcess mu+ MultipleAndCoulombScattering -1 1 1 goulombRegion
##/musr/command process addDiscreteProcess mu+ G4CoulombScattering
#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
#/musr/command process addProcess mu- G4MultipleScattering -1 1 1
##/musr/command process addDiscreteProcess mu- G4CoulombScattering
#/musr/command process addProcess mu- G4MuIonisation -1 2 2
#/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu- G4MuPairProduction -1 4 4
###################################################################################
################## S O M E O T H E R P A R A M E T E R S ##################
###################################################################################
@ -165,6 +130,19 @@
/musr/command rootOutput det_VvvProcID off
/musr/command rootOutput det_VvvTrackID off
/musr/command rootOutput det_VvvParticleID off
/musr/command rootOutput odet_ID off
/musr/command rootOutput nOptPhot off
/musr/command rootOutput odet_nPhot off
/musr/command rootOutput odet_timeFirst off
/musr/command rootOutput odet_timeA off
/musr/command rootOutput odet_timeB off
/musr/command rootOutput odet_timeC off
/musr/command rootOutput odet_timeD off
/musr/command rootOutput odet_timeE off
/musr/command rootOutput odet_timeMean off
/musr/command rootOutput odet_timeLast off
/musr/command rootOutput odet_timeCFD off
/musr/command rootOutput odet_amplCFD off
### Root variables that are not written out by default, but can be switched on:
#/musr/command rootOutput fieldIntegralBx on
#/musr/command rootOutput fieldIntegralBy on
@ -177,7 +155,7 @@
###################################################################################
#/vis/disable
#/control/execute visFromToni.mac
/control/execute visDawn1.mac
/control/execute visDawn102.mac
#/control/execute visVRML.mac
###################################################################################
######################### P A R T I C L E G U N #################################

241
run/110.mac Normal file
View File

@ -0,0 +1,241 @@
#-----------------------------------------------------------------------
# Macro file for the simulation of electron/positrons from the Sr decay
# passing through the scintiallator detectors (blocks).
# Unless specified otherwises, the default units are mm, ns, MeV, MeV/c.
# Lines starting with star "#" are comments.
###################################################################################
############################# G E O M E T R Y ###################################
#
# WORLD
/musr/command construct box World 10 10 100 G4_AIR 0 0 0 no_logical_volume norot dead -1
#
# Sr SOURCE
/musr/command construct sphere source 0 0.02 0 360 0 180 G4_Sr 0 0 0 log_World norot dead 301
#
# SCINTILLATOR BLOCKS
/musr/command construct box scintFarAwayC1 1.5 1.5 1 G4_PLASTIC_SC_VINYLTOLUENE 0 0 5 log_World norot musr/ScintSD 10
/musr/command construct box scintFarAwayC2 1.5 1.5 1 G4_PLASTIC_SC_VINYLTOLUENE 0 0 14 log_World norot musr/ScintSD 11
#
# APDs
/musr/command construct box APD1 0.1 1.5 1.5 G4_Cu 1.6 0 5 log_World norot dead 20
/musr/command construct box APD2 0.1 1.5 1.5 G4_Cu 1.6 0 14 log_World norot dead 21
#
# Plastic holders
/musr/command construct box Holder1 0.75 4 4 G4_GLASS_PLATE 2.5 0 5 log_World norot dead 30
/musr/command construct box Holder2 0.75 4 4 G4_GLASS_PLATE 2.5 0 14 log_World norot dead 31
#============================================================
/musr/command visattributes log_World invisible
/musr/command visattributes log_source red
/musr/command visattributes G4_PLASTIC_SC_VINYLTOLUENE lightblue
/musr/command visattributes log_APD1 red
###################################################################################
########################## O P T I C A L P H O T O N S #########################
# PhotonEnergy[nEntries] =
# { 2.695*eV, 2.75489*eV, 2.8175*eV, 2.88302*eV, // 460, 450, 440, 430 nm
# 2.95167*eV, 3.02366*eV, 3.09925*eV, 3.17872*eV, 3.26237*eV, // 420, 410, 400, 390, 380 nm
# 3.30587*eV, 3.35054*eV, 3.44361*eV, 3.542*eV, 3.64618*eV }; // 375, 370, 360, 350, 340 nm
#/musr/command materialPropertiesTable optScintMPT ABSLENGTH 2 2.695e-6 3.64618e-6 80 80
/musr/command materialPropertiesTable optScintMPT RINDEX 2 2.695e-6 3.64618e-6 1.58 1.58
/musr/command materialPropertiesTable optScintMPT FASTCOMPONENT 14 2.695e-6 2.75489e-6 2.8175e-6 2.88302e-6 2.95167e-6 3.02366e-6 3.09925e-6 3.17872e-6 3.26237e-6 3.30587e-6 3.35054e-6 3.44361e-6 3.542e-6 3.64618e-6 0.01 0.07 0.15 0.26 0.375 0.52 0.65 0.80 0.95 1 0.88 0.44 0.08 0.01
#/musr/command materialPropertiesTable optScintMPT SLOWCOMPONENT 14 2.695e-6 2.75489e-6 2.8175e-6 2.88302e-6 2.95167e-6 3.02366e-6 3.09925e-6 3.17872e-6 3.26237e-6 3.30587e-6 3.35054e-6 3.44361e-6 3.542e-6 3.64618e-6 0.01 0.07 0.15 0.26 0.375 0.52 0.65 0.80 0.95 1 0.88 0.44 0.08 0.01
/musr/command materialPropertiesTable optScintMPT SCINTILLATIONYIELD 0 9167.
/musr/command materialPropertiesTable optScintMPT RESOLUTIONSCALE 0 1.0
/musr/command materialPropertiesTable optScintMPT FASTTIMECONSTANT 0 1.32
/musr/command materialPropertiesTable optScintMPT FASTSCINTILLATIONRISETIME 0 0.063
#/musr/command materialPropertiesTable optScintMPT SLOWTIMECONSTANT 0 1.6
/musr/command materialPropertiesTable optScintMPT YIELDRATIO 0 1.0
/musr/command setMaterialPropertiesTable optScintMPT G4_PLASTIC_SC_VINYLTOLUENE
#
# AIR
/musr/command materialPropertiesTable optAIR_MPT ABSLENGTH 2 2.0e-6 4.5e-6 0.001 0.001
/musr/command materialPropertiesTable optAIR_MPT RINDEX 2 2.0e-6 4.5e-6 1.0003 1.0003
/musr/command setMaterialPropertiesTable optAIR_MPT G4_AIR
#
# OPTICAL BOUNDARY: SCINTILLATOR -> AIR
#/musr/command materialPropertiesTable airWrap1 REFLECTIVITY 2 2.0e-6 4.5e-6 1.0 1.0
#/musr/command materialPropertiesTable airWrap1 EFFICIENCY 2 2.0e-6 4.5e-6 0. 0.
#/musr/command materialPropertiesTable airWrap1
#/musr/command opticalSurface airBoundary1 phys_scintFarAwayC1 phys_World dielectric_dielectric polished unified airWrap1
/musr/command opticalSurface airBoundary1 phys_scintFarAwayC1 phys_World dielectric_dielectric polishedteflonair LUT
# OPTICAL BOUNDARY: SCINTILLATOR -> AIR
#/musr/command materialPropertiesTable airWrap2 REFLECTIVITY 2 2.0e-6 4.5e-6 1.0 1.0
#/musr/command materialPropertiesTable airWrap2 EFFICIENCY 2 2.0e-6 4.5e-6 0. 0.
/musr/command opticalSurface airBoundary2 phys_scintFarAwayC2 phys_World dielectric_dielectric polishedteflonair LUT
#
# OPTICAL BOUNDARY: SCINTILLATOR -> APD 1
/musr/command materialPropertiesTable apdWrapping1 REFLECTIVITY 2 2.0e-6 4.5e-6 0.0 0.0
/musr/command materialPropertiesTable apdWrapping1 EFFICIENCY 2 2.0e-6 4.5e-6 0.25 0.25
/musr/command opticalSurface APDsurface phys_scintFarAwayC1 phys_APD1 dielectric_metal polished LUT apdWrapping1
#
# OPTICAL BOUNDARY: SCINTILLATOR -> APD 2
/musr/command materialPropertiesTable apdWrapping2 REFLECTIVITY 2 2.0e-6 4.5e-6 0.0 0.0
/musr/command materialPropertiesTable apdWrapping2 EFFICIENCY 2 2.0e-6 4.5e-6 0.25 0.25
/musr/command opticalSurface APDsurface phys_scintFarAwayC2 phys_APD2 dielectric_metal polished LUT apdWrapping2
#
#
/musr/command OPSA signalSeparationTime 1000
#/musr/command OPSA eventsForOPSAhistos -2 0
/musr/command OPSA OPSAhist 1000 0. 10.
/musr/command OPSA pulseShapeArray APDpulseShapeFile_2011_1e_Z.txt
/musr/command OPSA CFD -0.2 0.4 -1.8
/musr/command OPSA APDcells 1 60 60 0.1 1.5 1.5
/musr/command OPSA photonFractions 0.01 0.05 0.5 0.2
/musr/command OPSA SetAPDcellsTimeVariationSigma 0.1
###################################################################################
######################### P H Y S I C S P R O C E S S E S ##################
###################################################################################
# Geant 4.9.4
/musr/command process addDiscreteProcess gamma G4PhotoElectricEffect
/musr/command process addDiscreteProcess gamma G4ComptonScattering
/musr/command process addDiscreteProcess gamma G4GammaConversion
/musr/command process addDiscreteProcess gamma G4RayleighScattering
/musr/command process addDiscreteProcess opticalphoton G4OpAbsorption
/musr/command process addDiscreteProcess opticalphoton G4OpRayleigh
/musr/command process addDiscreteProcess opticalphoton G4OpBoundaryProcess
#/musr/command process addDiscreteProcess opticalphoton G4OpWLS
/musr/command process addProcess e- G4eMultipleScattering -1 1 1
/musr/command process addProcess e- G4eIonisation -1 2 2
/musr/command process addProcess e- G4eBremsstrahlung -1 3 3
/musr/command process addProcess e- G4Scintillation 4 -1 4
/musr/command process addProcess e+ G4eMultipleScattering -1 1 1
/musr/command process addProcess e+ G4eIonisation -1 2 2
/musr/command process addProcess e+ G4eBremsstrahlung -1 3 3
/musr/command process addProcess e+ G4eplusAnnihilation 0 -1 4
/musr/command process addProcess e+ G4Scintillation 5 -1 5
#/musr/command process addProcess mu- G4MuMultipleScattering -1 1 1
#/musr/command process addProcess mu- G4MuIonisation -1 2 2
#/musr/command process addProcess mu- G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu- G4MuPairProduction -1 4 4
#/musr/command process addProcess mu- G4Scintillation 5 -1 5
#/musr/command process addProcess mu+ G4MuMultipleScattering -1 1 1
#/musr/command process addProcess mu+ G4MuIonisation -1 2 2
#/musr/command process addProcess mu+ G4MuBremsstrahlung -1 3 3
#/musr/command process addProcess mu+ G4MuPairProduction -1 4 4
#/musr/command process addProcess mu+ G4Scintillation 5 -1 5
#
#
###/home/install/geant4.9.3/source/processes/electromagnetic/utils/src/G4EnergyLossMessenger.cc
######## /process/msc/StepLimit Minimal | UseDistanceToBoundary | UseSafety
#/process/msc/StepLimit UseSafety
###/process/msc/LateralDisplacement
#/process/msc/RangeFactor 0.04
#/process/msc/GeomFactor 2.5
###/process/msc/FactorForAngleLimit
#/process/msc/Skin 3.0
###/process/msc/ThetaLimit 0.2 rad
###################################################################################
################## S O M E O T H E R P A R A M E T E R S ##################
###################################################################################
#/musr/command rootOutputDirectoryName /home/sedlak/simData
# Store all events into the ROOT tree or just the interesting ones ? (true is default)
#/musr/command storeOnlyEventsWithHits false
#/musr/command storeOnlyEventsWithHitInDetID 11
# Set the minimum time separation between two subsequent signals in the same detector (in ns)
/musr/command signalSeparationTime 50
#
/musr/command maximumRunTimeAllowed 400000
/musr/run/howOftenToPrintEvent 1
/musr/run/randomOption 2
# Use optical photons:
/musr/command G4OpticalPhotons true
#/tracking/verbose 5
#/process/verbose 5
###################################################################################
######################### R O O T O U T P U T ##############################
###################################################################################
#/musr/command rootOutput runID off
#/musr/command rootOutput eventID off
/musr/command rootOutput weight off
/musr/command rootOutput BFieldAtDecay off
/musr/command rootOutput muIniPosX off
/musr/command rootOutput muIniPosY off
/musr/command rootOutput muIniPosZ off
/musr/command rootOutput muIniMomX off
/musr/command rootOutput muIniMomY off
/musr/command rootOutput muIniMomZ off
/musr/command rootOutput muIniPolX off
/musr/command rootOutput muIniPolY off
/musr/command rootOutput muIniPolZ off
/musr/command rootOutput muIniTime off
/musr/command rootOutput muDecayDetID off
/musr/command rootOutput muDecayPosX off
/musr/command rootOutput muDecayPosY off
/musr/command rootOutput muDecayPosZ off
/musr/command rootOutput muDecayTime off
/musr/command rootOutput muDecayPolX off
/musr/command rootOutput muDecayPolY off
/musr/command rootOutput muDecayPolZ off
/musr/command rootOutput muTargetTime off
/musr/command rootOutput muTargetPolX off
/musr/command rootOutput muTargetPolY off
/musr/command rootOutput muTargetPolZ off
/musr/command rootOutput muM0Time off
/musr/command rootOutput muM0PolX off
/musr/command rootOutput muM0PolY off
/musr/command rootOutput muM0PolZ off
/musr/command rootOutput muM1Time off
/musr/command rootOutput muM1PolX off
/musr/command rootOutput muM1PolY off
/musr/command rootOutput muM1PolZ off
/musr/command rootOutput muM2Time off
/musr/command rootOutput muM2PolX off
/musr/command rootOutput muM2PolY off
/musr/command rootOutput muM2PolZ off
#/musr/command rootOutput posIniMomX off
#/musr/command rootOutput posIniMomY off
#/musr/command rootOutput posIniMomZ off
/musr/command rootOutput fieldNomVal off
#/musr/command rootOutput det_ID off
#/musr/command rootOutput det_edep off
/musr/command rootOutput det_edep_el off
/musr/command rootOutput det_edep_pos off
/musr/command rootOutput det_edep_gam off
/musr/command rootOutput det_edep_mup off
#/musr/command rootOutput det_nsteps off
#/musr/command rootOutput det_length off
#/musr/command rootOutput det_start off
#/musr/command rootOutput det_end off
#/musr/command rootOutput det_x off
#/musr/command rootOutput det_y off
#/musr/command rootOutput det_z off
#/musr/command rootOutput det_kine off
/musr/command rootOutput det_VrtxKine off
/musr/command rootOutput det_VrtxX off
/musr/command rootOutput det_VrtxY off
/musr/command rootOutput det_VrtxZ off
/musr/command rootOutput det_VrtxVolID off
/musr/command rootOutput det_VrtxProcID off
/musr/command rootOutput det_VrtxTrackID off
/musr/command rootOutput det_VrtxParticleID off
/musr/command rootOutput det_VvvKine off
/musr/command rootOutput det_VvvX off
/musr/command rootOutput det_VvvY off
/musr/command rootOutput det_VvvZ off
/musr/command rootOutput det_VvvVolID off
/musr/command rootOutput det_VvvProcID off
/musr/command rootOutput det_VvvTrackID off
/musr/command rootOutput det_VvvParticleID off
### Root variables that are not written out by default, but can be switched on:
#/musr/command rootOutput fieldIntegralBx on
#/musr/command rootOutput fieldIntegralBy on
#/musr/command rootOutput fieldIntegralBz on
#/musr/command rootOutput fieldIntegralBz1 on
#/musr/command rootOutput fieldIntegralBz2 on
#/musr/command rootOutput fieldIntegralBz3 on
###################################################################################
######################### V I S U A L I S A T I O N ##############################
###################################################################################
/vis/disable
#/control/execute visFromToni.mac
#/control/execute visDawn1.mac
#/control/execute visVRML201.mac
###################################################################################
######################### P A R T I C L E G U N #################################
###################################################################################
/gun/primaryparticle e-
/gun/vertex 0 0 0 mm
/gun/momentum 2.15 MeV
######################## B E A M O N #######################################
/run/beamOn 20
#/run/beamOn 5000000

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@
# Configure the viewer (optional)
#/vis/viewer/set/viewpointThetaPhi 235 -45
/vis/viewer/set/viewpointThetaPhi 80 190
/vis/viewer/set/viewpointThetaPhi 80 30
#/vis/viewer/set/lightsThetaPhi 120 60
#/vis/viewer/set/hiddenEdge true
/vis/viewer/set/style surface

70
run/visDawn102.mac Normal file
View File

@ -0,0 +1,70 @@
# This is a macro file for visualizing G4 events.
# It can either be included in another macro or called with /control/exec vis.mac
# Create an OpenGL driver (i.e. a scene handler and viewer)
# Some useful choices: VRML2FILE, OGLSX, OGLIX, DAWNFILE, etc.
#/vis/open VRML2FILE
#*/vis/open OGLIX 600x600-0+0
/vis/open DAWNFILE
# To calculate volumes and masses uncomment the next two lines
#*/vis/open ATree
#*/vis/ASCIITree/verbose 4
# Create a new empty scene and attach it to handler
/vis/scene/create
# Add world volume, trajectories and hits to the scene
/vis/scene/add/volume
/vis/scene/add/trajectories
/vis/scene/add/hits
/vis/sceneHandler/attach
# Configure the viewer (optional)
#/vis/viewer/set/viewpointThetaPhi 235 -45
/vis/viewer/set/viewpointThetaPhi 80 30
#/vis/viewer/set/lightsThetaPhi 120 60
#/vis/viewer/set/hiddenEdge true
/vis/viewer/set/style surface
/vis/viewer/zoom 0.8
# Style: s - surface, w - wireframe
# Note: "surface style" and "hiddenEdge true" remove transparency!
# Other viewpoints (25 55) (235 -45) (125 35)
# Store trajectory information for visualisation (set to 0 if too many tracks cause core dump)
/tracking/storeTrajectory 1
#At the end of each event (default behaviour)
#/vis/scene/endOfEventAction refresh
#At the end of run of X events - Data from X events will be superimposed
#cks
#/vis/scene/endOfEventAction accumulate
#At the end of Y runs - Data from Y runs will be superimposed
#/vis/scene/endOfRunAction accumulate
# Coloured trajectories for an easier particle identification:
# PDG IDs and colours: e- 11 red, e+ -11 blue, nu_e 12 yellow,
# mu+ -13 magenta, anti_nu_mu -14 green, gamma 22 grey
#
#/vis/modeling/trajectories/create/drawByCharge
#/vis/modeling/trajectories/drawByCharge-0/set 1 cyan
/vis/modeling/trajectories/create/drawByParticleID
#*/vis/modeling/trajectories/drawByParticleID-0/set gamma grey
#/vis/modeling/trajectories/drawByParticleID-0/setRGBA gamma 1 1 1 0
/vis/modeling/trajectories/drawByParticleID-0/setRGBA mu+ 1 0 0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA e+ 0 0 1 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA gamma 0 1 0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA e- 1 0 1 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA nu_e 1 1 1 0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA anti_nu_mu 1 1 1 0.5
#/vis/modeling/trajectories/drawByParticleID-0/set nu_e white
#/vis/modeling/trajectories/drawByParticleID-0/set anti_nu_mu white
# Verbosity of hits
#/hits/verbose 2
# Output just the detector geometry
/vis/viewer/flush

View File

@ -61,7 +61,7 @@
#/musr/command construct box KoincB2 20 90 2.5 G4_PLASTIC_SC_VINYLTOLUENE -33 0 -60 log_World matrix3 musr/ScintSD 22
# --- M0 ---
/musr/command construct box M0 5 5 1.0 G4_PLASTIC_SC_VINYLTOLUENE 0 0 -46 log_World matrix4 musr/ScintSD 102
/musr/command construct GPDmHolder GPDmHolder 5 25 1.0 G4_PLASTIC_SC_VINYLTOLUENE 0 -25 -46 log_World norot dead 103
#/musr/command construct GPDmHolder GPDmHolder 5 25 1.0 G4_PLASTIC_SC_VINYLTOLUENE 0 -25 -46 log_World norot dead 103
# --- Magnet ---
#/musr/command construct tubs Magnet1 180 375 78 0 360 G4_Cu 133 0 0 log_World matrix5 dead 291
#/musr/command construct tubs Magnet2 180 375 78 0 360 G4_Cu -133 0 0 log_World matrix5 dead 292
@ -81,10 +81,12 @@
#/musr/command visattributes log_GPDsampleHolderE red
#/musr/command visattributes log_GPDsampleHolderF red
#/musr/command visattributes log_GPDsampleHolderG red
/musr/command visattributes log_GPDcollimator magenta
/musr/command visattributes log_Firstcollimator magenta
/musr/command visattributes log_SecondCollimator magenta
/musr/command visattributes log_GPDmHolder magenta
/musr/command visattributes log_GPDcollimator green
/musr/command visattributes log_Firstcollimator green
/musr/command visattributes log_Firstcollimatorhole green
/musr/command visattributes log_SecondCollimator green
/musr/command visattributes log_SecondCollHole green
#/musr/command visattributes log_GPDmHolder magenta
#/musr/command visattributes log_target blue
/musr/command visattributes log_M0 red
#/musr/command visattributes G4_Pb blue

View File

@ -1187,6 +1187,8 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
if (strcmp(tmpString2,"odet_timeD")==0) {musrRootOutput::store_odet_timeD = false;}
if (strcmp(tmpString2,"odet_timeMean")==0) {musrRootOutput::store_odet_timeMean = false;}
if (strcmp(tmpString2,"odet_timeLast")==0) {musrRootOutput::store_odet_timeLast = false;}
if (strcmp(tmpString2,"odet_timeCFD")==0) {musrRootOutput::store_odet_timeCFD = false;}
if (strcmp(tmpString2,"odet_amplCFD")==0) {musrRootOutput::store_odet_amplCFD = false;}
}
else if(strcmp(storeIt,"on")==0) {
if (strcmp(tmpString2,"fieldIntegralBx")==0){musrRootOutput::store_fieldIntegralBx = true;}
@ -1195,6 +1197,7 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
if (strcmp(tmpString2,"fieldIntegralBz1")==0){musrRootOutput::store_fieldIntegralBz1 = true;}
if (strcmp(tmpString2,"fieldIntegralBz2")==0){musrRootOutput::store_fieldIntegralBz2 = true;}
if (strcmp(tmpString2,"fieldIntegralBz3")==0){musrRootOutput::store_fieldIntegralBz3 = true;}
if (strcmp(tmpString2,"odet_timeCFDarray")==0){musrRootOutput::store_odet_timeCFDarray = true;}
if ((musrRootOutput::store_fieldIntegralBx)||(musrRootOutput::store_fieldIntegralBy)||
(musrRootOutput::store_fieldIntegralBz)||(musrRootOutput::store_fieldIntegralBz1)||

View File

@ -160,7 +160,7 @@ G4bool musrRootOutput::store_odet_timeMean = true;
G4bool musrRootOutput::store_odet_timeLast = true;
G4bool musrRootOutput::store_odet_timeCFD = true;
G4bool musrRootOutput::store_odet_amplCFD = true;
G4bool musrRootOutput::store_odet_timeCFDarray = false;
G4int musrRootOutput::oldEventNumberInG4EqEMFieldWithSpinFunction=-1;
@ -301,7 +301,73 @@ void musrRootOutput::BeginOfRunAction() {
if (store_odet_timeLast) {rootTree->Branch("odet_timeLast",&odet_timeLast,"odet_timeLast[odet_n]/D");}
if (store_odet_timeCFD) {rootTree->Branch("odet_timeCFD",&odet_timeCFD,"odet_timeCFD[odet_n]/D");}
if (store_odet_amplCFD) {rootTree->Branch("odet_amplCFD",&odet_amplCFD,"odet_amplCFD[odet_n]/D");}
if (store_odet_timeCFDarray) {
rootTree->Branch("odet_timeCFD100",&odet_timeCFD100,"odet_timeCFD100[odet_n]/D");
rootTree->Branch("odet_timeCFD101",&odet_timeCFD101,"odet_timeCFD101[odet_n]/D");
rootTree->Branch("odet_timeCFD102",&odet_timeCFD102,"odet_timeCFD102[odet_n]/D");
rootTree->Branch("odet_timeCFD103",&odet_timeCFD103,"odet_timeCFD103[odet_n]/D");
rootTree->Branch("odet_timeCFD104",&odet_timeCFD104,"odet_timeCFD104[odet_n]/D");
rootTree->Branch("odet_timeCFD105",&odet_timeCFD105,"odet_timeCFD105[odet_n]/D");
rootTree->Branch("odet_timeCFD106",&odet_timeCFD106,"odet_timeCFD106[odet_n]/D");
rootTree->Branch("odet_timeCFD107",&odet_timeCFD107,"odet_timeCFD107[odet_n]/D");
rootTree->Branch("odet_timeCFD108",&odet_timeCFD108,"odet_timeCFD108[odet_n]/D");
rootTree->Branch("odet_timeCFD109",&odet_timeCFD109,"odet_timeCFD109[odet_n]/D");
rootTree->Branch("odet_timeCFD110",&odet_timeCFD110,"odet_timeCFD110[odet_n]/D");
rootTree->Branch("odet_timeCFD111",&odet_timeCFD111,"odet_timeCFD111[odet_n]/D");
rootTree->Branch("odet_timeCFD112",&odet_timeCFD112,"odet_timeCFD112[odet_n]/D");
rootTree->Branch("odet_timeCFD200",&odet_timeCFD200,"odet_timeCFD200[odet_n]/D");
rootTree->Branch("odet_timeCFD201",&odet_timeCFD201,"odet_timeCFD201[odet_n]/D");
rootTree->Branch("odet_timeCFD202",&odet_timeCFD202,"odet_timeCFD202[odet_n]/D");
rootTree->Branch("odet_timeCFD203",&odet_timeCFD203,"odet_timeCFD203[odet_n]/D");
rootTree->Branch("odet_timeCFD204",&odet_timeCFD204,"odet_timeCFD204[odet_n]/D");
rootTree->Branch("odet_timeCFD205",&odet_timeCFD205,"odet_timeCFD205[odet_n]/D");
rootTree->Branch("odet_timeCFD206",&odet_timeCFD206,"odet_timeCFD206[odet_n]/D");
rootTree->Branch("odet_timeCFD207",&odet_timeCFD207,"odet_timeCFD207[odet_n]/D");
rootTree->Branch("odet_timeCFD208",&odet_timeCFD208,"odet_timeCFD208[odet_n]/D");
rootTree->Branch("odet_timeCFD209",&odet_timeCFD209,"odet_timeCFD209[odet_n]/D");
rootTree->Branch("odet_timeCFD210",&odet_timeCFD210,"odet_timeCFD210[odet_n]/D");
rootTree->Branch("odet_timeCFD211",&odet_timeCFD211,"odet_timeCFD211[odet_n]/D");
rootTree->Branch("odet_timeCFD212",&odet_timeCFD212,"odet_timeCFD212[odet_n]/D");
rootTree->Branch("odet_timeCFD300",&odet_timeCFD300,"odet_timeCFD300[odet_n]/D");
rootTree->Branch("odet_timeCFD301",&odet_timeCFD301,"odet_timeCFD301[odet_n]/D");
rootTree->Branch("odet_timeCFD302",&odet_timeCFD302,"odet_timeCFD302[odet_n]/D");
rootTree->Branch("odet_timeCFD303",&odet_timeCFD303,"odet_timeCFD303[odet_n]/D");
rootTree->Branch("odet_timeCFD304",&odet_timeCFD304,"odet_timeCFD304[odet_n]/D");
rootTree->Branch("odet_timeCFD305",&odet_timeCFD305,"odet_timeCFD305[odet_n]/D");
rootTree->Branch("odet_timeCFD306",&odet_timeCFD306,"odet_timeCFD306[odet_n]/D");
rootTree->Branch("odet_timeCFD307",&odet_timeCFD307,"odet_timeCFD307[odet_n]/D");
rootTree->Branch("odet_timeCFD308",&odet_timeCFD308,"odet_timeCFD308[odet_n]/D");
rootTree->Branch("odet_timeCFD309",&odet_timeCFD309,"odet_timeCFD309[odet_n]/D");
rootTree->Branch("odet_timeCFD310",&odet_timeCFD310,"odet_timeCFD310[odet_n]/D");
rootTree->Branch("odet_timeCFD311",&odet_timeCFD311,"odet_timeCFD311[odet_n]/D");
rootTree->Branch("odet_timeCFD312",&odet_timeCFD312,"odet_timeCFD312[odet_n]/D");
rootTree->Branch("odet_timeCFD400",&odet_timeCFD400,"odet_timeCFD400[odet_n]/D");
rootTree->Branch("odet_timeCFD401",&odet_timeCFD401,"odet_timeCFD401[odet_n]/D");
rootTree->Branch("odet_timeCFD402",&odet_timeCFD402,"odet_timeCFD402[odet_n]/D");
rootTree->Branch("odet_timeCFD403",&odet_timeCFD403,"odet_timeCFD403[odet_n]/D");
rootTree->Branch("odet_timeCFD404",&odet_timeCFD404,"odet_timeCFD404[odet_n]/D");
rootTree->Branch("odet_timeCFD405",&odet_timeCFD405,"odet_timeCFD405[odet_n]/D");
rootTree->Branch("odet_timeCFD406",&odet_timeCFD406,"odet_timeCFD406[odet_n]/D");
rootTree->Branch("odet_timeCFD407",&odet_timeCFD407,"odet_timeCFD407[odet_n]/D");
rootTree->Branch("odet_timeCFD408",&odet_timeCFD408,"odet_timeCFD408[odet_n]/D");
rootTree->Branch("odet_timeCFD409",&odet_timeCFD409,"odet_timeCFD409[odet_n]/D");
rootTree->Branch("odet_timeCFD410",&odet_timeCFD410,"odet_timeCFD410[odet_n]/D");
rootTree->Branch("odet_timeCFD411",&odet_timeCFD411,"odet_timeCFD411[odet_n]/D");
rootTree->Branch("odet_timeCFD412",&odet_timeCFD412,"odet_timeCFD412[odet_n]/D");
rootTree->Branch("odet_timeCFD500",&odet_timeCFD500,"odet_timeCFD500[odet_n]/D");
rootTree->Branch("odet_timeCFD501",&odet_timeCFD501,"odet_timeCFD501[odet_n]/D");
rootTree->Branch("odet_timeCFD502",&odet_timeCFD502,"odet_timeCFD502[odet_n]/D");
rootTree->Branch("odet_timeCFD503",&odet_timeCFD503,"odet_timeCFD503[odet_n]/D");
rootTree->Branch("odet_timeCFD504",&odet_timeCFD504,"odet_timeCFD504[odet_n]/D");
rootTree->Branch("odet_timeCFD505",&odet_timeCFD505,"odet_timeCFD505[odet_n]/D");
rootTree->Branch("odet_timeCFD506",&odet_timeCFD506,"odet_timeCFD506[odet_n]/D");
rootTree->Branch("odet_timeCFD507",&odet_timeCFD507,"odet_timeCFD507[odet_n]/D");
rootTree->Branch("odet_timeCFD508",&odet_timeCFD508,"odet_timeCFD508[odet_n]/D");
rootTree->Branch("odet_timeCFD509",&odet_timeCFD509,"odet_timeCFD509[odet_n]/D");
rootTree->Branch("odet_timeCFD510",&odet_timeCFD510,"odet_timeCFD510[odet_n]/D");
rootTree->Branch("odet_timeCFD511",&odet_timeCFD511,"odet_timeCFD511[odet_n]/D");
rootTree->Branch("odet_timeCFD512",&odet_timeCFD512,"odet_timeCFD512[odet_n]/D");
}
// htest1 = new TH1F("htest1","The debugging histogram 1",50,-4.,4.);
// htest2 = new TH1F("htest2","The debugging histogram 2",50,0.,3.142);
@ -562,7 +628,74 @@ void musrRootOutput::SetOPSAinfo (G4int nDetectors, G4int ID, G4int nPhot, G4
odet_amplCFD[nDetectors]=amplCFD;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void musrRootOutput::SetCFDSpecialInfo (G4int n, G4double time) {
if (n==100) {odet_timeCFD100[odet_n-1] = time/microsecond;} // G4cout<<"OKKKKK odet_n-1="<<odet_n-1<<G4endl;}
else if (n==101) {odet_timeCFD101[odet_n-1] = time/microsecond;}
else if (n==102) {odet_timeCFD102[odet_n-1] = time/microsecond;}
else if (n==103) {odet_timeCFD103[odet_n-1] = time/microsecond;}
else if (n==104) {odet_timeCFD104[odet_n-1] = time/microsecond;}
else if (n==105) {odet_timeCFD105[odet_n-1] = time/microsecond;}
else if (n==106) {odet_timeCFD106[odet_n-1] = time/microsecond;}
else if (n==107) {odet_timeCFD107[odet_n-1] = time/microsecond;}
else if (n==108) {odet_timeCFD108[odet_n-1] = time/microsecond;}
else if (n==109) {odet_timeCFD109[odet_n-1] = time/microsecond;}
else if (n==110) {odet_timeCFD110[odet_n-1] = time/microsecond;}
else if (n==111) {odet_timeCFD111[odet_n-1] = time/microsecond;}
else if (n==112) {odet_timeCFD112[odet_n-1] = time/microsecond;}
else if (n==200) {odet_timeCFD200[odet_n-1] = time/microsecond;}
else if (n==201) {odet_timeCFD201[odet_n-1] = time/microsecond;}
else if (n==202) {odet_timeCFD202[odet_n-1] = time/microsecond;}
else if (n==203) {odet_timeCFD203[odet_n-1] = time/microsecond;}
else if (n==204) {odet_timeCFD204[odet_n-1] = time/microsecond;}
else if (n==205) {odet_timeCFD205[odet_n-1] = time/microsecond;}
else if (n==206) {odet_timeCFD206[odet_n-1] = time/microsecond;}
else if (n==207) {odet_timeCFD207[odet_n-1] = time/microsecond;}
else if (n==208) {odet_timeCFD208[odet_n-1] = time/microsecond;}
else if (n==209) {odet_timeCFD209[odet_n-1] = time/microsecond;}
else if (n==210) {odet_timeCFD210[odet_n-1] = time/microsecond;}
else if (n==211) {odet_timeCFD211[odet_n-1] = time/microsecond;}
else if (n==212) {odet_timeCFD212[odet_n-1] = time/microsecond;}
else if (n==300) {odet_timeCFD300[odet_n-1] = time/microsecond;}
else if (n==301) {odet_timeCFD301[odet_n-1] = time/microsecond;}
else if (n==302) {odet_timeCFD302[odet_n-1] = time/microsecond;}
else if (n==303) {odet_timeCFD303[odet_n-1] = time/microsecond;}
else if (n==304) {odet_timeCFD304[odet_n-1] = time/microsecond;}
else if (n==305) {odet_timeCFD305[odet_n-1] = time/microsecond;}
else if (n==306) {odet_timeCFD306[odet_n-1] = time/microsecond;}
else if (n==307) {odet_timeCFD307[odet_n-1] = time/microsecond;}
else if (n==308) {odet_timeCFD308[odet_n-1] = time/microsecond;}
else if (n==309) {odet_timeCFD309[odet_n-1] = time/microsecond;}
else if (n==310) {odet_timeCFD310[odet_n-1] = time/microsecond;}
else if (n==311) {odet_timeCFD311[odet_n-1] = time/microsecond;}
else if (n==312) {odet_timeCFD312[odet_n-1] = time/microsecond;}
else if (n==400) {odet_timeCFD400[odet_n-1] = time/microsecond;}
else if (n==401) {odet_timeCFD401[odet_n-1] = time/microsecond;}
else if (n==402) {odet_timeCFD402[odet_n-1] = time/microsecond;}
else if (n==403) {odet_timeCFD403[odet_n-1] = time/microsecond;}
else if (n==404) {odet_timeCFD404[odet_n-1] = time/microsecond;}
else if (n==405) {odet_timeCFD405[odet_n-1] = time/microsecond;}
else if (n==406) {odet_timeCFD406[odet_n-1] = time/microsecond;}
else if (n==407) {odet_timeCFD407[odet_n-1] = time/microsecond;}
else if (n==408) {odet_timeCFD408[odet_n-1] = time/microsecond;}
else if (n==409) {odet_timeCFD409[odet_n-1] = time/microsecond;}
else if (n==410) {odet_timeCFD410[odet_n-1] = time/microsecond;}
else if (n==411) {odet_timeCFD411[odet_n-1] = time/microsecond;}
else if (n==412) {odet_timeCFD412[odet_n-1] = time/microsecond;}
else if (n==500) {odet_timeCFD500[odet_n-1] = time/microsecond;}
else if (n==501) {odet_timeCFD501[odet_n-1] = time/microsecond;}
else if (n==502) {odet_timeCFD502[odet_n-1] = time/microsecond;}
else if (n==503) {odet_timeCFD503[odet_n-1] = time/microsecond;}
else if (n==504) {odet_timeCFD504[odet_n-1] = time/microsecond;}
else if (n==505) {odet_timeCFD505[odet_n-1] = time/microsecond;}
else if (n==506) {odet_timeCFD506[odet_n-1] = time/microsecond;}
else if (n==507) {odet_timeCFD507[odet_n-1] = time/microsecond;}
else if (n==508) {odet_timeCFD508[odet_n-1] = time/microsecond;}
else if (n==509) {odet_timeCFD509[odet_n-1] = time/microsecond;}
else if (n==510) {odet_timeCFD510[odet_n-1] = time/microsecond;}
else if (n==511) {odet_timeCFD511[odet_n-1] = time/microsecond;}
else if (n==512) {odet_timeCFD512[odet_n-1] = time/microsecond;}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void musrRootOutput::setRootOutputDirectoryName(char dirName[1000]) {

View File

@ -688,6 +688,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
OPSA_timeMean = OPSAhisto->GetMean() + OPSA_timeFirst;
// if required, convert the histogram with photon times to histogram of electronic pulse shape
G4double timeCFDarray[1000];
if (bool_pulseShapeExists) {
// for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of photon histogram
// Double_t photonCount = OPSAhisto ->GetBinContent(iBin);
@ -703,50 +704,45 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
// }
if (boolStoreThisOPSAhist) OPSAshape -> Write();
// Now fill the histogram with the CFD signal
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of electronic signal histogram
Double_t signalValue = OPSAshape->GetBinContent(iBin);
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
OPSA_CFD->Fill(xValue,signalValue*OPSA_CFD_a1);
Double_t xValueShifted = xValue + OPSA_CFD_delay;
if (xValueShifted>OPSAhistoMax) continue; //return if out of range;
OPSA_CFD->Fill(xValueShifted,signalValue);
}
if (boolStoreThisOPSAhist) OPSA_CFD -> Write();
// Find the timeCFD from CFD signal
Double_t oldYvalue;
Double_t yValue=-1000;
// G4bool OPSA_CFD_time_found = false;
OPSA_CFD_ampl = OPSA_CFD->GetMaximum();
int binmax = OPSA_CFD->GetMaximumBin();
int binmim = OPSA_CFD->GetMinimumBin();
for (Int_t iBin=binmim; iBin<=binmax; iBin++) { // loop over bins between min and max of CFD histogram
// Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
Double_t xValue = OPSA_CFD->GetXaxis()->GetBinCenter(iBin);
oldYvalue = yValue;
yValue = OPSA_CFD->GetBinContent(iBin);
// if (yValue>OPSA_CFD_ampl) OPSA_CFD_ampl=yValue; // find the CFD signal amplitude;
// if (xValue < 0.6*OPSA_CFD_delay) continue; // it is believed the CFD signal can not cross y=0 much before the delay time
// if ((yValue >= 0)&&(!OPSA_CFD_time_found)) { // signal just crossed the y=0 axis for the first time ==> record CFD time
if (yValue >= 0) { // signal just crossed the y=0 axis
// OPSA_CFD_time_found = true;
OPSA_CFD_time = xValue - yValue/(yValue-oldYvalue)*OPSAhistoBinWidth; //linear interpolation
OPSA_CFD_time += OPSA_timeFirst - OPSA_CFD_delay + OPSA_CFD_timeShiftOffset; // correct for
// G4cout<<"OPSA_CFD_time = "<<OPSA_CFD_time<<G4endl;
break;
// If requested, store CFD times for various CFD delays and amplitudes of the reverted signal
if (musrRootOutput::store_odet_timeCFDarray) {
G4double OPSA_CFD_a1_saveThis = OPSA_CFD_a1;
G4double OPSA_CFD_delay_saveThis = OPSA_CFD_delay;
const int nDelay = 13;
G4double delay[nDelay]={0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0};
const int nAmpl1 = 5;
G4double ampl1[nAmpl1] = {-0.05, -0.1, -0.2, -0.3, -0.4};
for (Int_t kk=0; kk<nDelay; kk++) {
for (Int_t ll=0; ll<nAmpl1; ll++) {
OPSA_CFD_a1 = ampl1[ll];
OPSA_CFD_delay = delay[kk];
FindCFDtime(OPSA_CFD_time, OPSA_CFD_ampl, OPSA_timeFirst);
int index = (ll+1)*100+kk;
if (index<1000) timeCFDarray[(ll+1)*100+kk] = OPSA_CFD_time;
else {G4cout<<"FATALNI ERROR in musrScintSD by calculating (ll+1)*100+kk"<<G4endl;}
// G4cout<<" delay= "<<OPSA_CFD_delay<<" ampl1= "<<OPSA_CFD_a1
// <<" OPSA_CFD_time= "<<OPSA_CFD_time<<" OPSA_CFD_ampl= "<<OPSA_CFD_ampl<<G4endl;
}
}
OPSA_CFD_a1 = OPSA_CFD_a1_saveThis;
OPSA_CFD_delay = OPSA_CFD_delay_saveThis;
}
// Now fill the histogram with the CFD signal
FindCFDtime(OPSA_CFD_time, OPSA_CFD_ampl, OPSA_timeFirst);
// G4cout<<"OPSA_CFD_time = "<<OPSA_CFD_time<<" OPSA_CFD_ampl = "<<OPSA_CFD_ampl<<G4endl;
if (boolStoreThisOPSAhist) OPSA_CFD -> Write();
// Find the timeC and timeD from the shape histogram
yValue=-1000;
Double_t yValue=-1000;
G4bool OPSA_C_time_found = false;
G4bool OPSA_D_time_found = false;
Double_t D_threshold = OPSA_D_threshold * (OPSAshape->GetMaximum()); // covert relative "OPSA_D_threshold" into
// the absolute threshold using signal amplitude
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of CFD histogram
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
oldYvalue = yValue;
Double_t oldYvalue = yValue;
yValue = OPSAshape->GetBinContent(iBin);
if ( (yValue>=OPSA_C_threshold) && (!OPSA_C_time_found) ) { // signal just moved above the threshold
OPSA_C_time_found = true;
@ -777,7 +773,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
}
signalInfo* mySignalInfo = new signalInfo(OPSA_detID,OPSA_nPhot,OPSA_timeFirst,OPSA_timeA,OPSA_timeB,OPSA_timeC,
OPSA_timeD,OPSA_timeMean,OPSA_timeLast,OPSA_CFD_time,OPSA_CFD_ampl);
OPSA_timeD,OPSA_timeMean,OPSA_timeLast,OPSA_CFD_time,OPSA_CFD_ampl,timeCFDarray);
OPSA_signal_Map.insert(std::pair<G4int,signalInfo*>(OPSA_nPhot,mySignalInfo) );
}
OPSA_nPhot = 0;
@ -890,4 +886,35 @@ G4int musrScintSD::FindAPDcellID(G4Step* aStep) {
"musrScintSD::FindAPDcellID: APD cell out of range (iz). Wrong dimensions of APD in \"/musr/command OPSA APDcells\" command?",false);
return in;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void musrScintSD::FindCFDtime(G4double& OPSA_CFD_time, G4double& OPSA_CFD_ampl, G4double timeOfFirstPhoton) {
OPSA_CFD->Reset("M");
for (Int_t iBin=1; iBin<=OPSAhistoNbin; iBin++) { // loop over all bins of electronic signal histogram
Double_t signalValue = OPSAshape->GetBinContent(iBin);
Double_t xValue = (iBin-0.5)*OPSAhistoBinWidth;
OPSA_CFD->Fill(xValue,signalValue*OPSA_CFD_a1);
Double_t xValueShifted = xValue + OPSA_CFD_delay;
if (xValueShifted>OPSAhistoMax) continue; //return if out of range;
OPSA_CFD->Fill(xValueShifted,signalValue);
}
// Find the timeCFD from CFD signal
Double_t oldYvalue;
Double_t yValue=-1000;
OPSA_CFD_ampl = OPSA_CFD->GetMaximum();
int binmax = OPSA_CFD->GetMaximumBin();
int binmim = OPSA_CFD->GetMinimumBin();
for (Int_t iBin=binmim; iBin<=binmax; iBin++) { // loop over bins between min and max of CFD histogram
Double_t xValue = OPSA_CFD->GetXaxis()->GetBinCenter(iBin);
oldYvalue = yValue;
yValue = OPSA_CFD->GetBinContent(iBin);
if (yValue >= 0) { // signal just crossed the y=0 axis
OPSA_CFD_time = xValue - yValue/(yValue-oldYvalue)*OPSAhistoBinWidth; //linear interpolation
OPSA_CFD_time += timeOfFirstPhoton - OPSA_CFD_delay + OPSA_CFD_timeShiftOffset; // correct for
break;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......