]>
Commit | Line | Data |
---|---|---|
56b2bd7e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
88cb7938 | 18 | Revision 1.1.4.1 2003/04/14 17:33:50 hristov |
19 | Merging with v3-09-08 (part1) | |
20 | ||
21 | Revision 1.2 2003/01/14 10:50:19 alibrary | |
22 | Cleanup of STEER coding conventions | |
23 | ||
116cbefd | 24 | Revision 1.1 2002/03/11 10:56:06 morsch |
25 | AliGenThetaSlice, first commit. (Jiri Chudoba) | |
26 | ||
56b2bd7e | 27 | */ |
28 | //////////////////////////////////////////////////////////////////////// | |
29 | // | |
30 | // generates n particles with in the same phi angle, varies theta | |
31 | // in equidistant intervals | |
32 | // This class is intended to use for studies of TPC response | |
33 | // via merging with background event. | |
34 | // | |
35 | // Note that for a given theta pt and p are not independent | |
36 | // Range for only one variable (pt or p) should be given. | |
37 | // Based on the AliGenBox class written by andreas.morsch@cern.ch | |
38 | // | |
39 | // Comments and suggestions: Jiri.Chudoba@cern.ch | |
40 | // | |
41 | //////////////////////////////////////////////////////////////////////// | |
42 | ||
116cbefd | 43 | #include <TPDGCode.h> |
44 | ||
45 | #include "AliConst.h" | |
56b2bd7e | 46 | #include "AliGenThetaSlice.h" |
47 | #include "AliRun.h" | |
56b2bd7e | 48 | |
49 | ClassImp(AliGenThetaSlice) | |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | AliGenThetaSlice::AliGenThetaSlice() | |
53 | :AliGenerator() | |
54 | { | |
55 | // | |
56 | // Default constructor | |
57 | // | |
58 | fIpart=0; | |
59 | } | |
60 | ||
61 | //_____________________________________________________________________________ | |
62 | AliGenThetaSlice::AliGenThetaSlice(Int_t npart) | |
63 | :AliGenerator(npart) | |
64 | { | |
65 | // | |
66 | // Standard constructor | |
67 | // | |
68 | fName = "ThetaSlice"; | |
69 | fTitle = "Particle generator - const. phi, slices in theta"; | |
70 | // Generate Proton by default | |
71 | fIpart=kProton; | |
72 | } | |
73 | ||
74 | //_____________________________________________________________________________ | |
75 | ||
76 | void AliGenThetaSlice::Generate() | |
77 | { | |
78 | // | |
79 | // Generate one trigger | |
80 | // | |
81 | ||
82 | Float_t polar[3]= {0,0,0}; | |
83 | Float_t origin[3]; | |
84 | Float_t p[3]; | |
85 | Int_t i, j, nt; | |
86 | Double_t pmom, theta, phi, pt; | |
87 | Float_t random[6]; | |
88 | ||
89 | if (fNpart == 0) return; | |
90 | ||
91 | for (j=0;j<3;j++) origin[j]=fOrigin[j]; | |
92 | if(fVertexSmear==kPerEvent) { | |
93 | Rndm(random,6); | |
94 | for (j=0;j<3;j++) { | |
95 | origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
96 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
97 | } | |
98 | } | |
99 | Float_t thetaInterval = 0.; | |
100 | if (fNpart > 1) { | |
101 | thetaInterval = (fThetaMax-fThetaMin)/(fNpart-1); | |
102 | } | |
103 | Rndm(random,1); | |
104 | phi=fPhiMin+random[0]*(fPhiMax-fPhiMin); | |
105 | for(i=0;i<fNpart;i++) { | |
106 | Rndm(random,1); | |
107 | theta=fThetaMin+i*thetaInterval; | |
108 | if(TestBit(kMomentumRange)) { | |
109 | pmom=fPMin+random[0]*(fPMax-fPMin); | |
110 | pt=pmom*TMath::Sin(theta); | |
111 | } else { | |
112 | pt=fPtMin+random[0]*(fPtMax-fPtMin); | |
113 | pmom=pt/TMath::Sin(theta); | |
114 | } | |
115 | p[0] = pt*TMath::Cos(phi); | |
116 | p[1] = pt*TMath::Sin(phi); | |
117 | p[2] = pmom*TMath::Cos(theta); | |
118 | ||
119 | if(fVertexSmear==kPerTrack) { | |
120 | Rndm(random,6); | |
121 | for (j=0;j<3;j++) { | |
122 | origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
123 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
124 | } | |
125 | } | |
126 | SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt); | |
127 | } | |
128 | } | |
129 | ||
130 | //_____________________________________________________________________________ | |
131 | ||
132 | void AliGenThetaSlice::Init() | |
133 | { | |
134 | // Initialisation, check consistency of selected ranges | |
135 | if(TestBit(kPtRange)&&TestBit(kMomentumRange)) | |
136 | Fatal("Init","You should not set the momentum range and the pt range!\n"); | |
137 | if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange))) | |
138 | Fatal("Init","You should set either the momentum or the pt range!\n"); | |
139 | } | |
140 |