diff --git a/Generators/QGSJet_i/src/QGSJet.cxx b/Generators/QGSJet_i/src/QGSJet.cxx index 6235bc897ea0b363cd54266851ec69e40d48bb2c..145d487311ea71466bcfb5a2c39dd3e1dfe42935 100644 --- a/Generators/QGSJet_i/src/QGSJet.cxx +++ b/Generators/QGSJet_i/src/QGSJet.cxx @@ -1,7 +1,6 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ - // ---------------------------------------------------------------------- // Generators/QGSJet.cxx // @@ -206,11 +205,15 @@ StatusCode QGSJet::genInitialize() long int si1 = sip[0]; long int si2 = sip[1]; - int iSeed = si1; // FIXME ? + // eA + + std::cout << "eA seed: " << si1 << " " << si2 << std::endl; + + int iSeed = si1%1000000000; // FIXME ? // set up initial values - // std::cout << "parameters " << m_nEvents << " " << iSeed << " " << m_beamMomentum << " " << m_targetMomentum << " " << m_primaryParticle << " " << m_targetParticle << " " << m_model << " " << m_itab << " " << m_ilheout << " " << m_lheout.c_str()<< " " << m_paramFile.c_str() << std::endl; + std::cout << "parameters " << m_nEvents << " " << iSeed << " " << m_beamMomentum << " " << m_targetMomentum << " " << m_primaryParticle << " " << m_targetParticle << " " << m_model << " " << m_itab << " " << m_ilheout << " " << m_lheout.c_str()<< " " << m_paramFile.c_str() << std::endl; crmc_set_f_(m_nEvents, iSeed, m_beamMomentum, m_targetMomentum, m_primaryParticle, m_targetParticle, m_model, m_itab, m_ilheout, m_paramFile.c_str() ); @@ -243,6 +246,8 @@ StatusCode QGSJet::callGenerator() // save the random number seeds in the event CLHEP::HepRandomEngine* engine = p_AtRndmGenSvcQGSJet->GetEngine( qgsjet_rndm_stream ); const long *s = engine->getSeeds(); + + std:: cout << "eA seed s : " << s[0] << " " << s[1] << std::endl; m_seeds.clear(); m_seeds.push_back(s[0]); @@ -327,7 +332,6 @@ StatusCode QGSJet::fillEvt( HepMC::GenEvent* evt ) hepio.fill_next_event(evt); // evt->print(); - evt->set_random_states( m_seeds ); evt->weights().push_back(1.0); diff --git a/Generators/Starlight_i/Starlight_i/Starlight_i.h b/Generators/Starlight_i/Starlight_i/Starlight_i.h index 5182ba531332b1c6aa1bdcc82d3d4174d3c910a7..082f565eaf5b70246868d21a93f0098b124424ca 100644 --- a/Generators/Starlight_i/Starlight_i/Starlight_i.h +++ b/Generators/Starlight_i/Starlight_i/Starlight_i.h @@ -1,7 +1,6 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ - // -------------------------------------------------- // // File: Generators/Starlight_i.h diff --git a/Generators/Tauolapp_i/CMakeLists.txt b/Generators/Tauolapp_i/CMakeLists.txt index 1652ce9c2afe716c4a5456874e1eba2c0f854223..b0d43aed2d20ca296241a44a12f0c6040f22533d 100644 --- a/Generators/Tauolapp_i/CMakeLists.txt +++ b/Generators/Tauolapp_i/CMakeLists.txt @@ -8,12 +8,19 @@ atlas_subdir( Tauolapp_i ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps + Control/AthenaKernel Database/AthenaPOOL/AthenaPoolUtilities Event/EventInfo GaudiKernel Generators/GeneratorObjects ) +# Set the version of Tauolapp to use: +#set( TAUOLAPP_VERSION 1.1.6 ) +#set( TAUOLAPP_ROOT +# ${LCG_RELEASE_DIR}/MCGenerators/tauola++/${TAUOLAPP_VERSION}/${ATLAS_PLATFORM} ) + # External dependencies: +find_package( CLHEP ) find_package( HepMC ) find_package( Tauolapp ) @@ -21,8 +28,8 @@ find_package( Tauolapp ) atlas_add_component( Tauolapp_i src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${TAUOLAPP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${TAUOLAPP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaPoolUtilities EventInfo GaudiKernel GeneratorObjects ) + INCLUDE_DIRS ${TAUOLAPP_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} + LINK_LIBRARIES ${TAUOLAPP_LIBRARIES} ${HEPMC_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaPoolUtilities EventInfo GaudiKernel GeneratorObjects ) # Install files from the package: atlas_install_headers( Tauolapp_i ) diff --git a/Generators/Tauolapp_i/Tauolapp_i/TauolaPP.h b/Generators/Tauolapp_i/Tauolapp_i/TauolaPP.h new file mode 100644 index 0000000000000000000000000000000000000000..1199313d471ff01bbacbbba66a6a649cb6115072 --- /dev/null +++ b/Generators/Tauolapp_i/Tauolapp_i/TauolaPP.h @@ -0,0 +1,77 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TAUOLAPP_H +#define TAUOLAPP_H + +#include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" + + +#include "HepMC/GenEvent.h" +#include "HepMC/GenVertex.h" + +#include "GaudiKernel/IPartPropSvc.h" + +#include "AthenaPoolUtilities/AthenaAttributeList.h" +#include "EventInfo/EventInfo.h" +#include "EventInfo/EventID.h" +#include "GeneratorObjects/McEventCollection.h" + +class StoreGateSvc; + +class IAtRndmGenSvc; + + +/// @brief This Algorithm provides an easy interface to Tauola C++ interface +/// @author Nadia Davidson, Marcin Wolter +/// @todo Convert to use standard GenModule base class +class TauolaPP : public AthAlgorithm { +public: + + /// Constructor + TauolaPP (const std::string& name, ISvcLocator* pSvcLocator); + + /// Initialization of Tauola++ and setting of JO configurables + StatusCode initialize(); + + /// Pass each event in the McEventCollection to Tauola to (re)decay the taus + StatusCode execute(); + + +private: + + /// Event record container key + std::string m_key; + + /// @name Variables used to configure Tauola + //@{ + + /// PDG ID of particle to study + int m_decay_particle; + + /// TAUOLA decay mode of particles with same charge as "decay_particle" + int m_decay_mode_same; + + /// TAUOLA decay mode of particles with opposite charge as "decay_particle" + int m_decay_mode_opp; + + /// tau mass to be taken by TAUOLA + double m_tau_mass; + + // TAUOLA switch for spin effects + bool m_spin_correlation; + + // TAUOLA switch for radiative corrections for leptonic tau decays + bool m_setRadiation; + + // TAUOLA cut-off for radiative corrections + double m_setRadiationCutOff; + + static IAtRndmGenSvc* &atRndmGenSvc(); + static std::string &tauolapp_stream(); + +}; + +#endif diff --git a/Generators/Tauolapp_i/src/TauolaPP.cxx b/Generators/Tauolapp_i/src/TauolaPP.cxx new file mode 100644 index 0000000000000000000000000000000000000000..611b3513d1ee11a343cd7f6a656af97d651c14ac --- /dev/null +++ b/Generators/Tauolapp_i/src/TauolaPP.cxx @@ -0,0 +1,173 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ +#include "Tauolapp_i/TauolaPP.h" + +// Tauola header files +#include "Tauola/Log.h" +#include "Tauola/Tauola.h" +#include "Tauola/TauolaHepMCEvent.h" + +#include "Tauola/f_Variables.h" + +// for proper seeding +#include "CLHEP/Random/RandFlat.h" +#include "AthenaKernel/IAtRndmGenSvc.h" +//for Ranlux +#include "CLHEP/Random/Randomize.h" + +using namespace Tauolapp; +using namespace CLHEP; + +RanluxEngine theRanluxEngine(123456,1); + +double RanluxGenerator() +{ +// std::cout<<" called Ranlux "<<std::endl; + return RandFlat::shoot(&theRanluxEngine); +} + + +//Random number service +IAtRndmGenSvc* &TauolaPP::atRndmGenSvc() +{ + static IAtRndmGenSvc *p_AtRndmGenSvc = 0; + return p_AtRndmGenSvc; +} + +std::string &TauolaPP::tauolapp_stream() +{ + + static std::string s_tauolapp_stream = "TAUOLAPP_INIT"; + return s_tauolapp_stream; +} + + +// Constructor +TauolaPP::TauolaPP(const std::string& name, ISvcLocator* pSvcLocator) + : AthAlgorithm(name, pSvcLocator) +{ + //Key to HepMC record + declareProperty("McEventKey", m_key="GEN_EVENT"); + + //TAUOLA configurables + //TAUOLA decay mode of particles with same/opposite charge as "decay_particle" + declareProperty("decay_mode_same", m_decay_mode_same=1); + declareProperty("decay_mode_opposite", m_decay_mode_opp=2); + declareProperty("decay_particle",m_decay_particle=15); + declareProperty("tau_mass",m_tau_mass=1.77684); + declareProperty("spin_correlation",m_spin_correlation=true); + declareProperty("setRadiation",m_setRadiation=true); + declareProperty("setRadiationCutOff",m_setRadiationCutOff=0.01); +} + + +StatusCode TauolaPP::initialize(){ + + // Get the Storegate collection + /// @todo Can't thi be removed? + evtStore().setName( "StoreGateSvc"); + StatusCode sc = evtStore().retrieve(); + if ( !sc.isSuccess() ) { + ATH_MSG_ERROR ("Could not locate StoreGateSvc"); + return sc; + } + + + + // Random number service + StatusCode RndmStatus = service("AtRndmGenSvc", atRndmGenSvc(), true); + + if(!RndmStatus.isSuccess() || atRndmGenSvc() == 0) + { + ATH_MSG_ERROR("Could not get Random number service!"); + return StatusCode::FAILURE; + } + + + HepRandomEngine* engine = atRndmGenSvc()->GetEngine(tauolapp_stream()); + const long* sip = engine->getSeeds(); + long int si1 = sip[0]; + long int si2 = sip[1]; + + + atRndmGenSvc()->CreateStream(si1, si2, tauolapp_stream()); + tauolapp_stream() = "TAUOLAPP"; + + + + // Setup and intialise Tauola Interface + Tauola::setSameParticleDecayMode(m_decay_mode_same); + Tauola::setOppositeParticleDecayMode(m_decay_mode_opp); + // etc.... see Tauola.h for the full list of configurables + // Note: some need to be set before (or after) calling Tauola::initialize(); + + // Tauola::setHiggsScalarPseudoscalarMixingAngle(atof(argv[5])); + // Tauola::setHiggsScalarPseudoscalarPDG(25); + + Tauola::initialize(); + + Tauola::setEtaK0sPi(1,0,1); // switches to decay eta K0_S and pi0 1/0 on/off. + Tauola::spin_correlation.setAll(m_spin_correlation); + Tauola::setRadiation(m_setRadiation); + Tauola::setRadiationCutOff(m_setRadiationCutOff); + + //call RanLux generator for ++ part of Tauola + Tauola::setRandomGenerator(RanluxGenerator); + + //seeding tauola-fortran generator + Tauola::setSeed((int) si1,0,0); + + //seeding tauola++ generator + theRanluxEngine.setSeed(si2,1); + + //setting tau mass + parmas_.amtau=m_tau_mass; + + //cout<<"tauola tau mass "<<Tauola::getTauMass()<<endl; + + return StatusCode::SUCCESS; +} + + +StatusCode TauolaPP::execute() { + + // Load HepMC info + const McEventCollection* mcCollptr_const; + if ( evtStore()->retrieve(mcCollptr_const, m_key).isFailure() ) { + ATH_MSG_ERROR ("Could not retrieve McEventCollection"); + return StatusCode::FAILURE; + } + + HepRandomEngine* engine = atRndmGenSvc()->GetEngine(tauolapp_stream()); + const long* sip = engine->getSeeds(); + long int si1 = sip[0]; + long int si2 = sip[1]; + + + //seeding tauola-fortran generator + Tauola::setSeed((int) si1,0,0); + + //seeding tauola++ generator + theRanluxEngine.setSeed(si2,1); + + + // Const_cast to make an event possible to update + McEventCollection* mcCollptr = const_cast<McEventCollection*>(mcCollptr_const); + + // Loop over all events in McEventCollection + McEventCollection::iterator itr; + for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) { + + // Convert event record to format readable by tauola interface + TauolaHepMCEvent * t_event = new TauolaHepMCEvent(*itr); + + // t_event->getEvent()->print(); + + // remove tau decays first + t_event->undecayTaus(); + // decay taus + t_event->decayTaus(); + } + return StatusCode::SUCCESS; +} diff --git a/Generators/Tauolapp_i/src/components/Tauolapp_i_entries.cxx b/Generators/Tauolapp_i/src/components/Tauolapp_i_entries.cxx index 2b5e4d162913ad46e6c96605283b15b430abd0ef..88647906b9e27b2dfe6cc425f71a5e87c38f12f4 100644 --- a/Generators/Tauolapp_i/src/components/Tauolapp_i_entries.cxx +++ b/Generators/Tauolapp_i/src/components/Tauolapp_i_entries.cxx @@ -1,7 +1,7 @@ -#include "Tauolapp_i/TauolaAlg.h" +#include "Tauolapp_i/TauolaPP.h" #include "GaudiKernel/DeclareFactoryEntries.h" -DECLARE_ALGORITHM_FACTORY( TauolaAlg ) +DECLARE_ALGORITHM_FACTORY( TauolaPP ) DECLARE_FACTORY_ENTRIES( Tauolapp_i ) { - DECLARE_ALGORITHM( TauolaAlg ) + DECLARE_ALGORITHM( TauolaPP ) } diff --git a/Projects/Athena/externals/Tauolapp.cmake b/Projects/Athena/externals/Tauolapp.cmake index 96321e2ac314be9288685c43ec0946ede4c21bf7..f7ccd72db65ffb778a2c5ab1e8428f13711cb1f4 100644 --- a/Projects/Athena/externals/Tauolapp.cmake +++ b/Projects/Athena/externals/Tauolapp.cmake @@ -2,6 +2,6 @@ # File specifying the location of Tauola++ to use. # -set( TAUOLAPP_VERSION 1.1.1a ) +set( TAUOLAPP_VERSION 1.1.6 ) set( TAUOLAPP_ROOT ${LCG_RELEASE_DIR}/MCGenerators/tauola++/${TAUOLAPP_VERSION}/${LCG_PLATFORM} )