]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVGEN/AliGenThetaSlice.cxx
Modyfing debug levels: level 1 only in ctors/dtors.
[u/mrichter/AliRoot.git] / EVGEN / AliGenThetaSlice.cxx
CommitLineData
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
803d1ab0 16/* $Id$ */
88cb7938 17
0af12c00 18
19// Generates n particles with in the same phi angle, varies theta
56b2bd7e 20// in equidistant intervals
21// This class is intended to use for studies of TPC response
22// via merging with background event.
56b2bd7e 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
0af12c00 28
56b2bd7e 29
116cbefd 30#include <TPDGCode.h>
31
32#include "AliConst.h"
56b2bd7e 33#include "AliGenThetaSlice.h"
34#include "AliRun.h"
56b2bd7e 35
36ClassImp(AliGenThetaSlice)
37
38//_____________________________________________________________________________
39AliGenThetaSlice::AliGenThetaSlice()
1c56e311 40 :AliGenerator(),
41 fIpart(0)
56b2bd7e 42{
43 //
44 // Default constructor
45 //
56b2bd7e 46}
47
48//_____________________________________________________________________________
49AliGenThetaSlice::AliGenThetaSlice(Int_t npart)
1c56e311 50 :AliGenerator(npart),
51 fIpart(kProton)
56b2bd7e 52{
53 //
54 // Standard constructor
55 //
56 fName = "ThetaSlice";
57 fTitle = "Particle generator - const. phi, slices in theta";
56b2bd7e 58}
59
60//_____________________________________________________________________________
61
62void AliGenThetaSlice::Generate()
63{
64 //
65 // Generate one trigger
66 //
67
68 Float_t polar[3]= {0,0,0};
69 Float_t origin[3];
70 Float_t p[3];
71 Int_t i, j, nt;
72 Double_t pmom, theta, phi, pt;
73 Float_t random[6];
74
75 if (fNpart == 0) return;
76
77 for (j=0;j<3;j++) origin[j]=fOrigin[j];
78 if(fVertexSmear==kPerEvent) {
79 Rndm(random,6);
80 for (j=0;j<3;j++) {
81 origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
82 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
83 }
84 }
85 Float_t thetaInterval = 0.;
86 if (fNpart > 1) {
87 thetaInterval = (fThetaMax-fThetaMin)/(fNpart-1);
88 }
89 Rndm(random,1);
90 phi=fPhiMin+random[0]*(fPhiMax-fPhiMin);
91 for(i=0;i<fNpart;i++) {
92 Rndm(random,1);
93 theta=fThetaMin+i*thetaInterval;
94 if(TestBit(kMomentumRange)) {
95 pmom=fPMin+random[0]*(fPMax-fPMin);
96 pt=pmom*TMath::Sin(theta);
97 } else {
98 pt=fPtMin+random[0]*(fPtMax-fPtMin);
99 pmom=pt/TMath::Sin(theta);
100 }
101 p[0] = pt*TMath::Cos(phi);
102 p[1] = pt*TMath::Sin(phi);
103 p[2] = pmom*TMath::Cos(theta);
104
105 if(fVertexSmear==kPerTrack) {
106 Rndm(random,6);
107 for (j=0;j<3;j++) {
108 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
109 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
110 }
111 }
642f15cf 112 PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
56b2bd7e 113 }
114}
115
116//_____________________________________________________________________________
117
118void AliGenThetaSlice::Init()
119{
120// Initialisation, check consistency of selected ranges
121 if(TestBit(kPtRange)&&TestBit(kMomentumRange))
122 Fatal("Init","You should not set the momentum range and the pt range!\n");
123 if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange)))
124 Fatal("Init","You should set either the momentum or the pt range!\n");
125}
126