Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F9514752
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Subscribers
None
View Options
diff --git a/MatrixElement/Matchbox/Cuts/InvariantMassCut.cc b/MatrixElement/Matchbox/Cuts/InvariantMassCut.cc
--- a/MatrixElement/Matchbox/Cuts/InvariantMassCut.cc
+++ b/MatrixElement/Matchbox/Cuts/InvariantMassCut.cc
@@ -1,211 +1,211 @@
// -*- C++ -*-
//
// InvariantMassCut.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2012 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the InvariantMassCut class.
//
#include "InvariantMassCut.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/PDT/ParticleData.h"
#include "ThePEG/PDT/EnumParticles.h"
#include "ThePEG/Cuts/Cuts.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/Repository/CurrentGenerator.h"
#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/PDT/MatcherBase.h"
#include "ThePEG/PDT/StandardMatchers.h"
using namespace Herwig;
void InvariantMassCut::describe() const {
CurrentGenerator::log()
<< fullName() << "\n"
<< "matching distances between: '"
<< theFirstMatcher->name() << "' and '"
<< theSecondMatcher->name() << "':\n"
<< "M = " << theMinMass/GeV << " .. " << theMaxMass/GeV << " GeV\n"
<< "same flavour only = " << (theSameFlavourOnly?"true":"false") << " \n"
- << "opposite sign only = " << (theOppositeSignOnly?"true":"false") << " \n";
+ << "opposite sign only = " << (theOppositeSignOnly?"true":"false") << " \n\n";
}
IBPtr InvariantMassCut::clone() const {
return new_ptr(*this);
}
IBPtr InvariantMassCut::fullclone() const {
return new_ptr(*this);
}
bool InvariantMassCut::passCuts(tcCutsPtr parent, tcPDPtr pitype, tcPDPtr pjtype,
LorentzMomentum pi, LorentzMomentum pj,
bool inci, bool incj) const {
bool match = false;
if ( theFirstMatcher->check(*pitype) && theSecondMatcher->check(*pjtype) ) match = true;
if ( theFirstMatcher->check(*pjtype) && theSecondMatcher->check(*pitype) ) match = true;
if ( !match ||
( theMinMass == ZERO && theMaxMass == Constants::MaxEnergy ) ) return true;
if ( inci || incj ) return true;
if ( sameFlavourOnly() || oppositeSignOnly() ) {
int fam1 = family(pitype->id());
int fam2 = family(pjtype->id());
if ( fam1 && fam2 ) {
if ( sameFlavourOnly() && ( abs(fam1) != abs(fam2) ) ) return true;
if ( oppositeSignOnly() && ( fam1*fam2 > 0 ) ) return true;
}
}
double weight = 1.0;
Energy minv = (pi+pj).m();
if ( !parent->isInside<CutTypes::Energy>(minv,minMass(),maxMass(),weight) )
{
parent->lastCutWeight(0.0);
return false;
}
parent->lastCutWeight(weight);
return true;
}
int InvariantMassCut::family(long id) const {
int sign = (id>0)?-1:1;
switch ( id ) {
case ParticleID::u:
case ParticleID::ubar:
case ParticleID::d:
case ParticleID::dbar:
return 1*sign; break;
case ParticleID::c:
case ParticleID::cbar:
case ParticleID::s:
case ParticleID::sbar:
return 2*sign; break;
case ParticleID::t:
case ParticleID::tbar:
case ParticleID::b:
case ParticleID::bbar:
return 3*sign; break;
case ParticleID::eminus:
case ParticleID::eplus:
case ParticleID::nu_e:
case ParticleID::nu_ebar:
return 11*sign; break;
case ParticleID::muminus:
case ParticleID::muplus:
case ParticleID::nu_mu:
case ParticleID::nu_mubar:
return 12*sign; break;
case ParticleID::tauminus:
case ParticleID::tauplus:
case ParticleID::nu_tau:
case ParticleID::nu_taubar:
return 13*sign; break;
}
return 0;
}
void InvariantMassCut::persistentOutput(PersistentOStream & os) const {
os << ounit(theMinMass,GeV) << ounit(theMaxMass,GeV)
<< theSameFlavourOnly << theOppositeSignOnly
<< theFirstMatcher << theSecondMatcher;
}
void InvariantMassCut::persistentInput(PersistentIStream & is, int) {
is >> iunit(theMinMass,GeV) >> iunit(theMaxMass,GeV)
>> theSameFlavourOnly >> theOppositeSignOnly
>> theFirstMatcher >> theSecondMatcher;
}
// *** Attention *** The following static variable is needed for the type
// description system in ThePEG. Please check that the template arguments
// are correct (the class and its base class), and that the constructor
// arguments are correct (the class name and the name of the dynamically
// loadable library where the class implementation can be found).
DescribeClass<InvariantMassCut,TwoCutBase>
describeHerwigInvariantMassCut("Herwig::InvariantMassCut", "HwMatchboxCuts.so");
void InvariantMassCut::Init() {
static ClassDocumentation<InvariantMassCut> documentation
("This class implements an invariant mass cut between "
"final-state particles.");
static Parameter<InvariantMassCut,Energy> interfaceMinMass
("MinMass",
"The minimal allowed invariant mass ",
&InvariantMassCut::theMinMass, GeV, 0*GeV, 0*GeV, Constants::MaxEnergy,
false, false, Interface::limited);
static Parameter<InvariantMassCut,Energy> interfaceMaxMass
("MaxMass",
"The maximal allowed invariant mass ",
&InvariantMassCut::theMaxMass, GeV, Constants::MaxEnergy, 0*GeV, Constants::MaxEnergy,
false, false, Interface::limited);
static Switch<InvariantMassCut,bool> interfaceSameFlavourOnly
("SameFlavourOnly",
"Whether cut works on fermion pairs of the same flavour only ",
&InvariantMassCut::theSameFlavourOnly, true, false, false);
static SwitchOption interfaceSameFlavourOnlyTrue
(interfaceSameFlavourOnly,
"True",
"True",
true);
static SwitchOption interfaceSameFlavourOnlyFalse
(interfaceSameFlavourOnly,
"False",
"False",
false);
static Switch<InvariantMassCut,bool> interfaceOppositeSignOnly
("OppositeSignOnly",
"Whether cut works on fermion pairs of opposite sign only ",
&InvariantMassCut::theOppositeSignOnly, true, false, false);
static SwitchOption interfaceOppositeSignOnlyTrue
(interfaceOppositeSignOnly,
"True",
"True",
true);
static SwitchOption interfaceOppositeSignOnlyFalse
(interfaceOppositeSignOnly,
"False",
"False",
false);
static Reference<InvariantMassCut,MatcherBase> interfaceFirstMatcher
("FirstMatcher",
"Matcher for first particle of type pitype in the pair (pitype,pjtype). "
"Only particles matching this object will be affected by the cut. ",
&InvariantMassCut::theFirstMatcher, true, false, true, true, false);
static Reference<InvariantMassCut,MatcherBase> interfaceSecondMatcher
("SecondMatcher",
"Matcher for second particle of type pjtype in the pair (pitype,pjtype). "
"Only particles matching this object will be affected by the cut. ",
&InvariantMassCut::theSecondMatcher, true, false, true, true, false);
}
diff --git a/MatrixElement/Matchbox/Cuts/MatchboxDeltaRCut.cc b/MatrixElement/Matchbox/Cuts/MatchboxDeltaRCut.cc
--- a/MatrixElement/Matchbox/Cuts/MatchboxDeltaRCut.cc
+++ b/MatrixElement/Matchbox/Cuts/MatchboxDeltaRCut.cc
@@ -1,197 +1,195 @@
// -*- C++ -*-
//
// MatchboxDeltaRCut.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2012 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the MatchboxDeltaRCut class.
//
#include "MatchboxDeltaRCut.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/Interface/Parameter.h"
#include "ThePEG/Interface/Command.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/EventRecord/Particle.h"
#include "ThePEG/Repository/UseRandom.h"
#include "ThePEG/Repository/EventGenerator.h"
#include "ThePEG/Utilities/DescribeClass.h"
#include "ThePEG/Repository/CurrentGenerator.h"
#include "ThePEG/Cuts/Cuts.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
using namespace Herwig;
MatchboxDeltaRCut::MatchboxDeltaRCut()
: theDeltaRMin(0.0), theDeltaRMax(Constants::MaxRapidity),
theDeltaYMin(0.0), theDeltaYMax(Constants::MaxRapidity),
theDeltaPhiMin(0.0), theDeltaPhiMax(2.0*Constants::pi) {}
MatchboxDeltaRCut::~MatchboxDeltaRCut() {}
IBPtr MatchboxDeltaRCut::clone() const {
return new_ptr(*this);
}
IBPtr MatchboxDeltaRCut::fullclone() const {
return new_ptr(*this);
}
bool MatchboxDeltaRCut::passCuts(tcCutsPtr parent, tcPDPtr pitype, tcPDPtr pjtype,
LorentzMomentum pi, LorentzMomentum pj,
bool inci, bool incj) const {
bool match = false;
if ( theFirstMatcher->check(*pitype) && theSecondMatcher->check(*pjtype) ) match = true;
if ( theFirstMatcher->check(*pjtype) && theSecondMatcher->check(*pitype) ) match = true;
if ( !match ||
(theDeltaRMin == 0.0 && theDeltaRMax == Constants::MaxRapidity &&
theDeltaYMin == 0.0 && theDeltaYMax == Constants::MaxRapidity &&
theDeltaPhiMin == 0.0 && theDeltaPhiMax == 2.0*Constants::pi) ) return true;
if ( inci || incj ) return true;
double weight = 1.0;
double dY = abs(pi.rapidity() - pj.rapidity());
double dPhi = abs(pi.phi() - pj.phi());
if ( dPhi > Constants::pi ) dPhi = 2.0*Constants::pi - dPhi;
double dR = sqrt(sqr(dY) + sqr(dPhi));
if ( !parent->isInside<CutTypes::Rapidity>(dY,deltaYMin(),deltaYMax(),weight) )
{
parent->lastCutWeight(0.0);
return false;
}
if ( !parent->isInside<CutTypes::Azimuth>(dPhi,deltaPhiMin(),deltaPhiMax(),weight) )
{
parent->lastCutWeight(0.0);
return false;
}
if ( !parent->isInside<CutTypes::Rapidity>(dR,deltaRMin(),deltaRMax(),weight) )
{
parent->lastCutWeight(0.0);
return false;
}
parent->lastCutWeight(weight);
return true;
}
void MatchboxDeltaRCut::describe() const {
CurrentGenerator::log()
<< fullName() << "\n"
<< "matching distances between: '"
<< theFirstMatcher->name() << "' and '"
<< theSecondMatcher->name() << "':\n"
<< "DeltaRMin = " << theDeltaRMin << " \n"
<< "DeltaRMax = " << theDeltaRMax << " \n"
<< "DeltaPhiMin = " << theDeltaPhiMin << " \n"
<< "DeltaPhiMax = " << theDeltaPhiMax << " \n"
<< "DeltaYMin = " << theDeltaYMin << " \n"
- << "DeltaYMax = " << theDeltaYMax << " \n"
- << "FirstMatcher = " << theFirstMatcher << " \n"
- << "SecondMatcher = " << theSecondMatcher << " \n\n";
+ << "DeltaYMax = " << theDeltaYMax << " \n\n"
}
// If needed, insert default implementations of virtual function defined
// in the InterfacedBase class here (using ThePEG-interfaced-impl in Emacs).
void MatchboxDeltaRCut::persistentOutput(PersistentOStream & os) const {
os << theDeltaYMin << theDeltaYMax
<< theDeltaPhiMin << theDeltaPhiMax
<< theDeltaRMin << theDeltaRMax
<< theFirstMatcher << theSecondMatcher;
}
void MatchboxDeltaRCut::persistentInput(PersistentIStream & is, int) {
is >> theDeltaYMin >> theDeltaYMax
>> theDeltaPhiMin >> theDeltaPhiMax
>> theDeltaRMin >> theDeltaRMax
>> theFirstMatcher >> theSecondMatcher;
}
// *** Attention *** The following static variable is needed for the type
// description system in ThePEG. Please check that the template arguments
// are correct (the class and its base class), and that the constructor
// arguments are correct (the class name and the name of the dynamically
// loadable library where the class implementation can be found).
DescribeClass<MatchboxDeltaRCut,TwoCutBase>
describeHerwigMatchboxDeltaRCut("Herwig::MatchboxDeltaRCut", "HwMatchboxCuts.so");
void MatchboxDeltaRCut::Init() {
static ClassDocumentation<MatchboxDeltaRCut> documentation
("This class implements cuts on legoplot, rapidity and azimuthal separation, "
"i.e. on the \\f$\\Delta R\\f$-measure and on \\f$\\Delta Y\\f$ and \\f$\\Delta \\phi\\f$. "
"By default the cuts are only applied to coloured particles, but "
"may optionally be applied to all particle types. ");
static Parameter<MatchboxDeltaRCut,double> interfaceDeltaRMin
("DeltaRMin",
"The minimum allowed for the legoplot distance "
"\\f$\\Delta R_{ij}=\\sqrt{\\Delta \\phi_{ij}^2+\\Delta Y_{ij}^2}\\f$ ",
&MatchboxDeltaRCut::theDeltaRMin, 0.0, 0.0, 0,
false, false, Interface::lowerlim);
static Parameter<MatchboxDeltaRCut,double> interfaceDeltaRMax
("DeltaRMax",
"The maximum allowed for the legoplot distance "
"\\f$\\Delta R_{ij}=\\sqrt{\\Delta \\phi_{ij}^2+\\Delta Y_{ij}^2}\\f$ ",
&MatchboxDeltaRCut::theDeltaRMax, Constants::MaxRapidity, 0, 0,
false, false, Interface::lowerlim);
static Parameter<MatchboxDeltaRCut,double> interfaceDeltaPhiMin
("DeltaPhiMin",
"The minimum allowed for the azimuthal separation "
"\\f$\\Delta \\phi_{ij}\\f$ ",
&MatchboxDeltaRCut::theDeltaPhiMin, 0.0, 0.0, 0,
false, false, Interface::lowerlim);
static Parameter<MatchboxDeltaRCut,double> interfaceDeltaPhiMax
("DeltaPhiMax",
"The maximum allowed for the azimuthal separation "
"\\f$\\Delta \\phi_{ij}\\f$ ",
&MatchboxDeltaRCut::theDeltaPhiMax, 2.0*Constants::pi, 0, 0,
false, false, Interface::lowerlim);
static Parameter<MatchboxDeltaRCut,double> interfaceDeltaYMin
("DeltaYMin",
"The minimum allowed for the rapidity separation "
"\\f$\\Delta Y_{ij}\\f$ ",
&MatchboxDeltaRCut::theDeltaYMin, 0.0, 0.0, 0,
false, false, Interface::lowerlim);
static Parameter<MatchboxDeltaRCut,double> interfaceDeltaYMax
("DeltaYMax",
"The maximum allowed for the rapidity separation "
"\\f$\\Delta Y_{ij}\\f$ ",
&MatchboxDeltaRCut::theDeltaYMax, Constants::MaxRapidity, 0, 0,
false, false, Interface::lowerlim);
static Reference<MatchboxDeltaRCut,MatcherBase> interfaceFirstMatcher
("FirstMatcher",
"Matcher for first particle of type pitype in the pair (pitype,pjtype). "
"If non-null only particles matching this object will be affected "
"by the cut. ",
&MatchboxDeltaRCut::theFirstMatcher, true, false, true, true, false);
// &MatchboxDeltaRCut::theFirstMatcher, false, false, true, false, false);
static Reference<MatchboxDeltaRCut,MatcherBase> interfaceSecondMatcher
("SecondMatcher",
"Matcher for second particle of type pjtype in the pair (pitype,pjtype). "
"If non-null only particles matching this object will be affected "
"by the cut. ",
&MatchboxDeltaRCut::theSecondMatcher, true, false, true, true, false);
// &MatchboxDeltaRCut::theSecondMatcher, false, false, true, false, false);
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Feb 24, 6:40 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4493313
Default Alt Text
(15 KB)
Attached To
R563 testingHerwigHG
Event Timeline
Log In to Comment