Project
Loading...
Searching...
No Matches
GeneratorGeantinos.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11//
13
14//------------------------------------------------------------------------
15// Generates geantino rays to check the material distributions and detector's
16// geometry
17//------------------------------------------------------------------------
18
20#include <TParticle.h>
22
23namespace o2
24{
25namespace eventgen
26{
27//_______________________________________________________________________
29 mMode(-1),
30 mRadMin(0),
31 mRadMax(0),
32 mZMax(0),
33 mNCoor1(0),
34 mNCoor2(0),
35 mCoor1Min(0),
36 mCoor1Max(0),
37 mCoor2Min(0),
38 mCoor2Max(0)
39{
40}
41
42//_______________________________________________________________________
44 Float_t c1max, Int_t nc2,
45 Float_t c2min, Float_t c2max,
46 Float_t rmin, Float_t rmax, Float_t zmax) :
47
49 mMode(mode),
50 mRadMin(rmin),
51 mRadMax(rmax),
52 mZMax(zmax),
53 mNCoor1(nc1),
54 mNCoor2(nc2),
55 mCoor1Min(c1min),
56 mCoor1Max(c1max),
57 mCoor2Min(c2min),
58 mCoor2Max(c2max)
59{
60 //
61 // Standard generator for geantinos
62 //
63}
64
65//_______________________________________________________________________
67{
68 Float_t orig[3], pmom[3];
69 Float_t t, cost, sint, cosp, sinp;
72 const Float_t g2rad = TMath::Pi() / 180.;
73 for (Int_t i = 0; i < mNCoor1; i++) {
74 for (Int_t j = 0; j < mNCoor2; j++) {
75 Float_t c1 = mCoor1Min + i * s1 + s1 / 2.;
76 Float_t c2 = mCoor2Min + j * s2 + s2 / 2.;
77 if (mMode == 2) {
78 sint = 1.;
79 cost = 0.;
80 } else if (mMode == 1) {
81 Float_t theta = 2. * TMath::ATan(TMath::Exp(-c1));
82 sint = TMath::Sin(theta);
83 cost = TMath::Cos(theta);
84 } else {
85 cost = TMath::Cos(c1 * g2rad);
86 sint = TMath::Sin(c1 * g2rad);
87 }
88
89 cosp = TMath::Cos(c2 * g2rad);
90 sinp = TMath::Sin(c2 * g2rad);
91
92 pmom[0] = cosp * sint;
93 pmom[1] = sinp * sint;
94 pmom[2] = cost;
95
96 // --- Where to start
97 orig[0] = orig[1] = orig[2] = 0;
98 if (mMode == 2) {
99 orig[2] = c1;
100 }
101 Float_t dalicz = 3000;
102 if (mRadMin > 0) {
103 t = PropagateCylinder(orig, pmom, mRadMin, dalicz);
104 orig[0] += pmom[0] * t;
105 orig[1] += pmom[1] * t;
106 orig[2] += pmom[2] * t;
107 if (TMath::Abs(orig[2]) > mZMax) {
108 return kFALSE;
109 }
110 }
111 Float_t polar[3] = {0., 0., 0.};
112 primGen->AddTrack(0, pmom[0], pmom[1], pmom[2], orig[0], orig[1], orig[2], -1, true, 0, 0, 1.);
113 } // j
114 } // i
115 return kTRUE;
116}
117
118//_______________________________________________________________________
120 Float_t z)
121{
122 //
123 // Propagate to cylinder from inside
124 //
125 Double_t hnorm, sz, t, t1, t2, t3, sr;
126 Double_t d[3];
127 const Float_t kSmall = 1e-8;
128 const Float_t kSmall2 = kSmall * kSmall;
129
130 // ---> Find intesection with Z planes
131 d[0] = v[0];
132 d[1] = v[1];
133 d[2] = v[2];
134 hnorm = TMath::Sqrt(1 / (d[0] * d[0] + d[1] * d[1] + d[2] * d[2]));
135 d[0] *= hnorm;
136 d[1] *= hnorm;
137 d[2] *= hnorm;
138 if (d[2] > kSmall) {
139 sz = (z - x[2]) / d[2];
140 } else if (d[2] < -kSmall) {
141 sz = -(z + x[2]) / d[2];
142 } else {
143 sz = 1.e10; // ---> Direction parallel to X-Y, no intersection
144 }
145
146 t1 = d[0] * d[0] + d[1] * d[1];
147 if (t1 <= kSmall2) {
148 t = sz; // ---> Track parallel to the z-axis, take distance to planes
149 } else {
150 t2 = x[0] * d[0] + x[1] * d[1];
151 t3 = x[0] * x[0] + x[1] * x[1];
152 // ---> It should be positive, but there may be numerical problems
153 sr = (-t2 + TMath::Sqrt(TMath::Max(t2 * t2 - (t3 - r * r) * t1, 0.))) / t1;
154 // ---> Find minimum distance between planes and cylinder
155 t = TMath::Min(sz, sr);
156 }
157 return t;
158}
159} // namespace eventgen
160} // namespace o2
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
uint32_t j
Definition RawData.h:0
virtual void AddTrack(Int_t pdgid, Double_t px, Double_t py, Double_t pz, Double_t vx, Double_t vy, Double_t vz, Int_t parent=-1, Bool_t wanttracking=true, Double_t e=-9e9, Double_t tof=0., Double_t weight=0., TMCProcess proc=kPPrimary)
static Float_t PropagateCylinder(Float_t *x, Float_t *v, Float_t r, Float_t z)
Bool_t ReadEvent(FairPrimaryGenerator *primGen) override
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition glcorearb.h:5034
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition glcorearb.h:5034
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...