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
Allow a boost on particles in PythiaMomDauFilter, PythiaFilter and PythiaFilterMultiMother #20140
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4fb8b5b
add boost to gen filters
ace179b
add boost to PythiaFilterMultiMother
3bd4f40
1.include header file for FourVector; 2.move the requirements that do…
e1fa7ea
move zboost to helper function
59fe3d7
clean the FourVector namespcae which is not needed in PythiaFilter.h …
31f3bcd
apply code-check patch
0b25398
use zboost helper for more filters
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
GeneratorInterface/GenFilters/interface/MCFilterZboostHelper.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MCFilterZboostHelper_h | ||
#define MCFilterZboostHelper_h | ||
|
||
#include "HepMC/SimpleVector.h" | ||
|
||
namespace HepMC { | ||
class FourVector; | ||
} | ||
|
||
namespace MCFilterZboostHelper{ | ||
|
||
HepMC::FourVector zboost(const HepMC::FourVector&, double); | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,7 @@ | |
// | ||
// | ||
|
||
namespace edm { | ||
class HepMCProduct; | ||
} | ||
|
||
// system include files | ||
#include <memory> | ||
|
||
|
@@ -35,6 +33,9 @@ namespace edm { | |
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
namespace edm { | ||
class HepMCProduct; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for both of these additions |
||
} | ||
|
||
// | ||
// class decleration | ||
|
@@ -43,16 +44,14 @@ namespace edm { | |
class PythiaMomDauFilter : public edm::EDFilter { | ||
public: | ||
explicit PythiaMomDauFilter(const edm::ParameterSet&); | ||
~PythiaMomDauFilter(); | ||
~PythiaMomDauFilter() override; | ||
|
||
|
||
virtual bool filter(edm::Event&, const edm::EventSetup&); | ||
bool filter(edm::Event&, const edm::EventSetup&) override; | ||
private: | ||
// ----------memeber function---------------------- | ||
|
||
// ----------member data --------------------------- | ||
|
||
edm::EDGetTokenT<edm::HepMCProduct> label_; | ||
edm::EDGetTokenT<edm::HepMCProduct> label_; | ||
std::vector<int> dauIDs; | ||
std::vector<int> desIDs; | ||
int particleID; | ||
|
@@ -68,6 +67,7 @@ class PythiaMomDauFilter : public edm::EDFilter { | |
double mom_maxptcut; | ||
double mom_minetacut; | ||
double mom_maxetacut; | ||
double betaBoost; | ||
}; | ||
#define PYCOMP pycomp_ | ||
extern "C" { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "GeneratorInterface/GenFilters/interface/MCFilterZboostHelper.h" | ||
|
||
HepMC::FourVector MCFilterZboostHelper::zboost(const HepMC::FourVector& mom, double betaBoost) { | ||
//Boost this Lorentz vector (from TLorentzVector::Boost) | ||
double b2 = betaBoost*betaBoost; | ||
double gamma = 1.0 / sqrt(1.0 - b2); | ||
double bp = betaBoost*mom.pz(); | ||
double gamma2 = b2 > 0 ? (gamma - 1.0)/b2 : 0.0; | ||
|
||
return HepMC::FourVector(mom.px(), mom.py(), mom.pz() + gamma2*bp*betaBoost + gamma*betaBoost*mom.e(), gamma*(mom.e()+bp)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @zc11 - actually I realize CMS has a few implementations of this already. Please use one or adopt the others to use this one - which may require some small refactoring . (https://cmssdt.cern.ch/lxr/search?_filestring=&_string=HepMC%3A%3AFourVector+zboost)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review.
I've modified the mentioned 3 filters to use MCfilterZboostHelper
Please let me know if it's ok