Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-12 01:59:51

0001 #ifndef Hydjet2Hadronizer_h
0002 #define Hydjet2Hadronizer_h
0003 
0004 /**
0005  *    \class HydjetHadronizer
0006  *    \brief Interface to the HYDJET++ (Hydjet2) generator (since core v. 2.4.2), produces HepMC events
0007  *    \version 1.1
0008  *    \author Andrey Belyaev
0009  */
0010 
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "GeneratorInterface/Core/interface/BaseHadronizer.h"
0013 
0014 #include "FWCore/Framework/interface/ConsumesCollector.h"
0015 #include "FWCore/Framework/interface/EDProducer.h"
0016 #include "FWCore/Utilities/interface/EDGetToken.h"
0017 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
0018 #include "SimDataFormats/PileupSummaryInfo/interface/PileupMixingContent.h"
0019 
0020 #include <cmath>
0021 #include <iostream>
0022 #include <map>
0023 #include <string>
0024 #include <vector>
0025 
0026 #include <Hydjet2.h>
0027 #include <InitialParams.h>
0028 
0029 namespace CLHEP {
0030   class HepRandomEngine;
0031   class RandFlat;
0032   class RandPoisson;
0033   class RandGauss;
0034 }  // namespace CLHEP
0035 
0036 namespace HepMC {
0037   class GenEvent;
0038   class GenParticle;
0039   class GenVertex;
0040   class FourVector;
0041 }  // namespace HepMC
0042 
0043 namespace gen {
0044   class Pythia6Service;
0045   class Hydjet2Hadronizer : public BaseHadronizer {
0046   public:
0047     Hydjet2Hadronizer(const edm::ParameterSet &, edm::ConsumesCollector &&);
0048     ~Hydjet2Hadronizer() override;
0049 
0050     bool readSettings(int);
0051     bool declareSpecialSettings(const std::vector<std::string> &) { return true; }
0052     bool initializeForInternalPartons();
0053     bool initializeForExternalPartons();  //0
0054     bool generatePartonsAndHadronize();
0055     bool declareStableParticles(const std::vector<int> &);
0056 
0057     bool hadronize();  //0
0058     bool decay();      //0
0059     bool residualDecay();
0060     void finalizeEvent();
0061     void statistics();
0062     const char *classname() const;
0063 
0064   private:
0065     void doSetRandomEngine(CLHEP::HepRandomEngine *v) override;
0066     void rotateEvtPlane();
0067     bool get_particles(HepMC::GenEvent *evt);
0068     HepMC::GenParticle *build_hyjet2(int index, int barcode);
0069     HepMC::GenVertex *build_hyjet2_vertex(int i, int id);
0070     void add_heavy_ion_rec(HepMC::GenEvent *evt);
0071 
0072     std::vector<std::string> const &doSharedResources() const override { return theSharedResources; }
0073     static const std::vector<std::string> theSharedResources;
0074 
0075     inline double nuclear_radius() const;
0076 
0077     int convertStatusForComponents(int, int, int);
0078     int convertStatus(int);
0079 
0080     InitialParamsHydjet_t fParams;
0081     Hydjet2 *hj2;
0082 
0083     bool ev = false;
0084     bool separateHydjetComponents_;
0085     bool rotate_;  // Switch to rotate event plane
0086     HepMC::GenEvent *evt;
0087     int nsub_;     // number of sub-events
0088     int nhard_;    // multiplicity of PYTHIA(+PYQUEN)-induced particles in event
0089     int nsoft_;    // multiplicity of HYDRO-induced particles in event
0090     double phi0_;  // Event plane angle
0091     double sinphi0_;
0092     double cosphi0_;
0093 
0094     unsigned int pythiaPylistVerbosity_;  // pythia verbosity; def=1
0095     unsigned int maxEventsToPrint_;       // Events to print if verbosity
0096 
0097     edm::ParameterSet pset;
0098     double Sigin, Sigjet;
0099 
0100     HepMC::FourVector *fVertex_;  // Event signal vertex
0101 
0102     std::vector<double> signalVtx_;  // Pset double vector to set event signal vertex
0103 
0104     Pythia6Service *pythia6Service_;
0105     edm::EDGetTokenT<CrossingFrame<edm::HepMCProduct>> src_;
0106   };
0107 
0108   double Hydjet2Hadronizer::nuclear_radius() const {
0109     // Return the nuclear radius derived from the
0110     // beam/target atomic mass number.
0111 
0112     return 1.15 * pow((double)fParams.fAw, 1. / 3.);
0113   }
0114 }  // namespace gen
0115 #endif