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/contrib/ConstituentSubtractor.hh"
59 useMassDropTagger_(
false),
61 useDynamicFiltering_(
false),
64 useCMSBoostedTauSeedingAlgorithm_(
false),
66 useConstituentSubtraction_(
false),
82 if ( iConfig.
exists(
"UseOnlyVertexTracks") )
87 if ( iConfig.
exists(
"UseOnlyOnePV") )
92 if ( iConfig.
exists(
"DzTrVtxMax") )
96 if ( iConfig.
exists(
"DxyTrVtxMax") )
100 if ( iConfig.
exists(
"MinVtxNdof") )
104 if ( iConfig.
exists(
"MaxVtxZ") )
110 if ( iConfig.
exists(
"useFiltering") ||
111 iConfig.
exists(
"useTrimming") ||
112 iConfig.
exists(
"usePruning") ||
113 iConfig.
exists(
"useMassDropTagger") ||
114 iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ||
115 iConfig.
exists(
"useConstituentSubtraction") ||
116 iConfig.
exists(
"useSoftDrop")
149 if ( iConfig.
exists(
"useMassDropTagger") ) {
155 if ( iConfig.
exists(
"useFiltering") ) {
159 if ( iConfig.
exists(
"useDynamicFiltering") ) {
167 if ( iConfig.
exists(
"useTrimming") ) {
173 if ( iConfig.
exists(
"usePruning") ) {
178 if ( iConfig.
exists(
"useKtPruning") )
182 if ( iConfig.
exists(
"useCMSBoostedTauSeedingAlgorithm") ) {
194 if ( iConfig.
exists(
"useConstituentSubtraction") ) {
197 throw cms::Exception(
"AreaMustBeSet") <<
"Logic error. The area definition must be set if you use constituent subtraction." << std::endl;
205 if ( iConfig.
exists(
"useSoftDrop") ) {
207 throw cms::Exception(
"PruningAndSoftDrop") <<
"Logic error. Soft drop is a generalized pruning, do not run them together." << std::endl;
263 std::vector<edm::Ptr<reco::RecoChargedRefCandidate> > allInputs;
264 std::vector<edm::Ptr<reco::Candidate> > origInputs;
265 for (
size_t i = 0;
i < inputsHandle->size(); ++
i) {
266 allInputs.push_back(inputsHandle->ptrAt(
i));
267 origInputs.push_back(inputsHandle->ptrAt(
i));
274 std::auto_ptr<std::vector<reco::TrackJet> >
jets(
new std::vector<reco::TrackJet>() );
277 for (reco::VertexCollection::const_iterator itVtx = pvCollection->begin(); itVtx != pvCollection->end(); ++itVtx) {
278 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
296 if ((*itIn)->track() == trref) {
301 allInputs.erase(itIn);
307 if (!found)
edm::LogInfo(
"FastjetTrackJetProducer") <<
"Ignoring a track at vertex which is not in input track collection!";
314 float dz = (*itIn)->track()->dz(itVtx->position());
315 float dxy = (*itIn)->track()->dxy(itVtx->position());
318 bool closervtx =
false;
320 for (reco::VertexCollection::const_iterator itVtx2 = pvCollection->begin(); itVtx2 != pvCollection->end(); ++itVtx2) {
321 if (itVtx->isFake() || itVtx->ndof() <
minVtxNdof_ || fabs(itVtx->z()) >
maxVtxZ_)
continue;
325 fabs((*itIn)->track()->dz(itVtx2->position())) < fabs(dz)) {
331 if (closervtx)
continue;
335 allInputs.erase(itIn);
344 LogDebug(
"FastjetTrackJetProducer") <<
"Inputted towers\n";
348 LogDebug(
"FastjetTrackJetProducer") <<
"Ran algorithm\n";
351 for (
unsigned int ijet=0;ijet<
fjJets_.size();++ijet) {
353 std::vector<fastjet::PseudoJet> fjConstituents = sorted_by_pt(
fjClusterSeq_->constituents(
fjJets_[ijet]));
355 std::vector<reco::CandidatePtr> constituents =
getConstituents(fjConstituents);
361 vertex_, constituents, iSetup);
366 jets->push_back(jet);
373 LogDebug(
"FastjetTrackJetProducer") <<
"Put " << jets->size() <<
" jets in the event.\n";
425 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
427 unique_ptr<fastjet::JetMedianBackgroundEstimator> bge_rho;
429 fastjet::Selector rho_range = fastjet::SelectorAbsRapMax(
csRho_EtaMax_);
430 bge_rho = unique_ptr<fastjet::JetMedianBackgroundEstimator> (
new fastjet::JetMedianBackgroundEstimator(rho_range, fastjet::JetDefinition(fastjet::kt_algorithm,
csRParam_), *
fjAreaDefinition_) );
432 fastjet::contrib::ConstituentSubtractor * constituentSubtractor =
new fastjet::contrib::ConstituentSubtractor(bge_rho.get());
434 constituentSubtractor->use_common_bge_for_rho_and_rhom(
true);
439 fastjet::MassDropTagger * md_tagger =
new fastjet::MassDropTagger (
muCut_,
yCut_ );
443 fastjet::contrib::CMSBoostedTauSeedingAlgorithm * tau_tagger =
457 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::cambridge_algorithm,
zCut_,
RcutFactor_);
467 fastjet::Pruner * pruner =
new fastjet::Pruner(fastjet::kt_algorithm,
zCut_,
RcutFactor_);
472 fastjet::contrib::SoftDrop *
sd =
new fastjet::contrib::SoftDrop(
beta_,
zCut_,
R0_ );
477 for ( std::vector<fastjet::PseudoJet>::const_iterator ijet = tempJets.begin(),
478 ijetEnd = tempJets.end(); ijet != ijetEnd; ++ijet ) {
480 fastjet::PseudoJet transformedJet = *ijet;
482 for ( transformer_coll::const_iterator itransf = transformers.begin(),
483 itransfEnd = transformers.end(); itransf != itransfEnd; ++itransf ) {
484 if ( transformedJet != 0 ) {
485 transformedJet = (**itransf)(transformedJet);
492 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.
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 soft drop : R0 (angular distance normalization - should be set to jet radius in most cases) ...
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
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
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 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_