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