]>
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$ | |
116cbefd | 18 | Revision 1.1 2002/03/11 10:56:06 morsch |
19 | AliGenThetaSlice, first commit. (Jiri Chudoba) | |
20 | ||
56b2bd7e | 21 | */ |
22 | //////////////////////////////////////////////////////////////////////// | |
23 | // | |
24 | // generates n particles with in the same phi angle, varies theta | |
25 | // in equidistant intervals | |
26 | // This class is intended to use for studies of TPC response | |
27 | // via merging with background event. | |
28 | // | |
29 | // Note that for a given theta pt and p are not independent | |
30 | // Range for only one variable (pt or p) should be given. | |
31 | // Based on the AliGenBox class written by andreas.morsch@cern.ch | |
32 | // | |
33 | // Comments and suggestions: Jiri.Chudoba@cern.ch | |
34 | // | |
35 | //////////////////////////////////////////////////////////////////////// | |
36 | ||
116cbefd | 37 | #include <TPDGCode.h> |
38 | ||
39 | #include "AliConst.h" | |
56b2bd7e | 40 | #include "AliGenThetaSlice.h" |
41 | #include "AliRun.h" | |
56b2bd7e | 42 | |
43 | ClassImp(AliGenThetaSlice) | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliGenThetaSlice::AliGenThetaSlice() | |
47 | :AliGenerator() | |
48 | { | |
49 | // | |
50 | // Default constructor | |
51 | // | |
52 | fIpart=0; | |
53 | } | |
54 | ||
55 | //_____________________________________________________________________________ | |
56 | AliGenThetaSlice::AliGenThetaSlice(Int_t npart) | |
57 | :AliGenerator(npart) | |
58 | { | |
59 | // | |
60 | // Standard constructor | |
61 | // | |
62 | fName = "ThetaSlice"; | |
63 | fTitle = "Particle generator - const. phi, slices in theta"; | |
64 | // Generate Proton by default | |
65 | fIpart=kProton; | |
66 | } | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | ||
70 | void AliGenThetaSlice::Generate() | |
71 | { | |
72 | // | |
73 | // Generate one trigger | |
74 | // | |
75 | ||
76 | Float_t polar[3]= {0,0,0}; | |
77 | Float_t origin[3]; | |
78 | Float_t p[3]; | |
79 | Int_t i, j, nt; | |
80 | Double_t pmom, theta, phi, pt; | |
81 | Float_t random[6]; | |
82 | ||
83 | if (fNpart == 0) return; | |
84 | ||
85 | for (j=0;j<3;j++) origin[j]=fOrigin[j]; | |
86 | if(fVertexSmear==kPerEvent) { | |
87 | Rndm(random,6); | |
88 | for (j=0;j<3;j++) { | |
89 | origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
90 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
91 | } | |
92 | } | |
93 | Float_t thetaInterval = 0.; | |
94 | if (fNpart > 1) { | |
95 | thetaInterval = (fThetaMax-fThetaMin)/(fNpart-1); | |
96 | } | |
97 | Rndm(random,1); | |
98 | phi=fPhiMin+random[0]*(fPhiMax-fPhiMin); | |
99 | for(i=0;i<fNpart;i++) { | |
100 | Rndm(random,1); | |
101 | theta=fThetaMin+i*thetaInterval; | |
102 | if(TestBit(kMomentumRange)) { | |
103 | pmom=fPMin+random[0]*(fPMax-fPMin); | |
104 | pt=pmom*TMath::Sin(theta); | |
105 | } else { | |
106 | pt=fPtMin+random[0]*(fPtMax-fPtMin); | |
107 | pmom=pt/TMath::Sin(theta); | |
108 | } | |
109 | p[0] = pt*TMath::Cos(phi); | |
110 | p[1] = pt*TMath::Sin(phi); | |
111 | p[2] = pmom*TMath::Cos(theta); | |
112 | ||
113 | if(fVertexSmear==kPerTrack) { | |
114 | Rndm(random,6); | |
115 | for (j=0;j<3;j++) { | |
116 | origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* | |
117 | TMath::Sqrt(-2*TMath::Log(random[2*j+1])); | |
118 | } | |
119 | } | |
120 | SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt); | |
121 | } | |
122 | } | |
123 | ||
124 | //_____________________________________________________________________________ | |
125 | ||
126 | void AliGenThetaSlice::Init() | |
127 | { | |
128 | // Initialisation, check consistency of selected ranges | |
129 | if(TestBit(kPtRange)&&TestBit(kMomentumRange)) | |
130 | Fatal("Init","You should not set the momentum range and the pt range!\n"); | |
131 | if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange))) | |
132 | Fatal("Init","You should set either the momentum or the pt range!\n"); | |
133 | } | |
134 |