CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
EmbeddingLHEProducer Class Reference

#include <test/EmbeddingLHEProducer/plugins/EmbeddingLHEProducer.cc>

Inheritance diagram for EmbeddingLHEProducer:
edm::one::EDProducer< edm::BeginRunProducer, edm::EndRunProducer > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EmbeddingLHEProducer (const edm::ParameterSet &)
 
 ~EmbeddingLHEProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::BeginRunProducer, edm::EndRunProducer >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void assign_4vector (TLorentzVector &Lepton, const pat::Muon *muon, std::string FSRmode)
 
void beginJob () override
 
void beginRunProduce (edm::Run &run, edm::EventSetup const &es) override
 
void endJob () override
 
void endRunProduce (edm::Run &, edm::EventSetup const &) override
 
void fill_lhe_from_mumu (TLorentzVector &positiveLepton, TLorentzVector &negativeLepton, lhef::HEPEUP &outlhe, CLHEP::HepRandomEngine *engine)
 
void fill_lhe_with_particle (lhef::HEPEUP &outlhe, TLorentzVector &particle, int pdgid, double spin, double ctau)
 
const reco::Candidatefind_original_muon (const reco::Candidate *muon)
 
LHERunInfoProduct::Header give_slha ()
 
void mirror (TLorentzVector &positiveLepton, TLorentzVector &negativeLepton)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
void rotate180 (TLorentzVector &positiveLepton, TLorentzVector &negativeLepton)
 
void transform_mumu_to_tautau (TLorentzVector &positiveLepton, TLorentzVector &negativeLepton)
 

Private Attributes

const double elMass_ = 0.00051
 
const int embeddingParticles [3] {11,13,15}
 
std::ofstream file
 
bool mirror_
 
edm::EDGetTokenT< edm::View< pat::Muon > > muonsCollection_
 
int particleToEmbed_
 
bool rotate180_
 
std::string studyFSRmode_
 
const double tauMass_ = 1.77682
 
edm::EDGetTokenT< reco::VertexCollectionvertexCollection_
 
bool write_lheout
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 73 of file EmbeddingLHEProducer.cc.

Constructor & Destructor Documentation

EmbeddingLHEProducer::EmbeddingLHEProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 120 of file EmbeddingLHEProducer.cc.

References begin, end, Exception, FrontierConditions_GlobalTag_cff::file, spr::find(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), edm::Service< T >::isAvailable(), MillePedeFileConverter_cfg::out, AlCaHLTBitMon_QueryRunRegistry::string, and estimatePileup_makeJSON::trunc.

121 {
122  //register your products
123  produces<LHEEventProduct>();
124  produces<LHERunInfoProduct, edm::Transition::BeginRun>();
125  produces<math::XYZTLorentzVectorD>("vertexPosition");
126 
127  muonsCollection_ = consumes<edm::View<pat::Muon>>(iConfig.getParameter<edm::InputTag>("src"));
128  vertexCollection_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"));
129  particleToEmbed_ = iConfig.getParameter<int>("particleToEmbed");
130  mirror_ = iConfig.getParameter<bool>("mirror");
131  rotate180_ = iConfig.getParameter<bool>("rotate180");
132  studyFSRmode_ = iConfig.getUntrackedParameter<std::string>("studyFSRmode","");
133 
134  write_lheout=false;
135  std::string lhe_ouputfile = iConfig.getUntrackedParameter<std::string>("lhe_outputfilename","");
136  if (lhe_ouputfile !=""){
137  write_lheout=true;
138  file.open(lhe_ouputfile, std::fstream::out | std::fstream::trunc);
139  }
140 
141  //check if particle can be embedded
144  throw cms::Exception("Configuration")
145  << "The given particle to embed is not in the list of allowed particles.";
146  }
147 
149  if ( ! rng.isAvailable()) {
150  throw cms::Exception("Configuration")
151  << "The EmbeddingLHEProducer requires the RandomNumberGeneratorService\n"
152  "which is not present in the configuration file. \n"
153  "You must add the service\n"
154  "in the configuration file or remove the modules that require it.";
155  }
156 
157 
158 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool isAvailable() const
Definition: Service.h:46
#define end
Definition: vmac.h:39
edm::EDGetTokenT< edm::View< pat::Muon > > muonsCollection_
#define begin
Definition: vmac.h:32
edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
EmbeddingLHEProducer::~EmbeddingLHEProducer ( )
override

Definition at line 161 of file EmbeddingLHEProducer.cc.

162 {
163 }

Member Function Documentation

void EmbeddingLHEProducer::assign_4vector ( TLorentzVector &  Lepton,
const pat::Muon muon,
std::string  FSRmode 
)
private

Definition at line 404 of file EmbeddingLHEProducer.cc.

References pat::PATObject< ObjectType >::genParticle(), reco::Candidate::p4(), and reco::LeafCandidate::p4().

405 {
406  if("afterFSR" == FSRmode && muon->genParticle() != nullptr)
407  {
408  const reco::GenParticle* afterFSRMuon = muon->genParticle();
409  Lepton.SetPxPyPzE(afterFSRMuon->p4().px(),afterFSRMuon->p4().py(),afterFSRMuon->p4().pz(), afterFSRMuon->p4().e());
410  }
411  else if ("beforeFSR" == FSRmode && muon->genParticle() != nullptr)
412  {
413  const reco::Candidate* beforeFSRMuon = find_original_muon(muon->genParticle());
414  Lepton.SetPxPyPzE(beforeFSRMuon->p4().px(),beforeFSRMuon->p4().py(),beforeFSRMuon->p4().pz(), beforeFSRMuon->p4().e());
415  }
416  else
417  {
418  Lepton.SetPxPyPzE(muon->p4().px(),muon->p4().py(),muon->p4().pz(), muon->p4().e());
419  }
420  return;
421 }
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:244
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
const reco::Candidate * find_original_muon(const reco::Candidate *muon)
Definition: Lepton.py:1
void EmbeddingLHEProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 230 of file EmbeddingLHEProducer.cc.

231 {
232 }
void EmbeddingLHEProducer::beginRunProduce ( edm::Run run,
edm::EventSetup const &  es 
)
overrideprivate

Definition at line 242 of file EmbeddingLHEProducer.cc.

References popcon2dropbox::copy(), FrontierConditions_GlobalTag_cff::file, lhef::HEPRUP::IDWTUP, lhef::HEPRUP::LPRUP, eostools::move(), edm::Run::put(), lhef::HEPRUP::resize(), lhef::HEPRUP::XERRUP, lhef::HEPRUP::XMAXUP, and lhef::HEPRUP::XSECUP.

243 {
244  // fill HEPRUP common block and store in edm::Run
245  lhef::HEPRUP heprup;
246 
247  // set number of processes: 1 for Z to tau tau
248  heprup.resize(1);
249 
250  //Process independent information
251 
252  //beam particles ID (two protons)
253  //heprup.IDBMUP.first = 2212;
254  //heprup.IDBMUP.second = 2212;
255 
256  //beam particles energies (both 6.5 GeV)
257  //heprup.EBMUP.first = 6500.;
258  //heprup.EBMUP.second = 6500.;
259 
260  //take default pdf group for both beamparticles
261  //heprup.PDFGUP.first = -1;
262  //heprup.PDFGUP.second = -1;
263 
264  //take certan pdf set ID (same as in officially produced DYJets LHE files)
265  //heprup.PDFSUP.first = -1;
266  //heprup.PDFSUP.second = -1;
267 
268  //master switch for event weight iterpretation (same as in officially produced DYJets LHE files)
269  heprup.IDWTUP = 3;
270 
271  //Information for first process (Z to tau tau), for now only placeholder:
272  heprup.XSECUP[0] = 1.;
273  heprup.XERRUP[0] = 0;
274  heprup.XMAXUP[0] = 1;
275  heprup.LPRUP[0]= 1;
276 
277 
278  std::unique_ptr<LHERunInfoProduct> runInfo(new LHERunInfoProduct(heprup));
279  runInfo->addHeader(give_slha());
280 
281 
282  if (write_lheout)std::copy(runInfo->begin(), runInfo->end(),std::ostream_iterator<std::string>(file));
283  run.put(std::move(runInfo));
284 
285 
286 }
void resize(int nrup)
Definition: LesHouches.h:52
def copy(args, dbName)
LHERunInfoProduct::Header give_slha()
std::vector< double > XERRUP
Definition: LesHouches.h:127
std::vector< double > XMAXUP
Definition: LesHouches.h:132
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:115
std::vector< double > XSECUP
Definition: LesHouches.h:121
def move(src, dest)
Definition: eostools.py:511
std::vector< int > LPRUP
Definition: LesHouches.h:137
void EmbeddingLHEProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 236 of file EmbeddingLHEProducer.cc.

236  {
237 }
void EmbeddingLHEProducer::endRunProduce ( edm::Run run,
edm::EventSetup const &  es 
)
overrideprivate

Definition at line 290 of file EmbeddingLHEProducer.cc.

References LHERunInfoProduct::endOfFile(), and FrontierConditions_GlobalTag_cff::file.

291 {
292  if (write_lheout) {
294  file.close();
295  }
296 }
static const std::string & endOfFile()
void EmbeddingLHEProducer::fill_lhe_from_mumu ( TLorentzVector &  positiveLepton,
TLorentzVector &  negativeLepton,
lhef::HEPEUP outlhe,
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 299 of file EmbeddingLHEProducer.cc.

References DOFs::Z.

300 {
301 
302  TLorentzVector Z = positiveLepton + negativeLepton;
303  int leptonPDGID = particleToEmbed_;
304 
305  // double tau_ctau = 0.00871100; //cm
306  double tau_ctau0 = 8.71100e-02; // mm (for Pythia)
307  double tau_ctau_p = tau_ctau0 * CLHEP::RandExponential::shoot(engine); // return -std::log(HepRandom::getTheEngine()->flat());
308  // replaces tau = process[iNow].tau0() * rndmPtr->exp(); from pythia8212/src/ProcessContainer.cc which is not initialized for ProcessLevel:all = off mode (no beam particle mode)
309  double tau_ctau_n = tau_ctau0 * CLHEP::RandExponential::shoot(engine);
310  //std::cout<<"tau_ctau P: "<<tau_ctau_p<<" tau_ctau N: "<<tau_ctau_n<<std::endl;
311 
312  fill_lhe_with_particle(outlhe, Z,23,9.0, 0);
313  fill_lhe_with_particle(outlhe, positiveLepton,-leptonPDGID,1.0, tau_ctau_p);
314  fill_lhe_with_particle(outlhe, negativeLepton,leptonPDGID,-1.0, tau_ctau_n);
315 
316  return;
317 }
void fill_lhe_with_particle(lhef::HEPEUP &outlhe, TLorentzVector &particle, int pdgid, double spin, double ctau)
void EmbeddingLHEProducer::fill_lhe_with_particle ( lhef::HEPEUP outlhe,
TLorentzVector &  particle,
int  pdgid,
double  spin,
double  ctau 
)
private

Definition at line 319 of file EmbeddingLHEProducer.cc.

References funct::abs(), begin, end, spr::find(), lhef::HEPEUP::ICOLUP, lhef::HEPEUP::IDUP, lhef::HEPEUP::ISTUP, lhef::HEPEUP::MOTHUP, lhef::HEPEUP::NUP, BPhysicsValidation_cfi::pdgid, lhef::HEPEUP::PUP, lhef::HEPEUP::resize(), spin(), lhef::HEPEUP::SPINUP, and lhef::HEPEUP::VTIMUP.

320 {
321  // Pay attention to different index conventions:
322  // 'particleindex' follows usual C++ index conventions starting at 0 for a list.
323  // 'motherindex' follows the LHE index conventions: 0 is for 'not defined', so the listing starts at 1.
324  // That means: LHE index 1 == C++ index 0.
325  int particleindex = outlhe.NUP;
326  outlhe.resize(outlhe.NUP+1);
327 
328  outlhe.PUP[particleindex][0] = particle.Px();
329  outlhe.PUP[particleindex][1] = particle.Py();
330  outlhe.PUP[particleindex][2] = particle.Pz();
331  outlhe.PUP[particleindex][3] = particle.E();
332  outlhe.PUP[particleindex][4] = particle.M();
333  outlhe.IDUP[particleindex] = pdgid;
334  outlhe.SPINUP[particleindex] = spin;
335  outlhe.VTIMUP[particleindex] = ctau;
336 
337  outlhe.ICOLUP[particleindex].first = 0;
338  outlhe.ICOLUP[particleindex].second = 0;
339 
340  if (std::abs(pdgid) == 23){
341  outlhe.MOTHUP[particleindex].first = 0; // No Mother
342  outlhe.MOTHUP[particleindex].second = 0;
343  outlhe.ISTUP[particleindex] = 2; // status
344 
345  }
346 
349  outlhe.MOTHUP[particleindex].first = 1; // Mother is the Z (first partile)
350  outlhe.MOTHUP[particleindex].second = 1; // Mother is the Z (first partile)
351 
352  outlhe.ISTUP[particleindex] = 1;//status
353  }
354 
355  return;
356 }
std::vector< double > VTIMUP
Definition: LesHouches.h:267
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< std::pair< int, int > > MOTHUP
Definition: LesHouches.h:249
void resize(int nup)
Definition: LesHouches.h:174
std::vector< FiveVector > PUP
Definition: LesHouches.h:261
std::vector< double > SPINUP
Definition: LesHouches.h:274
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > ISTUP
Definition: LesHouches.h:243
#define end
Definition: vmac.h:39
std::vector< int > IDUP
Definition: LesHouches.h:238
#define begin
Definition: vmac.h:32
std::vector< std::pair< int, int > > ICOLUP
Definition: LesHouches.h:255
float spin(float ph)
void EmbeddingLHEProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 582 of file EmbeddingLHEProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

582  {
583  //The following says we do not know what parameters are allowed so do no validation
584  // Please change this to state exactly what you do use, even if it is no parameters
586  desc.setUnknown();
587  descriptions.addDefault(desc);
588 }
void addDefault(ParameterSetDescription const &psetDescription)
const reco::Candidate * EmbeddingLHEProducer::find_original_muon ( const reco::Candidate muon)
private

Definition at line 423 of file EmbeddingLHEProducer.cc.

References reco::Candidate::mother(), metsig::muon, and reco::Candidate::pdgId().

424 {
425  if(muon->mother(0) == nullptr) return muon;
426  if(muon->pdgId() == muon->mother(0)->pdgId()) return find_original_muon(muon->mother(0));
427  else return muon;
428 }
virtual const Candidate * mother(size_type i=0) const =0
return pointer to mother
virtual int pdgId() const =0
PDG identifier.
const reco::Candidate * find_original_muon(const reco::Candidate *muon)
LHERunInfoProduct::Header EmbeddingLHEProducer::give_slha ( )
private

Definition at line 485 of file EmbeddingLHEProducer.cc.

References LHERunInfoProduct::Header::addLine().

485  {
486  LHERunInfoProduct::Header slhah("slha");
487 
488  slhah.addLine("######################################################################\n");
489  slhah.addLine("## PARAM_CARD AUTOMATICALY GENERATED BY MG5 FOLLOWING UFO MODEL ####\n");
490  slhah.addLine("######################################################################\n");
491  slhah.addLine("## ##\n");
492  slhah.addLine("## Width set on Auto will be computed following the information ##\n");
493  slhah.addLine("## present in the decay.py files of the model. ##\n");
494  slhah.addLine("## See arXiv:1402.1178 for more details. ##\n");
495  slhah.addLine("## ##\n");
496  slhah.addLine("######################################################################\n");
497  slhah.addLine("\n");
498  slhah.addLine("###################################\n");
499  slhah.addLine("## INFORMATION FOR MASS\n");
500  slhah.addLine("###################################\n");
501  slhah.addLine("Block mass \n");
502  slhah.addLine(" 6 1.730000e+02 # MT \n");
503  slhah.addLine(" 15 1.777000e+00 # MTA \n");
504  slhah.addLine(" 23 9.118800e+01 # MZ \n");
505  slhah.addLine(" 25 1.250000e+02 # MH \n");
506  slhah.addLine("## Dependent parameters, given by model restrictions.\n");
507  slhah.addLine("## Those values should be edited following the \n");
508  slhah.addLine("## analytical expression. MG5 ignores those values \n");
509  slhah.addLine("## but they are important for interfacing the output of MG5\n");
510  slhah.addLine("## to external program such as Pythia.\n");
511  slhah.addLine(" 1 0.000000 # d : 0.0 \n");
512  slhah.addLine(" 2 0.000000 # u : 0.0 \n");
513  slhah.addLine(" 3 0.000000 # s : 0.0 \n");
514  slhah.addLine(" 4 0.000000 # c : 0.0 \n");
515  slhah.addLine(" 5 0.000000 # b : 0.0 \n");
516  slhah.addLine(" 11 0.000000 # e- : 0.0 \n");
517  slhah.addLine(" 12 0.000000 # ve : 0.0 \n");
518  slhah.addLine(" 13 0.000000 # mu- : 0.0 \n");
519  slhah.addLine(" 14 0.000000 # vm : 0.0 \n");
520  slhah.addLine(" 16 0.000000 # vt : 0.0 \n");
521  slhah.addLine(" 21 0.000000 # g : 0.0 \n");
522  slhah.addLine(" 22 0.000000 # a : 0.0 \n");
523  slhah.addLine(" 24 80.419002 # w+ : cmath.sqrt(MZ__exp__2/2. + cmath.sqrt(MZ__exp__4/4. - (aEW*cmath.pi*MZ__exp__2)/(Gf*sqrt__2))) \n");
524  slhah.addLine("\n");
525  slhah.addLine("###################################\n");
526  slhah.addLine("## INFORMATION FOR SMINPUTS\n");
527  slhah.addLine("###################################\n");
528  slhah.addLine("Block sminputs \n");
529  slhah.addLine(" 1 1.325070e+02 # aEWM1 \n");
530  slhah.addLine(" 2 1.166390e-05 # Gf \n");
531  slhah.addLine(" 3 1.180000e-01 # aS \n");
532  slhah.addLine("\n");
533  slhah.addLine("###################################\n");
534  slhah.addLine("## INFORMATION FOR WOLFENSTEIN\n");
535  slhah.addLine("###################################\n");
536  slhah.addLine("Block wolfenstein \n");
537  slhah.addLine(" 1 2.253000e-01 # lamWS \n");
538  slhah.addLine(" 2 8.080000e-01 # AWS \n");
539  slhah.addLine(" 3 1.320000e-01 # rhoWS \n");
540  slhah.addLine(" 4 3.410000e-01 # etaWS \n");
541  slhah.addLine("\n");
542  slhah.addLine("###################################\n");
543  slhah.addLine("## INFORMATION FOR YUKAWA\n");
544  slhah.addLine("###################################\n");
545  slhah.addLine("Block yukawa \n");
546  slhah.addLine(" 6 1.730000e+02 # ymt \n");
547  slhah.addLine(" 15 1.777000e+00 # ymtau \n");
548  slhah.addLine("\n");
549  slhah.addLine("###################################\n");
550  slhah.addLine("## INFORMATION FOR DECAY\n");
551  slhah.addLine("###################################\n");
552  slhah.addLine("DECAY 6 1.491500e+00 # WT \n");
553  slhah.addLine("DECAY 15 2.270000e-12 # WTau \n");
554  slhah.addLine("DECAY 23 2.441404e+00 # WZ \n");
555  slhah.addLine("DECAY 24 2.047600e+00 # WW \n");
556  slhah.addLine("DECAY 25 6.382339e-03 # WH \n");
557  slhah.addLine("## Dependent parameters, given by model restrictions.\n");
558  slhah.addLine("## Those values should be edited following the \n");
559  slhah.addLine("## analytical expression. MG5 ignores those values \n");
560  slhah.addLine("## but they are important for interfacing the output of MG5\n");
561  slhah.addLine("## to external program such as Pythia.\n");
562  slhah.addLine("DECAY 1 0.000000 # d : 0.0 \n");
563  slhah.addLine("DECAY 2 0.000000 # u : 0.0 \n");
564  slhah.addLine("DECAY 3 0.000000 # s : 0.0 \n");
565  slhah.addLine("DECAY 4 0.000000 # c : 0.0 \n");
566  slhah.addLine("DECAY 5 0.000000 # b : 0.0 \n");
567  slhah.addLine("DECAY 11 0.000000 # e- : 0.0 \n");
568  slhah.addLine("DECAY 12 0.000000 # ve : 0.0 \n");
569  slhah.addLine("DECAY 13 0.000000 # mu- : 0.0 \n");
570  slhah.addLine("DECAY 14 0.000000 # vm : 0.0 \n");
571  slhah.addLine("DECAY 16 0.000000 # vt : 0.0 \n");
572  slhah.addLine("DECAY 21 0.000000 # g : 0.0 \n");
573  slhah.addLine("DECAY 22 0.000000 # a : 0.0\n");
574 
575  return slhah;
576 }
void EmbeddingLHEProducer::mirror ( TLorentzVector &  positiveLepton,
TLorentzVector &  negativeLepton 
)
private

Definition at line 458 of file EmbeddingLHEProducer.cc.

References DOFs::Z.

459 {
460  if(!mirror_) return;
461  edm::LogInfo("TauEmbedding")<< "Applying mirroring" ;
462  TLorentzVector Z = positiveLepton + negativeLepton;
463 
464  edm::LogInfo("TauEmbedding") << "MuMinus before. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M() ;
465 
466  TVector3 Z3 = Z.Vect();
467  TVector3 positiveLepton3 = positiveLepton.Vect();
468  TVector3 negativeLepton3 = negativeLepton.Vect();
469 
470  TVector3 beam(0.,0.,1.);
471  TVector3 perpToZandBeam = Z3.Cross(beam).Unit();
472 
473  positiveLepton3 -= 2*positiveLepton3.Dot(perpToZandBeam)*perpToZandBeam;
474  negativeLepton3 -= 2*negativeLepton3.Dot(perpToZandBeam)*perpToZandBeam;
475 
476  positiveLepton.SetVect(positiveLepton3);
477  negativeLepton.SetVect(negativeLepton3);
478 
479  edm::LogInfo("TauEmbedding") << "MuMinus after. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M() ;
480 
481  return;
482 }
void EmbeddingLHEProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 172 of file EmbeddingLHEProducer.cc.

References lhef::HEPEUP::AQCDUP, lhef::HEPEUP::AQEDUP, edm::View< T >::begin(), popcon2dropbox::copy(), edm::View< T >::end(), FrontierConditions_GlobalTag_cff::file, edm::Event::getByToken(), edm::RandomNumberGenerator::getEngine(), lhef::HEPEUP::IDPRUP, EmbeddingLHEProducer_cfi::mirror, eostools::move(), metsig::muon, edm::Event::put(), EmbeddingLHEProducer_cfi::rotate180, lhef::HEPEUP::SCALUP, edm::Event::streamID(), and lhef::HEPEUP::XWGTUP.

173 {
174  using namespace edm;
175 
177  CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID());
178 
179 
181  iEvent.getByToken(muonsCollection_, muonHandle);
182  edm::View<pat::Muon> coll_muons = *muonHandle;
183 
184  Handle<std::vector<reco::Vertex>> coll_vertices;
185  iEvent.getByToken(vertexCollection_ , coll_vertices);
186 
187  TLorentzVector positiveLepton, negativeLepton;
188  bool mu_plus_found = false;
189  bool mu_minus_found = false;
190  lhef::HEPEUP hepeup;
191  hepeup.IDPRUP = 0;
192  hepeup.XWGTUP = 1;
193  hepeup.SCALUP = -1;
194  hepeup.AQEDUP = -1;
195  hepeup.AQCDUP = -1;
196  // Assuming Pt-Order
197  for (edm::View<pat::Muon>::const_iterator muon= coll_muons.begin(); muon!= coll_muons.end(); ++muon)
198  {
199  if (muon->charge() == 1 && !mu_plus_found)
200  {
201  assign_4vector(positiveLepton, &(*muon), studyFSRmode_);
202  mu_plus_found = true;
203  }
204  else if (muon->charge() == -1 && !mu_minus_found)
205  {
206  assign_4vector(negativeLepton, &(*muon), studyFSRmode_);
207  mu_minus_found = true;
208  }
209  else if (mu_minus_found && mu_plus_found) break;
210  }
211  mirror(positiveLepton,negativeLepton); // if no mirror, function does nothing.
212  rotate180(positiveLepton,negativeLepton); // if no rotate180, function does nothing
213  transform_mumu_to_tautau(positiveLepton,negativeLepton); // if MuonEmbedding, function does nothing.
214  fill_lhe_from_mumu(positiveLepton,negativeLepton,hepeup,engine);
215 
216  double originalXWGTUP_ = 1.;
217  std::unique_ptr<LHEEventProduct> product( new LHEEventProduct(hepeup,originalXWGTUP_) );
218 
219  if (write_lheout) std::copy(product->begin(), product->end(), std::ostream_iterator<std::string>(file));
220 
221  iEvent.put(std::move(product));
222  // Saving vertex position
223  std::unique_ptr<math::XYZTLorentzVectorD> vertex_position (new math::XYZTLorentzVectorD(coll_vertices->at(0).x(),coll_vertices->at(0).y(),coll_vertices->at(0).z(),0.0));
224  iEvent.put(std::move(vertex_position), "vertexPosition");
225 
226 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void mirror(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:14
def copy(args, dbName)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void transform_mumu_to_tautau(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton)
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const_iterator begin() const
void assign_4vector(TLorentzVector &Lepton, const pat::Muon *muon, std::string FSRmode)
double AQCDUP
Definition: LesHouches.h:233
void rotate180(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton)
edm::EDGetTokenT< edm::View< pat::Muon > > muonsCollection_
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
StreamID streamID() const
Definition: Event.h:96
edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
double AQEDUP
Definition: LesHouches.h:228
const_iterator end() const
void fill_lhe_from_mumu(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton, lhef::HEPEUP &outlhe, CLHEP::HepRandomEngine *engine)
double XWGTUP
Definition: LesHouches.h:209
def move(src, dest)
Definition: eostools.py:511
double SCALUP
Definition: LesHouches.h:223
void EmbeddingLHEProducer::rotate180 ( TLorentzVector &  positiveLepton,
TLorentzVector &  negativeLepton 
)
private

Definition at line 430 of file EmbeddingLHEProducer.cc.

References DOFs::Z.

431 {
432  if (!rotate180_) return;
433  edm::LogInfo("TauEmbedding") << "Applying 180<C2><B0> rotation" ;
434  // By construction, the 3-momenta of mu-, mu+ and Z are in one plane.
435  // That means, one vector for perpendicular projection can be used for both leptons.
436  TLorentzVector Z = positiveLepton + negativeLepton;
437 
438  edm::LogInfo("TauEmbedding") << "MuMinus before. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M();
439 
440  TVector3 Z3 = Z.Vect();
441  TVector3 positiveLepton3 = positiveLepton.Vect();
442  TVector3 negativeLepton3 = negativeLepton.Vect();
443 
444  TVector3 p3_perp = positiveLepton3 - positiveLepton3.Dot(Z3)/Z3.Dot(Z3)*Z3;
445  p3_perp = p3_perp.Unit();
446 
447  positiveLepton3 -= 2*positiveLepton3.Dot(p3_perp)*p3_perp;
448  negativeLepton3 -= 2*negativeLepton3.Dot(p3_perp)*p3_perp;
449 
450  positiveLepton.SetVect(positiveLepton3);
451  negativeLepton.SetVect(negativeLepton3);
452 
453  edm::LogInfo("TauEmbedding") << "MuMinus after. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M();
454 
455  return;
456 }
void EmbeddingLHEProducer::transform_mumu_to_tautau ( TLorentzVector &  positiveLepton,
TLorentzVector &  negativeLepton 
)
private

Definition at line 361 of file EmbeddingLHEProducer.cc.

References Scenarios_cff::scale, mathSSE::sqrt(), and DOFs::Z.

362 {
363  // No corrections applied for muon embedding
364  double lep_mass;
365  if (particleToEmbed_ == 11) {
366  lep_mass = elMass_;
367  } else if (particleToEmbed_ == 15) {
368  lep_mass = tauMass_;
369  } else {
370  return;
371  }
372 
373  TLorentzVector Z = positiveLepton + negativeLepton;
374 
375  TVector3 boost_from_Z_to_LAB = Z.BoostVector();
376  TVector3 boost_from_LAB_to_Z = -Z.BoostVector();
377 
378  // Boosting the two leptons to Z restframe, then both are back to back. This means, same 3-momentum squared
379  positiveLepton.Boost(boost_from_LAB_to_Z);
380  negativeLepton.Boost(boost_from_LAB_to_Z);
381 
382  // Energy of tau = 0.5*Z-mass
383  double lep_mass_squared = lep_mass*lep_mass;
384  double lep_energy_squared = 0.25*Z.M2();
385  double lep_3momentum_squared = lep_energy_squared - lep_mass_squared;
386  if (lep_3momentum_squared < 0)
387  {
388  edm::LogWarning("TauEmbedding") << "3-Momentum squared is negative";
389  return;
390  }
391 
392  //Computing scale, applying it on the 3-momenta and building new 4 momenta of the taus
393  double scale = std::sqrt(lep_3momentum_squared/positiveLepton.Vect().Mag2());
394  positiveLepton.SetPxPyPzE(scale*positiveLepton.Px(),scale*positiveLepton.Py(),scale*positiveLepton.Pz(),std::sqrt(lep_energy_squared));
395  negativeLepton.SetPxPyPzE(scale*negativeLepton.Px(),scale*negativeLepton.Py(),scale*negativeLepton.Pz(),std::sqrt(lep_energy_squared));
396 
397  //Boosting the new taus back to LAB frame
398  positiveLepton.Boost(boost_from_Z_to_LAB);
399  negativeLepton.Boost(boost_from_Z_to_LAB);
400 
401  return;
402 }
T sqrt(T t)
Definition: SSEVec.h:18

Member Data Documentation

const double EmbeddingLHEProducer::elMass_ = 0.00051
private

Definition at line 105 of file EmbeddingLHEProducer.cc.

const int EmbeddingLHEProducer::embeddingParticles[3] {11,13,15}
private

Definition at line 106 of file EmbeddingLHEProducer.cc.

std::ofstream EmbeddingLHEProducer::file
private

Definition at line 108 of file EmbeddingLHEProducer.cc.

bool EmbeddingLHEProducer::mirror_
private

Definition at line 103 of file EmbeddingLHEProducer.cc.

edm::EDGetTokenT<edm::View<pat::Muon> > EmbeddingLHEProducer::muonsCollection_
private

Definition at line 100 of file EmbeddingLHEProducer.cc.

int EmbeddingLHEProducer::particleToEmbed_
private

Definition at line 102 of file EmbeddingLHEProducer.cc.

bool EmbeddingLHEProducer::rotate180_
private

Definition at line 103 of file EmbeddingLHEProducer.cc.

std::string EmbeddingLHEProducer::studyFSRmode_
private

Definition at line 114 of file EmbeddingLHEProducer.cc.

const double EmbeddingLHEProducer::tauMass_ = 1.77682
private

Definition at line 104 of file EmbeddingLHEProducer.cc.

edm::EDGetTokenT<reco::VertexCollection> EmbeddingLHEProducer::vertexCollection_
private

Definition at line 101 of file EmbeddingLHEProducer.cc.

bool EmbeddingLHEProducer::write_lheout
private

Definition at line 109 of file EmbeddingLHEProducer.cc.