25 #include "CLHEP/Random/RandGaussQ.h"
26 #include "CLHEP/Random/RandFlat.h"
27 #include "CLHEP/Units/GlobalSystemOfUnits.h"
28 #include "CLHEP/Units/GlobalPhysicalConstants.h"
30 #include "HepMC/GenEvent.h"
31 #include "HepMC/GenParticle.h"
32 #include "HepMC/HeavyIon.h"
33 #include "HepMC/SimpleVector.h"
41 using namespace CLHEP;
105 sourceLabel(p.getParameter<edm::
InputTag>(
"src")),
106 fixEP(p.getUntrackedParameter<bool>(
"fixEP",
true))
114 <<
"The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n"
115 "which is not present in the configuration file. You must add the service\n"
116 "in the configuration file or remove the modules that require it.";
119 CLHEP::HepRandomEngine& engine = rng->
getEngine();
135 fv2 =
new TF1(
"fv2", modv2.
label().c_str());
136 fv3 =
new TF1(
"fv3", modv3.
label().c_str());
137 fv4 =
new TF1(
"fv4", modv4.
label().c_str());
138 fv5 =
new TF1(
"fv5", modv5.
label().c_str());
139 fv6 =
new TF1(
"fv6", modv6.
label().c_str());
148 produces<double>(
"v1");
149 produces<double>(
"v2");
150 produces<double>(
"v3");
151 produces<double>(
"v4");
152 produces<double>(
"v5");
153 produces<double>(
"v6");
155 produces<double>(
"flucv1");
156 produces<double>(
"flucv2");
157 produces<double>(
"flucv3");
158 produces<double>(
"flucv4");
159 produces<double>(
"flucv5");
160 produces<double>(
"flucv6");
179 HepMC::GenEvent * genevt = (HepMC::GenEvent *)HepMCEvt->GetEvent();
180 HepMC::HeavyIon * hi = genevt->heavy_ion();
183 ep = hi->event_plane_angle();
210 for ( HepMC::GenEvent::particle_iterator
part = genevt->particles_begin();
211 part != genevt->particles_end(); ++
part ) {
212 double E = (*part)->momentum().e();
213 double px = (*part)->momentum().x();
214 double py = (*part)->momentum().y();
215 double pz = (*part)->momentum().z();
216 double pt =
sqrt(px*px+py*py);
218 do { v1 =
GetV1(pt); }
while ( v1 < 0);
219 do { v2 =
GetV2(pt); }
while ( v2 < 0);
220 do { v3 =
GetV3(pt); }
while ( v3 < 0);
221 do { v4 =
GetV4(pt); }
while ( v4 < 0);
222 do { v5 =
GetV5(pt); }
while ( v5 < 0);
223 do { v6 =
GetV6(pt); }
while ( v6 < 0);
244 double pmax = 1+2*fabs(v1)+2*fabs(v2)+2*fabs(v3)+2*fabs(v4)+2*fabs(v5)+2*fabs(v6);
248 ptest = 1+2*v1*
cos(phi) + 2*v2*
cos(2*phi) + 2*v3*
cos(3*phi) + 2*v4*
cos(4*phi) + 2*v5*
cos(5*phi) + 2*v6*
cos(6*phi);
249 }
while ( ptest < fFlat->fire(pmax) );
250 if (!
fixEP) phi += ep;
253 (*part)->set_momentum(HepMC::FourVector(px, py, pz, E));
256 HepMC::FourVector
p = (*part)->momentum();
260 if ( !
fixEP ) phi_RP = ep;
261 double phi0 = p.phi() - v2 *
sin( 2*(p.phi() - phi_RP) );
262 phi1 = phi0 - v2*
sin( 2*(phi0 - phi_RP) );
264 double f = phi0 - p.phi() + 2*v1*
sin( phi0 - phi_RP ) + v2 *
sin( 2*(phi0-phi_RP) ) + 2./3.*v3*
sin( 3*(phi0-phi_RP) ) + 0.5*v4*
sin( 4*(phi0-phi_RP) ) + 0.4*v5*
sin( 5*(phi0-phi_RP) ) + 1./3.*v6*
sin( 6*(phi0-phi_RP) );
265 double fp = 1 + 2*v1*
cos(phi0-phi_RP) + 2*v2*
cos( 2*(phi0-phi_RP) ) + 2*v3*
cos( 3*(phi0-phi_RP) ) + 2*v4*
cos( 4*(phi0-phi_RP) ) + 2*v5*
cos( 5*(phi0-phi_RP)) + 2*v5*
cos( 6*(phi0-phi_RP) ) + 2*v6*
cos( 6*(phi0-phi_RP) );
266 phi1 = phi0 - f / fp;
269 }
while ( fabs(dphi)>0.01 );
270 px = pt *
cos( phi1 );
271 py = pt *
sin( phi1 );
272 (*part)->set_momentum(HepMC::FourVector(px, py, pz, E));
277 auto_ptr<double> ptr_v1(
new double(meanv1/n)) ;
278 auto_ptr<double> ptr_v2(
new double(meanv2/n)) ;
279 auto_ptr<double> ptr_v3(
new double(meanv3/n)) ;
280 auto_ptr<double> ptr_v4(
new double(meanv4/n)) ;
281 auto_ptr<double> ptr_v5(
new double(meanv5/n)) ;
282 auto_ptr<double> ptr_v6(
new double(meanv6/n)) ;
283 evt.
put(ptr_v1,
"v1");
284 evt.
put(ptr_v2,
"v2");
285 evt.
put(ptr_v3,
"v3");
286 evt.
put(ptr_v4,
"v4");
287 evt.
put(ptr_v5,
"v5");
288 evt.
put(ptr_v6,
"v6");
289 auto_ptr<double> ptr_fv1(
new double(sigmav1/n)) ;
290 auto_ptr<double> ptr_fv2(
new double(sigmav2/n)) ;
291 auto_ptr<double> ptr_fv3(
new double(sigmav3/n)) ;
292 auto_ptr<double> ptr_fv4(
new double(sigmav4/n)) ;
293 auto_ptr<double> ptr_fv5(
new double(sigmav5/n)) ;
294 auto_ptr<double> ptr_fv6(
new double(sigmav6/n)) ;
295 evt.
put(ptr_fv1,
"flucv1");
296 evt.
put(ptr_fv2,
"flucv2");
297 evt.
put(ptr_fv3,
"flucv3");
298 evt.
put(ptr_fv4,
"flucv4");
299 evt.
put(ptr_fv5,
"flucv5");
300 evt.
put(ptr_fv6,
"flucv6");
nocap nocap const skelname & operator=(const skelname &)
CLHEP::RandGaussQ * fRandom
T getParameter(std::string const &) const
AfterBurnerGenerator(const edm::ParameterSet &p)
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Cos< T >::type cos(const T &t)
CLHEP::HepRandomEngine * fEngine
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual ~AfterBurnerGenerator()
virtual void produce(edm::Event &, const edm::EventSetup &)
return a new event vertex
edm::InputTag sourceLabel