FairShip
Loading...
Searching...
No Matches
CosmicsGenerator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5// -------------------------------------------------------------------
6// ----- CosmicsGenerator source file for SHiP -----
7// ----- Version as of 15.09.15 by Martin Franke -----
8// ----- mailto: mfranke(at)physik.hu-berlin.de -----
9// -------------------------------------------------------------------
10
11#ifndef SHIPGEN_COSMICSGENERATOR_H_
12#define SHIPGEN_COSMICSGENERATOR_H_
13
14#include "Generator.h"
15#include "TF1.h"
16#include "TH1.h"
17#include "TMath.h"
18#include "TROOT.h"
19#include "TRandom3.h"
20
21class FairPrimaryGenerator;
22
23class Co3Rng {
24 public:
26 rng = new TRandom3(gRandom->GetSeed());
27 fTheta = new TF1("f2", "cos(x)*cos(x)", 0, TMath::Pi() / 2);
28 fTheta->SetNpx(10);
30 new TF1("f4", "1400*TMath::Power(x,-2.7)*(1/(1+x/115)+0.054/(1+x/850))",
31 100, 1000); // momentum above 100GeV
32 };
33 virtual ~Co3Rng() {
34 delete rng;
35 delete fTheta;
36 delete fSpectrumH;
37 };
38 double Uniform(Float_t min, Float_t max) { return rng->Uniform(min, max); };
40 TF1* fTheta;
41 double fSpectrumL(double theta, double minE,
42 Bool_t generateP); // momentum below 100GeV
43 private:
44 TRandom3* rng;
45};
46
48 public:
51 ~CosmicsGenerator() override {
52 delete fRandomEngine;
53 std::cout << nInside << " events have been generated." << std::endl;
54 std::cout << "There is a total of " << nInside << "/" << nTest
55 << " muons that passed close enough to the detector."
56 << std::endl;
57 std::cout << "Including the given weight this corresponds to ";
58 std::cout << weighttest / FluxIntegral / xdist / zdist * 10000
59 << " spills (1 spill = " << xdist * zdist * FluxIntegral / 10000;
60 std::cout << " real cosmic muons = " << n_EVENTS << " simulated events)."
61 << std::endl;
62 };
63
66 Bool_t ReadEvent(FairPrimaryGenerator*) override;
67 // virtual Bool_t Init(); //!
68 virtual Bool_t Init(Bool_t largeMom);
69 Bool_t Init(const char* inFile) override { return Init(inFile, 0); };
70
71 Bool_t Init(const char* inFile, int startEvent) override {
72 LOG(warning) << "Init with files not implemented for CosmicsGenerator.";
73 return false;
74 };
75
76 double z0, yBox, xBox, zBox, xdist, zdist, minE;
78
79 private:
81
82 protected:
85 Bool_t high;
86
87 void GenerateDynamics();
88 Bool_t DetectorBox();
89};
90
91#endif // SHIPGEN_COSMICSGENERATOR_H_ /* !PNDCoGENERATOR_H */
double fSpectrumL(double theta, double minE, Bool_t generateP)
TF1 * fTheta
TF1 * fSpectrumH
TRandom3 * rng
double Uniform(Float_t min, Float_t max)
virtual ~Co3Rng()
Bool_t Init(const char *inFile, int startEvent) override
~CosmicsGenerator() override
Bool_t Init(const char *inFile) override
Bool_t ReadEvent(FairPrimaryGenerator *) override
virtual Bool_t Init(Bool_t largeMom)
virtual Bool_t Init(const char *, int)=0