Skip to content

Commit

Permalink
Merge pull request #27263 from cms-sw/code-format-generators-446e7f
Browse files Browse the repository at this point in the history
Running code-format for generators
  • Loading branch information
cmsbuild committed Jun 20, 2019
2 parents 2091c9d + 58556b6 commit 1c49323
Show file tree
Hide file tree
Showing 6 changed files with 390 additions and 482 deletions.
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

0 comments on commit 1c49323

Please sign in to comment.