Skip to content
Snippets Groups Projects
Commit 6f622aeb authored by Tamara Vazquez Schroeder's avatar Tamara Vazquez Schroeder
Browse files

Merge branch '21.0-gene-tau' into '21.0'

update Tauolapp to version 1.1.6

See merge request !4599

Former-commit-id: 88595cb89506c252c32b139e305bebf2bc6b2181
parents feff5de1 6265a415
No related branches found
No related tags found
No related merge requests found
/*
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);
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// --------------------------------------------------
//
// File: Generators/Starlight_i.h
......
......@@ -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 )
......
/*
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
/*
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;
}
#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 )
}
......@@ -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} )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment