Skip to content

Commit

Permalink
Merge pull request cms-sw#5287 from inugent/SpinUPforTauola_7_2_X_V2
Browse files Browse the repository at this point in the history
GeneratorInterface -- Spin u pfor tauola 7 2 x v2
Resolved Conflicts:
	GeneratorInterface/Core/interface/HadronizerFilter.h
	GeneratorInterface/ExternalDecays/src/ExternalDecayDriver.cc
  • Loading branch information
nclopezo authored and bendavid committed Jan 25, 2015
1 parent 8bbb812 commit 27da60d
Show file tree
Hide file tree
Showing 15 changed files with 1,328 additions and 352 deletions.
2 changes: 1 addition & 1 deletion GeneratorInterface/Core/interface/HadronizerFilter.h
Expand Up @@ -217,7 +217,7 @@ namespace edm
//
if ( decayer_ )
{
event.reset( decayer_->decay( event.get() ) );
event.reset( decayer_->decay( event.get(),lheEvent ) );
}

if ( !event.get() ) continue;
Expand Down
1 change: 1 addition & 0 deletions GeneratorInterface/ExternalDecays/BuildFile.xml
Expand Up @@ -8,6 +8,7 @@
<use name="clhep"/>
<use name="hepmc"/>
<use name="GeneratorInterface/Core"/>
<use name="GeneratorInterface/LHEInterface"/>
<use name="GeneratorInterface/EvtGenInterface"/>
<use name="GeneratorInterface/PhotosInterface"/>
<use name="GeneratorInterface/TauolaInterface"/>
Expand Down
Expand Up @@ -16,6 +16,10 @@ namespace CLHEP {
class HepRandomEngine;
}

namespace lhef {
class LHEEvent;
}

namespace gen {

class EvtGenInterfaceBase;
Expand All @@ -35,15 +39,15 @@ namespace gen {
const std::vector<int>& operatesOnParticles() { return fPDGs; }
const std::vector<std::string>& specialSettings() { return fSpecialSettings; }

HepMC::GenEvent* decay( HepMC::GenEvent* );

HepMC::GenEvent* decay( HepMC::GenEvent* evt);
HepMC::GenEvent* decay( HepMC::GenEvent* evt, lhef::LHEEvent *lheEvent);

void statistics() const;

void setRandomEngine(CLHEP::HepRandomEngine*);
std::vector<std::string> const& sharedResources() const { return exSharedResources; }

private:

bool fIsInitialized;
TauolaInterfaceBase* fTauolaInterface;
EvtGenInterfaceBase* fEvtGenInterface;
Expand Down
4 changes: 4 additions & 0 deletions GeneratorInterface/ExternalDecays/src/ExternalDecayDriver.cc
Expand Up @@ -78,6 +78,10 @@ ExternalDecayDriver::~ExternalDecayDriver()
}


HepMC::GenEvent* ExternalDecayDriver::decay(HepMC::GenEvent* evt, lhef::LHEEvent *lheEvent){
if(fTauolaInterface) fTauolaInterface->SetLHE(lheEvent);
return decay(evt);
}
HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt )
{
if ( !fIsInitialized ) return evt;
Expand Down
1 change: 1 addition & 0 deletions GeneratorInterface/TauolaInterface/BuildFile.xml
@@ -1,6 +1,7 @@
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="GeneratorInterface/LHEInterface"/>
<use name="hepmc"/>
<use name="clhep"/>
<use name="heppdt"/>
Expand Down
14 changes: 11 additions & 3 deletions GeneratorInterface/TauolaInterface/interface/TauolaInterfaceBase.h
Expand Up @@ -7,11 +7,19 @@
#include <vector>
#include "CLHEP/Random/RandomEngine.h"

// LHE Run
#include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h"
#include "GeneratorInterface/LHEInterface/interface/LHERunInfo.h"

// LHE Event
#include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h"
#include "GeneratorInterface/LHEInterface/interface/LHEEvent.h"

namespace gen {
class TauolaInterfaceBase {
public:
TauolaInterfaceBase(){};
TauolaInterfaceBase( const edm::ParameterSet&){};
TauolaInterfaceBase( const edm::ParameterSet&){};
virtual ~TauolaInterfaceBase(){};

virtual void SetDecayRandomEngine(CLHEP::HepRandomEngine* decayRandomEngine){};
Expand All @@ -22,10 +30,10 @@ namespace gen {
virtual HepMC::GenEvent* decay( HepMC::GenEvent* evt){return evt;}
virtual void statistics(){};
virtual void setRandomEngine(CLHEP::HepRandomEngine* v)=0;

virtual void SetLHE(lhef::LHEEvent *l){};
protected:
std::vector<int> fPDGs;

};
}

Expand Down
104 changes: 68 additions & 36 deletions GeneratorInterface/TauolaInterface/interface/TauolappInterface.h
@@ -1,55 +1,87 @@
#ifndef gen_TauolaInterface_TauolappInterface_h
#define gen_TauolaInterface_TauolappInterface_h

#include "HepPDT/ParticleDataTable.hh"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "GeneratorInterface/TauolaInterface/interface/TauolaInterfaceBase.h"
namespace HepMC
#include "TLorentzVector.h"
#include "TVector.h"


namespace HepMC
{
class GenEvent;
class GenEvent;
}

namespace CLHEP
{
class HepRandomEngine;
class HepRandomEngine;
}

namespace gen {
extern "C" {
void ranmar_( float *rvec, int *lenv );
void rmarin_( int*, int*, int* );
}
class TauolappInterface : public TauolaInterfaceBase {
public:
// ctor & dtor
TauolappInterface( const edm::ParameterSet& );
~TauolappInterface();
void enablePolarization() { fPolarization = true; return; }
void disablePolarization() { fPolarization = false; return; }
void init( const edm::EventSetup& );
const std::vector<int>& operatesOnParticles() { return fPDGs; }
HepMC::GenEvent* decay( HepMC::GenEvent* );
void statistics() ;
void setRandomEngine(CLHEP::HepRandomEngine* v) { fRandomEngine = v; }
static double flat();
private:
// member function(s)
void decodeMDTAU( int );
void selectDecayByMDTAU();
int selectLeptonic();
int selectHadronic();
//
static CLHEP::HepRandomEngine* fRandomEngine;
std::vector<int> fPDGs;
bool fPolarization;
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable ;
edm::ParameterSet* fPSet;
bool fIsInitialized;
int fMDTAU;
bool fSelectDecayByEvent;
std::vector<int> fLeptonModes;
std::vector<int> fHadronModes;
std::vector<double> fScaledLeptonBrRatios;
std::vector<double> fScaledHadronBrRatios;
};

class TauolappInterface : public TauolaInterfaceBase {
public:

// ctor & dtor
TauolappInterface( const edm::ParameterSet& );
~TauolappInterface();

void enablePolarization() { fPolarization = true; return; }
void disablePolarization() { fPolarization = false; return; }
void init( const edm::EventSetup& );
const std::vector<int>& operatesOnParticles() { return fPDGs; }
HepMC::GenEvent* decay( HepMC::GenEvent* );
void statistics() ;
virtual void SetLHE(lhef::LHEEvent *l){lhe=l;}
void setRandomEngine(CLHEP::HepRandomEngine* v) { fRandomEngine = v; }
static double flat();

private:
// member function(s)
void decodeMDTAU( int );
void selectDecayByMDTAU();
int selectLeptonic();
int selectHadronic();

HepMC::GenEvent* make_simple_tau_event(const TLorentzVector &l,int pdgid,int status);
void update_particles(HepMC::GenParticle* partHep,HepMC::GenEvent* theEvent,HepMC::GenParticle* p,TVector3 &boost);
bool isLastTauInChain(const HepMC::GenParticle* tau);
HepMC::GenParticle* GetMother(HepMC::GenParticle* tau);
double MatchedLHESpinUp(HepMC::GenParticle* tau, std::vector<HepMC::GenParticle> &p, std::vector<double> &spinup,std::vector<int> &m_idx);
HepMC::GenParticle* FirstTauInChain(HepMC::GenParticle* tau);
void BoostProdToLabLifeTimeInDecays(HepMC::GenParticle* p,TLorentzVector &lab, TLorentzVector &prod);

//
static CLHEP::HepRandomEngine* fRandomEngine;
std::vector<int> fPDGs;
bool fPolarization;
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable ;
edm::ParameterSet* fPSet;
bool fIsInitialized;

int fMDTAU;
bool fSelectDecayByEvent;
std::vector<int> fLeptonModes;
std::vector<int> fHadronModes;
std::vector<double> fScaledLeptonBrRatios;
std::vector<double> fScaledHadronBrRatios;
lhef::LHEEvent *lhe;

double dmMatch;
bool dolhe;
bool dolheBosonCorr;
int ntries;
double lifetime;
};

}

#endif
2 changes: 2 additions & 0 deletions GeneratorInterface/TauolaInterface/plugins/BuildFile.xml
Expand Up @@ -8,6 +8,8 @@
<use name="heppdt"/>
<use name="clhep"/>
<use name="hepmc"/>
<use name="root"/>
<use name="rootmath"/>
<use name="tauolapp"/>
<flags EDM_PLUGIN="1"/>
</library>
Expand Down

0 comments on commit 27da60d

Please sign in to comment.