Kamil Sedlak 7.2.2013
Implemented changes of James Lord. Compiling was possible, but no testing was done so far.
This commit is contained in:
parent
db7b6a80f4
commit
c5fb2ca46f
30
CMakeMacroParseArguments.cmake
Normal file
30
CMakeMacroParseArguments.cmake
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
||||||
|
SET(DEFAULT_ARGS)
|
||||||
|
FOREACH(arg_name ${arg_names})
|
||||||
|
SET(${prefix}_${arg_name})
|
||||||
|
ENDFOREACH(arg_name)
|
||||||
|
FOREACH(option ${option_names})
|
||||||
|
SET(${prefix}_${option} FALSE)
|
||||||
|
ENDFOREACH(option)
|
||||||
|
|
||||||
|
SET(current_arg_name DEFAULT_ARGS)
|
||||||
|
SET(current_arg_list)
|
||||||
|
FOREACH(arg ${ARGN})
|
||||||
|
SET(larg_names ${arg_names})
|
||||||
|
LIST(FIND larg_names "${arg}" is_arg_name)
|
||||||
|
IF (is_arg_name GREATER -1)
|
||||||
|
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||||
|
SET(current_arg_name ${arg})
|
||||||
|
SET(current_arg_list)
|
||||||
|
ELSE (is_arg_name GREATER -1)
|
||||||
|
SET(loption_names ${option_names})
|
||||||
|
LIST(FIND loption_names "${arg}" is_option)
|
||||||
|
IF (is_option GREATER -1)
|
||||||
|
SET(${prefix}_${arg} TRUE)
|
||||||
|
ELSE (is_option GREATER -1)
|
||||||
|
SET(current_arg_list ${current_arg_list} ${arg})
|
||||||
|
ENDIF (is_option GREATER -1)
|
||||||
|
ENDIF (is_arg_name GREATER -1)
|
||||||
|
ENDFOREACH(arg)
|
||||||
|
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
||||||
|
ENDMACRO(PARSE_ARGUMENTS)
|
138
CMakeParseArguments.cmake
Normal file
138
CMakeParseArguments.cmake
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
|
||||||
|
#
|
||||||
|
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
|
||||||
|
# parsing the arguments given to that macro or function.
|
||||||
|
# It processes the arguments and defines a set of variables which hold the
|
||||||
|
# values of the respective options.
|
||||||
|
#
|
||||||
|
# The <options> argument contains all options for the respective macro,
|
||||||
|
# i.e. keywords which can be used when calling the macro without any value
|
||||||
|
# following, like e.g. the OPTIONAL keyword of the install() command.
|
||||||
|
#
|
||||||
|
# The <one_value_keywords> argument contains all keywords for this macro
|
||||||
|
# which are followed by one value, like e.g. DESTINATION keyword of the
|
||||||
|
# install() command.
|
||||||
|
#
|
||||||
|
# The <multi_value_keywords> argument contains all keywords for this macro
|
||||||
|
# which can be followed by more than one value, like e.g. the TARGETS or
|
||||||
|
# FILES keywords of the install() command.
|
||||||
|
#
|
||||||
|
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
|
||||||
|
# keywords listed in <options>, <one_value_keywords> and
|
||||||
|
# <multi_value_keywords> a variable composed of the given <prefix>
|
||||||
|
# followed by "_" and the name of the respective keyword.
|
||||||
|
# These variables will then hold the respective value from the argument list.
|
||||||
|
# For the <options> keywords this will be TRUE or FALSE.
|
||||||
|
#
|
||||||
|
# All remaining arguments are collected in a variable
|
||||||
|
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
|
||||||
|
# your macro was called with unrecognized parameters.
|
||||||
|
#
|
||||||
|
# As an example here a my_install() macro, which takes similar arguments as the
|
||||||
|
# real install() command:
|
||||||
|
#
|
||||||
|
# function(MY_INSTALL)
|
||||||
|
# set(options OPTIONAL FAST)
|
||||||
|
# set(oneValueArgs DESTINATION RENAME)
|
||||||
|
# set(multiValueArgs TARGETS CONFIGURATIONS)
|
||||||
|
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||||
|
# ...
|
||||||
|
#
|
||||||
|
# Assume my_install() has been called like this:
|
||||||
|
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
|
||||||
|
#
|
||||||
|
# After the cmake_parse_arguments() call the macro will have set the following
|
||||||
|
# variables:
|
||||||
|
# MY_INSTALL_OPTIONAL = TRUE
|
||||||
|
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
|
||||||
|
# MY_INSTALL_DESTINATION = "bin"
|
||||||
|
# MY_INSTALL_RENAME = "" (was not used)
|
||||||
|
# MY_INSTALL_TARGETS = "foo;bar"
|
||||||
|
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
|
||||||
|
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
|
||||||
|
#
|
||||||
|
# You can the continue and process these variables.
|
||||||
|
#
|
||||||
|
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
|
||||||
|
# another recognized keyword follows, this is interpreted as the beginning of
|
||||||
|
# the new option.
|
||||||
|
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
|
||||||
|
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
|
||||||
|
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
|
||||||
|
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
|
||||||
|
|
||||||
|
|
||||||
|
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
|
||||||
|
# first set all result variables to empty/FALSE
|
||||||
|
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
|
||||||
|
set(${prefix}_${arg_name})
|
||||||
|
endforeach(arg_name)
|
||||||
|
|
||||||
|
foreach(option ${_optionNames})
|
||||||
|
set(${prefix}_${option} FALSE)
|
||||||
|
endforeach(option)
|
||||||
|
|
||||||
|
set(${prefix}_UNPARSED_ARGUMENTS)
|
||||||
|
|
||||||
|
set(insideValues FALSE)
|
||||||
|
set(currentArgName)
|
||||||
|
|
||||||
|
# now iterate over all arguments and fill the result variables
|
||||||
|
foreach(currentArg ${ARGN})
|
||||||
|
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||||
|
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||||
|
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||||
|
|
||||||
|
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
|
||||||
|
if(insideValues)
|
||||||
|
if("${insideValues}" STREQUAL "SINGLE")
|
||||||
|
set(${prefix}_${currentArgName} ${currentArg})
|
||||||
|
set(insideValues FALSE)
|
||||||
|
elseif("${insideValues}" STREQUAL "MULTI")
|
||||||
|
list(APPEND ${prefix}_${currentArgName} ${currentArg})
|
||||||
|
endif()
|
||||||
|
else(insideValues)
|
||||||
|
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
|
||||||
|
endif(insideValues)
|
||||||
|
else()
|
||||||
|
if(NOT ${optionIndex} EQUAL -1)
|
||||||
|
set(${prefix}_${currentArg} TRUE)
|
||||||
|
set(insideValues FALSE)
|
||||||
|
elseif(NOT ${singleArgIndex} EQUAL -1)
|
||||||
|
set(currentArgName ${currentArg})
|
||||||
|
set(${prefix}_${currentArgName})
|
||||||
|
set(insideValues "SINGLE")
|
||||||
|
elseif(NOT ${multiArgIndex} EQUAL -1)
|
||||||
|
set(currentArgName ${currentArg})
|
||||||
|
set(${prefix}_${currentArgName})
|
||||||
|
set(insideValues "MULTI")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endforeach(currentArg)
|
||||||
|
|
||||||
|
# propagate the result variables to the caller:
|
||||||
|
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
|
||||||
|
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
|
||||||
|
endforeach(arg_name)
|
||||||
|
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
|
||||||
|
|
||||||
|
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
|
BIN
doc/musrSim.pdf
BIN
doc/musrSim.pdf
Binary file not shown.
@ -23,10 +23,11 @@
|
|||||||
%\title{GEANT Simulation Program for the
|
%\title{GEANT Simulation Program for the
|
||||||
%$\mathbf{\mu}$SR Instruments}
|
%$\mathbf{\mu}$SR Instruments}
|
||||||
|
|
||||||
\author{Kamil Sedl\'ak$^1$, Toni Shiroka$^1$, Zaher Salman$^1$, Jose Rodriguez$^1$, Tom Lancaster$^2$, Thomas Prokscha$^1$, Taofiq Para\"{\i}so$^1$, Robert Scheuermann$^1$}
|
\author{Kamil Sedl\'ak$^1$, Toni Shiroka$^1$, Zaher Salman$^1$, Jose Rodriguez$^1$, Tom Lancaster$^2$, Thomas Prokscha$^1$, Taofiq Para\"{\i}so$^1$, Robert Scheuermann$^1$, James S. Lord$^3$}
|
||||||
|
|
||||||
\address{{$^1$ Laboratory for Muon Spin Spectroscopy, Paul Scherrer Institut, CH-5232 Villigen PSI, Switzerland}\\
|
\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}
|
$^2$ Clarendon Laboratory, Department of Physics, Oxford University, Parks Road, Oxford OX1 3PU, UK\\
|
||||||
|
$^3$ ISIS Facility, Rutherford Appleton Laboratory, Chilton, Oxon OX11 0QX, U.K.}
|
||||||
%\address{{\rm (on behalf of the H1 collaboration)}\\
|
%\address{{\rm (on behalf of the H1 collaboration)}\\
|
||||||
%Institute of Physics AS\,CR\\
|
%Institute of Physics AS\,CR\\
|
||||||
%%Academy of Sciences of the Czech Republic
|
%%Academy of Sciences of the Czech Republic
|
||||||
|
Binary file not shown.
1676
doc/musrSimAna.tex
1676
doc/musrSimAna.tex
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,9 @@
|
|||||||
#include "G4RunManager.hh"
|
#include "G4RunManager.hh"
|
||||||
#include "G4UImanager.hh"
|
#include "G4UImanager.hh"
|
||||||
#include "G4UIterminal.hh"
|
#include "G4UIterminal.hh"
|
||||||
#include "G4UItcsh.hh"
|
#ifdef G4UI_USE_TCSH
|
||||||
|
#include "G4UItcsh.hh" //JSL: should be commented on windows ?
|
||||||
|
#endif
|
||||||
|
|
||||||
//#include <TApplication.h>
|
//#include <TApplication.h>
|
||||||
//#include <TSystem.h>
|
//#include <TSystem.h>
|
||||||
@ -24,7 +26,7 @@
|
|||||||
|
|
||||||
#include "Randomize.hh"
|
#include "Randomize.hh"
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
// #include <X11/Xlib.h> //JSL
|
||||||
|
|
||||||
#ifdef G4VIS_USE
|
#ifdef G4VIS_USE
|
||||||
// #include "musrVisManager.hh"
|
// #include "musrVisManager.hh"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,12 @@
|
|||||||
//#include "musrTH.hh"
|
//#include "musrTH.hh"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
const double pi=3.14159265358979324; // initialise here instead JSL
|
||||||
|
const double microsecond=1.;
|
||||||
|
const double nanosecond=0.001;
|
||||||
|
const double picosecond=0.000001;
|
||||||
|
|
||||||
|
|
||||||
class musrTH;
|
class musrTH;
|
||||||
|
|
||||||
//#include "musrSimGlobal.hh"
|
//#include "musrSimGlobal.hh"
|
||||||
@ -192,6 +198,7 @@ public :
|
|||||||
Double_t eventID_double;
|
Double_t eventID_double;
|
||||||
Double_t muDecayDetID_double;
|
Double_t muDecayDetID_double;
|
||||||
Double_t det_n_double;
|
Double_t det_n_double;
|
||||||
|
Double_t det_multifirst_double;
|
||||||
Double_t muDecayPosR;
|
Double_t muDecayPosR;
|
||||||
Double_t wght;
|
Double_t wght;
|
||||||
Double_t det_m0edep;
|
Double_t det_m0edep;
|
||||||
@ -219,6 +226,7 @@ public :
|
|||||||
Double_t pos_Phi_MINUS_muDecayPol_Phi360;
|
Double_t pos_Phi_MINUS_muDecayPol_Phi360;
|
||||||
Double_t pos_detID;
|
Double_t pos_detID;
|
||||||
Double_t pos_detID_doubleHit;
|
Double_t pos_detID_doubleHit;
|
||||||
|
Double_t pos_doubleHit_dPhi;
|
||||||
// Double_t det_time0;
|
// Double_t det_time0;
|
||||||
// Double_t get_time0;
|
// Double_t get_time0;
|
||||||
// Double_t det_time1;
|
// Double_t det_time1;
|
||||||
@ -229,6 +237,7 @@ public :
|
|||||||
Double_t det_time20;
|
Double_t det_time20;
|
||||||
Double_t det_time31;
|
Double_t det_time31;
|
||||||
Double_t det_time1_MINUS_muDecayTime;
|
Double_t det_time1_MINUS_muDecayTime;
|
||||||
|
Double_t det_multi_interval;
|
||||||
Double_t detP_x;
|
Double_t detP_x;
|
||||||
Double_t detP_y;
|
Double_t detP_y;
|
||||||
Double_t detP_z;
|
Double_t detP_z;
|
||||||
@ -254,6 +263,7 @@ public :
|
|||||||
Bool_t alwaysTrue;
|
Bool_t alwaysTrue;
|
||||||
Bool_t oncePerEvent;
|
Bool_t oncePerEvent;
|
||||||
Bool_t muonDecayedInSample_gen;
|
Bool_t muonDecayedInSample_gen;
|
||||||
|
Bool_t muonDecayedInSampleOnce_gen;
|
||||||
Bool_t muonTriggered_gen;
|
Bool_t muonTriggered_gen;
|
||||||
Bool_t muonTriggered_gen_AND_muonDecayedInSample_gen;
|
Bool_t muonTriggered_gen_AND_muonDecayedInSample_gen;
|
||||||
Bool_t muonTriggered_det;
|
Bool_t muonTriggered_det;
|
||||||
@ -264,6 +274,12 @@ public :
|
|||||||
Bool_t pileupEventCandidate;
|
Bool_t pileupEventCandidate;
|
||||||
Bool_t pileupEvent;
|
Bool_t pileupEvent;
|
||||||
Bool_t goodEvent_det_AND_muonDecayedInSample_gen;
|
Bool_t goodEvent_det_AND_muonDecayedInSample_gen;
|
||||||
|
Bool_t goodEvent_F_det_AND_muonDecayedInSample_gen;
|
||||||
|
Bool_t goodEvent_B_det_AND_muonDecayedInSample_gen;
|
||||||
|
Bool_t goodEvent_U_det_AND_muonDecayedInSample_gen;
|
||||||
|
Bool_t goodEvent_D_det_AND_muonDecayedInSample_gen;
|
||||||
|
Bool_t goodEvent_L_det_AND_muonDecayedInSample_gen;
|
||||||
|
Bool_t goodEvent_R_det_AND_muonDecayedInSample_gen;
|
||||||
Bool_t goodEvent_F_det;
|
Bool_t goodEvent_F_det;
|
||||||
Bool_t goodEvent_B_det;
|
Bool_t goodEvent_B_det;
|
||||||
Bool_t goodEvent_U_det;
|
Bool_t goodEvent_U_det;
|
||||||
@ -284,6 +300,25 @@ public :
|
|||||||
Bool_t promptPeakL;
|
Bool_t promptPeakL;
|
||||||
Bool_t promptPeakR;
|
Bool_t promptPeakR;
|
||||||
Bool_t doubleHit;
|
Bool_t doubleHit;
|
||||||
|
// pulsed:
|
||||||
|
// goodEvent_det = (discrim triggered, however happened)
|
||||||
|
// goodEvent_gen = (1st or only over-threshold event, even if killed by dead time)
|
||||||
|
// doubleHitEvent_gen = (2nd onwards of a double hit sequence, whether detected or dead)
|
||||||
|
Bool_t doubleHitEvent_gen;
|
||||||
|
// doubleHit = (2nd and subsequent hits, counted)
|
||||||
|
// to subdivide double counting among banks (2nd and subsequent)
|
||||||
|
Bool_t goodEvent_F_det_AND_doubleHit;
|
||||||
|
Bool_t goodEvent_B_det_AND_doubleHit;
|
||||||
|
Bool_t goodEvent_U_det_AND_doubleHit;
|
||||||
|
Bool_t goodEvent_D_det_AND_doubleHit;
|
||||||
|
Bool_t goodEvent_L_det_AND_doubleHit;
|
||||||
|
Bool_t goodEvent_R_det_AND_doubleHit;
|
||||||
|
// singleHitEvent_gen = (single hits only)
|
||||||
|
Bool_t singleHitEvent_gen;
|
||||||
|
// stackedEvent_gen = (multiple small hits adding to threshold, muon details refer to last one)
|
||||||
|
Bool_t stackedEvent_gen;
|
||||||
|
// pileupEvent = (all events killed by dead time)
|
||||||
|
// ..._AND_pileupEvent = subdivided by bank (note the _det isn't appropriate here)
|
||||||
|
|
||||||
musrAnalysis(TTree *tree=0);
|
musrAnalysis(TTree *tree=0);
|
||||||
virtual ~musrAnalysis();
|
virtual ~musrAnalysis();
|
||||||
@ -298,6 +333,7 @@ public :
|
|||||||
virtual void CreateHistograms();
|
virtual void CreateHistograms();
|
||||||
virtual void AnalyseEvent(Long64_t iiiEntry);
|
virtual void AnalyseEvent(Long64_t iiiEntry);
|
||||||
virtual void FillHistograms(Int_t iiiEntry);
|
virtual void FillHistograms(Int_t iiiEntry);
|
||||||
|
virtual void FillHistogramsPulsed(Int_t iiiEntry1, Int_t iiiEntry2);
|
||||||
virtual void SaveHistograms(char* runChar,char* v1190FileName);
|
virtual void SaveHistograms(char* runChar,char* v1190FileName);
|
||||||
virtual void RemoveOldHitsFromCounters(Long64_t timeBinLimit);
|
virtual void RemoveOldHitsFromCounters(Long64_t timeBinLimit);
|
||||||
// virtual void RewindAllTimeInfo(Double_t timeToRewind);
|
// virtual void RewindAllTimeInfo(Double_t timeToRewind);
|
||||||
@ -319,11 +355,13 @@ public :
|
|||||||
TH1D* hGeantParameters;
|
TH1D* hGeantParameters;
|
||||||
TH1D* hInfo;
|
TH1D* hInfo;
|
||||||
|
|
||||||
|
typedef std::multimap<double,int> doubleHitSorterType;
|
||||||
|
|
||||||
// typedef std::map<int,int> debugEventMapType;
|
// typedef std::map<int,int> debugEventMapType;
|
||||||
// debugEventMapType debugEventMap;
|
// debugEventMapType debugEventMap;
|
||||||
// Bool_t bool_debugingRequired;
|
// Bool_t bool_debugingRequired;
|
||||||
|
|
||||||
static const Double_t pi=3.14159265358979324;
|
//JSL static const Double_t pi=3.14159265358979324;
|
||||||
static musrWriteDump* myWriteDump;
|
static musrWriteDump* myWriteDump;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -335,9 +373,10 @@ public :
|
|||||||
Int_t mdelay;
|
Int_t mdelay;
|
||||||
Int_t pdelay;
|
Int_t pdelay;
|
||||||
Int_t mcoincwin;
|
Int_t mcoincwin;
|
||||||
Int_t pcoincwin;
|
Int_t pcoincwin; // pulsed: for dead time or add-up overlap. Model as exponential decay of this time constant?
|
||||||
Int_t vcoincwin;
|
Int_t vcoincwin;
|
||||||
Double_t muonRateFactor;
|
Double_t muonRateFactor; // also mean rate for pulsed mode
|
||||||
|
Double_t muonPulseWidthFactor; // pulsed
|
||||||
Double_t dataWindowMin;
|
Double_t dataWindowMin;
|
||||||
Double_t dataWindowMax;
|
Double_t dataWindowMax;
|
||||||
Double_t pileupWindowMin;
|
Double_t pileupWindowMin;
|
||||||
@ -346,16 +385,22 @@ public :
|
|||||||
Double_t promptPeakWindowMax;
|
Double_t promptPeakWindowMax;
|
||||||
Int_t overallBinDelay;
|
Int_t overallBinDelay;
|
||||||
Bool_t boolInfinitelyLowMuonRate;
|
Bool_t boolInfinitelyLowMuonRate;
|
||||||
|
Double_t frameInterval; // JSL: pulsed: to divide muons into frames
|
||||||
char musrMode; // D = time diferential; I = time integral;
|
Double_t detRecoveryTime; // JSL: pulsed: for dead time effects
|
||||||
|
Bool_t doPartialFrameAtEnd; // process the left over muons if the beam goes off mid frame having done some complete frames
|
||||||
|
// Bool_t processInBulk; // do all the muons in one go rather than re-filtering at end of run
|
||||||
|
Double_t commonThreshold; // set all thresholds to this value regardless of individual settings
|
||||||
|
|
||||||
|
char musrMode; // D = time diferential; I = time integral; P = pulsed time differential
|
||||||
Double_t safeTimeWindow;
|
Double_t safeTimeWindow;
|
||||||
Double_t currentTime;
|
Double_t currentTime;
|
||||||
// Double_t nextEventTime;
|
// Double_t nextEventTime;
|
||||||
Double_t nextUnfilledEventTime;
|
Double_t nextUnfilledEventTime;
|
||||||
Long64_t numberOfRewinds;
|
Long64_t numberOfRewinds; // JSL: number of frames for Pulsed Mode
|
||||||
Long64_t numberOfGoodMuons;
|
Long64_t numberOfGoodMuons;
|
||||||
// Int_t currentEventID;
|
// Int_t currentEventID;
|
||||||
Long64_t lastPreprocessedEntry;
|
Long64_t lastPreprocessedEntry;
|
||||||
|
Long64_t firstPreprocessedEntry; // JSL: first in this frame
|
||||||
musrCounter* mCounter;
|
musrCounter* mCounter;
|
||||||
typedef std::map<int,musrCounter*> counterMapType;
|
typedef std::map<int,musrCounter*> counterMapType;
|
||||||
counterMapType pCounterMap;
|
counterMapType pCounterMap;
|
||||||
@ -367,9 +412,9 @@ public :
|
|||||||
Bool_t bool_muDecayTimeTransformation;
|
Bool_t bool_muDecayTimeTransformation;
|
||||||
Double_t muDecayTime_Transformation_min, muDecayTime_Transformation_max, muDecayTime_t_min, muDecayTime_t_max;
|
Double_t muDecayTime_Transformation_min, muDecayTime_Transformation_max, muDecayTime_t_min, muDecayTime_t_max;
|
||||||
|
|
||||||
static const Double_t microsecond=1.;
|
// static const Double_t microsecond=1.;
|
||||||
static const Double_t nanosecond=0.001;
|
// static const Double_t nanosecond=0.001;
|
||||||
static const Double_t picosecond=0.000001;
|
// static const Double_t picosecond=0.000001;
|
||||||
// static const Double_t rewindTime=1000000.;
|
// static const Double_t rewindTime=1000000.;
|
||||||
// static const Double_t rewindTime=1000.;
|
// static const Double_t rewindTime=1000.;
|
||||||
// static const Long64_t rewindTimeBins=1000000000000000; // Max Long64_t can be +9,223,372,036,854,775,807
|
// static const Long64_t rewindTimeBins=1000000000000000; // Max Long64_t can be +9,223,372,036,854,775,807
|
||||||
@ -383,6 +428,7 @@ public :
|
|||||||
public:
|
public:
|
||||||
static const Int_t nrConditions = 31;
|
static const Int_t nrConditions = 31;
|
||||||
Bool_t condition[nrConditions];
|
Bool_t condition[nrConditions];
|
||||||
|
Long64_t conditionCounter[nrConditions];
|
||||||
static Long64_t rewindTimeBins;
|
static Long64_t rewindTimeBins;
|
||||||
// static Int_t clock_channelID;
|
// static Int_t clock_channelID;
|
||||||
// static Long64_t clock_interval;
|
// static Long64_t clock_interval;
|
||||||
@ -488,7 +534,10 @@ musrAnalysis::musrAnalysis(TTree *tree)
|
|||||||
variableMap["posIniMomZ"]=&posIniMomZ;
|
variableMap["posIniMomZ"]=&posIniMomZ;
|
||||||
// variableMap["nFieldNomVal"]=&nFieldNomVal_double;
|
// variableMap["nFieldNomVal"]=&nFieldNomVal_double;
|
||||||
// variableMap["fieldNomVal0"]=...; //[nFieldNomVal]
|
// variableMap["fieldNomVal0"]=...; //[nFieldNomVal]
|
||||||
|
variableMap["fieldNomVal0"]=&fieldNomVal[0]; // JSL: allow nominal field especially for background muons stopping elsewhere in map
|
||||||
|
variableMap["fieldNomVal1"]=&fieldNomVal[1]; // a second field if defined. Could add more?
|
||||||
variableMap["det_n"]=&det_n_double;
|
variableMap["det_n"]=&det_n_double;
|
||||||
|
variableMap["det_multifirst"]=&det_multifirst_double;
|
||||||
//
|
//
|
||||||
variableMap["muDecayPosR"]=&muDecayPosR;
|
variableMap["muDecayPosR"]=&muDecayPosR;
|
||||||
variableMap["wght"]=&wght;
|
variableMap["wght"]=&wght;
|
||||||
@ -517,6 +566,7 @@ musrAnalysis::musrAnalysis(TTree *tree)
|
|||||||
variableMap["pos_Phi_MINUS_muDecayPol_Phi360"]=&pos_Phi_MINUS_muDecayPol_Phi360;
|
variableMap["pos_Phi_MINUS_muDecayPol_Phi360"]=&pos_Phi_MINUS_muDecayPol_Phi360;
|
||||||
variableMap["pos_detID"]=&pos_detID;
|
variableMap["pos_detID"]=&pos_detID;
|
||||||
variableMap["pos_detID_doubleHit"]=&pos_detID_doubleHit;
|
variableMap["pos_detID_doubleHit"]=&pos_detID_doubleHit;
|
||||||
|
variableMap["pos_doubleHit_dPhi"]=&pos_doubleHit_dPhi;
|
||||||
// variableMap["det_time0"]=&det_time0;
|
// variableMap["det_time0"]=&det_time0;
|
||||||
// variableMap["gen_time0"]=&gen_time0;
|
// variableMap["gen_time0"]=&gen_time0;
|
||||||
// variableMap["det_time1"]=&det_time1;
|
// variableMap["det_time1"]=&det_time1;
|
||||||
@ -525,6 +575,7 @@ musrAnalysis::musrAnalysis(TTree *tree)
|
|||||||
variableMap["gen_time10"]=&gen_time10;
|
variableMap["gen_time10"]=&gen_time10;
|
||||||
variableMap["det_time10_MINUS_gen_time10"]=&det_time10_MINUS_gen_time10;
|
variableMap["det_time10_MINUS_gen_time10"]=&det_time10_MINUS_gen_time10;
|
||||||
variableMap["det_time1_MINUS_muDecayTime"]=&det_time1_MINUS_muDecayTime;
|
variableMap["det_time1_MINUS_muDecayTime"]=&det_time1_MINUS_muDecayTime;
|
||||||
|
variableMap["multiHitInterval"]=&det_multi_interval;
|
||||||
variableMap["detP_x"]=&detP_x;
|
variableMap["detP_x"]=&detP_x;
|
||||||
variableMap["detP_y"]=&detP_x;
|
variableMap["detP_y"]=&detP_x;
|
||||||
variableMap["detP_z"]=&detP_x;
|
variableMap["detP_z"]=&detP_x;
|
||||||
|
@ -1,413 +1,523 @@
|
|||||||
//#include <iostream>
|
//#include <iostream>
|
||||||
#include "musrCounter.hh"
|
#include "musrCounter.hh"
|
||||||
#include "TCanvas.h"
|
#include "TCanvas.h"
|
||||||
#include "musrAnalysis.hh"
|
#include "musrAnalysis.hh"
|
||||||
|
|
||||||
typedef std::map<int,int> debugEventMapType;
|
typedef std::map<int,int> debugEventMapType;
|
||||||
debugEventMapType debugEventMap;
|
debugEventMapType debugEventMap;
|
||||||
Bool_t bool_debugingRequired;
|
Bool_t bool_debugingRequired;
|
||||||
|
|
||||||
Bool_t musrCounter::bool_ignoreUnperfectMuons = true;
|
Bool_t musrCounter::bool_ignoreUnperfectMuons = true;
|
||||||
Bool_t musrCounter::bool_ignoreUnperfectPositrons = true;
|
Bool_t musrCounter::bool_ignoreUnperfectPositrons = true;
|
||||||
Bool_t musrCounter::bool_WriteDataToDumpFile = false;
|
Bool_t musrCounter::bool_WriteDataToDumpFile = false;
|
||||||
//Long64_t musrCounter::previousClock = -1;
|
//Long64_t musrCounter::previousClock = -1;
|
||||||
//Long64_t musrCounter::CLOCK_INTERVAL = 512000;
|
//Long64_t musrCounter::CLOCK_INTERVAL = 512000;
|
||||||
//ofstream musrCounter::dumpFile;
|
//ofstream musrCounter::dumpFile;
|
||||||
|
|
||||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||||
|
|
||||||
musrCounter::musrCounter(int CHANNEL_NR, char CHANNEL_NAME[200], char CHANNEL_TYPE, float E_THRESH, int TIME_SHIFT) {
|
musrCounter::musrCounter(int CHANNEL_NR, char CHANNEL_NAME[200], char CHANNEL_TYPE, float E_THRESH, int TIME_SHIFT, double DEADTIME, Bool_t KEEP_BELOW_THRESH) {
|
||||||
// pointerToAnalysis=this;
|
// pointerToAnalysis=this;
|
||||||
counterNr = CHANNEL_NR;
|
counterNr = CHANNEL_NR;
|
||||||
strcpy(counterName,CHANNEL_NAME);
|
strcpy(counterName,CHANNEL_NAME);
|
||||||
counterType = CHANNEL_TYPE;
|
counterType = CHANNEL_TYPE;
|
||||||
couterEThreshold = E_THRESH;
|
couterEThreshold = E_THRESH;
|
||||||
counterTimeShift = (Long64_t) TIME_SHIFT;
|
counterTimeShift = (Long64_t) TIME_SHIFT;
|
||||||
std::cout<<"musrCounter::musrCounter: Creating counter "<<counterNr<<" "<<counterName<<" "<<counterType<<" "<<couterEThreshold<<" "<<counterTimeShift<<std::endl;
|
keepBelowThresholdHits = KEEP_BELOW_THRESH;
|
||||||
strcpy(TDC_histoName,"Unset");
|
discriminatorRecoveryTime = DEADTIME;
|
||||||
TDC_t0=0;
|
std::cout<<"musrCounter::musrCounter: Creating counter "<<counterNr<<" "<<counterName<<" "<<counterType<<" "<<couterEThreshold<<" "<<counterTimeShift<<std::endl;
|
||||||
TDC_t1=0;
|
strcpy(TDC_histoName,"Unset");
|
||||||
TDC_t2=0;
|
TDC_t0=0;
|
||||||
TDC_histoNrAdd=0;
|
TDC_t1=0;
|
||||||
antiCoincidenceTimeWindowMin=0;
|
TDC_t2=0;
|
||||||
antiCoincidenceTimeWindowMax=0;
|
TDC_histoNrAdd=0;
|
||||||
coincidenceTimeWindowMin_M=0;
|
antiCoincidenceTimeWindowMin=0;
|
||||||
coincidenceTimeWindowMax_M=0;
|
antiCoincidenceTimeWindowMax=0;
|
||||||
coincidenceTimeWindowMin_P=0;
|
coincidenceTimeWindowMin_M=0;
|
||||||
coincidenceTimeWindowMax_P=0;
|
coincidenceTimeWindowMax_M=0;
|
||||||
maxCoincidenceTimeWindow=0;
|
coincidenceTimeWindowMin_P=0;
|
||||||
strcpy(TDC_histoNameAdd,"Unset");
|
coincidenceTimeWindowMax_P=0;
|
||||||
doubleHitN=0;
|
maxCoincidenceTimeWindow=0;
|
||||||
numberOfMuonCandidates=0;
|
strcpy(TDC_histoNameAdd,"Unset");
|
||||||
numberOfMuonCandidatesAfterVK=0;
|
doubleHitN=0;
|
||||||
numberOfMuonCandidatesAfterVKandDoubleHitRemoval=0;
|
numberOfMuonCandidates=0;
|
||||||
}
|
numberOfMuonCandidatesAfterVK=0;
|
||||||
|
numberOfMuonCandidatesAfterVKandDoubleHitRemoval=0;
|
||||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
}
|
||||||
|
|
||||||
musrCounter::~musrCounter() {}
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||||
|
|
||||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
musrCounter::~musrCounter() {}
|
||||||
|
|
||||||
void musrCounter::SetTDChistogram(char hName[200],int t0,int t1,int t2,int hNr,char hNameAdd[200]) {
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||||
strcpy(TDC_histoName,hName);
|
|
||||||
TDC_t0=t0;
|
void musrCounter::SetTDChistogram(char hName[200],int t0,int t1,int t2,int hNr,char hNameAdd[200]) {
|
||||||
TDC_t1=t1;
|
strcpy(TDC_histoName,hName);
|
||||||
TDC_t2=t2;
|
TDC_t0=t0;
|
||||||
TDC_histoNrAdd=hNr;
|
TDC_t1=t1;
|
||||||
strcpy(TDC_histoNameAdd,hNameAdd);
|
TDC_t2=t2;
|
||||||
std::cout<<"TDC_histogram: "<<TDC_histoName<<" "<<TDC_t0<<" "<<TDC_t1<<" "<<TDC_t2<<" "<<TDC_histoNrAdd<<" "<<TDC_histoNameAdd<<std::endl;
|
TDC_histoNrAdd=hNr;
|
||||||
histTDC = new TH1D(TDC_histoName,TDC_histoName,t2,0.,float(t2));
|
strcpy(TDC_histoNameAdd,hNameAdd);
|
||||||
}
|
std::cout<<"TDC_histogram: "<<TDC_histoName<<" "<<TDC_t0<<" "<<TDC_t1<<" "<<TDC_t2<<" "<<TDC_histoNrAdd<<" "<<TDC_histoNameAdd<<std::endl;
|
||||||
//================================================================
|
histTDC = new TH1D(TDC_histoName,TDC_histoName,t2,0.,float(t2));
|
||||||
void musrCounter::FillTDChistogram(Double_t variable, Double_t vaha) {
|
}
|
||||||
histTDC->Fill(variable,vaha);
|
//================================================================
|
||||||
}
|
void musrCounter::FillTDChistogram(Double_t variable, Double_t vaha) {
|
||||||
|
histTDC->Fill(variable,vaha);
|
||||||
//================================================================
|
}
|
||||||
void musrCounter::DrawTDChistogram() {
|
|
||||||
char canvasName[501];
|
//================================================================
|
||||||
sprintf(canvasName,"c%s",TDC_histoName);
|
void musrCounter::DrawTDChistogram() {
|
||||||
TCanvas* cTmp = new TCanvas(canvasName,canvasName);
|
char canvasName[501];
|
||||||
histTDC->Draw();
|
sprintf(canvasName,"c%s",TDC_histoName);
|
||||||
}
|
TCanvas* cTmp = new TCanvas(canvasName,canvasName);
|
||||||
|
histTDC->Draw();
|
||||||
//================================================================
|
}
|
||||||
void musrCounter::FillHitInCounter(Double_t edep, Long64_t timeBin, Long64_t timeBin2, Int_t kEntry, Int_t eveID, Int_t iDet, Int_t detectorID, Int_t eventNum){
|
|
||||||
//cDEL std::cout<<"FillHitInCounter: timeBin="<<timeBin<<" timeBin2="<<timeBin2<<" counterTimeShift="<< counterTimeShift<<std::endl;
|
//================================================================
|
||||||
//cDEL std::cout<<" FillHitInCounter I: timeBin-counterTimeShift="<<timeBin-counterTimeShift<<" timeBin2-counterTimeShift="<<timeBin2-counterTimeShift<<std::endl;
|
void musrCounter::FillHitInCounter(Double_t edep, Long64_t timeBin, Long64_t timeBin2, Int_t kEntry, Int_t eveID, Int_t iDet, Int_t detectorID, Int_t eventNum, Int_t& multiCtr){
|
||||||
// std::cout<<"musrCounter::FillHitInCounter:"<<counterNr<<std::endl;
|
static hitInfo *hFlagged; // common to all histograms
|
||||||
if (edep>=couterEThreshold) {
|
//cDEL std::cout<<"FillHitInCounter: timeBin="<<timeBin<<" timeBin2="<<timeBin2<<" counterTimeShift="<< counterTimeShift<<std::endl;
|
||||||
|
//cDEL std::cout<<" FillHitInCounter I: timeBin-counterTimeShift="<<timeBin-counterTimeShift<<" timeBin2-counterTimeShift="<<timeBin2-counterTimeShift<<std::endl;
|
||||||
hitInfo* hInfo = new hitInfo(kEntry,eveID,iDet,detectorID,edep,timeBin2-counterTimeShift);
|
// std::cout<<"musrCounter::FillHitInCounter:"<<counterNr<<std::endl;
|
||||||
//cDEL std::cout<<detectorID<<" FillHitInCounter II: timeBin-counterTimeShift="<<timeBin-counterTimeShift<<" timeBin2-counterTimeShift="<<timeBin2-counterTimeShift<<std::endl;
|
// JSL: allow keeping of small hits (but label them)
|
||||||
hitMap.insert( std::pair<Long64_t,hitInfo*>(timeBin-counterTimeShift,hInfo) );
|
if ((edep>=couterEThreshold) || ((counterType=='P') && keepBelowThresholdHits)) {
|
||||||
if (bool_WriteDataToDumpFile) { // write data into an output file
|
// multiple count labelling (JSL)
|
||||||
// CheckClockInfo(timeBin);
|
// counter provided by caller (per event across all counters), reset for new muon
|
||||||
// dumpFile<<eventNum<<"\t"<<detectorID<<"\t"<<timeBin<<"\n";
|
// first big hit numbered 0
|
||||||
DumpInfoToDumpFile(eventNum,detectorID,timeBin);
|
// first hit relabelled 1 when second significant hit comes in
|
||||||
}
|
// second and subsequent big hits labelled 2,3,etc
|
||||||
}
|
// small ones labelled -1 regardless of sequence
|
||||||
}
|
// Only for P counters; V,K,M all labelled 0.
|
||||||
|
Int_t multiCtrTmp;
|
||||||
//================================================================
|
if(counterType=='P') {
|
||||||
void musrCounter::RemoveHitsInCounter(Long64_t timeBinLimit) {
|
if(edep>=couterEThreshold) {
|
||||||
// Remove the obsolete hits (i.e. hits that happaned well before t0) from the Counter class
|
if((multiCtr==1) && hFlagged) {
|
||||||
if (hitMap.empty()) return;
|
// a second good hit, relabel the first hit
|
||||||
// myPrintThisCounter();
|
// std::cout << "flagged double count in event "<<kEntry<<" hist "<<detectorID<<" time "<<timeBin<<std::endl;
|
||||||
// if (counterNr==1) {std::cout<<"ooooo1 timeBinLimit="<<timeBinLimit<<std::endl; myPrintThisCounter();}
|
hFlagged->multiHitCtr = 1;
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
// hFlagged=NULL;
|
||||||
// std::cout<<" musrCounter::RemoveHitsInCounter: counterNr="<<counterNr<<" timeBinLimit="<<timeBinLimit<<" maxCoincidenceTimeWindow="<<maxCoincidenceTimeWindow<<" counterTimeShift="<<counterTimeShift<<std::endl;
|
multiCtr++;
|
||||||
if ((it->first)>(timeBinLimit+maxCoincidenceTimeWindow-counterTimeShift)) return; //note that maxCoincidenceTimeWindow is usually negative number
|
}
|
||||||
else {
|
multiCtrTmp=multiCtr;
|
||||||
// std::cout<<" Deleting hit from counter "<<counterNr<<", time bin = "<<(it->first)<<std::endl;
|
multiCtr++;
|
||||||
delete (it->second);
|
} else {
|
||||||
hitMap.erase(it);
|
multiCtrTmp=-1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
// if (counterNr==1) {std::cout<<"ooooo2"<<std::endl; myPrintThisCounter();}
|
multiCtrTmp=0; // M, V or K counter
|
||||||
}
|
}
|
||||||
|
hitInfo* hInfo = new hitInfo(kEntry,eveID,iDet,detectorID,edep,timeBin-counterTimeShift,timeBin2-counterTimeShift, multiCtrTmp, NULL,0);
|
||||||
//================================================================
|
if((multiCtrTmp==0) && (counterType=='P')) { hFlagged=hInfo; } // save pointer to the first hit
|
||||||
//void musrCounter::RewindHitsInCounter(Long64_t timeBinsToRewind) {
|
if(multiCtrTmp>0) {
|
||||||
void musrCounter::RewindHitsInCounter() {
|
hInfo->firstMulti = hFlagged;
|
||||||
// Reset time in hits from the Counter class
|
}
|
||||||
if (hitMap.empty()) return;
|
//cDEL std::cout<<detectorID<<" FillHitInCounter II: timeBin-counterTimeShift="<<timeBin-counterTimeShift<<" timeBin2-counterTimeShift="<<timeBin2-counterTimeShift<<std::endl;
|
||||||
|
hitMap.insert( std::pair<Long64_t,hitInfo*>(timeBin-counterTimeShift,hInfo) );
|
||||||
// Long64_t timeBinsToRewind = musrAnalysis::rewindTimeBins;
|
if (bool_WriteDataToDumpFile) { // write data into an output file
|
||||||
hitMap_TYPE hitMap_TMP;
|
// CheckClockInfo(timeBin);
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
// dumpFile<<eventNum<<"\t"<<detectorID<<"\t"<<timeBin<<"\n";
|
||||||
Long64_t tempBinT = it->first;
|
DumpInfoToDumpFile(eventNum,detectorID,timeBin);
|
||||||
hitInfo* tempEvnr= it->second;
|
}
|
||||||
tempEvnr->RewindTimeBin2(musrAnalysis::rewindTimeBins);
|
}
|
||||||
hitMap_TMP.insert( std::pair<Long64_t,hitInfo*>(tempBinT-musrAnalysis::rewindTimeBins,tempEvnr) );
|
}
|
||||||
}
|
|
||||||
hitMap.swap(hitMap_TMP);
|
//================================================================
|
||||||
}
|
void musrCounter::RemoveHitsInCounter(Long64_t timeBinLimit) {
|
||||||
|
// Remove the obsolete hits (i.e. hits that happaned well before t0) from the Counter class
|
||||||
//================================================================
|
hitMap_TYPE::iterator it2; // JSL
|
||||||
Bool_t musrCounter::IsInCoincidence(Long64_t timeBin, char motherCounter){
|
if (hitMap.empty()) return;
|
||||||
// timeBin ... time bin, at which the coincidence is searched
|
// myPrintThisCounter();
|
||||||
|
// if (counterNr==1) {std::cout<<"ooooo1 timeBinLimit="<<timeBinLimit<<std::endl; myPrintThisCounter();}
|
||||||
if (hitMap.empty()) return false;
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end();) { // JSL: move ++it into body
|
||||||
Long64_t timeBinMin;
|
// std::cout<<" musrCounter::RemoveHitsInCounter: counterNr="<<counterNr<<" timeBinLimit="<<timeBinLimit<<" maxCoincidenceTimeWindow="<<maxCoincidenceTimeWindow<<" counterTimeShift="<<counterTimeShift<<std::endl;
|
||||||
Long64_t timeBinMax;
|
if ((it->first)>(timeBinLimit+maxCoincidenceTimeWindow-counterTimeShift)) return; //note that maxCoincidenceTimeWindow is usually negative number
|
||||||
|
else {
|
||||||
// If timeBinMinimum and timeBinMaximum are not specified, use internal time window of the detector (koincidence or veto detectors).
|
// std::cout<<" Deleting hit from counter "<<counterNr<<", time bin = "<<(it->first)<<std::endl;
|
||||||
// Otherwise use timeBinMinimum and timeBinMaximum (e.g.coincidence of a positron counter with other positron counters).
|
it2=it;
|
||||||
if (counterType == 'V') timeBinMin = timeBin + antiCoincidenceTimeWindowMin; // this is veto detector
|
it2++;
|
||||||
else if (motherCounter=='M') timeBinMin = timeBin + coincidenceTimeWindowMin_M; // this is coinc. detector connected to M
|
delete (it->second);
|
||||||
else if (motherCounter=='P') timeBinMin = timeBin + coincidenceTimeWindowMin_P; // this is coinc. detector connected to P
|
hitMap.erase(it);
|
||||||
|
it=it2;
|
||||||
if (counterType == 'V') timeBinMax = timeBin + antiCoincidenceTimeWindowMax; // this is veto detector
|
}
|
||||||
else if (motherCounter=='M') timeBinMax = timeBin + coincidenceTimeWindowMax_M; // this is coinc. detector connected to M
|
}
|
||||||
else if (motherCounter=='P') timeBinMax = timeBin + coincidenceTimeWindowMax_P; // this is coinc. detector connected to P
|
// if (counterNr==1) {std::cout<<"ooooo2"<<std::endl; myPrintThisCounter();}
|
||||||
|
}
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
|
||||||
Long64_t timeBinOfCount_tmp = it->first;
|
//================================================================
|
||||||
if ((timeBinOfCount_tmp >= timeBinMin) && (timeBinOfCount_tmp <= timeBinMax)) {
|
//void musrCounter::RewindHitsInCounter(Long64_t timeBinsToRewind) {
|
||||||
// if ((timeBin!=timeBinOfCount_tmp)||(!ignoreHitsAtBinZero)) {
|
void musrCounter::RewindHitsInCounter() {
|
||||||
return true;
|
// Reset time in hits from the Counter class
|
||||||
// }
|
if (hitMap.empty()) return;
|
||||||
}
|
|
||||||
else if (timeBinOfCount_tmp > timeBinMax) return false;
|
// Long64_t timeBinsToRewind = musrAnalysis::rewindTimeBins;
|
||||||
}
|
hitMap_TYPE hitMap_TMP;
|
||||||
return false;
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
||||||
}
|
Long64_t tempBinT = it->first;
|
||||||
|
hitInfo* tempEvnr= it->second;
|
||||||
//================================================================
|
tempEvnr->RewindTimeBin2(musrAnalysis::rewindTimeBins);
|
||||||
Bool_t musrCounter::GetNextGoodMuon(Int_t evtID, Long64_t timeBinMin, Long64_t& timeBinOfNextHit, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep) {
|
hitMap_TMP.insert( std::pair<Long64_t,hitInfo*>(tempBinT-musrAnalysis::rewindTimeBins,tempEvnr) );
|
||||||
// This function searches for a good muon, i.e. the muon
|
}
|
||||||
// 1) belongs to the currently analysed event
|
hitMap.swap(hitMap_TMP);
|
||||||
// 2) is in coincidence with all required coincidence detectors
|
}
|
||||||
// 3) is not in coincidence with veto detectors
|
|
||||||
// INPUT PARAMETERS: evtID, timeBinMin
|
//================================================================
|
||||||
// OUTPUT PARAMETERS: timeBinOfNextHit
|
Bool_t musrCounter::IsInCoincidence(Long64_t timeBin, char motherCounter){
|
||||||
//
|
// timeBin ... time bin, at which the coincidence is searched
|
||||||
// Loop over the hits in the counter
|
|
||||||
// std::cout<<" musrCounter::GetNextGoodMuon timeBinMin="<<timeBinMin<<std::endl;
|
if (hitMap.empty()) return false;
|
||||||
if (hitMap.empty()) return false;
|
Long64_t timeBinMin;
|
||||||
if (counterType!='M') {std::cout<<"\n!!! FATAL ERROR !!! musrCounter::GetNextGoodMuon: not the muon counter! ==> S T O P !!!\n"; exit(1);}
|
Long64_t timeBinMax;
|
||||||
|
|
||||||
std::list<hitMap_TYPE::iterator> it_muon_hits_to_be_deleted;
|
// If timeBinMinimum and timeBinMaximum are not specified, use internal time window of the detector (koincidence or veto detectors).
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
// Otherwise use timeBinMinimum and timeBinMaximum (e.g.coincidence of a positron counter with other positron counters).
|
||||||
|
if (counterType == 'V') timeBinMin = timeBin + antiCoincidenceTimeWindowMin; // this is veto detector
|
||||||
Long64_t timeBinOfCount_tmp = it->first;
|
else if (motherCounter=='M') timeBinMin = timeBin + coincidenceTimeWindowMin_M; // this is coinc. detector connected to M
|
||||||
timeBinOfNextHit = timeBinOfCount_tmp;
|
else if (motherCounter=='P') timeBinMin = timeBin + coincidenceTimeWindowMin_P; // this is coinc. detector connected to P
|
||||||
Int_t modulo = timeBinOfNextHit % 524288;
|
|
||||||
if (timeBinOfCount_tmp <= timeBinMin) continue; // This hit was already processed previously ==> skip it
|
if (counterType == 'V') timeBinMax = timeBin + antiCoincidenceTimeWindowMax; // this is veto detector
|
||||||
|
else if (motherCounter=='M') timeBinMax = timeBin + coincidenceTimeWindowMax_M; // this is coinc. detector connected to M
|
||||||
Int_t eventNumber = (it->second)->eventIDnumber;
|
else if (motherCounter=='P') timeBinMax = timeBin + coincidenceTimeWindowMax_P; // this is coinc. detector connected to P
|
||||||
if (eventNumber!=evtID) continue; // This trigger hit does not correspond to the currently processed event
|
|
||||||
// ==> skip it, because it was already proceesed or will be processed in future
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
||||||
numberOfMuonCandidates++;
|
Long64_t timeBinOfCount_tmp = it->first;
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate found ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
if ((timeBinOfCount_tmp >= timeBinMin) && (timeBinOfCount_tmp <= timeBinMax)) {
|
||||||
|
// if ((timeBin!=timeBinOfCount_tmp)||(!ignoreHitsAtBinZero)) {
|
||||||
// Hit candidate was found. Now check its coincidences and vetos
|
return true;
|
||||||
Bool_t bool_coincidenceConditions = true;
|
// }
|
||||||
for (counterMapType::const_iterator itCounter = koincidenceCounterMap.begin(); itCounter!=koincidenceCounterMap.end(); ++itCounter) {
|
}
|
||||||
if (!( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') )) { // no coincidence found ==> skip hit
|
else if (timeBinOfCount_tmp > timeBinMax) return false;
|
||||||
// if (bool_ignoreUnperfectMuons) hitMap.erase(it);
|
}
|
||||||
if (bool_ignoreUnperfectMuons) it_muon_hits_to_be_deleted.push_back(it);
|
return false;
|
||||||
bool_coincidenceConditions = false;
|
}
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate not in koincidence ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
|
||||||
goto MuonCoincidencesChecked;
|
//================================================================
|
||||||
}
|
Bool_t musrCounter::GetNextGoodMuon(Int_t evtID, Long64_t timeBinMin, Long64_t& timeBinOfNextHit, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep) {
|
||||||
}
|
// This function searches for a good muon, i.e. the muon
|
||||||
for (counterMapType::const_iterator itCounter = vetoCounterMap.begin(); itCounter!=vetoCounterMap.end(); ++itCounter) {
|
// 1) belongs to the currently analysed event
|
||||||
if ( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') ) { // coincidence with veto found ==> skip hit
|
// 2) is in coincidence with all required coincidence detectors
|
||||||
// if (bool_ignoreUnperfectMuons) hitMap.erase(it);
|
// 3) is not in coincidence with veto detectors
|
||||||
if (bool_ignoreUnperfectMuons) it_muon_hits_to_be_deleted.push_back(it);
|
// INPUT PARAMETERS: evtID, timeBinMin
|
||||||
bool_coincidenceConditions = false;
|
// OUTPUT PARAMETERS: timeBinOfNextHit
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate vetoed ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
//
|
||||||
goto MuonCoincidencesChecked;
|
// Loop over the hits in the counter
|
||||||
}
|
// std::cout<<" musrCounter::GetNextGoodMuon timeBinMin="<<timeBinMin<<std::endl;
|
||||||
}
|
if (hitMap.empty()) return false;
|
||||||
|
if (counterType!='M') {std::cout<<"\n!!! FATAL ERROR !!! musrCounter::GetNextGoodMuon: not the muon counter! ==> S T O P !!!\n"; exit(1);}
|
||||||
MuonCoincidencesChecked:
|
|
||||||
if (!bool_coincidenceConditions) continue; // This hit does not fulfill coincidence and veto criteria
|
std::list<hitMap_TYPE::iterator> it_muon_hits_to_be_deleted;
|
||||||
numberOfMuonCandidatesAfterVK++;
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate after VK ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
|
||||||
|
Long64_t timeBinOfCount_tmp = it->first;
|
||||||
if ( CheckForPileupMuons(timeBinOfNextHit) ) {
|
timeBinOfNextHit = timeBinOfCount_tmp;
|
||||||
// std::cout<<"CheckForPileupMuons=true"<<std::endl;
|
Int_t modulo = timeBinOfNextHit % 524288;
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate killed by pileup muon ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
if (timeBinOfCount_tmp <= timeBinMin) continue; // This hit was already processed previously ==> skip it
|
||||||
continue; // This muon candidate is killed due to a double hit rejection.
|
|
||||||
}
|
Int_t eventNumber = (it->second)->eventIDnumber;
|
||||||
kEntry = (it->second)->eventEntry;
|
if (eventNumber!=evtID) continue; // This trigger hit does not correspond to the currently processed event
|
||||||
idet = (it->second)->det_i;
|
// ==> skip it, because it was already proceesed or will be processed in future
|
||||||
idetID = (it->second)->det_id;
|
numberOfMuonCandidates++;
|
||||||
idetEdep = (it->second)->det_edep;
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate found ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>1) std::cout<<"GetNextGoodMuon: GOOD muon candidate found ("
|
|
||||||
<<timeBinOfNextHit<<" , "<<modulo<<" ; "<<evtID<<")"<<std::endl;}
|
// Hit candidate was found. Now check its coincidences and vetos
|
||||||
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_muon_hits_to_be_deleted.begin(); itt != it_muon_hits_to_be_deleted.end(); ++itt) {
|
Bool_t bool_coincidenceConditions = true;
|
||||||
hitMap.erase(*itt);
|
for (counterMapType::const_iterator itCounter = koincidenceCounterMap.begin(); itCounter!=koincidenceCounterMap.end(); ++itCounter) {
|
||||||
}
|
if (!( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') )) { // no coincidence found ==> skip hit
|
||||||
return true;
|
// if (bool_ignoreUnperfectMuons) hitMap.erase(it);
|
||||||
}
|
if (bool_ignoreUnperfectMuons) it_muon_hits_to_be_deleted.push_back(it);
|
||||||
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_muon_hits_to_be_deleted.begin(); itt != it_muon_hits_to_be_deleted.end(); ++itt) {
|
bool_coincidenceConditions = false;
|
||||||
hitMap.erase(*itt);
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate not in koincidence ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
||||||
}
|
goto MuonCoincidencesChecked;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
for (counterMapType::const_iterator itCounter = vetoCounterMap.begin(); itCounter!=vetoCounterMap.end(); ++itCounter) {
|
||||||
//================================================================
|
if ( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') ) { // coincidence with veto found ==> skip hit
|
||||||
Bool_t musrCounter::CheckForPileupMuons(Long64_t timeBin0) {
|
// if (bool_ignoreUnperfectMuons) hitMap.erase(it);
|
||||||
// Check for pileup muons. If double hit in M-counter is found, return true.
|
if (bool_ignoreUnperfectMuons) it_muon_hits_to_be_deleted.push_back(it);
|
||||||
Long64_t timeBinMinimum = timeBin0;
|
bool_coincidenceConditions = false;
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate vetoed ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
||||||
Long64_t timeBinOfCount_tmp = it->first;
|
goto MuonCoincidencesChecked;
|
||||||
// std::cout<<"timeBin0="<<timeBin0<<" timeBinOfCount_tmp="<<timeBinOfCount_tmp<<std::endl;
|
}
|
||||||
if (timeBinOfCount_tmp < timeBinMinimum+musrAnalysis::pileupWindowBinMin) continue; // This hit happened too long ago
|
}
|
||||||
if (timeBinOfCount_tmp > timeBinMinimum+musrAnalysis::pileupWindowBinMax) break; // This hit happened too late
|
|
||||||
// if ((timeBinOfCount_tmp == timeBinMinimum)&&( ((it->second)->eventEntry) == kEntry_NN)) continue;
|
MuonCoincidencesChecked:
|
||||||
if (timeBinOfCount_tmp == timeBinMinimum) continue;
|
if (!bool_coincidenceConditions) continue; // This hit does not fulfill coincidence and veto criteria
|
||||||
// This is the M-counter hit for which we check the pileup -> ignore this hit in this double-hit check.
|
numberOfMuonCandidatesAfterVK++;
|
||||||
// We have found the hit, which could be the double hit. If it is required, we now have
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate after VK ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
||||||
// to check the coincidences and anticoincidences of this double-hit muon:
|
|
||||||
if (!bool_ignoreUnperfectMuons) {
|
if ( CheckForPileupMuons(timeBinOfNextHit) ) {
|
||||||
return true; // In this case we do not check for coincidences and anticoincidences ==> double hit found.
|
// std::cout<<"CheckForPileupMuons=true"<<std::endl;
|
||||||
}
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>3) std::cout<<"GetNextGoodMuon: muon candidate killed by pileup muon ("<<timeBinOfNextHit<<" , "<<modulo<<")"<<std::endl;}
|
||||||
for (counterMapType::const_iterator itCounter = koincidenceCounterMap.begin(); itCounter!=koincidenceCounterMap.end(); ++itCounter) {
|
continue; // This muon candidate is killed due to a double hit rejection.
|
||||||
if (!( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') )) goto endOfThisHit; // no coincidence found ==> skip hit
|
}
|
||||||
}
|
kEntry = (it->second)->eventEntry;
|
||||||
for (counterMapType::const_iterator itCounter = vetoCounterMap.begin(); itCounter!=vetoCounterMap.end(); ++itCounter) {
|
idet = (it->second)->det_i;
|
||||||
if ( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') ) goto endOfThisHit; // coincidence with veto found ==> skip hit
|
idetID = (it->second)->det_id;
|
||||||
}
|
idetEdep = (it->second)->det_edep;
|
||||||
// The double hit was found (the pileup muon fulfils all veto and coincidence requirements) ==> end of the search
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>1) std::cout<<"GetNextGoodMuon: GOOD muon candidate found ("
|
||||||
return true;
|
<<timeBinOfNextHit<<" , "<<modulo<<" ; "<<evtID<<")"<<std::endl;}
|
||||||
|
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_muon_hits_to_be_deleted.begin(); itt != it_muon_hits_to_be_deleted.end(); ++itt) {
|
||||||
endOfThisHit:
|
hitMap.erase(*itt);
|
||||||
;
|
}
|
||||||
}
|
return true;
|
||||||
numberOfMuonCandidatesAfterVKandDoubleHitRemoval++;
|
}
|
||||||
return false;
|
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_muon_hits_to_be_deleted.begin(); itt != it_muon_hits_to_be_deleted.end(); ++itt) {
|
||||||
}
|
hitMap.erase(*itt);
|
||||||
//================================================================
|
}
|
||||||
Int_t musrCounter::GetNextGoodPositron(Int_t evtID, Long64_t timeBinMin, Long64_t timeBinMax, Long64_t& timeBinOfNextGoodHit, Long64_t& timeBinOfNextGoodHit_phaseShifted, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep) {
|
return false;
|
||||||
// INPUT PARAMETERS: evtID, timeBinMin
|
}
|
||||||
// OUTPUT PARAMETERS: timeBinOfNextGoodHit
|
|
||||||
// positronQuality = 0 ... no positron candidate found
|
//================================================================
|
||||||
// = 2 ... good positron found
|
Bool_t musrCounter::CheckForPileupMuons(Long64_t timeBin0) {
|
||||||
// = 3 ... double hit
|
// Check for pileup muons. If double hit in M-counter is found, return true.
|
||||||
// Loop over the hits in the counter
|
Long64_t timeBinMinimum = timeBin0;
|
||||||
Int_t positronQuality=0;
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
||||||
if (bool_debugingRequired) {if (debugEventMap[evtID]>4) myPrintThisCounter(evtID,0);}
|
Long64_t timeBinOfCount_tmp = it->first;
|
||||||
if (hitMap.empty()) return 0;
|
// std::cout<<"timeBin0="<<timeBin0<<" timeBinOfCount_tmp="<<timeBinOfCount_tmp<<std::endl;
|
||||||
if (counterType!='P') {std::cout<<"\n!!! FATAL ERROR !!! musrCounter::GetNextGoodPositron: not the positron counter! ==> S T O P !!!\n"; exit(1);}
|
if (timeBinOfCount_tmp < timeBinMinimum+musrAnalysis::pileupWindowBinMin) continue; // This hit happened too long ago
|
||||||
std::list<hitMap_TYPE::iterator> it_positron_hits_to_be_deleted;
|
if (timeBinOfCount_tmp > timeBinMinimum+musrAnalysis::pileupWindowBinMax) break; // This hit happened too late
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
// if ((timeBinOfCount_tmp == timeBinMinimum)&&( ((it->second)->eventEntry) == kEntry_NN)) continue;
|
||||||
// Int_t eventNumber = (it->second)->eventIDnumber;
|
if (timeBinOfCount_tmp == timeBinMinimum) continue;
|
||||||
Long64_t timeBinOfCount_tmp = it->first;
|
// This is the M-counter hit for which we check the pileup -> ignore this hit in this double-hit check.
|
||||||
Int_t modulo = timeBinOfCount_tmp % 524288;
|
// We have found the hit, which could be the double hit. If it is required, we now have
|
||||||
if ((timeBinOfCount_tmp <= timeBinMin) || (timeBinOfCount_tmp > timeBinMax)) {
|
// to check the coincidences and anticoincidences of this double-hit muon:
|
||||||
if (bool_debugingRequired) {
|
if (!bool_ignoreUnperfectMuons) {
|
||||||
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Hit out of data interval"<<std::endl;}
|
return true; // In this case we do not check for coincidences and anticoincidences ==> double hit found.
|
||||||
}
|
}
|
||||||
continue; // This hit is out of the data interval ==> skip it
|
for (counterMapType::const_iterator itCounter = koincidenceCounterMap.begin(); itCounter!=koincidenceCounterMap.end(); ++itCounter) {
|
||||||
}
|
if (!( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') )) goto endOfThisHit; // no coincidence found ==> skip hit
|
||||||
|
}
|
||||||
// Hit candidate was found. Now check its coincidences and vetos
|
for (counterMapType::const_iterator itCounter = vetoCounterMap.begin(); itCounter!=vetoCounterMap.end(); ++itCounter) {
|
||||||
Bool_t bool_coincidenceConditions = true;
|
if ( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'M') ) goto endOfThisHit; // coincidence with veto found ==> skip hit
|
||||||
for (counterMapType::const_iterator itCounter = koincidenceCounterMap.begin(); itCounter!=koincidenceCounterMap.end(); ++itCounter) {
|
}
|
||||||
if (bool_debugingRequired) {
|
// The double hit was found (the pileup muon fulfils all veto and coincidence requirements) ==> end of the search
|
||||||
if (debugEventMap[evtID]>4) { (itCounter->second)->myPrintThisCounter(evtID); }
|
return true;
|
||||||
}
|
|
||||||
if (!( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'P') )) {
|
endOfThisHit:
|
||||||
if (bool_debugingRequired) {
|
;
|
||||||
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Coincidence required but not found (timeBin="<<timeBinOfCount_tmp<<" , "<<modulo<<")"<<std::endl;}
|
}
|
||||||
}
|
numberOfMuonCandidatesAfterVKandDoubleHitRemoval++;
|
||||||
// if (bool_ignoreUnperfectPositrons) hitMap.erase(it); // no coincidence found ==> remove the candidate.
|
return false;
|
||||||
if (bool_ignoreUnperfectPositrons) it_positron_hits_to_be_deleted.push_back(it);
|
}
|
||||||
bool_coincidenceConditions = false;
|
//================================================================
|
||||||
goto CoincidencesChecked;
|
Int_t musrCounter::GetNextGoodPositron(Int_t evtID, Long64_t timeBinMin, Long64_t timeBinMax, Long64_t& timeBinOfNextGoodHit, Long64_t& timeBinOfNextGoodHit_phaseShifted, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep) {
|
||||||
// goto endOfThisHit; // no coincidence found ==> skip hit
|
// INPUT PARAMETERS: evtID, timeBinMin
|
||||||
}
|
// OUTPUT PARAMETERS: timeBinOfNextGoodHit
|
||||||
}
|
// positronQuality = 0 ... no positron candidate found
|
||||||
for (counterMapType::const_iterator itCounter = vetoCounterMap.begin(); itCounter!=vetoCounterMap.end(); ++itCounter) {
|
// = 2 ... good positron found
|
||||||
if ( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'P') ) {
|
// = 3 ... double hit
|
||||||
if (bool_debugingRequired) {
|
// Loop over the hits in the counter
|
||||||
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Coincidence vith veto detector found (timeBin="<<timeBinOfCount_tmp<<" , "<<modulo<<")"<<std::endl;}
|
Int_t positronQuality=0;
|
||||||
}
|
if (bool_debugingRequired) {if (debugEventMap[evtID]>4) myPrintThisCounter(evtID,0);}
|
||||||
// if (bool_ignoreUnperfectPositrons) hitMap.erase(it); // coincidence with veto found ==> remove the candidate.
|
if (hitMap.empty()) return 0;
|
||||||
if (bool_ignoreUnperfectPositrons) it_positron_hits_to_be_deleted.push_back(it);
|
if (counterType!='P') {std::cout<<"\n!!! FATAL ERROR !!! musrCounter::GetNextGoodPositron: not the positron counter! ==> S T O P !!!\n"; exit(1);}
|
||||||
bool_coincidenceConditions = false;
|
std::list<hitMap_TYPE::iterator> it_positron_hits_to_be_deleted;
|
||||||
goto CoincidencesChecked;
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
||||||
// goto endOfThisHit; // coincidence with veto found ==> skip hit
|
// Int_t eventNumber = (it->second)->eventIDnumber;
|
||||||
}
|
Long64_t timeBinOfCount_tmp = it->first;
|
||||||
}
|
Int_t modulo = timeBinOfCount_tmp % 524288;
|
||||||
|
if ((timeBinOfCount_tmp <= timeBinMin) || (timeBinOfCount_tmp > timeBinMax)) {
|
||||||
CoincidencesChecked:
|
if (bool_debugingRequired) {
|
||||||
if (!bool_coincidenceConditions) continue; // This hit does not fulfill coincidence and veto criteria
|
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Hit out of data interval"<<std::endl;}
|
||||||
if (positronQuality==2) {
|
}
|
||||||
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_positron_hits_to_be_deleted.begin(); itt != it_positron_hits_to_be_deleted.end(); ++itt) {
|
continue; // This hit is out of the data interval ==> skip it
|
||||||
hitMap.erase(*itt);
|
}
|
||||||
}
|
|
||||||
return 3; // An electron was already found before, and now again ==> double hit
|
// Hit candidate was found. Now check its coincidences and vetos
|
||||||
}
|
Bool_t bool_coincidenceConditions = true;
|
||||||
else positronQuality=2;
|
for (counterMapType::const_iterator itCounter = koincidenceCounterMap.begin(); itCounter!=koincidenceCounterMap.end(); ++itCounter) {
|
||||||
|
if (bool_debugingRequired) {
|
||||||
kEntry = (it->second)->eventEntry;
|
if (debugEventMap[evtID]>4) { (itCounter->second)->myPrintThisCounter(evtID); }
|
||||||
idet = (it->second)->det_i;
|
}
|
||||||
idetID = (it->second)->det_id;
|
if (!( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'P') )) {
|
||||||
idetEdep = (it->second)->det_edep;
|
if (bool_debugingRequired) {
|
||||||
timeBinOfNextGoodHit = timeBinOfCount_tmp;
|
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Coincidence required but not found (timeBin="<<timeBinOfCount_tmp<<" , "<<modulo<<")"<<std::endl;}
|
||||||
timeBinOfNextGoodHit_phaseShifted = (it->second) -> timeBin2;
|
}
|
||||||
if (bool_debugingRequired) {
|
// if (bool_ignoreUnperfectPositrons) hitMap.erase(it); // no coincidence found ==> remove the candidate.
|
||||||
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Good positron candidate found in this counter. (timeBin="<<timeBinOfCount_tmp<<" , "<<modulo<<" "<<(it->second)->eventIDnumber<<")"<<std::endl;}
|
if (bool_ignoreUnperfectPositrons) it_positron_hits_to_be_deleted.push_back(it);
|
||||||
}
|
bool_coincidenceConditions = false;
|
||||||
}
|
goto CoincidencesChecked;
|
||||||
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_positron_hits_to_be_deleted.begin(); itt != it_positron_hits_to_be_deleted.end(); ++itt) {
|
// goto endOfThisHit; // no coincidence found ==> skip hit
|
||||||
hitMap.erase(*itt);
|
}
|
||||||
}
|
}
|
||||||
|
for (counterMapType::const_iterator itCounter = vetoCounterMap.begin(); itCounter!=vetoCounterMap.end(); ++itCounter) {
|
||||||
return positronQuality;
|
if ( (itCounter->second)->IsInCoincidence(timeBinOfCount_tmp,'P') ) {
|
||||||
}
|
if (bool_debugingRequired) {
|
||||||
|
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Coincidence vith veto detector found (timeBin="<<timeBinOfCount_tmp<<" , "<<modulo<<")"<<std::endl;}
|
||||||
//================================================================
|
}
|
||||||
void musrCounter::SetCoincidenceTimeWindowOfAllCoincidenceDetectors(char motherCounter, Long64_t maxCoinc, Long64_t min, Long64_t max) {
|
// if (bool_ignoreUnperfectPositrons) hitMap.erase(it); // coincidence with veto found ==> remove the candidate.
|
||||||
// std::cout<<"QQQQQQQQQQQQQQQQQQQQQ koincidenceCounterMap.size()="<<koincidenceCounterMap.size()<<std::endl;
|
if (bool_ignoreUnperfectPositrons) it_positron_hits_to_be_deleted.push_back(it);
|
||||||
for (counterMapType::const_iterator it = koincidenceCounterMap.begin(); it!=koincidenceCounterMap.end(); ++it) {
|
bool_coincidenceConditions = false;
|
||||||
Long64_t maxCoinc_AlreadySet = ((it->second)->GetMaxCoincidenceTimeWindow());
|
goto CoincidencesChecked;
|
||||||
if (maxCoinc < maxCoinc_AlreadySet) (it->second)->SetMaxCoincidenceTimeWindow(maxCoinc);
|
// goto endOfThisHit; // coincidence with veto found ==> skip hit
|
||||||
|
}
|
||||||
if (motherCounter=='M') (it->second)->SetCoincidenceTimeWindow_M(min,max);
|
}
|
||||||
else if (motherCounter=='P') (it->second)->SetCoincidenceTimeWindow_P(min,max);
|
|
||||||
else {
|
CoincidencesChecked:
|
||||||
std::cout<<"musrCounter::SetCoincidenceTimeWindowOfAllCoincidenceDetectors ERROR: Strange motherCounter "
|
if (!bool_coincidenceConditions) continue; // This hit does not fulfill coincidence and veto criteria
|
||||||
<<motherCounter<<"\n ==> S T O P "<<std::endl;
|
if (positronQuality==2) {
|
||||||
exit(1);
|
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_positron_hits_to_be_deleted.begin(); itt != it_positron_hits_to_be_deleted.end(); ++itt) {
|
||||||
}
|
hitMap.erase(*itt);
|
||||||
}
|
}
|
||||||
}
|
return 3; // An electron was already found before, and now again ==> double hit
|
||||||
|
}
|
||||||
//================================================================
|
else positronQuality=2;
|
||||||
void musrCounter::SetCoincidenceTimeWindowOfAllVetoDetectors(Long64_t maxCoinc, Long64_t min, Long64_t max) {
|
|
||||||
for (counterMapType::const_iterator it = vetoCounterMap.begin(); it!=vetoCounterMap.end(); ++it) {
|
kEntry = (it->second)->eventEntry;
|
||||||
musrCounter* counter = it->second;
|
idet = (it->second)->det_i;
|
||||||
Long64_t maxCoinc_AlreadySet = counter->GetMaxCoincidenceTimeWindow();
|
idetID = (it->second)->det_id;
|
||||||
Long64_t min_AlreadySet = counter->GetAntiCoincidenceTimeWindowMin();
|
idetEdep = (it->second)->det_edep;
|
||||||
Long64_t max_AlreadySet = counter->GetAntiCoincidenceTimeWindowMax();
|
timeBinOfNextGoodHit = timeBinOfCount_tmp;
|
||||||
if (maxCoinc < maxCoinc_AlreadySet) counter->SetMaxCoincidenceTimeWindow(maxCoinc);
|
timeBinOfNextGoodHit_phaseShifted = (it->second) -> timeBin2;
|
||||||
if (min < min_AlreadySet) counter->SetAntiCoincidenceTimeWindowMin(min);
|
if (bool_debugingRequired) {
|
||||||
if (max > max_AlreadySet) counter->SetAntiCoincidenceTimeWindowMax(max);
|
if (debugEventMap[evtID]>3) {std::cout<<"GetNextGoodPositron: Good positron candidate found in this counter. (timeBin="<<timeBinOfCount_tmp<<" , "<<modulo<<" "<<(it->second)->eventIDnumber<<")"<<std::endl;}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(std::list<hitMap_TYPE::iterator>::iterator itt = it_positron_hits_to_be_deleted.begin(); itt != it_positron_hits_to_be_deleted.end(); ++itt) {
|
||||||
//================================================================
|
hitMap.erase(*itt);
|
||||||
void musrCounter::myPrintThisCounter(Int_t evtID, Int_t detail) {
|
}
|
||||||
Bool_t eventMixing=false;
|
|
||||||
if ((hitMap.begin()==hitMap.end()) && (detail<=1) ) return;
|
return positronQuality;
|
||||||
// if (detail>1) std::cout<<"musrCounter::myPrintThisCounter: counterNr = "<<counterNr<<": ";
|
}
|
||||||
// else
|
|
||||||
std::cout<<" counter = "<<counterNr<<": ";
|
//================================================================
|
||||||
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
Int_t musrCounter::GetNextGoodPositronPulsed(Int_t entWanted1, Int_t entWanted2, Long64_t timeBinMin, Long64_t timeBinMax, Long64_t& timeBinOfNextGoodHit, Long64_t& timeBinOfNextGoodHit_phaseShifted, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep, Int_t& idetFirstMulti, hitInfo*& hitStruct) {
|
||||||
std::cout<<"\t"<<it->first<<" ("<<(it->first)%524288 <<") "<<(it->second)->eventIDnumber<<",";
|
// pulsed. Sort through one detector
|
||||||
if (evtID != (it->second)->eventIDnumber) {eventMixing=true;}
|
// return positron quality: (>= -1 are "counted" events, 0,1,-2,-3 are "ideal")
|
||||||
}
|
// -1000: no more positron candidates
|
||||||
if (eventMixing) {std::cout<<" Potential event mixing";}
|
// 0: a normal "good" positron, the only above threshold hit for that muon
|
||||||
std::cout<<std::endl;
|
// 1..n: "good" positrons, but double count events. 1 - 1st such hit 2=2nd, etc
|
||||||
}
|
// -1: "stacked" event, this positron plus remaining "charge" adds to threshold (double hit status of such events not recorded)
|
||||||
|
// -2..-999: "dead" event, good positron but will not be counted. -2=only hit -3=1st of double -4=2nd of double, etc
|
||||||
//================================================================
|
Int_t positronQuality=-1000;
|
||||||
//void musrCounter::CheckClockInfo(Long64_t timeBin) {
|
Int_t idMin=+1000000000;
|
||||||
// Int_t clock_detectorID=musrAnalysis::clock_channelID;
|
Int_t idMax=-1000000000;
|
||||||
// if (timeBin > (previousClock+musrAnalysis::clock_interval)) {
|
//
|
||||||
// previousClock += musrAnalysis::clock_interval;
|
// entWanted: must be in range
|
||||||
// // dumpFile<<"-1\t"<<clock_detectorID<<"\t"<<previousClock<<"\n";
|
// timeBinMin, timeBinMax: range to search
|
||||||
// DumpInfoToDumpFile(-1,clock_detectorID,previousClock);
|
// timeBinOfNextGoodHit: starting point on entry, filled with time. If < timeBinMin, reset discriminator to beginning and run through pre-time-window events
|
||||||
// }
|
// timeBinOfNextGoodHit_phaseShifted: adjusted (out only)
|
||||||
//}
|
// kEntry: entry number for this event
|
||||||
//================================================================
|
// idet: detector number
|
||||||
void musrCounter::DumpInfoToDumpFile(Int_t eventNr, Int_t detID, Long64_t tdcBin) {
|
// idetID:
|
||||||
if (tdcBin>=musrAnalysis::rewindTimeBins) tdcBin -= musrAnalysis::rewindTimeBins;
|
// idetEdep: energy deposited by this positron event (may be < threshold!)
|
||||||
else if (tdcBin<0) tdcBin += musrAnalysis::rewindTimeBins;
|
//
|
||||||
// Int_t tdc = (tdcBin<musrAnalysis::rewindTimeBins) ? tdcBin : tdcBin-musrAnalysis::rewindTimeBins;
|
// may no longer need to unpackage all the vars?
|
||||||
// dumpFile<<eventNr<<"\t"<<detID<<"\t"<<tdcBin<<"\n";
|
|
||||||
musrAnalysis::myWriteDump->send_to_dump(detID,tdcBin,false);
|
if(timeBinOfNextGoodHit < timeBinMin || timeBinOfNextGoodHit < discriminatorLastTime) {
|
||||||
}
|
// rewind discriminator
|
||||||
//================================================================
|
discriminatorLastVolts = 0.0;
|
||||||
void musrCounter::WriteRewindIntoDumpFile() {
|
discriminatorLastTime = timeBinOfNextGoodHit;
|
||||||
DumpInfoToDumpFile(-2,1000,0);
|
discriminatorIterator = hitMap.begin();
|
||||||
}
|
}
|
||||||
//================================================================
|
// process events until a good hit found, or end
|
||||||
|
while((discriminatorIterator != hitMap.end()) && (discriminatorIterator->first <= timeBinMax)) {
|
||||||
|
if(discriminatorIterator->second->eventEntry > idMax) { idMax=discriminatorIterator->second->eventEntry; }
|
||||||
|
if(discriminatorIterator->second->eventEntry < idMin) { idMin=discriminatorIterator->second->eventEntry; }
|
||||||
|
Long_t dT=((discriminatorIterator->first)-discriminatorLastTime);
|
||||||
|
double discriminatorDropVolts=discriminatorLastVolts * exp(-dT/discriminatorRecoveryTime);
|
||||||
|
discriminatorLastVolts=discriminatorDropVolts + discriminatorIterator->second->det_edep;
|
||||||
|
discriminatorLastTime=discriminatorIterator->first;
|
||||||
|
// discriminate it!
|
||||||
|
Bool_t discriminatorTriggered = (discriminatorDropVolts < couterEThreshold && discriminatorLastVolts > couterEThreshold);
|
||||||
|
// have we found the wanted event?
|
||||||
|
if ((((discriminatorIterator->second->eventEntry >= entWanted1) && (discriminatorIterator->second->eventEntry <= entWanted2)) && discriminatorIterator->first > timeBinMin) && (discriminatorTriggered || (discriminatorIterator->second->det_edep > couterEThreshold))) {
|
||||||
|
//yes
|
||||||
|
if(discriminatorTriggered) {
|
||||||
|
positronQuality=discriminatorIterator->second->multiHitCtr; // already checked to see if it was above threshold on its own and/or double
|
||||||
|
} else { // a missed good count, record these too
|
||||||
|
positronQuality= -2 - discriminatorIterator->second->multiHitCtr;
|
||||||
|
}
|
||||||
|
kEntry = (discriminatorIterator->second)->eventEntry;
|
||||||
|
idet = (discriminatorIterator->second)->det_i;
|
||||||
|
idetID = (discriminatorIterator->second)->det_id;
|
||||||
|
idetEdep = (discriminatorIterator->second)->det_edep;
|
||||||
|
timeBinOfNextGoodHit = discriminatorIterator->first;
|
||||||
|
timeBinOfNextGoodHit_phaseShifted = (discriminatorIterator->second) -> timeBin2;
|
||||||
|
if(((discriminatorIterator->second)->multiHitCtr > 1) && (discriminatorIterator->second)->firstMulti) {
|
||||||
|
idetFirstMulti = (discriminatorIterator->second)->firstMulti->det_i;
|
||||||
|
} else {
|
||||||
|
idetFirstMulti = -1000; // not a second or subsequent multi hit, or not recorded for some reason
|
||||||
|
}
|
||||||
|
hitStruct = discriminatorIterator->second;
|
||||||
|
discriminatorIterator->second->posQual = positronQuality;
|
||||||
|
discriminatorIterator++;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
discriminatorIterator++;
|
||||||
|
hitStruct = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(positronQuality==-1000 && ((idMax>idMin) && timeBinOfNextGoodHit<0)) {
|
||||||
|
// std::cout << "Didn't find entry " << entWanted << " but only range " << idMin << " to " << idMax << " from " << timeBinOfNextGoodHit << std::endl;
|
||||||
|
}
|
||||||
|
return positronQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
void musrCounter::SetCoincidenceTimeWindowOfAllCoincidenceDetectors(char motherCounter, Long64_t maxCoinc, Long64_t min, Long64_t max) {
|
||||||
|
// std::cout<<"QQQQQQQQQQQQQQQQQQQQQ koincidenceCounterMap.size()="<<koincidenceCounterMap.size()<<std::endl;
|
||||||
|
for (counterMapType::const_iterator it = koincidenceCounterMap.begin(); it!=koincidenceCounterMap.end(); ++it) {
|
||||||
|
Long64_t maxCoinc_AlreadySet = ((it->second)->GetMaxCoincidenceTimeWindow());
|
||||||
|
if (maxCoinc < maxCoinc_AlreadySet) (it->second)->SetMaxCoincidenceTimeWindow(maxCoinc);
|
||||||
|
|
||||||
|
if (motherCounter=='M') (it->second)->SetCoincidenceTimeWindow_M(min,max);
|
||||||
|
else if (motherCounter=='P') (it->second)->SetCoincidenceTimeWindow_P(min,max);
|
||||||
|
else {
|
||||||
|
std::cout<<"musrCounter::SetCoincidenceTimeWindowOfAllCoincidenceDetectors ERROR: Strange motherCounter "
|
||||||
|
<<motherCounter<<"\n ==> S T O P "<<std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
void musrCounter::SetCoincidenceTimeWindowOfAllVetoDetectors(Long64_t maxCoinc, Long64_t min, Long64_t max) {
|
||||||
|
for (counterMapType::const_iterator it = vetoCounterMap.begin(); it!=vetoCounterMap.end(); ++it) {
|
||||||
|
musrCounter* counter = it->second;
|
||||||
|
Long64_t maxCoinc_AlreadySet = counter->GetMaxCoincidenceTimeWindow();
|
||||||
|
Long64_t min_AlreadySet = counter->GetAntiCoincidenceTimeWindowMin();
|
||||||
|
Long64_t max_AlreadySet = counter->GetAntiCoincidenceTimeWindowMax();
|
||||||
|
if (maxCoinc < maxCoinc_AlreadySet) counter->SetMaxCoincidenceTimeWindow(maxCoinc);
|
||||||
|
if (min < min_AlreadySet) counter->SetAntiCoincidenceTimeWindowMin(min);
|
||||||
|
if (max > max_AlreadySet) counter->SetAntiCoincidenceTimeWindowMax(max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
void musrCounter::myPrintThisCounter(Int_t evtID, Int_t detail) {
|
||||||
|
Bool_t eventMixing=false;
|
||||||
|
if ((hitMap.begin()==hitMap.end()) && (detail<=1) ) return;
|
||||||
|
// if (detail>1) std::cout<<"musrCounter::myPrintThisCounter: counterNr = "<<counterNr<<": ";
|
||||||
|
// else
|
||||||
|
std::cout<<" counter = "<<counterNr<<": ";
|
||||||
|
for (hitMap_TYPE::iterator it = hitMap.begin(); it != hitMap.end(); ++it) {
|
||||||
|
std::cout<<"\t"<<it->first<<" ("<<(it->first)%524288 <<") "<<(it->second)->eventIDnumber<<",";
|
||||||
|
if (evtID != (it->second)->eventIDnumber) {eventMixing=true;}
|
||||||
|
}
|
||||||
|
if (eventMixing) {std::cout<<" Potential event mixing";}
|
||||||
|
std::cout<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
//void musrCounter::CheckClockInfo(Long64_t timeBin) {
|
||||||
|
// Int_t clock_detectorID=musrAnalysis::clock_channelID;
|
||||||
|
// if (timeBin > (previousClock+musrAnalysis::clock_interval)) {
|
||||||
|
// previousClock += musrAnalysis::clock_interval;
|
||||||
|
// // dumpFile<<"-1\t"<<clock_detectorID<<"\t"<<previousClock<<"\n";
|
||||||
|
// DumpInfoToDumpFile(-1,clock_detectorID,previousClock);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//================================================================
|
||||||
|
void musrCounter::DumpInfoToDumpFile(Int_t eventNr, Int_t detID, Long64_t tdcBin) {
|
||||||
|
if (tdcBin>=musrAnalysis::rewindTimeBins) tdcBin -= musrAnalysis::rewindTimeBins;
|
||||||
|
else if (tdcBin<0) tdcBin += musrAnalysis::rewindTimeBins;
|
||||||
|
// Int_t tdc = (tdcBin<musrAnalysis::rewindTimeBins) ? tdcBin : tdcBin-musrAnalysis::rewindTimeBins;
|
||||||
|
// dumpFile<<eventNr<<"\t"<<detID<<"\t"<<tdcBin<<"\n";
|
||||||
|
musrAnalysis::myWriteDump->send_to_dump(detID,tdcBin,false);
|
||||||
|
}
|
||||||
|
//================================================================
|
||||||
|
void musrCounter::WriteRewindIntoDumpFile() {
|
||||||
|
DumpInfoToDumpFile(-2,1000,0);
|
||||||
|
}
|
||||||
|
//================================================================
|
||||||
|
@ -1,112 +1,123 @@
|
|||||||
#ifndef musrCounter_h
|
#ifndef musrCounter_h
|
||||||
#define musrCounter_h 1
|
#define musrCounter_h 1
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <TApplication.h>
|
#include <TApplication.h>
|
||||||
#include <TSystem.h>
|
#include <TSystem.h>
|
||||||
#include <TH1.h>
|
#include <TH1.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
class hitInfo {
|
class hitInfo {
|
||||||
public:
|
public:
|
||||||
hitInfo(Int_t kEntry, Int_t evID, Int_t deI, Int_t detectorID, Double_t deEDEP, Long64_t timeBIN2) {eventEntry=kEntry; eventIDnumber=evID; det_i=deI; det_id = detectorID; det_edep=deEDEP; timeBin2=timeBIN2;}
|
hitInfo(Int_t kEntry, Int_t evID, Int_t deI, Int_t detectorID, Double_t deEDEP, Long64_t timeBIN1, Long64_t timeBIN2, Int_t multiCtr, hitInfo* firstMulti, Int_t posQuality) {eventEntry=kEntry; eventIDnumber=evID; det_i=deI; det_id = detectorID; det_edep=deEDEP; timeBin1=timeBIN1; timeBin2=timeBIN2; multiHitCtr=multiCtr; firstMulti=NULL;posQual=posQuality;}
|
||||||
~hitInfo() {}
|
~hitInfo() {}
|
||||||
void RewindTimeBin2(Long64_t timeBinsToRewind) {timeBin2-=timeBinsToRewind;}
|
void RewindTimeBin2(Long64_t timeBinsToRewind) {timeBin2-=timeBinsToRewind;}
|
||||||
Int_t eventEntry;
|
Int_t eventEntry;
|
||||||
Int_t eventIDnumber;
|
Int_t eventIDnumber;
|
||||||
Int_t det_i;
|
Int_t det_i;
|
||||||
Int_t det_id;
|
Int_t det_id;
|
||||||
Double_t det_edep;
|
Double_t det_edep;
|
||||||
Long64_t timeBin2;
|
Long64_t timeBin1; // repeated here in case this is not stored in a Map with First=timeBin1
|
||||||
|
Long64_t timeBin2;
|
||||||
// extern double GlobalKamil;
|
Int_t multiHitCtr;
|
||||||
// typedef std::map<int,int> debugEventMapType;
|
hitInfo* firstMulti;
|
||||||
// extern debugEventMapType debugEventMap;
|
Int_t posQual;
|
||||||
// extern Bool_t bool_debugingRequired;
|
|
||||||
};
|
// extern double GlobalKamil;
|
||||||
|
// typedef std::map<int,int> debugEventMapType;
|
||||||
class musrCounter {
|
// extern debugEventMapType debugEventMap;
|
||||||
public:
|
// extern Bool_t bool_debugingRequired;
|
||||||
musrCounter(int CHANNEL_NR, char CHANNEL_NAME[200], char CHANNEL_TYPE, float E_THRESH, int TIME_SHIFT);
|
};
|
||||||
~musrCounter();
|
|
||||||
int GetCounterNr() {return counterNr;}
|
class musrCounter {
|
||||||
char GetCounterType() {return counterType;}
|
public:
|
||||||
void SetCoincidenceCounter(musrCounter* c, int icNr) {
|
musrCounter(int CHANNEL_NR, char CHANNEL_NAME[200], char CHANNEL_TYPE, float E_THRESH, int TIME_SHIFT, double DEADTIME, Bool_t KEEP_BELOW_THRESH);
|
||||||
int cNr = abs(icNr);
|
~musrCounter();
|
||||||
if (icNr>0) {
|
int GetCounterNr() {return counterNr;}
|
||||||
std::cout<<"SetCoincidenceCounter: Adding counter ="<<cNr<<" to coincidence with the counter "<<counterNr<<std::endl;
|
char GetCounterType() {return counterType;}
|
||||||
koincidenceCounterMap[cNr] = c;
|
void SetCoincidenceCounter(musrCounter* c, int icNr) {
|
||||||
}
|
int cNr = abs(icNr);
|
||||||
else {
|
if (icNr>0) {
|
||||||
std::cout<<"SetCoincidenceCounter: Adding counter ="<<cNr<<" as veto to the counter "<<counterNr<<std::endl;
|
std::cout<<"SetCoincidenceCounter: Adding counter ="<<cNr<<" to coincidence with the counter "<<counterNr<<std::endl;
|
||||||
vetoCounterMap[cNr] = c;
|
koincidenceCounterMap[cNr] = c;
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
void SetMaxCoincidenceTimeWindow(Long64_t val) {maxCoincidenceTimeWindow=val;}
|
std::cout<<"SetCoincidenceCounter: Adding counter ="<<cNr<<" as veto to the counter "<<counterNr<<std::endl;
|
||||||
Long64_t GetMaxCoincidenceTimeWindow() {return maxCoincidenceTimeWindow;}
|
vetoCounterMap[cNr] = c;
|
||||||
void SetCoincidenceTimeWindowOfAllCoincidenceDetectors(char motherCounter, Long64_t maxCoinc, Long64_t min, Long64_t max);
|
}
|
||||||
void SetCoincidenceTimeWindowOfAllVetoDetectors(Long64_t maxCoinc, Long64_t min, Long64_t max);
|
}
|
||||||
void SetCoincidenceTimeWindow_M(Long64_t min, Long64_t max) {coincidenceTimeWindowMin_M=min; coincidenceTimeWindowMax_M=max;}
|
void SetMaxCoincidenceTimeWindow(Long64_t val) {maxCoincidenceTimeWindow=val;}
|
||||||
void SetCoincidenceTimeWindow_P(Long64_t min, Long64_t max) {coincidenceTimeWindowMin_P=min; coincidenceTimeWindowMax_P=max;}
|
Long64_t GetMaxCoincidenceTimeWindow() {return maxCoincidenceTimeWindow;}
|
||||||
void SetAntiCoincidenceTimeWindowMin(Long64_t min) {antiCoincidenceTimeWindowMin=min;}
|
void SetCoincidenceTimeWindowOfAllCoincidenceDetectors(char motherCounter, Long64_t maxCoinc, Long64_t min, Long64_t max);
|
||||||
void SetAntiCoincidenceTimeWindowMax(Long64_t max) {antiCoincidenceTimeWindowMax=max;}
|
void SetCoincidenceTimeWindowOfAllVetoDetectors(Long64_t maxCoinc, Long64_t min, Long64_t max);
|
||||||
Long64_t GetAntiCoincidenceTimeWindowMin() {return antiCoincidenceTimeWindowMin;}
|
void SetCoincidenceTimeWindow_M(Long64_t min, Long64_t max) {coincidenceTimeWindowMin_M=min; coincidenceTimeWindowMax_M=max;}
|
||||||
Long64_t GetAntiCoincidenceTimeWindowMax() {return antiCoincidenceTimeWindowMax;}
|
void SetCoincidenceTimeWindow_P(Long64_t min, Long64_t max) {coincidenceTimeWindowMin_P=min; coincidenceTimeWindowMax_P=max;}
|
||||||
void SetTDChistogram(char hName[200],int t0,int t1,int t2,int hNr,char hNameAdd[200]);
|
void SetAntiCoincidenceTimeWindowMin(Long64_t min) {antiCoincidenceTimeWindowMin=min;}
|
||||||
void FillTDChistogram(Double_t variable, Double_t vaha);
|
void SetAntiCoincidenceTimeWindowMax(Long64_t max) {antiCoincidenceTimeWindowMax=max;}
|
||||||
void DrawTDChistogram();
|
Long64_t GetAntiCoincidenceTimeWindowMin() {return antiCoincidenceTimeWindowMin;}
|
||||||
void FillHitInCounter(Double_t edep, Long64_t timeBin, Long64_t timeBin2, Int_t kEntry, Int_t eveID, Int_t iDet, Int_t detectorID, Int_t eventNum);
|
Long64_t GetAntiCoincidenceTimeWindowMax() {return antiCoincidenceTimeWindowMax;}
|
||||||
void RemoveHitsInCounter(Long64_t timeBinLimit);
|
void SetTDChistogram(char hName[200],int t0,int t1,int t2,int hNr,char hNameAdd[200]);
|
||||||
// void RewindHitsInCounter(Long64_t timeBinsToRewind);
|
void FillTDChistogram(Double_t variable, Double_t vaha);
|
||||||
void RewindHitsInCounter();
|
void DrawTDChistogram();
|
||||||
Bool_t IsInCoincidence(Long64_t timeBin, char motherCounter);
|
void FillHitInCounter(Double_t edep, Long64_t timeBin, Long64_t timeBin2, Int_t kEntry, Int_t eveID, Int_t iDet, Int_t detectorID, Int_t eventNum, Int_t& multiCtr);
|
||||||
Bool_t GetNextGoodMuon(Int_t evtID, Long64_t timeBinMin, Long64_t& timeBinOfNextHit, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep);
|
void RemoveHitsInCounter(Long64_t timeBinLimit);
|
||||||
Bool_t CheckForPileupMuons(Long64_t timeBin0);
|
// void RewindHitsInCounter(Long64_t timeBinsToRewind);
|
||||||
Int_t GetNextGoodPositron(Int_t evtID, Long64_t timeBinMin, Long64_t timeBinMax, Long64_t& timeBinOfNextGoodHit, Long64_t& timeBinOfNextGoodHit_phaseShifted, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep);
|
void RewindHitsInCounter();
|
||||||
void myPrintThisCounter(Int_t evtID, Int_t detail=2);
|
Bool_t IsInCoincidence(Long64_t timeBin, char motherCounter);
|
||||||
// void CheckClockInfo(Long64_t timeBin);
|
Bool_t GetNextGoodMuon(Int_t evtID, Long64_t timeBinMin, Long64_t& timeBinOfNextHit, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep);
|
||||||
Long64_t GetNumberOfMuonCandidates(){return numberOfMuonCandidates;}
|
Bool_t CheckForPileupMuons(Long64_t timeBin0);
|
||||||
Long64_t GetNumberOfMuonCandidatesAfterVK(){return numberOfMuonCandidatesAfterVK;}
|
Int_t GetNextGoodPositron(Int_t evtID, Long64_t timeBinMin, Long64_t timeBinMax, Long64_t& timeBinOfNextGoodHit, Long64_t& timeBinOfNextGoodHit_phaseShifted, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep);
|
||||||
Long64_t GetNumberOfMuonCandidatesAfterVKandDoubleHitRemoval(){return numberOfMuonCandidatesAfterVKandDoubleHitRemoval;}
|
Int_t GetNextGoodPositronPulsed(Int_t entWanted1, Int_t entWanted2, Long64_t timeBinMin, Long64_t timeBinMax, Long64_t& timeBinOfNextGoodHit, Long64_t& timeBinOfNextGoodHit_phaseShifted, Int_t& kEntry, Int_t& idet, Int_t& idetID, Double_t& idetEdep, Int_t& idetFirstMulti, hitInfo*& hitStruct);
|
||||||
void DumpInfoToDumpFile(Int_t eventNr, Int_t detID, Long64_t tdcBin);
|
void myPrintThisCounter(Int_t evtID, Int_t detail=2);
|
||||||
void WriteRewindIntoDumpFile();
|
// void CheckClockInfo(Long64_t timeBin);
|
||||||
|
Long64_t GetNumberOfMuonCandidates(){return numberOfMuonCandidates;}
|
||||||
private:
|
Long64_t GetNumberOfMuonCandidatesAfterVK(){return numberOfMuonCandidatesAfterVK;}
|
||||||
// static musrCounter* pointerToAnalysis;
|
Long64_t GetNumberOfMuonCandidatesAfterVKandDoubleHitRemoval(){return numberOfMuonCandidatesAfterVKandDoubleHitRemoval;}
|
||||||
int counterNr;
|
void DumpInfoToDumpFile(Int_t eventNr, Int_t detID, Long64_t tdcBin);
|
||||||
char counterName[200];
|
void WriteRewindIntoDumpFile();
|
||||||
char counterType;
|
|
||||||
double couterEThreshold;
|
private:
|
||||||
Long64_t counterTimeShift;
|
// static musrCounter* pointerToAnalysis;
|
||||||
typedef std::map<int,musrCounter*> counterMapType;
|
int counterNr;
|
||||||
counterMapType koincidenceCounterMap;
|
char counterName[200];
|
||||||
counterMapType vetoCounterMap;
|
char counterType;
|
||||||
char TDC_histoName[200];
|
double couterEThreshold;
|
||||||
int TDC_t0, TDC_t1, TDC_t2, TDC_histoNrAdd;
|
Bool_t keepBelowThresholdHits; // JSL: for pulsed mode overlap
|
||||||
char TDC_histoNameAdd[200];
|
Long64_t counterTimeShift;
|
||||||
TH1D* histTDC;
|
typedef std::map<int,musrCounter*> counterMapType;
|
||||||
Long64_t antiCoincidenceTimeWindowMin, coincidenceTimeWindowMin_M, coincidenceTimeWindowMin_P;
|
counterMapType koincidenceCounterMap;
|
||||||
Long64_t antiCoincidenceTimeWindowMax, coincidenceTimeWindowMax_M, coincidenceTimeWindowMax_P;
|
counterMapType vetoCounterMap;
|
||||||
Long64_t maxCoincidenceTimeWindow;
|
char TDC_histoName[200];
|
||||||
// typedef std::map<Long64_t,Int_t> hitMap_TYPE; // Long64_t = timeBin, Int_t=eventID
|
int TDC_t0, TDC_t1, TDC_t2, TDC_histoNrAdd;
|
||||||
typedef std::map<Long64_t,hitInfo*> hitMap_TYPE; // Long64_t = timeBin, hitInfo = eventID and det_i
|
char TDC_histoNameAdd[200];
|
||||||
hitMap_TYPE hitMap;
|
TH1D* histTDC;
|
||||||
// std::list<Double_t> timeOfHitsList;
|
Long64_t antiCoincidenceTimeWindowMin, coincidenceTimeWindowMin_M, coincidenceTimeWindowMin_P;
|
||||||
|
Long64_t antiCoincidenceTimeWindowMax, coincidenceTimeWindowMax_M, coincidenceTimeWindowMax_P;
|
||||||
Int_t doubleHitN;
|
Long64_t maxCoincidenceTimeWindow;
|
||||||
Long64_t numberOfMuonCandidates;
|
// typedef std::map<Long64_t,Int_t> hitMap_TYPE; // Long64_t = timeBin, Int_t=eventID
|
||||||
Long64_t numberOfMuonCandidatesAfterVK;
|
typedef std::map<Long64_t,hitInfo*> hitMap_TYPE; // Long64_t = timeBin, hitInfo = eventID and det_i
|
||||||
Long64_t numberOfMuonCandidatesAfterVKandDoubleHitRemoval;
|
hitMap_TYPE hitMap;
|
||||||
|
// std::list<Double_t> timeOfHitsList;
|
||||||
public:
|
// for pulsed double hit processing
|
||||||
static Bool_t bool_ignoreUnperfectMuons;
|
double discriminatorLastVolts;
|
||||||
static Bool_t bool_ignoreUnperfectPositrons;
|
Long64_t discriminatorLastTime;
|
||||||
static Bool_t bool_WriteDataToDumpFile;
|
hitMap_TYPE::iterator discriminatorIterator;
|
||||||
// static ofstream dumpFile;
|
Double_t discriminatorRecoveryTime; // in TDC bins!
|
||||||
// static Long64_t previousClock;
|
|
||||||
// static Long64_t CLOCK_INTERVAL;
|
Int_t doubleHitN;
|
||||||
};
|
Long64_t numberOfMuonCandidates;
|
||||||
|
Long64_t numberOfMuonCandidatesAfterVK;
|
||||||
#endif
|
Long64_t numberOfMuonCandidatesAfterVKandDoubleHitRemoval;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static Bool_t bool_ignoreUnperfectMuons;
|
||||||
|
static Bool_t bool_ignoreUnperfectPositrons;
|
||||||
|
static Bool_t bool_WriteDataToDumpFile;
|
||||||
|
// static ofstream dumpFile;
|
||||||
|
// static Long64_t previousClock;
|
||||||
|
// static Long64_t CLOCK_INTERVAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -49,7 +49,7 @@ void musrTH::FillTH1D(Double_t vaha, Bool_t* cond){
|
|||||||
for (Int_t i=0; i<musrAnalysis::nrConditions; i++) {
|
for (Int_t i=0; i<musrAnalysis::nrConditions; i++) {
|
||||||
if (bool_rotating_reference_frame) {
|
if (bool_rotating_reference_frame) {
|
||||||
// Double_t var = *variableToBeFilled_X;
|
// Double_t var = *variableToBeFilled_X;
|
||||||
Double_t waha = vaha*exp((*variableToBeFilled_X)/2.19703)*cos(2*musrAnalysis::pi*rot_ref_frequency*(*variableToBeFilled_X)+rot_ref_phase);
|
Double_t waha = vaha*exp((*variableToBeFilled_X)/2.19703)*cos(2*pi*rot_ref_frequency*(*variableToBeFilled_X)+rot_ref_phase);
|
||||||
// std::cout<<"rot_ref_frequency="<<rot_ref_frequency<<std::endl;
|
// std::cout<<"rot_ref_frequency="<<rot_ref_frequency<<std::endl;
|
||||||
if (cond[i]) histArray1D[i]->Fill(*variableToBeFilled_X,waha);
|
if (cond[i]) histArray1D[i]->Fill(*variableToBeFilled_X,waha);
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ void musrTH::ListHistograms() {
|
|||||||
//==============================================================================================
|
//==============================================================================================
|
||||||
void musrTH::FitHistogramsIfRequired(Double_t omega) {
|
void musrTH::FitHistogramsIfRequired(Double_t omega) {
|
||||||
if (funct==NULL) return;
|
if (funct==NULL) return;
|
||||||
if (bool_rotating_reference_frame) omega = fabs(omega) - 2*musrAnalysis::pi*fabs(rot_ref_frequency);
|
if (bool_rotating_reference_frame) omega = fabs(omega) - 2*pi*fabs(rot_ref_frequency);
|
||||||
std::cout<<"============================================================================================================"<<std::endl;
|
std::cout<<"============================================================================================================"<<std::endl;
|
||||||
std::cout<<"Fitting \""<<funct->GetName()<<"\", funct_xMin="<<funct_xMin<<" funct_xMax="<<funct_xMax<<" omega="<<omega<<std::endl;
|
std::cout<<"Fitting \""<<funct->GetName()<<"\", funct_xMin="<<funct_xMin<<" funct_xMax="<<funct_xMax<<" omega="<<omega<<std::endl;
|
||||||
if (strcmp(funct->GetName(),"funct1")==0) {funct->FixParameter(0,omega);}
|
if (strcmp(funct->GetName(),"funct1")==0) {funct->FixParameter(0,omega);}
|
||||||
|
20
src/meyer.cc
20
src/meyer.cc
@ -60,6 +60,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ios>
|
#include <ios>
|
||||||
|
// James Lord:
|
||||||
|
// already defines its own constant Pi so no need to look for M_PI anywhere
|
||||||
|
// #define _USE_MATH_DEFINES 1
|
||||||
|
// #include <math.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
meyer::meyer()
|
meyer::meyer()
|
||||||
@ -258,7 +262,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
|||||||
}
|
}
|
||||||
// std::cout<< "M4: "<<Meyer_faktor4<<std::endl;
|
// std::cout<< "M4: "<<Meyer_faktor4<<std::endl;
|
||||||
// std::cout<< "Ekin: "<<Ekin <<std::endl;
|
// std::cout<< "Ekin: "<<Ekin <<std::endl;
|
||||||
thetaMax = thetaSchlangeMax / Meyer_faktor4 / Ekin/M_PI*180;
|
thetaMax = thetaSchlangeMax / Meyer_faktor4 / Ekin/Pi*180;
|
||||||
if (thetaMax>50.)
|
if (thetaMax>50.)
|
||||||
{
|
{
|
||||||
thetaStep = .5;
|
thetaStep = .5;
|
||||||
@ -292,7 +296,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
|||||||
// ! Berechne aus theta das 'reduzierte' thetaSchlange (dabei gleich
|
// ! Berechne aus theta das 'reduzierte' thetaSchlange (dabei gleich
|
||||||
// ! noch von degree bei theta in Radiant bei thetaSchlange umrechnen):
|
// ! noch von degree bei theta in Radiant bei thetaSchlange umrechnen):
|
||||||
//
|
//
|
||||||
thetaSchlange = Meyer_faktor4 * Ekin * theta *M_PI/180;
|
thetaSchlange = Meyer_faktor4 * Ekin * theta *Pi/180;
|
||||||
|
|
||||||
// ! Auslesen der Tabellenwerte fuer die f-Funktionen:
|
// ! Auslesen der Tabellenwerte fuer die f-Funktionen:
|
||||||
|
|
||||||
@ -305,7 +309,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ! Berechnen der Streuintensitaet:
|
// ! Berechnen der Streuintensitaet:
|
||||||
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
||||||
|
|
||||||
nBin = nBin + 1;
|
nBin = nBin + 1;
|
||||||
if (nBin>nBinMax)
|
if (nBin>nBinMax)
|
||||||
@ -317,7 +321,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
|||||||
value[nBin] = sin(theta)*F;
|
value[nBin] = sin(theta)*F;
|
||||||
|
|
||||||
fValues[nBin+1] = F; // ! fuer Testzwecke
|
fValues[nBin+1] = F; // ! fuer Testzwecke
|
||||||
fValuesFolded[nBin+1] = sin(theta/180*M_PI)*F;// ! fuer Testzwecke
|
fValuesFolded[nBin+1] = sin(theta/180*Pi)*F;// ! fuer Testzwecke
|
||||||
|
|
||||||
|
|
||||||
}// end of do loop
|
}// end of do loop
|
||||||
@ -348,7 +352,7 @@ void meyer::Get_F_Function_Meyer(double tau, double Ekin, double Z1, double Z2,
|
|||||||
//! Berechne die Werte fuer theta=0:
|
//! Berechne die Werte fuer theta=0:
|
||||||
|
|
||||||
F_Functions_Meyer(tau,0.,&f1,&f2);
|
F_Functions_Meyer(tau,0.,&f1,&f2);
|
||||||
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);// TAO, Anselm was: Meyer_faktor5 * Ekin*Ekin * (f1 - Meyer_faktor3*f2);
|
||||||
fValues[1] = F;
|
fValues[1] = F;
|
||||||
fValuesFolded[1] = 0.;
|
fValuesFolded[1] = 0.;
|
||||||
|
|
||||||
@ -463,7 +467,7 @@ void meyer:: Get_F_Function(double tau,double theta, double Ekin, double Z1, dou
|
|||||||
|
|
||||||
nBin = 0;
|
nBin = 0;
|
||||||
|
|
||||||
thetaSchlange = Meyer_faktor4 * Ekin * theta *M_PI/180;
|
thetaSchlange = Meyer_faktor4 * Ekin * theta *Pi/180;
|
||||||
|
|
||||||
|
|
||||||
F_Functions_Meyer(tau,thetaSchlange,&f1,&f2);
|
F_Functions_Meyer(tau,thetaSchlange,&f1,&f2);
|
||||||
@ -472,7 +476,7 @@ void meyer:: Get_F_Function(double tau,double theta, double Ekin, double Z1, dou
|
|||||||
goto bigtheta;
|
goto bigtheta;
|
||||||
}
|
}
|
||||||
|
|
||||||
*F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);
|
*F = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);
|
||||||
|
|
||||||
bigtheta:for( i = 1;i<= nBin; i++)
|
bigtheta:for( i = 1;i<= nBin; i++)
|
||||||
{
|
{
|
||||||
@ -486,7 +490,7 @@ void meyer:: Get_F_Function(double tau,double theta, double Ekin, double Z1, dou
|
|||||||
//! Berechne die Werte fuer theta=0:
|
//! Berechne die Werte fuer theta=0:
|
||||||
double norm;
|
double norm;
|
||||||
F_Functions_Meyer(tau,0.,&f1,&f2);
|
F_Functions_Meyer(tau,0.,&f1,&f2);
|
||||||
norm = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /M_PI * (f1 - Meyer_faktor3*f2);
|
norm = Meyer_faktor4*Meyer_faktor4 * Ekin*Ekin /2 /Pi * (f1 - Meyer_faktor3*f2);
|
||||||
*F=*F/norm;
|
*F=*F/norm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "G4Box.hh"
|
#include "G4Box.hh"
|
||||||
#include "G4Cons.hh"
|
#include "G4Cons.hh"
|
||||||
#include "G4Polycone.hh"
|
#include "G4Polycone.hh"
|
||||||
|
#include "G4Torus.hh"
|
||||||
#include "G4LogicalVolume.hh"
|
#include "G4LogicalVolume.hh"
|
||||||
#include "G4PVPlacement.hh"
|
#include "G4PVPlacement.hh"
|
||||||
#include "G4Tubs.hh"
|
#include "G4Tubs.hh"
|
||||||
@ -329,6 +330,13 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
|||||||
solidName+=name;
|
solidName+=name;
|
||||||
solid = new G4Para(solidName,x1*mm,x2*mm,x3*mm,x4*deg,x5*deg,x6*deg);
|
solid = new G4Para(solidName,x1*mm,x2*mm,x3*mm,x4*deg,x5*deg,x6*deg);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(tmpString2,"torus")==0){ // added JSL. Torus piece, Rmin (bore), Rmax (outer), Rtorus (swept), pSPhi (start angle), pDPhi (swept angle)
|
||||||
|
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||||
|
name,&x1,&x2,&x3,&x4,&x5,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||||
|
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName);
|
||||||
|
solidName+=name;
|
||||||
|
solid = new G4Torus(solidName,x1*mm,x2*mm,x3*mm,x4*deg,x5*deg);
|
||||||
|
}
|
||||||
else if (strcmp(tmpString2,"cylpart")==0){ // Volume introduced by Pavel Bakule on 12 May 2009
|
else if (strcmp(tmpString2,"cylpart")==0){ // Volume introduced by Pavel Bakule on 12 May 2009
|
||||||
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||||
name,&x1,&x2,&x3,&x4,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
name,&x1,&x2,&x3,&x4,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||||
@ -665,7 +673,7 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
|||||||
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d",sensitiveDet,&volumeID);
|
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d",sensitiveDet,&volumeID);
|
||||||
solidName+=name;
|
solidName+=name;
|
||||||
G4Box* solidGPDcutOut = new G4Box ("solidGPDcutOut",x1*mm,x1*mm,(x3+0.01)*mm);
|
G4Box* solidGPDcutOut = new G4Box ("solidGPDcutOut",x1*mm,x1*mm,(x3+0.01)*mm);
|
||||||
G4Box* solidGPDmHolder = new G4Box ("solidGPDmHolder",sqrt(2)*x1*mm,x2*mm,x3*mm);
|
G4Box* solidGPDmHolder = new G4Box ("solidGPDmHolder",sqrt((double)2)*x1*mm,x2*mm,x3*mm);
|
||||||
// G4RotationMatrix* rot = new G4RotationMatrix(45*deg,0,0);
|
// G4RotationMatrix* rot = new G4RotationMatrix(45*deg,0,0);
|
||||||
G4RotationMatrix* rot = new G4RotationMatrix(G4ThreeVector(0,0,1),45*deg);
|
G4RotationMatrix* rot = new G4RotationMatrix(G4ThreeVector(0,0,1),45*deg);
|
||||||
// G4RotationMatrix* rot = new G4RotationMatrix();
|
// G4RotationMatrix* rot = new G4RotationMatrix();
|
||||||
@ -673,6 +681,28 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
|
|||||||
solid = new G4SubtractionSolid(solidName,solidGPDmHolder,solidGPDcutOut,rot,trans);
|
solid = new G4SubtractionSolid(solidName,solidGPDmHolder,solidGPDcutOut,rot,trans);
|
||||||
// solid = new G4SubtractionSolid(solidName,solidGPDcutOut,solidGPDmHolder,rot,trans);
|
// solid = new G4SubtractionSolid(solidName,solidGPDcutOut,solidGPDmHolder,rot,trans);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(tmpString2,"cruciform")==0){
|
||||||
|
// JSL: Create a solid cruciform (union of 3 mutually perpendicular cylinders). Top port can be different to bottom.
|
||||||
|
// x1=radius of main (+-z) x2=radius of +-x and -y, x3=radius of +y x4=z extent x5=x,y extent
|
||||||
|
// could enclose another of these inside, filled with vacuum
|
||||||
|
sscanf(&line[0],"%*s %*s %*s %s %lf %lf %lf %lf %lf %s %lf %lf %lf %s %s",
|
||||||
|
name,&x1,&x2,&x3,&x4,&x5,material,&posx,&posy,&posz,mothersName,rotMatrix);
|
||||||
|
sscanf(&line[0],"%*s %*s %*s %*s %*g %*g %*g %*g %*g %*s %*g %*g %*g %*s %*s %s %d %s",sensitiveDet,&volumeID,actualFieldName);
|
||||||
|
solidName+=name;
|
||||||
|
//G4double roundingErr=0.01*mm; // to avoid some displaying problems of the subtracted volumes
|
||||||
|
G4Tubs* solidMainBore = new G4Tubs("solidMainBore" ,0.*mm,x1*mm,x4*mm,0*deg,360*deg);
|
||||||
|
G4Tubs* solidHorizCrossBore = new G4Tubs("solidHorizCrossBore",0.*mm,x2*mm,x5*mm,0*deg,360*deg);
|
||||||
|
G4Tubs* solidBottomBore = new G4Tubs("solidBottomBore" ,0.*mm,x2*mm,x5/2*mm,0*deg,360*deg);
|
||||||
|
G4Tubs* solidTopBore = new G4Tubs("solidTopBore" ,0.*mm,x3*mm,x5/2*mm,0*deg,360*deg);
|
||||||
|
G4RotationMatrix* rotx = new G4RotationMatrix(G4ThreeVector(0.,1.,0.),90.*deg);
|
||||||
|
G4RotationMatrix* roty = new G4RotationMatrix(G4ThreeVector(1.,0.,0.),90.*deg);
|
||||||
|
G4ThreeVector nowhere( 0,0,0);
|
||||||
|
G4ThreeVector UpOffset( 0., x5/2.*mm, 0.);
|
||||||
|
G4ThreeVector DownOffset( 0., -x5/2.*mm, 0.);
|
||||||
|
G4UnionSolid* partXZonly = new G4UnionSolid("partXZonly", solidMainBore, solidHorizCrossBore, rotx, nowhere);
|
||||||
|
G4UnionSolid* partXZBonly = new G4UnionSolid("partXZBonly", partXZonly, solidBottomBore, roty, DownOffset);
|
||||||
|
solid = new G4UnionSolid(solidName, partXZBonly, solidTopBore, roty, UpOffset);
|
||||||
|
}
|
||||||
else ReportGeometryProblem(line);
|
else ReportGeometryProblem(line);
|
||||||
|
|
||||||
G4ThreeVector position = G4ThreeVector (posx*mm,posy*mm,posz*mm);
|
G4ThreeVector position = G4ThreeVector (posx*mm,posy*mm,posz*mm);
|
||||||
@ -1631,6 +1661,41 @@ void musrDetectorConstruction::DefineMaterials()
|
|||||||
Air->AddElement(N, fractionmass=0.7);
|
Air->AddElement(N, fractionmass=0.7);
|
||||||
Air->AddElement(O, fractionmass=0.3);
|
Air->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* Air1mbar =
|
||||||
|
new G4Material("Air1mbar" , density= 1.290e-3*mg/cm3, ncomponents=2);
|
||||||
|
Air1mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
Air1mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* AirE1mbar =
|
||||||
|
new G4Material("AirE1mbar" , density= 1.290e-4*mg/cm3, ncomponents=2);
|
||||||
|
AirE1mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
AirE1mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* AirE2mbar =
|
||||||
|
new G4Material("AirE2mbar" , density= 1.290e-5*mg/cm3, ncomponents=2);
|
||||||
|
AirE2mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
AirE2mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* AirE3mbar =
|
||||||
|
new G4Material("AirE3mbar" , density= 1.290e-6*mg/cm3, ncomponents=2);
|
||||||
|
AirE3mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
AirE3mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* AirE4mbar =
|
||||||
|
new G4Material("AirE4mbar" , density= 1.290e-7*mg/cm3, ncomponents=2);
|
||||||
|
AirE4mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
AirE4mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* AirE5mbar =
|
||||||
|
new G4Material("AirE5mbar" , density= 1.290e-8*mg/cm3, ncomponents=2);
|
||||||
|
AirE5mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
AirE5mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
|
G4Material* AirE6mbar =
|
||||||
|
new G4Material("AirE6mbar" , density= 1.290e-9*mg/cm3, ncomponents=2);
|
||||||
|
AirE6mbar->AddElement(N, fractionmass=0.7);
|
||||||
|
AirE6mbar->AddElement(O, fractionmass=0.3);
|
||||||
|
|
||||||
//
|
//
|
||||||
// examples of vacuum
|
// examples of vacuum
|
||||||
//
|
//
|
||||||
@ -1661,6 +1726,9 @@ void musrDetectorConstruction::DefineMaterials()
|
|||||||
new G4Material("HeliumGas80mbar",z=2., a=4.002602*g/mole, density= 0.00001410112*g/cm3);
|
new G4Material("HeliumGas80mbar",z=2., a=4.002602*g/mole, density= 0.00001410112*g/cm3);
|
||||||
new G4Material("HeliumGas90mbar",z=2., a=4.002602*g/mole, density= 0.00001586376*g/cm3);
|
new G4Material("HeliumGas90mbar",z=2., a=4.002602*g/mole, density= 0.00001586376*g/cm3);
|
||||||
new G4Material("HeliumGas100mbar",z=2.,a=4.002602*g/mole, density= 0.00001762640*g/cm3);
|
new G4Material("HeliumGas100mbar",z=2.,a=4.002602*g/mole, density= 0.00001762640*g/cm3);
|
||||||
|
new G4Material("HeliumGasSat4K",z=2., a=4.002602*g/mole, density= 0.016891*g/cm3); // saturated vapour above liquid at 4.2K (JSL)
|
||||||
|
new G4Material("HeliumGas5mbar4K",z=2.,a=4.002602*g/mole, density= 0.016891*5.0/1013.0*g/cm3); // typical cold exchange gas, 4.2K and 5 mbar
|
||||||
|
new G4Material("HeliumGas2mbar4K",z=2.,a=4.002602*g/mole, density= 0.016891*2.0/1013.0*g/cm3); // typical cold exchange gas, 4.2K and 5 mbar
|
||||||
|
|
||||||
if (musrParameters::boolG4OpticalPhotons) {
|
if (musrParameters::boolG4OpticalPhotons) {
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ void musrErrorMessage::musrError(SEVERITY severity, G4String message, G4bool sil
|
|||||||
actualErrorMessage.mesSeverity = severity;
|
actualErrorMessage.mesSeverity = severity;
|
||||||
actualErrorMessage.nTimes = 1;
|
actualErrorMessage.nTimes = 1;
|
||||||
ErrorMapping[message]=actualErrorMessage;
|
ErrorMapping[message]=actualErrorMessage;
|
||||||
|
it = ErrorMapping.find(message);
|
||||||
G4cout<<"!!!"<<severityWord[severity]<<"!!! "<<message<<" (First time occurrence)"<<G4endl;
|
G4cout<<"!!!"<<severityWord[severity]<<"!!! "<<message<<" (First time occurrence)"<<G4endl;
|
||||||
nErrors++;
|
nErrors++;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ void musrEventAction::EndOfEventAction(const G4Event* evt) {
|
|||||||
fRunManager->AbortRun(true);
|
fRunManager->AbortRun(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thisEventNr != 0 and thisEventNr%nHowOftenToPrintEvent == 0) {
|
if ((thisEventNr != 0) && (thisEventNr%nHowOftenToPrintEvent == 0)) {
|
||||||
time_t curr=time(0);
|
time_t curr=time(0);
|
||||||
//char * ctime(const time_t * tp);
|
//char * ctime(const time_t * tp);
|
||||||
G4cout << ">>> Event " << evt->GetEventID() <<". Running already for "<<curr-timeOfRunStart<<" seconds. Present time: "<< ctime(&curr);
|
G4cout << ">>> Event " << evt->GetEventID() <<". Running already for "<<curr-timeOfRunStart<<" seconds. Present time: "<< ctime(&curr);
|
||||||
@ -133,7 +133,7 @@ void musrEventAction::EndOfEventAction(const G4Event* evt) {
|
|||||||
for (G4int i=0; i<n_trajectories; i++)
|
for (G4int i=0; i<n_trajectories; i++)
|
||||||
{ G4Trajectory* trj = (G4Trajectory*)
|
{ G4Trajectory* trj = (G4Trajectory*)
|
||||||
((*(evt->GetTrajectoryContainer()))[i]);
|
((*(evt->GetTrajectoryContainer()))[i]);
|
||||||
trj->DrawTrajectory(1000);
|
trj->DrawTrajectory(); //removed argument 1000 (JSL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,6 +264,7 @@ void musrPhysicsList::ConstructProcess()
|
|||||||
|
|
||||||
// For optical photons
|
// For optical photons
|
||||||
#include "G4Scintillation.hh"
|
#include "G4Scintillation.hh"
|
||||||
|
#include "G4Cerenkov.hh"
|
||||||
|
|
||||||
// For models
|
// For models
|
||||||
#include "G4ProcessTable.hh"
|
#include "G4ProcessTable.hh"
|
||||||
@ -336,6 +337,13 @@ void musrPhysicsList::ConstructEM()
|
|||||||
else if (stringProcessName=="G4OpRayleigh") pManager->AddDiscreteProcess(new G4OpRayleigh);
|
else if (stringProcessName=="G4OpRayleigh") pManager->AddDiscreteProcess(new G4OpRayleigh);
|
||||||
else if (stringProcessName=="G4OpBoundaryProcess") pManager->AddDiscreteProcess(new G4OpBoundaryProcess);
|
else if (stringProcessName=="G4OpBoundaryProcess") pManager->AddDiscreteProcess(new G4OpBoundaryProcess);
|
||||||
else if (stringProcessName=="G4OpWLS") pManager->AddDiscreteProcess(new G4OpWLS);
|
else if (stringProcessName=="G4OpWLS") pManager->AddDiscreteProcess(new G4OpWLS);
|
||||||
|
else if (stringProcessName=="G4Cerenkov") {
|
||||||
|
G4Cerenkov* myCerenkov = new G4Cerenkov();
|
||||||
|
myCerenkov->SetMaxNumPhotonsPerStep(20); // settings from GEANT example N06
|
||||||
|
myCerenkov->SetMaxBetaChangePerStep(10.0);
|
||||||
|
myCerenkov->SetTrackSecondariesFirst(false); // as for Scintillation, do main high energy particles first
|
||||||
|
pManager->AddDiscreteProcess(myCerenkov); // added JSL
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(eMessage,"musrPhysicsList: Process \"%s\" is not implemented in musrPhysicsList.cc for addDiscreteProcess. It can be easily added.",
|
sprintf(eMessage,"musrPhysicsList: Process \"%s\" is not implemented in musrPhysicsList.cc for addDiscreteProcess. It can be easily added.",
|
||||||
charProcessName);
|
charProcessName);
|
||||||
@ -373,6 +381,14 @@ void musrPhysicsList::ConstructEM()
|
|||||||
if (musrParameters::finiteRiseTimeInScintillator) myScintillation->SetFiniteRiseTime(true);
|
if (musrParameters::finiteRiseTimeInScintillator) myScintillation->SetFiniteRiseTime(true);
|
||||||
pManager->AddProcess(myScintillation,nr1,nr2,nr3);
|
pManager->AddProcess(myScintillation,nr1,nr2,nr3);
|
||||||
}
|
}
|
||||||
|
else if (stringProcessName=="G4Cerenkov") {
|
||||||
|
G4Cerenkov* myCerenkov = new G4Cerenkov();
|
||||||
|
myCerenkov->SetMaxNumPhotonsPerStep(20); // settings from GEANT example N06
|
||||||
|
myCerenkov->SetMaxBetaChangePerStep(10.0);
|
||||||
|
myCerenkov->SetTrackSecondariesFirst(false); // as for Scintillation, do main high energy particles first
|
||||||
|
pManager->AddProcess(myCerenkov,nr1,nr2,nr3); // added JSL
|
||||||
|
pManager->SetProcessOrdering(myCerenkov,idxPostStep); // from Example N06
|
||||||
|
}
|
||||||
// cks: musrMuScatter could be uncommented here, but testing is needed, because Toni has some strange comments
|
// cks: musrMuScatter could be uncommented here, but testing is needed, because Toni has some strange comments
|
||||||
// in his original "musrPhysicsList.cc about implementing musrMuScatter.
|
// in his original "musrPhysicsList.cc about implementing musrMuScatter.
|
||||||
// else if (stringProcessName=="musrMuScatter") pManager->AddProcess(new musrMuScatter,nr1,nr2,nr3);
|
// else if (stringProcessName=="musrMuScatter") pManager->AddProcess(new musrMuScatter,nr1,nr2,nr3);
|
||||||
|
@ -833,8 +833,9 @@ void musrRootOutput::SetPhotDetTime(G4double time) {
|
|||||||
nOptPhotDet++;
|
nOptPhotDet++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
nOptPhotDet++; // still want to know how many in total (JSL)
|
||||||
char message[200];
|
char message[200];
|
||||||
sprintf(message,"musrRootOutput.cc::SetPhotDetTime: number of individual photons larger than maxNOptPhotDet (=%d)",maxNOptPhotDet);
|
sprintf(message,"musrRootOutput.cc::SetPhotDetTime: number of individual photons larger than maxNOptPhotDet (=%d)",maxNOptPhotDet);
|
||||||
musrErrorMessage::GetInstance()->musrError(WARNING,message,false);
|
musrErrorMessage::GetInstance()->musrError(WARNING,message,true); // had silent=false and printed all messages (JSL)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "musrErrorMessage.hh"
|
#include "musrErrorMessage.hh"
|
||||||
#include "musrSteppingAction.hh"
|
#include "musrSteppingAction.hh"
|
||||||
//#include "TCanvas.h"
|
//#include "TCanvas.h"
|
||||||
|
#include "TH1D.h"
|
||||||
#include "TMath.h"
|
#include "TMath.h"
|
||||||
#include "TF1.h"
|
#include "TF1.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -131,6 +132,7 @@ musrScintSD::musrScintSD(G4String name)
|
|||||||
APDcellsTimeVariationRequested=false;
|
APDcellsTimeVariationRequested=false;
|
||||||
APDcrossTalkRequested=false;
|
APDcrossTalkRequested=false;
|
||||||
APDcrossTalkProb=0.;
|
APDcrossTalkProb=0.;
|
||||||
|
// verboseLevel = 9; // JSL
|
||||||
}
|
}
|
||||||
|
|
||||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||||
@ -167,8 +169,10 @@ void musrScintSD::Initialize(G4HCofThisEvent* HCE) {
|
|||||||
if (musrParameters::boolG4OpticalPhotons) {
|
if (musrParameters::boolG4OpticalPhotons) {
|
||||||
if (!musrParameters::boolG4OpticalPhotonsUnprocess) {
|
if (!musrParameters::boolG4OpticalPhotonsUnprocess) {
|
||||||
for (optHitMapType::const_iterator it=optHitMap.begin() ; it != optHitMap.end(); it++ ) {
|
for (optHitMapType::const_iterator it=optHitMap.begin() ; it != optHitMap.end(); it++ ) {
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting optHitDetectorMap" <<"\n";
|
||||||
delete (it->second);
|
delete (it->second);
|
||||||
}
|
}
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : clearing optHitMap" <<"\n";
|
||||||
optHitMap.clear();
|
optHitMap.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,6 +212,7 @@ G4bool musrScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new musrScintHit" <<"\n";
|
||||||
musrScintHit* newHit = new musrScintHit();
|
musrScintHit* newHit = new musrScintHit();
|
||||||
// newHit->SetParticleName (aTrack->GetDefinition()->GetParticleName());
|
// newHit->SetParticleName (aTrack->GetDefinition()->GetParticleName());
|
||||||
newHit->SetParticleName(particleName);
|
newHit->SetParticleName(particleName);
|
||||||
@ -286,6 +291,7 @@ void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
|
|||||||
// G4cout<<" detID ="<<detID<<" actualVolume="<<actualVolume<<G4endl;
|
// G4cout<<" detID ="<<detID<<" actualVolume="<<actualVolume<<G4endl;
|
||||||
optHitMapType::iterator iter = optHitMap.find(detID);
|
optHitMapType::iterator iter = optHitMap.find(detID);
|
||||||
if (iter==optHitMap.end()) { // optHitDetectorMapType does not exist ==> create it
|
if (iter==optHitMap.end()) { // optHitDetectorMapType does not exist ==> create it
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new OptHitDetectorMap" <<"\n";
|
||||||
optHitDetectorMapType* optHitDetectorMapTmp = new optHitDetectorMapType;
|
optHitDetectorMapType* optHitDetectorMapTmp = new optHitDetectorMapType;
|
||||||
optHitMap.insert(std::pair<Int_t,optHitDetectorMapType*>(detID,optHitDetectorMapTmp));
|
optHitMap.insert(std::pair<Int_t,optHitDetectorMapType*>(detID,optHitDetectorMapTmp));
|
||||||
iter = optHitMap.find(detID);
|
iter = optHitMap.find(detID);
|
||||||
@ -380,7 +386,7 @@ void musrScintSD::EndOfEvent(G4HCofThisEvent*) {
|
|||||||
// in which case times are huge and due to the limited rounding
|
// in which case times are huge and due to the limited rounding
|
||||||
// precision become equal --> map ignores the same "keys",
|
// precision become equal --> map ignores the same "keys",
|
||||||
// multimap does not.
|
// multimap does not.
|
||||||
std::map<G4double,G4int>::iterator it;
|
std::multimap<G4double,G4int>::iterator it;
|
||||||
for (G4int i=0; i<NbHits; i++) {
|
for (G4int i=0; i<NbHits; i++) {
|
||||||
musrScintHit* aHit = (*scintCollection)[i];
|
musrScintHit* aHit = (*scintCollection)[i];
|
||||||
G4double tmptime=aHit->GetGlobalTime();
|
G4double tmptime=aHit->GetGlobalTime();
|
||||||
@ -670,6 +676,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
|||||||
iHistNr++;
|
iHistNr++;
|
||||||
char nameHist[200]; sprintf(nameHist,"OPSAhist_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
char nameHist[200]; sprintf(nameHist,"OPSAhist_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
||||||
char nameHistTitle[200]; sprintf(nameHistTitle,"OPSAhist_%d_%d_%d;time (ns);Nr of photons",eeeventID,OPSA_detID,iHistNr);
|
char nameHistTitle[200]; sprintf(nameHistTitle,"OPSAhist_%d_%d_%d;time (ns);Nr of photons",eeeventID,OPSA_detID,iHistNr);
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new TH1D for OPSAhisto" <<"\n";
|
||||||
OPSAhisto = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
OPSAhisto = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||||
// poiss = new TF1("poiss",poissonf,0.,.5,2); // x in [0;300], 2
|
// poiss = new TF1("poiss",poissonf,0.,.5,2); // x in [0;300], 2
|
||||||
// poiss->SetParameter(0,1);
|
// poiss->SetParameter(0,1);
|
||||||
@ -677,9 +684,11 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
|||||||
if (bool_pulseShapeExists) {
|
if (bool_pulseShapeExists) {
|
||||||
sprintf(nameHist,"OPSAshape_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
sprintf(nameHist,"OPSAshape_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
||||||
sprintf(nameHistTitle,"OPSAshape_%d_%d_%d;time (ns);Pulse signal",eeeventID,OPSA_detID,iHistNr);
|
sprintf(nameHistTitle,"OPSAshape_%d_%d_%d;time (ns);Pulse signal",eeeventID,OPSA_detID,iHistNr);
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new TH1D for OPSAshape" <<"\n";
|
||||||
OPSAshape = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
OPSAshape = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||||
sprintf(nameHist,"OPSA_CFD_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
sprintf(nameHist,"OPSA_CFD_%d_%d_%d",eeeventID,OPSA_detID,iHistNr);
|
||||||
sprintf(nameHistTitle,"OPSA_CFD_%d_%d_%d;time (ns);CFD signal",eeeventID,OPSA_detID,iHistNr);
|
sprintf(nameHistTitle,"OPSA_CFD_%d_%d_%d;time (ns);CFD signal",eeeventID,OPSA_detID,iHistNr);
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating a new TH1D for OPSA_CFD" <<"\n";
|
||||||
OPSA_CFD = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
OPSA_CFD = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,6 +704,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
|||||||
else { // create histogram because it does not exist
|
else { // create histogram because it does not exist
|
||||||
char nameHistTitle[200]; sprintf(nameHistTitle,"OPSAhistSUM_%d_%d;time (ns);Nr of photons",OPSA_detID,iHistNrSUM);
|
char nameHistTitle[200]; sprintf(nameHistTitle,"OPSAhistSUM_%d_%d;time (ns);Nr of photons",OPSA_detID,iHistNrSUM);
|
||||||
char nameHistTitle0[200]; sprintf(nameHistTitle0,"OPSAhistSUM0_%d_%d;time (ns);Nr of photons",OPSA_detID,iHistNrSUM);
|
char nameHistTitle0[200]; sprintf(nameHistTitle0,"OPSAhistSUM0_%d_%d;time (ns);Nr of photons",OPSA_detID,iHistNrSUM);
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating new TH1Ds for OPSAhistoSUM,0" <<"\n";
|
||||||
OPSAhistoSUM = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
OPSAhistoSUM = new TH1D(nameHist, nameHistTitle, OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||||
OPSAhistoSUM0= new TH1D(nameHist0,nameHistTitle0,OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
OPSAhistoSUM0= new TH1D(nameHist0,nameHistTitle0,OPSAhistoNbin, OPSAhistoMin, OPSAhistoMax);
|
||||||
mapOfOPSAsumHistograms.insert(std::pair<std::string,TH1D*>(nameHist,OPSAhistoSUM));
|
mapOfOPSAsumHistograms.insert(std::pair<std::string,TH1D*>(nameHist,OPSAhistoSUM));
|
||||||
@ -1026,13 +1036,16 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
|||||||
|
|
||||||
// Delete the histograms from memory if they were created
|
// Delete the histograms from memory if they were created
|
||||||
if ((boolStoreThisOPSAhist)||(bool_pulseShapeExists)) {
|
if ((boolStoreThisOPSAhist)||(bool_pulseShapeExists)) {
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting OPSAhisto" <<"\n";
|
||||||
delete OPSAhisto;
|
delete OPSAhisto;
|
||||||
if (bool_pulseShapeExists) {
|
if (bool_pulseShapeExists) {
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting OPSAshape and CFD" <<"\n";
|
||||||
delete OPSAshape;
|
delete OPSAshape;
|
||||||
delete OPSA_CFD;
|
delete OPSA_CFD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : creating new signalInfo" <<"\n";
|
||||||
signalInfo* mySignalInfo = new signalInfo(OPSA_detID,OPSA_nPhot,OPSA_nPhotPrim,OPSA_timeFirst,OPSA_timeSecond,OPSA_timeThird,
|
signalInfo* mySignalInfo = new signalInfo(OPSA_detID,OPSA_nPhot,OPSA_nPhotPrim,OPSA_timeFirst,OPSA_timeSecond,OPSA_timeThird,
|
||||||
OPSA_timeA,OPSA_timeB,OPSA_timeC,OPSA_timeD,OPSA_timeMean,OPSA_timeLast,
|
OPSA_timeA,OPSA_timeB,OPSA_timeC,OPSA_timeD,OPSA_timeMean,OPSA_timeLast,
|
||||||
OPSA_CFD_time,OPSA_CFD_ampl,timeCFDarray,OPSA_timeC1);
|
OPSA_CFD_time,OPSA_CFD_ampl,timeCFDarray,OPSA_timeC1);
|
||||||
@ -1070,6 +1083,7 @@ void musrScintSD::EndOfEvent_OptiacalPhotons() {
|
|||||||
}
|
}
|
||||||
// Now delete all mySignalInfo* from OPSA_signal_Map
|
// Now delete all mySignalInfo* from OPSA_signal_Map
|
||||||
for (OPSA_signal_MapType::const_iterator itOPSA = OPSA_signal_Map.begin(); itOPSA != OPSA_signal_Map.end(); itOPSA++) {
|
for (OPSA_signal_MapType::const_iterator itOPSA = OPSA_signal_Map.begin(); itOPSA != OPSA_signal_Map.end(); itOPSA++) {
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : deleting itOPSA->second" <<"\n";
|
||||||
delete (itOPSA->second);
|
delete (itOPSA->second);
|
||||||
}
|
}
|
||||||
OPSA_signal_Map.clear();
|
OPSA_signal_Map.clear();
|
||||||
@ -1162,16 +1176,20 @@ G4int musrScintSD::FindAPDcellID(G4Step* aStep) {
|
|||||||
void musrScintSD::FireAPDcell(optHitDetectorMapType* optHitDetectorMap, G4int APDcellID, G4double time, G4int nTruePhe) {
|
void musrScintSD::FireAPDcell(optHitDetectorMapType* optHitDetectorMap, G4int APDcellID, G4double time, G4int nTruePhe) {
|
||||||
if ( (musrRootOutput::store_phot_time) && (nTruePhe>0) ) myRootOutput->SetPhotDetTime(time);
|
if ( (musrRootOutput::store_phot_time) && (nTruePhe>0) ) myRootOutput->SetPhotDetTime(time);
|
||||||
if (!APDcellsEffectRequested) {
|
if (!APDcellsEffectRequested) {
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : storing photon hit (non APD)" <<"\n";
|
||||||
APDidClass tmpAPDid(0,nTruePhe);
|
APDidClass tmpAPDid(0,nTruePhe);
|
||||||
// optHitDetectorMap->insert(std::pair<G4double,G4int>(time,0));
|
// optHitDetectorMap->insert(std::pair<G4double,G4int>(time,0));
|
||||||
optHitDetectorMap->insert(std::pair<G4double,APDidClass>(time,tmpAPDid));
|
optHitDetectorMap->insert(std::pair<G4double,APDidClass>(time,tmpAPDid));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
G4bool APDcellAlreadyFired = false;
|
G4bool APDcellAlreadyFired = false;
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : searching for the APD element" <<"\n";
|
||||||
for (optHitDetectorMapType::iterator it2 = optHitDetectorMap->begin(); it2 != optHitDetectorMap->end(); it2++ ) {
|
for (optHitDetectorMapType::iterator it2 = optHitDetectorMap->begin(); it2 != optHitDetectorMap->end(); it2++ ) {
|
||||||
if ((it2->second).GetAPDcellID()==APDcellID) { // this cell already fired before ==> check times
|
if ((it2->second).GetAPDcellID()==APDcellID) { // this cell already fired before ==> check times
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : this cell already fired before" <<"\n";
|
||||||
APDcellAlreadyFired = true;
|
APDcellAlreadyFired = true;
|
||||||
if (time<(it2->first)) { // the new cell fired before the already saved cell ==> replace it
|
if (time<(it2->first)) { // the new cell fired before the already saved cell ==> replace it
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : and the new photon is earlier, replacing" <<"\n";
|
||||||
G4int tmpAPDcellNphot = (it2->second).GetAPDcellNphot() + nTruePhe;
|
G4int tmpAPDcellNphot = (it2->second).GetAPDcellNphot() + nTruePhe;
|
||||||
APDidClass tmpAPDid(APDcellID,tmpAPDcellNphot);
|
APDidClass tmpAPDid(APDcellID,tmpAPDcellNphot);
|
||||||
optHitDetectorMap->erase(it2);
|
optHitDetectorMap->erase(it2);
|
||||||
@ -1183,6 +1201,7 @@ void musrScintSD::FireAPDcell(optHitDetectorMapType* optHitDetectorMap, G4int AP
|
|||||||
}
|
}
|
||||||
if (!APDcellAlreadyFired) {
|
if (!APDcellAlreadyFired) {
|
||||||
// optHitDetectorMap->insert(std::pair<G4double,G4int>(time,APDcellID));
|
// optHitDetectorMap->insert(std::pair<G4double,G4int>(time,APDcellID));
|
||||||
|
if (verboseLevel>1) G4cout<<"VERBOSE 2 : this cell hasn't fired, storing" <<"\n";
|
||||||
APDidClass tmpAPDid(APDcellID,nTruePhe);
|
APDidClass tmpAPDid(APDcellID,nTruePhe);
|
||||||
optHitDetectorMap->insert(std::pair<G4double,APDidClass>(time,tmpAPDid));
|
optHitDetectorMap->insert(std::pair<G4double,APDidClass>(time,tmpAPDid));
|
||||||
}
|
}
|
||||||
|
@ -617,10 +617,12 @@ void musrTabulatedElementField::addFieldValue2D(const G4double point[4],
|
|||||||
local = global2local.TransformPoint(global);
|
local = global2local.TransformPoint(global);
|
||||||
|
|
||||||
double x, z, z_sign;
|
double x, z, z_sign;
|
||||||
if ((strcmp(fieldTableType,"2D")==0)||(strcmp(fieldTableType,"2DBOpera")==0)||
|
// if ((strcmp(fieldTableType,"2D")==0)||(strcmp(fieldTableType,"2DBOpera")==0)||
|
||||||
(strcmp(fieldTableType,"2D_OperaXY"))||(strcmp(fieldTableType,"2DEf")==0)) {
|
// (strcmp(fieldTableType,"2D_OperaXY"))||(strcmp(fieldTableType,"2DEf")==0)) {
|
||||||
// Field is defined in just positive range of z; i.e. it is expected to be "symmetric"
|
// Field is defined in just positive range of z; i.e. it is expected to be "symmetric"
|
||||||
// and the field for negative z is calculated from the positive z half.
|
// and the field for negative z is calculated from the positive z half.
|
||||||
|
if (minimumz >= 0) {
|
||||||
|
// JSL: Use field values for z<0 if they're in the table! Reflect otherwise.
|
||||||
x = sqrt(local.x()*local.x()+local.y()*local.y());
|
x = sqrt(local.x()*local.x()+local.y()*local.y());
|
||||||
z = fabs(local.z());
|
z = fabs(local.z());
|
||||||
z_sign = (local.z()>0) ? 1.:-1.;
|
z_sign = (local.z()>0) ? 1.:-1.;
|
||||||
@ -631,8 +633,9 @@ void musrTabulatedElementField::addFieldValue2D(const G4double point[4],
|
|||||||
z = local.z();
|
z = local.z();
|
||||||
z_sign = 1;
|
z_sign = 1;
|
||||||
}
|
}
|
||||||
// Check that the point is within the defined region
|
// Check that the point is within the defined region (JSL: 2-sided check)
|
||||||
if ( x<maximumx && z<maximumz ) {
|
if ( x>=minimumx && x<maximumx &&
|
||||||
|
z>=minimumz && z<maximumz ) {
|
||||||
// if (evNr>evNrKriz) std::cout<<"bol som tu"<<std::endl;
|
// if (evNr>evNrKriz) std::cout<<"bol som tu"<<std::endl;
|
||||||
|
|
||||||
// Position of given point within region, normalized to the range
|
// Position of given point within region, normalized to the range
|
||||||
|
Loading…
x
Reference in New Issue
Block a user