Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding Interface for photos++ 3.55 to 7_2_X #4533

Merged
merged 2 commits into from Jul 9, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 28 additions & 39 deletions GeneratorInterface/ExternalDecays/src/ExternalDecayDriver.cc
Expand Up @@ -52,6 +52,12 @@ ExternalDecayDriver::ExternalDecayDriver( const ParameterSet& pset )
exSharedResources.emplace_back(edm::SharedResourceNames::kPhotos);
}
}
else if (curSet == "Photospp355" ){
if ( !fPhotosInterface ){
fPhotosInterface = (PhotosInterfaceBase*)(PhotosFactory::get()->create("Photospp355", pset.getUntrackedParameter< ParameterSet>(curSet)));
exSharedResources.emplace_back(edm::SharedResourceNames::kPhotos);
}
}
}
}

Expand All @@ -67,20 +73,17 @@ HepMC::GenEvent* ExternalDecayDriver::decay( HepMC::GenEvent* evt )

if ( !fIsInitialized ) return evt;

if ( fEvtGenInterface )
{
evt = fEvtGenInterface->decay( evt );
if ( !evt ) return 0;
if ( fEvtGenInterface ){
evt = fEvtGenInterface->decay( evt );
if ( !evt ) return 0;
}

if ( fTauolaInterface )
{
if ( fTauolaInterface ){
evt = fTauolaInterface->decay( evt );
if ( !evt ) return 0;
}

if ( fPhotosInterface )
{
if ( fPhotosInterface ){
evt = fPhotosInterface->apply( evt );
if ( !evt ) return 0;
}
Expand All @@ -93,45 +96,30 @@ void ExternalDecayDriver::init( const edm::EventSetup& es )

if ( fIsInitialized ) return;

if ( fTauolaInterface )
{
if ( fTauolaInterface ){
fTauolaInterface->init( es );
for ( std::vector<int>::const_iterator i=fTauolaInterface->operatesOnParticles().begin();
i!=fTauolaInterface->operatesOnParticles().end(); i++ )
fPDGs.push_back( *i );
}

if ( fEvtGenInterface )
{
fEvtGenInterface->init();
for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
fPDGs.push_back( *i );
if ( fEvtGenInterface ){
fEvtGenInterface->init();
for ( std::vector<int>::const_iterator i=fEvtGenInterface->operatesOnParticles().begin();
i!=fEvtGenInterface->operatesOnParticles().end(); i++ )
fPDGs.push_back( *i );
}


if ( fPhotosInterface )
{
fPhotosInterface->init();
// for tauola++
if ( fPhotosInterface )
{
for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ )
{
fSpecialSettings.push_back( fPhotosInterface->specialSettings()[iss] );
}
}
}

// this is specific to old tauola27 only, because it calls up photos automatically
//
//
// if ( fTauolaInterface )
// {
// // override !
// fSpecialSettings.clear();
// fSpecialSettings.push_back( "QED-brem-off:15" );
// }
if ( fPhotosInterface ){
fPhotosInterface->init();
// for tauola++
if ( fPhotosInterface ){
for ( unsigned int iss=0; iss<fPhotosInterface->specialSettings().size(); iss++ ){
fSpecialSettings.push_back( fPhotosInterface->specialSettings()[iss] );
}
}
}

fIsInitialized = true;

Expand All @@ -141,7 +129,8 @@ void ExternalDecayDriver::init( const edm::EventSetup& es )
void ExternalDecayDriver::statistics() const
{
if ( fTauolaInterface ) fTauolaInterface->statistics();
// similar for EvtGen and/or Photos, if needs be
if ( fPhotosInterface ) fPhotosInterface->statistics();
// similar for EvtGen if needed
return;
}

Expand Down
Expand Up @@ -36,13 +36,14 @@ namespace gen {
static double flat();

private:
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not comment code, simply remove it.

struct Scaling {
HepMC::ThreeVector weights;
int flag;
Scaling( const HepMC::ThreeVector& vec, int flg )
: weights(HepMC::ThreeVector(1.,1.,1)), flag(1) { weights=vec; flag=flg; }
};

*/
int fOnlyPDG;
bool fAvoidTauLeptonicDecays;
std::vector<int> fBarcodes;
Expand Down
Expand Up @@ -24,6 +24,7 @@ namespace gen {
virtual void avoidTauLeptonicDecays()=0;;
virtual void configureOnlyFor( int )=0;
virtual void setRandomEngine(CLHEP::HepRandomEngine* decayRandomEngine)=0;
virtual void statistics(){};

protected:
std::vector<std::string> fSpecialSettings;
Expand Down
48 changes: 48 additions & 0 deletions GeneratorInterface/PhotosInterface/interface/PhotosppInterface.h
@@ -0,0 +1,48 @@
#ifndef gen_PhotosInterface_PhotosppInterface_h
#define gen_PhotosInterface_PhotosppInterface_h

// #include "HepPDT/ParticleDataTable.hh"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "HepMC/SimpleVector.h"
#include "GeneratorInterface/PhotosInterface/interface/PhotosInterfaceBase.h"


namespace HepMC
{
class GenEvent;
class GenVertex;
}

namespace gen {
class PhotosppInterface : public PhotosInterfaceBase {
public:

// ctor & dtor
PhotosppInterface( const edm::ParameterSet& pset);
~PhotosppInterface() {}

void init();
const std::vector<std::string>& specialSettings() { return fSpecialSettings; }
HepMC::GenEvent* apply( HepMC::GenEvent* );
void configureOnlyFor( int );
void avoidTauLeptonicDecays() { fAvoidTauLeptonicDecays=true; return; }
bool isTauLeptonicDecay( HepMC::GenVertex* );
void setRandomEngine(CLHEP::HepRandomEngine* decayRandomEngine);
static double flat();
void statistics();

private:
int fOnlyPDG;
bool fAvoidTauLeptonicDecays;
bool fIsInitialized;
edm::ParameterSet* fPSet;

static CLHEP::HepRandomEngine* fRandomEngine;
};
}

#endif
13 changes: 13 additions & 0 deletions GeneratorInterface/PhotosInterface/plugins/BuildFile.xml
Expand Up @@ -9,3 +9,16 @@
<use name="clhep"/>
<flags EDM_PLUGIN="1"/>
</library>


<library file="PhotosppInterface.cc" name="PhotosppInterface">
<use name="FWCore/Framework"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/PluginManager"/>
<use name="GeneratorInterface/PhotosInterface"/>
<use name="photospp"/>
<use name="hepmc"/>
<use name="clhep"/>
<flags EDM_PLUGIN="1"/>
</library>
@@ -1,5 +1,5 @@
#include <iostream>
#include "PhotosInterface.h"
#include "GeneratorInterface/PhotosInterface/interface/PhotosInterface.h"
#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "GeneratorInterface/PhotosInterface/interface/PhotosFactory.h"
Expand Down