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