|
| 1 | +/************************************************************************** |
| 2 | + * Copyright(c) 1998-2002, 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 | + * Copyright(c) 1997, 1998, 2002, Adrian Alscher and Kai Hencken * |
| 17 | + * See $ALICE_ROOT/EpEmGen/diffcross.f for full Copyright notice * |
| 18 | + * * |
| 19 | + * * |
| 20 | + * Copyright(c) 2002 Kai Hencken, Yuri Kharlov, Serguei Sadovsky * |
| 21 | + * See $ALICE_ROOT/EpEmGen/epemgen.f for full Copyright notice * |
| 22 | + * * |
| 23 | + **************************************************************************/ |
| 24 | +//------------------------------------------------------------------------ |
| 25 | +// TEpEmGen is an interface class to fortran event generator of |
| 26 | +// single e+e- pair production in ultraperipheral PbPb collisions |
| 27 | +// at 5.5 GeV/c |
| 28 | +//% |
| 29 | + |
| 30 | +// 9 October 2002 |
| 31 | +// |
| 32 | +// Revised on September 2018 for ALICEo2: Roberto Preghenella ([email protected]) |
| 33 | +//------------------------------------------------------------------------ |
| 34 | + |
| 35 | +#include "TRandom.h" |
| 36 | + |
| 37 | +#include "TEpEmGen.h" |
| 38 | +#include "TClonesArray.h" |
| 39 | +#include "TParticle.h" |
| 40 | +#include "TEcommon.h" |
| 41 | + |
| 42 | +#ifndef WIN32 |
| 43 | +# define ee_init ee_init_ |
| 44 | +# define ee_event ee_event_ |
| 45 | +# define eernd eernd_ |
| 46 | +#else |
| 47 | +# define ee_init EE_INIT |
| 48 | +# define ee_event EE_EVENT |
| 49 | +# define eernd EERND |
| 50 | +#endif |
| 51 | + |
| 52 | +extern "C" { |
| 53 | + void ee_init (Double_t &ymin, Double_t &ymax, Double_t &xmin, Double_t &xmax); |
| 54 | + void ee_event (Double_t &ymin, Double_t &ymax, Double_t &xmin, Double_t &xmax, |
| 55 | + Double_t &yE, Double_t &yP, Double_t &xE, Double_t &xP, |
| 56 | + Double_t &phi, Double_t &w); |
| 57 | + Double_t eernd(Int_t*) { |
| 58 | + Double_t r; |
| 59 | + do r=gRandom->Rndm(); while(0 >= r || r >= 1); |
| 60 | + return r; |
| 61 | + } |
| 62 | +} |
| 63 | + |
| 64 | +ClassImp(TEpEmGen) |
| 65 | + |
| 66 | +//------------------------------------------------------------------------------ |
| 67 | +TEpEmGen::TEpEmGen() : TGenerator("TEpEmGen","TEpEmGen") |
| 68 | +{ |
| 69 | +// TEpEmGen constructor: creates a TClonesArray in which it will store all |
| 70 | +// particles. Note that there may be only one functional TEpEmGen object |
| 71 | +// at a time, so it's not use to create more than one instance of it. |
| 72 | + |
| 73 | +} |
| 74 | + |
| 75 | +//------------------------------------------------------------------------------ |
| 76 | +TEpEmGen::~TEpEmGen() |
| 77 | +{ |
| 78 | + // Destroys the object, deletes and disposes all TParticles currently on list. |
| 79 | + fParticles->Delete(); |
| 80 | + delete fParticles; |
| 81 | +} |
| 82 | + |
| 83 | +//______________________________________________________________________________ |
| 84 | +void TEpEmGen::GenerateEvent(Double_t ymin, Double_t ymax, Double_t ptmin, Double_t ptmax, |
| 85 | + Double_t &yElectron, Double_t &yPositron, |
| 86 | + Double_t &xElectron, Double_t &xPositron, |
| 87 | + Double_t &phi12, Double_t &weight) |
| 88 | +{ |
| 89 | + //produce one event |
| 90 | + ee_event(ymin,ymax,ptmin,ptmax, |
| 91 | + yElectron,yPositron,xElectron,xPositron, |
| 92 | + phi12,weight); |
| 93 | +} |
| 94 | + |
| 95 | +//______________________________________________________________________________ |
| 96 | +void TEpEmGen::Initialize(Double_t ymin, Double_t ymax, Double_t ptmin, Double_t ptmax) |
| 97 | +{ |
| 98 | + // Initialize EpEmGen |
| 99 | + Double_t ptminMeV = ptmin*1000; |
| 100 | + Double_t ptmaxMeV = ptmax*1000; |
| 101 | + ee_init(ymin,ymax,ptminMeV,ptmaxMeV); |
| 102 | +} |
| 103 | + |
| 104 | +//______________________________________________________________________________ |
| 105 | +Int_t TEpEmGen::ImportParticles(TClonesArray *particles, Option_t *option) |
| 106 | +{ |
| 107 | + if (particles == 0) return 0; |
| 108 | + TClonesArray &clonesParticles = *particles; |
| 109 | + clonesParticles.Clear(); |
| 110 | + Int_t numpart = fParticles->GetEntries(); |
| 111 | + for (Int_t i = 0; i<numpart; i++) { |
| 112 | + TParticle *particle = (TParticle *)fParticles->At(i); |
| 113 | + new(clonesParticles[i]) TParticle(*particle); |
| 114 | + } |
| 115 | + return numpart; |
| 116 | +} |
| 117 | + |
| 118 | + |
| 119 | +//______________________________________________________________________________ |
| 120 | +Double_t TEpEmGen::GetXsection() |
| 121 | +{ |
| 122 | + // Return cross section accumulated so far |
| 123 | + return EEVENT.Xsecttot; |
| 124 | +} |
| 125 | + |
| 126 | +//______________________________________________________________________________ |
| 127 | +Double_t TEpEmGen::GetDsection() |
| 128 | +{ |
| 129 | + // Return cross section error accumulated so far |
| 130 | + return EEVENT.Dsecttot; |
| 131 | +} |
0 commit comments