Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:48:33

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