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

Filter for parton shower b #8644

Merged
merged 2 commits into from Apr 8, 2015
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
33 changes: 33 additions & 0 deletions GeneratorInterface/Core/interface/PartonShowerBsHepMCFilter.h
@@ -0,0 +1,33 @@
/**
** Description: Filter gen particles based on pdg_id and status code
**
** @author bortigno
** @version 1.0 02.04.2015
*/


#ifndef __PARTONSHOWERBSHEPMCFILTER__
#define __PARTONSHOWERBSHEPMCFILTER__


#include "GeneratorInterface/Core/interface/BaseHepMCFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

class PartonShowerBsHepMCFilter : public BaseHepMCFilter{

public:

PartonShowerBsHepMCFilter( const edm::ParameterSet & );
~PartonShowerBsHepMCFilter();

virtual bool filter(const HepMC::GenEvent* evt);

private:

int particle_id;
int exclude_status_id;
int status_id;
};


#endif
5 changes: 5 additions & 0 deletions GeneratorInterface/Core/src/HepMCFilterDriver.cc
@@ -1,5 +1,7 @@
#include "GeneratorInterface/Core/interface/HepMCFilterDriver.h"
#include "GeneratorInterface/Core/interface/GenericDauHepMCFilter.h"
#include "GeneratorInterface/Core/interface/PartonShowerBsHepMCFilter.h"


#include "FWCore/MessageLogger/interface/MessageLogger.h"

Expand All @@ -21,6 +23,9 @@ HepMCFilterDriver::HepMCFilterDriver(const edm::ParameterSet& pset) :
if (filterName=="GenericDauHepMCFilter") {
filter_ = new GenericDauHepMCFilter(filterParameters);
}
else if (filterName=="PartonShowerBsHepMCFilter") {
filter_ = new PartonShowerBsHepMCFilter(filterParameters);
}
else {
edm::LogError("HepMCFilterDriver")<< "Invalid HepMCFilter name:" << filterName;
}
Expand Down
60 changes: 60 additions & 0 deletions GeneratorInterface/Core/src/PartonShowerBsHepMCFilter.cc
@@ -0,0 +1,60 @@
#include "GeneratorInterface/Core/interface/PartonShowerBsHepMCFilter.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include <iostream>


using namespace edm;
using namespace std;


//constructor
PartonShowerBsHepMCFilter::PartonShowerBsHepMCFilter(const edm::ParameterSet& iConfig) :

// particle id of the gen particles that you want to filter
particle_id(iConfig.getParameter<int>("Particle_id")),
// status id of the particles that you want to exclude from the filter
exclude_status_id(iConfig.getUntrackedParameter<int>("Exclude_status_id",-1)),
// status id of the particles that you want to filetr on
status_id(iConfig.getUntrackedParameter<int>("Status_id",-1))

{

}


//destructor
PartonShowerBsHepMCFilter::~PartonShowerBsHepMCFilter()
{

}

//
// member functions
//

// ------------ method called to produce the data ------------
bool PartonShowerBsHepMCFilter::filter(const HepMC::GenEvent* evt)
{

if( exclude_status_id > 0. && status_id > 0.){
std::cout << "ERROR: Skipping event: Configuration has both exclude and status id set to a value > 0. They can not be used simultaneously." << std::endl;
return false; // skip event
}

for ( HepMC::GenEvent::particle_const_iterator p = evt->particles_begin();
p != evt->particles_end(); ++p ) {

if( abs((*p)->pdg_id()) == particle_id ){
if( exclude_status_id > 0. && (*p)->status() != exclude_status_id )
return true; // keep event
else if( status_id > 0. && (*p)->status() == status_id )
return true; // keep event
else
return true; // keep event
}

}

return false; // skip event

}
@@ -0,0 +1,163 @@
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: Configuration/GenProduction/python/ThirteenTeV/Hadronizer_MgmMatchTune4C_13TeV_madgraph_pythia8_Tauola_cff.py --filein dbs:/DYJetsToLL_M-50_13TeV-madgraph_v2/Fall13wmLHE-START62_V1-v1/GEN --fileout file:SMP-Fall13-00008.root --mc --eventcontent RAWSIM --datatier GEN-SIM --conditions POSTLS162_V1::All --step GEN,SIM --magField 38T_PostLS1 --geometry Extended2015 --python_filename SMP-Fall13-00008_1_cfg.py --no_exec -n 93
import FWCore.ParameterSet.Config as cms

process = cms.Process('SIM')

# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.EventContent.EventContent_cff')
process.load('SimGeneral.MixingModule.mixNoPU_cfi')
process.load('Configuration.Geometry.GeometryExtended2015Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2015_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_PostLS1_cff')
process.load('Configuration.StandardSequences.Generator_cff')
process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic8TeVCollision_cfi')
process.load('GeneratorInterface.Core.genFilterSummary_cff')
process.load('Configuration.StandardSequences.SimIdeal_cff')
process.load('Configuration.StandardSequences.EndOfProcess_cff')
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')

process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(10)
)

# Input source
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring('/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/00035F04-A0C3-E311-AB8A-02163E00A054.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/0046FC1F-F9C8-E311-BADC-90B11C18C363.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/00B96A0B-A0C3-E311-9BCC-0025B3203750.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/020D792C-D8C9-E311-8ED0-002481D20912.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/02233275-92C5-E311-9CAF-782BCB1CFD1C.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/022F6C36-FBC8-E311-8DFB-008CFA002ED8.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/0276432F-BCC3-E311-BCB1-003048678B8E.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/02B46ECB-39C3-E311-A579-003048D3740E.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/02CDBBE1-F8C8-E311-9CA8-7845C4F932D8.root',
'/store/generator/Fall13wmLHE/DYJetsToLL_M-50_13TeV-madgraph_v2/GEN/START62_V1-v1/00000/02D65BCB-F7C8-E311-8A00-AC162DACC3F0.root'),
secondaryFileNames = cms.untracked.vstring()
)

process.options = cms.untracked.PSet(

)

# Production Info
process.configurationMetadata = cms.untracked.PSet(
annotation = cms.untracked.string('Configuration/GenProduction/python/ThirteenTeV/Hadronizer_MgmMatchTune4C_13TeV_madgraph_pythia8_Tauola_cff.py nevts:93'),
name = cms.untracked.string('Applications'),
version = cms.untracked.string('$Revision: 1.19 $')
)


#AODSIM output definition

process.AODSIMoutput = cms.OutputModule("PoolOutputModule",
compressionLevel = cms.untracked.int32(4),
compressionAlgorithm = cms.untracked.string('LZMA'),
eventAutoFlushCompressedSize = cms.untracked.int32(15728640),
outputCommands = process.AODSIMEventContent.outputCommands,
fileName = cms.untracked.string('Hadronizer_MgmMatchTune4C_ZJetsNoPSb_13TeV_madgraph_pythia8_Tauola.root'),
dataset = cms.untracked.PSet(
filterName = cms.untracked.string(''),
dataTier = cms.untracked.string('AODSIM')
),
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('generation_step')
)
)




# Output definition

#process.RAWSIMoutput = cms.OutputModule("PoolOutputModule",
# SelectEvents = cms.untracked.PSet(
# SelectEvents = cms.vstring('generation_step')
# ),
# dataset = cms.untracked.PSet(
# dataTier = cms.untracked.string('GEN-SIM'),
# filterName = cms.untracked.string('')
# ),
# eventAutoFlushCompressedSize = cms.untracked.int32(5242880),
# fileName = cms.untracked.string('file:Hadronizer_MgmMatchTune4C_ZJetsNoPSb_13TeV_madgraph_pythia8_Tauola.root'),
# outputCommands = process.RAWSIMEventContent.outputCommands,
# splitLevel = cms.untracked.int32(0)
#)
#
# Additional output definition

# Other statements
process.genstepfilter.triggerConditions=cms.vstring("generation_step")
from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:mc', '')

process.generator = cms.EDFilter("Pythia8HadronizerFilter",
ExternalDecays = cms.PSet(
Tauola = cms.untracked.PSet(
InputCards = cms.PSet(
mdtau = cms.int32(0),
pjak1 = cms.int32(0),
pjak2 = cms.int32(0)
),
UseTauolaPolarization = cms.bool(True)
),
parameterSets = cms.vstring('Tauola')
),
PythiaParameters = cms.PSet(
parameterSets = cms.vstring('processParameters'),
processParameters = cms.vstring('Main:timesAllowErrors = 10000',
'ParticleDecays:limitTau0 = on',
'ParticleDecays:tauMax = 10',
'Tune:ee 3',
'Tune:pp 5')
),
nAttempts = cms.uint32(22),
HepMCFilter = cms.PSet(
filterName = cms.string('PartonShowerBsHepMCFilter'),
filterParameters = cms.PSet(
Particle_id = cms.int32(5), #pdg id of the particle to filter on. In this case b.
exclude_status_id = cms.untracked.int32(23), #status id of the particles to filter on. In this case matrix element particles.
),
),
UseExternalGenerators = cms.untracked.bool(True),
comEnergy = cms.double(13000.0),
filterEfficiency = cms.untracked.double(1.0),
jetMatching = cms.untracked.PSet(
MEMAIN_etaclmax = cms.double(-1),
MEMAIN_excres = cms.string(''),
MEMAIN_maxjets = cms.int32(-1),
MEMAIN_minjets = cms.int32(-1),
MEMAIN_nqmatch = cms.int32(5),
MEMAIN_qcut = cms.double(-1),
MEMAIN_showerkt = cms.double(0),
mode = cms.string('auto'),
outTree_flag = cms.int32(0),
scheme = cms.string('Madgraph')
),
maxEventsToPrint = cms.untracked.int32(1),
pythiaHepMCVerbosity = cms.untracked.bool(False),
pythiaPylistVerbosity = cms.untracked.int32(1)
)


# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen)
#process.simulation_step = cms.Path(process.psim)
process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
process.endjob_step = cms.EndPath(process.endOfProcess)
process.AODSIMoutput_step = cms.EndPath(process.AODSIMoutput)
#process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput)

# Schedule definition
process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.endjob_step,process.AODSIMoutput_step)
# filter all path with the production filter sequence
for path in process.paths:
getattr(process,path)._seq = process.generator * getattr(process,path)._seq