2 <one line to give the program's name and a brief idea of what it does.>
3 Copyright (C) <year> <name of author>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "starlightdpmjet.h"
24 #include <spectrumprotonnucleus.h>
25 #include "starlightconfig.h"
43 void dt_produceevent_(float* gammaE, int* nparticles);
44 void dt_getparticle_(int *ipart, int *res);
45 void dt_initialise_();
48 starlightDpmJet::starlightDpmJet(beamBeamSystem& beamsystem ) : eventChannel(beamsystem)
52 ,_maxGammaEnergy(600000.0)
58 int starlightDpmJet::init()
62 _spectrum = new spectrumProtonNucleus(&_bbs);
66 _spectrum = new spectrum(&_bbs);
69 _spectrum->setMinGammaEnergy(_minGammaEnergy);
70 _spectrum->setMaxGammaEnergy(_maxGammaEnergy);
74 _spectrum->generateKsingle();
78 _spectrum->generateKdouble();
86 upcEvent starlightDpmJet::produceEvent()
93 //int zdirection = (Randy.Rndom()) < 0.5 ? -1 : 1;
95 float gammaE = _spectrum->drawKsingle();
96 event = produceSingleEvent(zdirection, gammaE);
97 // std::cout << "Gamma energy: " << gammaE << std::endl;
101 event = produceDoubleEvent();
107 upcEvent starlightDpmJet::produceSingleEvent(int zdirection, float gammaE)
111 event.addGamma(gammaE);
115 dt_produceevent_(&gammaE, &nParticles);
118 //In which direction do we go?
119 double rapidity = _bbs.beam1().rapidity()*zdirection;
121 for (int i = 0; i < nParticles; i++)
123 starlightParticle particle(dpmjetparticle_.slpx[i], dpmjetparticle_.slpy[i], zdirection*dpmjetparticle_.slpz[i], dpmjetparticle_.sle[i], dpmjetparticle_.slm[i], dpmjetparticle_.slpid[i], dpmjetparticle_.slcharge[i]);
124 vector3 boostVector(0, 0, tanh(-rapidity));
125 particle.Boost(boostVector);
126 event.addParticle(particle);
131 upcEvent starlightDpmJet::produceDoubleEvent()
138 _spectrum->drawKdouble(gammaE1, gammaE2);
140 // std::cout << "Gamma1 energy: " << gammaE1 << std::endl;
141 //std::cout << "Gamma2 energy: " << gammaE2 << std::endl;
143 //In which direction do we go?
144 int zdirection = (randyInstance.Rndom()) < 0.5 ? -1 : 1;
146 event = produceSingleEvent(zdirection, gammaE1);
148 zdirection = zdirection *-1;
150 event = event + produceSingleEvent(zdirection, gammaE2);