1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
27 // Comments and suggestions: Jiri.Chudoba@cern.ch
33 #include "AliGenThetaSlice.h"
36 ClassImp(AliGenThetaSlice)
38 //_____________________________________________________________________________
39 AliGenThetaSlice::AliGenThetaSlice()
43 // Default constructor
48 //_____________________________________________________________________________
49 AliGenThetaSlice::AliGenThetaSlice(Int_t npart)
53 // Standard constructor
56 fTitle = "Particle generator - const. phi, slices in theta";
57 // Generate Proton by default
61 //_____________________________________________________________________________
63 void AliGenThetaSlice::Generate()
66 // Generate one trigger
69 Float_t polar[3]= {0,0,0};
73 Double_t pmom, theta, phi, pt;
76 if (fNpart == 0) return;
78 for (j=0;j<3;j++) origin[j]=fOrigin[j];
79 if(fVertexSmear==kPerEvent) {
82 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
83 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
86 Float_t thetaInterval = 0.;
88 thetaInterval = (fThetaMax-fThetaMin)/(fNpart-1);
91 phi=fPhiMin+random[0]*(fPhiMax-fPhiMin);
92 for(i=0;i<fNpart;i++) {
94 theta=fThetaMin+i*thetaInterval;
95 if(TestBit(kMomentumRange)) {
96 pmom=fPMin+random[0]*(fPMax-fPMin);
97 pt=pmom*TMath::Sin(theta);
99 pt=fPtMin+random[0]*(fPtMax-fPtMin);
100 pmom=pt/TMath::Sin(theta);
102 p[0] = pt*TMath::Cos(phi);
103 p[1] = pt*TMath::Sin(phi);
104 p[2] = pmom*TMath::Cos(theta);
106 if(fVertexSmear==kPerTrack) {
109 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
110 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
113 PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
117 //_____________________________________________________________________________
119 void AliGenThetaSlice::Init()
121 // Initialisation, check consistency of selected ranges
122 if(TestBit(kPtRange)&&TestBit(kMomentumRange))
123 Fatal("Init","You should not set the momentum range and the pt range!\n");
124 if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange)))
125 Fatal("Init","You should set either the momentum or the pt range!\n");