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

Running code-format for generators #27263

Merged
merged 1 commit into from Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 10 additions & 11 deletions GeneratorInterface/GenFilters/interface/HTXSFilter.h
Expand Up @@ -4,7 +4,7 @@
//
// Package: HTXSFilter
// Class: HTXSFilter
//
//
/**\class HTXSFilter HTXSFilter.cc user/HTXSFilter/plugins/HTXSFilter.cc

Description: [one line class summary]
Expand All @@ -18,7 +18,6 @@
//
//


// system include files
#include <memory>

Expand All @@ -41,16 +40,16 @@ namespace edm {
}

class HTXSFilter : public edm::global::EDFilter<> {
public:
explicit HTXSFilter(const edm::ParameterSet&);
~HTXSFilter() override;
public:
explicit HTXSFilter(const edm::ParameterSet&);
~HTXSFilter() override;

bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;

private:
// ----------member data ---------------------------

bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
private:
// ----------member data ---------------------------

const edm::EDGetTokenT<HTXS::HiggsClassification> token_;
const std::vector<int> htxs_flags;
const edm::EDGetTokenT<HTXS::HiggsClassification> token_;
const std::vector<int> htxs_flags;
};
#endif
52 changes: 21 additions & 31 deletions GeneratorInterface/GenFilters/src/HTXSFilter.cc
Expand Up @@ -2,7 +2,7 @@
//
// Package: HTXSFilter
// Class: HTXSFilter
//
//
/**\class HTXSFilter HTXSFilter.cc user/HTXSFilter/plugins/HTXSFilter.cc

Description: [one line class summary]
Expand All @@ -16,7 +16,6 @@
//
//


// system include files
#include <memory>
#include "GeneratorInterface/GenFilters/interface/HTXSFilter.h"
Expand All @@ -32,43 +31,34 @@
#include "FWCore/Utilities/interface/StreamID.h"
#include "SimDataFormats/HTXS/interface/HiggsTemplateCrossSections.h"

HTXSFilter::HTXSFilter(const edm::ParameterSet& iConfig)
: token_(consumes<HTXS::HiggsClassification>(edm::InputTag("rivetProducerHTXS", "HiggsClassification"))),
htxs_flags(iConfig.getUntrackedParameter("htxs_flags", std::vector<int>())) {}

HTXSFilter::HTXSFilter(const edm::ParameterSet& iConfig) :
token_(consumes<HTXS::HiggsClassification>(edm::InputTag("rivetProducerHTXS", "HiggsClassification"))),
htxs_flags(iConfig.getUntrackedParameter("htxs_flags",std::vector <int> ()))
{

}


HTXSFilter::~HTXSFilter()
{

// do anything here that needs to be done at destruction time
// (e.g. close files, deallocate resources etc.)

HTXSFilter::~HTXSFilter() {
// do anything here that needs to be done at destruction time
// (e.g. close files, deallocate resources etc.)
}


//
// member functions
//

// ------------ method called on each new Event ------------
bool HTXSFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const
{
using namespace edm;
Handle<HTXS::HiggsClassification> cat;
iEvent.getByToken(token_, cat);
if(htxs_flags.empty()){
edm::LogInfo ("HTXSFilter") << "Selection of HTXS flags to filter is empty. Filtering will not be applied." << std::endl;
return true;
}
if(std::find(htxs_flags.begin(), htxs_flags.end(), cat->stage1_1_cat_pTjet30GeV) != htxs_flags.end()) {
return true;
} else {
return false;
}
bool HTXSFilter::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
using namespace edm;
Handle<HTXS::HiggsClassification> cat;
iEvent.getByToken(token_, cat);
if (htxs_flags.empty()) {
edm::LogInfo("HTXSFilter") << "Selection of HTXS flags to filter is empty. Filtering will not be applied."
<< std::endl;
return true;
}
if (std::find(htxs_flags.begin(), htxs_flags.end(), cat->stage1_1_cat_pTjet30GeV) != htxs_flags.end()) {
return true;
} else {
return false;
}
}

//define this as a plug-in
Expand Down
85 changes: 33 additions & 52 deletions GeneratorInterface/Herwig7Interface/interface/Herwig7Interface.h
Expand Up @@ -2,12 +2,9 @@
Marco A. Harrendorf
**/


#ifndef GeneratorInterface_Herwig7Interface_Herwig7Interface_h
#define GeneratorInterface_Herwig7Interface_Herwig7Interface_h



#include <memory>
#include <string>

Expand All @@ -28,76 +25,60 @@ Marco A. Harrendorf

namespace ThePEG {

template<> struct HepMCTraits<HepMC::GenEvent> :
public HepMCTraitsBase<
HepMC::GenEvent, HepMC::GenParticle,
HepMC::GenVertex, HepMC::Polarization,
HepMC::PdfInfo> {};
template <>
struct HepMCTraits<HepMC::GenEvent>
: public HepMCTraitsBase<HepMC::GenEvent, HepMC::GenParticle, HepMC::GenVertex, HepMC::Polarization, HepMC::PdfInfo> {
};

}
} // namespace ThePEG

namespace CLHEP {
class HepRandomEngine;
}

class Herwig7Interface {
public:
Herwig7Interface(const edm::ParameterSet &params);
~Herwig7Interface() noexcept;
public:
Herwig7Interface(const edm::ParameterSet &params);
~Herwig7Interface() noexcept;

void setPEGRandomEngine(CLHEP::HepRandomEngine*);
void setPEGRandomEngine(CLHEP::HepRandomEngine *);

ThePEG::EGPtr eg_;
ThePEG::EGPtr eg_;

protected:
void initRepository(const edm::ParameterSet &params);
bool initGenerator();
void flushRandomNumberGenerator();

static std::auto_ptr<HepMC::GenEvent> convert(const ThePEG::EventPtr &event);

protected:
void initRepository(const edm::ParameterSet &params);
bool initGenerator();
void flushRandomNumberGenerator();
static double pthat(const ThePEG::EventPtr &event);

static std::auto_ptr<HepMC::GenEvent>
convert(const ThePEG::EventPtr &event);
std::auto_ptr<HepMC::IO_BaseClass> iobc_;

static double pthat(const ThePEG::EventPtr &event);
// HerwigUi contains settings piped to Herwig7
std::shared_ptr<Herwig::HerwigUIProvider> HwUI_;



std::auto_ptr<HepMC::IO_BaseClass> iobc_;

// HerwigUi contains settings piped to Herwig7
std::shared_ptr<Herwig::HerwigUIProvider> HwUI_;

/**
/**
* Function calls Herwig event generator via API
*
* According to the run mode different steps of event generation are done
**/
void callHerwigGenerator();

void callHerwigGenerator();

// The Inputfile ist created according to the parameter set
void createInputFile(const edm::ParameterSet &params);
// The Inputfile ist created according to the parameter set
void createInputFile(const edm::ParameterSet &params);

private:
boost::shared_ptr<ThePEG::RandomEngineGlue::Proxy> randomEngineGlueProxy_;


private:
boost::shared_ptr<ThePEG::RandomEngineGlue::Proxy>
randomEngineGlueProxy_;

const std::string dataLocation_;
const std::string generator_;
const std::string run_;
// File name containing Herwig input config
std::string dumpConfig_;
const unsigned int skipEvents_;
CLHEP::HepRandomEngine* randomEngine;
const std::string dataLocation_;
const std::string generator_;
const std::string run_;
// File name containing Herwig input config
std::string dumpConfig_;
const unsigned int skipEvents_;
CLHEP::HepRandomEngine *randomEngine;
};







#endif // GeneratorInterface_Herwig7Interface_Herwig7Interface_h
#endif // GeneratorInterface_Herwig7Interface_Herwig7Interface_h