SND@LHC Software
Loading...
Searching...
No Matches
CosmicsGenerator.h
Go to the documentation of this file.
1// -------------------------------------------------------------------
2// ----- CosmicsGenerator source file for SHiP -----
3// ----- Version as of 15.09.15 by Martin Franke -----
4// ----- mailto: mfranke(at)physik.hu-berlin.de -----
5// -------------------------------------------------------------------
6
7#ifndef PNDCoGENERATOR_H
8#define PNDCoGENERATOR_H 1
9
10#include "TROOT.h"
11#include "FairGenerator.h"
12#include "TRandom3.h"
13#include "TF1.h"
14#include "TMath.h"
15#include "TH1.h"
16
17using std::cout;
18using std::endl;
19class FairPrimaryGenerator;
20
21class Co3Rng{
22 public:
24 rng = new TRandom3(gRandom->GetSeed());
25 fTheta = new TF1("f2","cos(x)*cos(x)",0,TMath::Pi()/2);
26 fTheta->SetNpx(10);
27 fSpectrumH = new TF1("f4","1400*TMath::Power(x,-2.7)*(1/(1+x/115)+0.054/(1+x/850))",100,1000); // momentum above 100GeV
28 };
29 virtual ~Co3Rng() {delete rng; delete fTheta; delete fSpectrumH;};
30 double Uniform(Float_t min, Float_t max){return rng->Uniform(min,max);};
32 TF1 *fTheta;
33 double fSpectrumL(double theta, double minE, Bool_t generateP); // momentum below 100GeV
34 private:
35 TRandom3 *rng;
36};
37
38class CosmicsGenerator : public FairGenerator{
39 public:
43 delete fRandomEngine;
44 cout<<nInside<<" events have been generated."<<endl;
45 cout<<"There is a total of "<<nInside<<"/"<<nTest<<" muons that passed close enough to the detector."<<endl;
46 cout<<"Including the given weight this corresponds to ";
47 cout<<weighttest/FluxIntegral/xdist/zdist*10000<<" spills (1 spill = "<<xdist*zdist*FluxIntegral/10000;
48 cout<<" real cosmic muons = "<<n_EVENTS<<" simulated events)."<<endl;
49 };
50
52 Bool_t ReadEvent(FairPrimaryGenerator*);
53 // virtual Bool_t Init(); //!
54 virtual Bool_t Init(Bool_t largeMom);
55
58
59 private:
61
62 protected:
65 Bool_t high;
66
67 void GenerateDynamics();
68 Bool_t DetectorBox();
70};
71
72#endif /* !PNDCoGENERATOR_H */
double fSpectrumL(double theta, double minE, Bool_t generateP)
TF1 * fSpectrumH
TRandom3 * rng
double Uniform(Float_t min, Float_t max)
virtual ~Co3Rng()
Bool_t ReadEvent(FairPrimaryGenerator *)
ClassDef(CosmicsGenerator, 4)
virtual Bool_t Init(Bool_t largeMom)
virtual ~CosmicsGenerator()