703 JParser<> zap(
"Example program to calculate multiples rate.");
708 zap[
'D'] =
make_field(D_m) = JRange_t(0.216, 10);
720 catch(
const exception &error) {
721 FATAL(error.what() << endl);
724 gRandom->SetSeed(seed);
726 using namespace NAMESPACE;
730 const JModule module = getModule<JKM3NeT_t>(id);
732 DEBUG(module << endl);
736 const double R_m = 17.0 * 2.54 * 0.5e-2;
737 const double A =
PI * R_m * R_m;
739 const double wmin = 280.0;
740 const double wmax = 700.0;
743 const double WAVELENGTH_EXPANSION = (wmax-wmin) / (wmin*wmax) * (300.0*600.0)/(600.0-300.0);
745 JGenerator* enigma = NULL;
749 case +2: enigma =
new JEnigma<+2>(D_m);
break;
750 case 0: enigma =
new JEnigma< 0>(D_m);
break;
751 case -2: enigma =
new JEnigma<-2>(D_m);
break;
753 default:
FATAL(
"No generator type " << generator << endl);
756 const double vmin = 1.0 / wmax;
757 const double vmax = 1.0 / wmin;
761 for (
double w = wmin;
w <= wmax;
w += 1.0) {
767 NOTICE(
"Maximal QE " <<
FIXED(5,3) << QEmax << endl);
768 NOTICE(
"Wavelength expansion " <<
FIXED(5,3) << WAVELENGTH_EXPANSION << endl);
769 NOTICE(
"Number of photons per decay " <<
FIXED(5,2) << ng << endl);
771 typedef JManager<int, TH1D> JManager_t;
773 JManager_t H1(
new TH1D(
"M[%]", NULL, 100, D_m.getLowerLimit(), D_m.getUpperLimit()));
777 TH1D pmt(
"pmt", NULL, 1000, -1.0, +1.0);
779 for (Int_t
i = 1;
i != pmt.GetNbinsX(); ++
i) {
781 const double dot = pmt.GetBinCenter(
i);
792 y = get_angular_acceptance(dot);
796 pmt.SetBinContent(
i, y);
807 for (
counter_type event_count = 0; event_count != numberOfEvents; ++event_count) {
809 if (event_count%10000 == 0) {
810 STATUS(
"event: " << setw(10) << event_count <<
'\r');
DEBUG(endl);
813 const JResult&
result = enigma->next();
815 const double D = result.D;
816 const double V = result.V;
821 double W =
A / (4*
PI*(D-R_m)*(D-R_m));
828 double x = gRandom->Rndm();
831 if ((x -= k40_beta_decay .getBranchingRatio()) <= 0.0)
832 y = k40_beta_decay (gRandom->Rndm());
833 else if ((x -= k40_electron_capture.getBranchingRatio()) <= 0.0)
834 y = k40_electron_capture(gRandom->Rndm());
836 const int N = gRandom->Poisson(y * WAVELENGTH_EXPANSION * QE * W * QEmax * focus);
845 const double ct = gRandom->Uniform(-1.0, +1.0);
846 const double phi = gRandom->Uniform(-
PI, +
PI);
848 const double st = sqrt((1.0 - ct) * (1.0 + ct));
850 const JPosition3D vertex(D * st * cos(phi),
856 for (
int i = 0;
i !=
N; ++
i) {
860 const double v = gRandom->Uniform(vmin, vmax);
861 const double w = 1.0 /
v;
867 for (
size_t pmt = 0; pmt != module.size(); ++pmt) {
873 const double d = pos.getLength();
878 ERROR(
"Distance " << d <<
" < " << D << endl);
898 p = get_angular_acceptance(dot) *
getQE(w);
902 P += pi[pmt] = U * p *
exp(-d/l_abs);
906 ERROR(
"Probability " << P <<
" > " << W << endl);
909 if (W * QEmax * gRandom->Rndm() <
P) {
912 double y = gRandom->Uniform(P);
916 buffer.push_back(pmt);
920 if (!buffer.empty()) {
922 int M = buffer.size();
926 sort(buffer.begin(), buffer.end());
928 M =
distance(buffer.begin(), unique(buffer.begin(), buffer.end()));
934 for (
int i = 2;
i <= M; ++
i) {
935 P2[
i].put((
double) (buffer.size() - M) / (
double) M,
V);
943 for (JManager_t::iterator
i = H1.begin();
i != H1.end(); ++
i) {
944 i->second->Scale(bequerel / (
double) numberOfEvents);
947 for (
size_t M = 2; M != 7; ++M) {
948 cout <<
"Rate[" << M <<
"] = "
949 <<
FIXED(8,3) << bequerel * h1[M].getTotal() / (double) numberOfEvents
951 <<
FIXED(7,3) << bequerel * h1[M].getError() / (double) numberOfEvents
955 for (
size_t M = 2; M != 7; ++M) {
957 cout <<
"P2[" << M <<
"] = " << P2[M].getMean() << endl;
Utility class to parse command line options.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
double getDot(const JNeutrinoDirection &first, const JNeutrinoDirection &second)
Dot product.
Long64_t counter_type
Type definition for counter.
Auxiliary data structure for floating point format specification.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
JDirection3D getDirection(const Vec &dir)
Get direction.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons...
JPosition3D getPosition(const Vec &pos)
Get position.
static const double PI
Mathematical constants.
double getPhotocathodeArea()
Get photo-cathode area of PMT.
static const JPhotocathodeArea2D getPhotocathodeArea2D
Function object for effective photo-cathode area of PMT.
double getAbsorptionLength(const double lambda)
Get absorption length.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
int getCount(const T &hit)
Get hit count.
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` source JAcousticsToolkit.sh typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
#define DEBUG(A)
Message macros.
double getAngularAcceptance(const double x)
Angular acceptence of PMT.