X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVGEN%2FAliGenBox.cxx;h=112da0d00c972320b86f6529191ac11caf39fb54;hb=f429b017e4c1a463a8e4382fc5ced96610ebed39;hp=1613e15b838d62db0ec082dc94a44f5315be445b;hpb=aee8290b9e98b230f8f38596bffd47ca1abfbf9d;p=u%2Fmrichter%2FAliRoot.git
diff --git a/EVGEN/AliGenBox.cxx b/EVGEN/AliGenBox.cxx
index 1613e15b838..112da0d00c9 100644
--- a/EVGEN/AliGenBox.cxx
+++ b/EVGEN/AliGenBox.cxx
@@ -13,77 +13,51 @@
* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.1 2000/06/09 20:22:58 morsch
-Same class as previously in AliSimpleGen.cxx
-All coding rule violations except RS3 corrected (AM)
-
-*/
-
-/*
-Old Log:
-Revision 1.8 2000/06/08 13:34:50 fca
-Better control of momentum range in GenBox
-
-Revision 1.7 2000/06/07 16:29:58 fca
-Adding check for pt range in AliGenBox
-
-Revision 1.6 1999/11/03 17:43:20 fca
-New version from G.Martinez & A.Morsch
-
-Revision 1.5 1999/09/29 09:24:14 fca
-Introduction of the Copyright and cvs Log
-*/
-
-///////////////////////////////////////////////////////////////////
-// //
-// Generate the final state of the interaction as the input //
-// to the MonteCarlo //
-//
-//Begin_Html
-/*
-
-
- The responsible person for this module is
-Andreas Morsch.
-
-
-
-*/ -//End_Html -// // -/////////////////////////////////////////////////////////////////// +/* $Id$ */ + +// Generator for particles in a preset +// kinematic range (flat distribution) +// Note that for a given theta pt and p are not independent +// Range for only one variable (pt or p) should be given. +// Comments and suggestions: andreas.morsch@cern.ch + + +#include "TPDGCode.h" + +#include "AliConst.h" #include "AliGenBox.h" #include "AliRun.h" -#include "AliConst.h" +#include "AliGenEventHeader.h" +#include "TDatabasePDG.h" #include "AliPDG.h" ClassImp(AliGenBox) //_____________________________________________________________________________ AliGenBox::AliGenBox() - :AliGenerator() + :AliGenerator(), + fIpart(0), + fEtaMin(0), + fEtaMax(0) { // // Default constructor // - fIpart=0; } //_____________________________________________________________________________ AliGenBox::AliGenBox(Int_t npart) - :AliGenerator(npart) + :AliGenerator(npart), + fIpart(kProton), + fEtaMin(0), + fEtaMax(0) { // // Standard constructor // - fName="Box"; - fTitle="Box particle generator"; - // Generate Proton by default - fIpart=kProton; + fName = "Box"; + fTitle = "Box particle generator"; } //_____________________________________________________________________________ @@ -97,44 +71,91 @@ void AliGenBox::Generate() Float_t polar[3]= {0,0,0}; // Float_t origin[3]; + Float_t time; Float_t p[3]; Int_t i, j, nt; Double_t pmom, theta, phi, pt; + Double_t y, mt; // Float_t random[6]; // for (j=0;j<3;j++) origin[j]=fOrigin[j]; + time = fTimeOrigin; if(fVertexSmear==kPerEvent) { - gMC->Rndm(random,6); - for (j=0;j<3;j++) { - origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* - TMath::Sqrt(-2*TMath::Log(random[2*j+1])); - } + Vertex(); + for (j=0;j<3;j++) origin[j]=fVertex[j]; + time = fTime; } + + Double_t m = TDatabasePDG::Instance()->GetParticle(fIpart)->Mass(); + for(i=0;iRndm(random,3); - theta=fThetaMin+random[0]*(fThetaMax-fThetaMin); - if(TestBit(kMomentumRange)) { - pmom=fPMin+random[1]*(fPMax-fPMin); - pt=pmom*TMath::Sin(theta); + Rndm(random,3); + + if (TestBit(kYRange)) { + y = fYMin+random[0]*(fYMax-fYMin); + + if(TestBit(kMomentumRange)) { + pmom=fPMin+random[1]*(fPMax-fPMin); + mt = TMath::Sqrt(pmom*pmom+m*m)/TMath::CosH(y); + pt = TMath::Sqrt(mt*mt - m*m); + } else { + pt=fPtMin+random[1]*(fPtMax-fPtMin); + mt=TMath::Sqrt(pt*pt+m*m); + } + + phi=fPhiMin+random[2]*(fPhiMax-fPhiMin); + p[0] = pt*TMath::Cos(phi); + p[1] = pt*TMath::Sin(phi); + p[2] = mt*TMath::SinH(y); } else { + if (TestBit(kThetaRange)) { + theta = fThetaMin+random[0]*(fThetaMax-fThetaMin); + } else { + Float_t eta = fEtaMin+random[0]*(fEtaMax-fEtaMin); + theta = 2. * TMath::ATan(TMath::Exp(-eta)); + } + + if(TestBit(kMomentumRange)) { + pmom=fPMin+random[1]*(fPMax-fPMin); + pt=pmom*TMath::Sin(theta); + } else { + + pt=fPtMin+random[1]*(fPtMax-fPtMin); + pmom=pt/TMath::Sin(theta); + } - pt=fPtMin+random[1]*(fPtMax-fPtMin); - pmom=pt/TMath::Sin(theta); + phi=fPhiMin+random[2]*(fPhiMax-fPhiMin); + p[0] = pt*TMath::Cos(phi); + p[1] = pt*TMath::Sin(phi); + p[2] = pmom*TMath::Cos(theta); } - phi=fPhiMin+random[2]*(fPhiMax-fPhiMin); - p[0] = pt*TMath::Cos(phi); - p[1] = pt*TMath::Sin(phi); - p[2] = pmom*TMath::Cos(theta); if(fVertexSmear==kPerTrack) { - gMC->Rndm(random,6); + Rndm(random,6); for (j=0;j<3;j++) { origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* TMath::Sqrt(-2*TMath::Log(random[2*j+1])); } + + Rndm(random,2); + time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()* + TMath::Cos(2*random[0]*TMath::Pi())* + TMath::Sqrt(-2*TMath::Log(random[1])); } - gAlice->SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,"Primary",nt); + PushTrack(fTrackIt,-1,fIpart,p,origin,polar,time,kPPrimary,nt); + } + + AliGenEventHeader* header = new AliGenEventHeader("BOX"); + header->SetPrimaryVertex(fVertex); + header->SetNProduced(fNpart); + header->SetInteractionTime(fTime); + + // Passes header either to the container or to gAlice + if (fContainer) { + fContainer->AddHeader(header); + } else { + gAlice->SetGenEventHeader(header); } } @@ -147,5 +168,11 @@ void AliGenBox::Init() Fatal("Init","You should not set the momentum range and the pt range!\n"); if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange))) Fatal("Init","You should set either the momentum or the pt range!\n"); + if((TestBit(kYRange)&&TestBit(kThetaRange)) || (TestBit(kYRange)&&TestBit(kEtaRange)) || (TestBit(kEtaRange)&&TestBit(kThetaRange)) ) + Fatal("Init","You should only set the range of one of these variables: y, eta or theta\n"); + if((!TestBit(kYRange)) && (!TestBit(kEtaRange)) && (!TestBit(kThetaRange)) ) + Fatal("Init","You should set the range of one of these variables: y, eta or theta\n"); + + AliPDG::AddParticlesToPdgDataBase(); }