29 #include "fastjet/SISConePlugin.hh"
30 #include "fastjet/CMSIterativeConePlugin.hh"
31 #include "fastjet/ATLASConePlugin.hh"
32 #include "fastjet/CDFMidPointPlugin.hh"
33 #include "fastjet/tools/Filter.hh"
34 #include "fastjet/tools/Pruner.hh"
35 #include "fastjet/tools/MassDropTagger.hh"
36 #include "fastjet/contrib/SoftDrop.hh"
37 #include "fastjet/tools/JetMedianBackgroundEstimator.hh"
38 #include "fastjet/tools/GridMedianBackgroundEstimator.hh"
39 #include "fastjet/tools/Subtractor.hh"
40 #include "fastjet/contrib/ConstituentSubtractor.hh"
61 useMassDropTagger_(
false),
63 useDynamicFiltering_(
false),
66 useCMSBoostedTauSeedingAlgorithm_(
false),
68 useConstituentSubtraction_(
false),
83 gridMaxRapidity_(-1.0),
87 if ( iConfig.
exists(
"UseOnlyVertexTracks") )
92 if ( iConfig.
exists(
"UseOnlyOnePV") )
97 if ( iConfig.
exists(
"DzTrVtxMax") )
101 if ( iConfig.
exists(
"DxyTrVtxMax") )
105 if ( iConfig.
exists(
"MinVtxNdof") )
109 if ( iConfig.
exists(
"MaxVtxZ") )
115 if ( iConfig.
exists(
"useFiltering") ||
116 iConfig.
exists(
"useTrimming") ||
117 iConfig.
exists(
"usePruning") ||
118 iConfig.
exists(
"useMassDropTagger") ||
119 iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ||
120 iConfig.
exists(
"useConstituentSubtraction") ||
121 iConfig.
exists(
"useSoftDrop")
154 if ( iConfig.
exists(
"useMassDropTagger") ) {
160 if ( iConfig.
exists(
"useFiltering") ) {
164 if ( iConfig.
exists(
"useDynamicFiltering") ) {
172 if ( iConfig.
exists(
"useTrimming") ) {
178 if ( iConfig.
exists(
"usePruning") ) {
183 if ( iConfig.
exists(
"useKtPruning") )
187 if ( iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ) {
199 if ( iConfig.
exists(
"useConstituentSubtraction") ) {
202 throw cms::Exception(
"AreaMustBeSet") <<
"Logic error. The area definition must be set if you use constituent subtraction." << std::endl;
210 if ( iConfig.
exists(
"useSoftDrop") ) {
212 throw cms::Exception(
"PruningAndSoftDrop") <<
"Logic error. Soft drop is a generalized pruning, do not run them together." << std::endl;
222 if ( iConfig.
exists(
"correctShape") ) {
275 std::vector<edm::Ptr<reco::RecoChargedRefCandidate> > allInputs;
276 std::vector<edm::Ptr<reco::Candidate> > origInputs;
277 for (
size_t i = 0;
i < inputsHandle->size(); ++
i) {
278 allInputs.push_back(inputsHandle->ptrAt(
i));
279 origInputs.push_back(inputsHandle->ptrAt(
i));
286 std::auto_ptr<std::vector<reco::TrackJet> >
jets(
new std::vector<reco::TrackJet>() );
289 for (reco::VertexCollection::const_iterator itVtx = pvCollection->begin(); itVtx != pvCollection->end(); ++itVtx) {
290 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
308 if ((*itIn)->track() == trref) {
313 allInputs.erase(itIn);
319 if (!found)
edm::LogInfo(
"FastjetTrackJetProducer") <<
"Ignoring a track at vertex which is not in input track collection!";
326 float dz = (*itIn)->track()->dz(itVtx->position());
327 float dxy = (*itIn)->track()->dxy(itVtx->position());
330 bool closervtx =
false;
332 for (reco::VertexCollection::const_iterator itVtx2 = pvCollection->begin(); itVtx2 != pvCollection->end(); ++itVtx2) {
333 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
337 fabs((*itIn)->track()->dz(itVtx2->position())) < fabs(dz)) {
343 if (closervtx)
continue;
347 allInputs.erase(itIn);
356 LogDebug(
"FastjetTrackJetProducer") <<
"Inputted towers\n";
360 LogDebug(
"FastjetTrackJetProducer") <<
"Ran algorithm\n";
363 for (
unsigned int ijet=0;ijet<
fjJets_.size();++ijet) {
365 std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(
fjClusterSeq_->constituents(
fjJets_[ijet]));
367 std::vector<reco::CandidatePtr> constituents =
getConstituents(fjConstituents);
373 vertex_, constituents, iSetup);
378 jets->push_back(jet);
385 LogDebug(
"FastjetTrackJetProducer") <<
"Put " << jets->size() <<
" jets in the event.\n";
437 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
439 unique_ptr<fastjet::JetMedianBackgroundEstimator> bge_rho;
441 fastjet::Selector rho_range = fastjet::SelectorAbsRapMax(
csRho_EtaMax_);
442 bge_rho = unique_ptr<fastjet::JetMedianBackgroundEstimator> (
new fastjet::JetMedianBackgroundEstimator(rho_range, fastjet::JetDefinition(fastjet::kt_algorithm,
csRParam_), *
fjAreaDefinition_) );
444 fastjet::contrib::ConstituentSubtractor * constituentSubtractor =
new fastjet::contrib::ConstituentSubtractor(bge_rho.get());
446 constituentSubtractor->use_common_bge_for_rho_and_rhom(
true);
451 fastjet::MassDropTagger * md_tagger =
new fastjet::MassDropTagger (
muCut_,
yCut_ );
455 fastjet::contrib::CMSBoostedTauSeedingAlgorithm * tau_tagger =
469 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::cambridge_algorithm,
zCut_,
RcutFactor_);
479 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::kt_algorithm,
zCut_,
RcutFactor_);
484 fastjet::contrib::SoftDrop *
sd =
new fastjet::contrib::SoftDrop(
beta_,
zCut_,
R0_ );
488 unique_ptr<fastjet::Subtractor> subtractor;
489 unique_ptr<fastjet::GridMedianBackgroundEstimator> bge_rho_grid;
491 bge_rho_grid = unique_ptr<fastjet::GridMedianBackgroundEstimator> (
new fastjet::GridMedianBackgroundEstimator(
gridMaxRapidity_,
gridSpacing_) );
493 subtractor = unique_ptr<fastjet::Subtractor>(
new fastjet::Subtractor( bge_rho_grid.get()) );
494 subtractor->set_use_rho_m();
499 for ( std::vector<fastjet::PseudoJet>::const_iterator ijet = tempJets.begin(),
500 ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) {
502 fastjet::PseudoJet transformedJet = *ijet;
504 for ( transformer_coll::const_iterator itransf = transformers.begin(),
505 itransfEnd = transformers.end(); itransf != itransfEnd; ++itransf ) {
506 if ( transformedJet != 0 ) {
507 transformedJet = (**itransf)(transformedJet);
514 transformedJet = (*subtractor)(transformedJet);
518 fjJets_.push_back( transformedJet );
double muMin_
for CMSBoostedTauSeedingAlgorithm : subjet pt min
void swap(ora::Record &rh, ora::Record &lh)
T getParameter(std::string const &) const
double yMin_
for CMSBoostedTauSeedingAlgorithm : max mass-drop
bool useFiltering_
Mass-drop tagging for boosted Higgs.
bool correctShape_
Soft drop.
double rFilt_
for mass-drop tagging, symmetry cut: min(pt1^2,pt2^2) * dR(1,2) / mjet > ycut
reco::Particle::Point vertex_
double dRMax_
for CMSBoostedTauSeedingAlgorithm : min dR
double subjetPtMin_
for shape subtraction, get the grid spacing
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
std::vector< fastjet::PseudoJet > fjJets_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void setPileup(float fEnergy)
Set pileup energy contribution as calculated by algorithm.
virtual void inputTowers()
virtual void runAlgorithm(edm::Event &iEvent, const edm::EventSetup &iSetup)
#define DEFINE_FWK_MODULE(type)
bool useOnlyVertexTracks_
bool useDynamicFiltering_
Jet filtering technique.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
double RcutFactor_
for pruning OR soft drop: constituent minimum pt fraction of parent cluster
bool useSoftDrop_
constituent subtraction technique
double yMax_
for CMSBoostedTauSeedingAlgorithm : min asymmetry
double gridSpacing_
for shape subtraction, get the fixed-grid rho
bool useKtPruning_
algorithm for seeding reconstruction of boosted Taus (similar to mass-drop tagging) ...
FastjetJetProducer(const edm::ParameterSet &iConfig)
bool useTrimming_
Use dynamic filtering radius (as in arXiv:0802.2470)
double csRParam_
for constituent subtraction : maximum rapidity for ghosts
bool makeTrackJet(const JetType::Type &fTag)
virtual void setJetArea(float fArea)
set jet area
std::vector< fastjet::PseudoJet > fjInputs_
std::vector< transformer_ptr > transformer_coll
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
double trimPtFracMin_
for filtering, pruning: number of subjets expected
double gridMaxRapidity_
for soft drop : R0 (angular distance normalization - should be set to jet radius in most cases) ...
bool usePruning_
Jet trimming technique.
std::vector< edm::Ptr< reco::Candidate > > inputs_
bool useCMSBoostedTauSeedingAlgorithm_
Jet pruning technique.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ClusterSequencePtr fjClusterSeq_
virtual void produceTrackJets(edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::EDGetTokenT< edm::View< reco::RecoChargedRefCandidate > > input_chrefcand_token_
for CMSBoostedTauSeedingAlgorithm : max depth for descending into clustering sequence ...
double csRho_EtaMax_
for pruning: constituent dR * pt/2m < rcut_factor
double muMax_
for CMSBoostedTauSeedingAlgorithm : min mass-drop
double muCut_
Correct the shape of the jets.
double rFiltFactor_
for dynamic filtering radius (as in arXiv:0802.2470)
DynamicRfiltPtr rFiltDynamic_
for filtering, trimming: dR scale of sub-clustering
void setPrimaryVertex(const reco::VertexRef &vtx)
set associated primary vertex
double dRMin_
for CMSBoostedTauSeedingAlgorithm : max asymmetry
boost::shared_ptr< DynamicRfilt > DynamicRfiltPtr
double beta_
for constituent subtraction : R parameter for KT alg in jet median background estimator ...
double zCut_
for trimming: constituent minimum pt fraction of full jet
virtual void setVertex(const Point &vertex)
set vertex
int nFilt_
for dynamic filtering radius (as in arXiv:0802.2470)
int maxDepth_
for CMSBoostedTauSeedingAlgorithm : max dR
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
double R0_
for soft drop : beta (angular exponent)
std::unique_ptr< transformer > transformer_ptr
double yCut_
for mass-drop tagging, m0/mjet (m0 = mass of highest mass subjet)
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
virtual ~FastjetJetProducer()
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
bool useConstituentSubtraction_
Use Kt clustering algorithm for pruning (default is Cambridge/Aachen)
AreaDefinitionPtr fjAreaDefinition_
volatile std::atomic< bool > shutdown_flag false
math::XYZTLorentzVector LorentzVector
Lorentz vector.
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, edm::EventSetup const &c)
JetDefPtr fjJetDefinition_