CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
cms::CSJetProducer Class Reference

#include <CSJetProducer.h>

Inheritance diagram for cms::CSJetProducer:
VirtualJetProducer edm::stream::EDProducer<>

Public Member Functions

 CSJetProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~CSJetProducer () override
 
- Public Member Functions inherited from VirtualJetProducer
std::string jetType () const
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 VirtualJetProducer (const edm::ParameterSet &iConfig)
 
 ~VirtualJetProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromCSJetProducer (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from VirtualJetProducer
static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static void fillDescriptionsFromVirtualJetProducer (edm::ParameterSetDescription &desc)
 

Protected Member Functions

void runAlgorithm (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
- Protected Member Functions inherited from VirtualJetProducer
virtual void addHTTTopJetTagInfoCollection (edm::Event &iEvent, const edm::EventSetup &iSetup, edm::OrphanHandle< reco::BasicJetCollection > &oh)
 
virtual void copyConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents, reco::Jet *jet)
 
virtual std::vector< reco::CandidatePtrgetConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents)
 
virtual void inputTowers ()
 
virtual bool isAnomalousTower (reco::CandidatePtr input)
 
bool makeBasicJet (const JetType::Type &fTag)
 
bool makeCaloJet (const JetType::Type &fTag)
 
bool makeGenJet (const JetType::Type &fTag)
 
bool makePFClusterJet (const JetType::Type &fTag)
 
bool makePFJet (const JetType::Type &fTag)
 
virtual void makeProduces (std::string s, std::string tag="")
 
bool makeTrackJet (const JetType::Type &fTag)
 
void offsetCorrectJets (std::vector< fastjet::PseudoJet > &orphanInput)
 
virtual void output (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
template<typename T >
void writeCompoundJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 
template<typename T >
void writeJets (edm::Event &iEvent, edm::EventSetup const &iSetup)
 
template<typename T >
void writeJetsWithConstituents (edm::Event &iEvent, edm::EventSetup const &iSetup)
 function template to write out the outputs More...
 

Protected Attributes

double csAlpha_
 for constituent subtraction : R parameter More...
 
double csRParam_
 
edm::EDGetTokenT< std::vector< double > > etaToken_
 for HI constituent subtraction : alpha (power of pt in metric) More...
 
edm::EDGetTokenT< std::vector< double > > rhomToken_
 
edm::EDGetTokenT< std::vector< double > > rhoToken_
 
- Protected Attributes inherited from VirtualJetProducer
int activeAreaRepeats_
 
bool doAreaDiskApprox_
 
bool doAreaFastjet_
 
bool doFastJetNonUniform_
 
bool doPUOffsetCorr_
 
bool doPVCorrection_
 
bool doRhoFastjet_
 
ActiveAreaSpecPtr fjActiveArea_
 
AreaDefinitionPtr fjAreaDefinition_
 
ClusterSequencePtr fjClusterSeq_
 
std::vector< fastjet::PseudoJet > fjInputs_
 
JetDefPtr fjJetDefinition_
 
std::vector< fastjet::PseudoJet > fjJets_
 
PluginPtr fjPlugin_
 
SelectorPtr fjSelector_
 
bool fromHTTTopJetProducer_ = false
 
double ghostArea_
 
double ghostEtaMax_
 
edm::EDGetTokenT< reco::VertexCollectioninput_vertex_token_
 
double inputEMin_
 
double inputEtMin_
 
std::vector< edm::Ptr< reco::Candidate > > inputs_
 
std::string jetAlgorithm_
 
std::string jetCollInstanceName_
 
double jetPtMin_
 
std::string jetType_
 
JetType::Type jetTypeE
 
unsigned int maxInputs_
 
unsigned int minSeed_
 
std::string moduleLabel_
 
unsigned int nExclude_
 
std::vector< double > puCenters_
 
std::string puSubtractorName_
 
double puWidth_
 
bool restrictInputs_
 
double rhoEtaMax_
 
double rParam_
 
edm::InputTag src_
 
edm::InputTag srcPVs_
 
boost::shared_ptr< PileUpSubtractorsubtractor_
 
bool useDeterministicSeed_
 
bool useExplicitGhosts_
 
int verbosity_
 
reco::Particle::Point vertex_
 
double voronoiRfact_
 
bool writeCompound_
 
bool writeJetsWithConst_
 

Additional Inherited Members

- Public Types inherited from VirtualJetProducer
typedef boost::shared_ptr< fastjet::GhostedAreaSpec > ActiveAreaSpecPtr
 
typedef boost::shared_ptr< fastjet::AreaDefinition > AreaDefinitionPtr
 
typedef boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
 
typedef boost::shared_ptr< fastjet::JetDefinition > JetDefPtr
 
typedef boost::shared_ptr< fastjet::JetDefinition::Plugin > PluginPtr
 
typedef boost::shared_ptr< fastjet::Selector > SelectorPtr
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 24 of file CSJetProducer.h.

Constructor & Destructor Documentation

CSJetProducer::CSJetProducer ( const edm::ParameterSet ps)

Definition at line 13 of file CSJetProducer.cc.

References csAlpha_, csRParam_, etaToken_, edm::ParameterSet::getParameter(), rhomToken_, and rhoToken_.

13  :
14  VirtualJetProducer( conf ),
15  csRParam_(-1.0),
16  csAlpha_(0.)
17 {
18  //get eta range, rho and rhom map
19  etaToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>( "etaMap" ));
20  rhoToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>( "rho" ));
21  rhomToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>( "rhom" ));
22  csRParam_ = conf.getParameter<double>("csRParam");
23  csAlpha_ = conf.getParameter<double>("csAlpha");
24 }
double csAlpha_
for constituent subtraction : R parameter
Definition: CSJetProducer.h:41
edm::EDGetTokenT< std::vector< double > > rhoToken_
Definition: CSJetProducer.h:45
edm::EDGetTokenT< std::vector< double > > etaToken_
for HI constituent subtraction : alpha (power of pt in metric)
Definition: CSJetProducer.h:44
edm::EDGetTokenT< std::vector< double > > rhomToken_
Definition: CSJetProducer.h:46
VirtualJetProducer(const edm::ParameterSet &iConfig)
cms::CSJetProducer::~CSJetProducer ( )
inlineoverride

Member Function Documentation

void CSJetProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 126 of file CSJetProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), fillDescriptionsFromCSJetProducer(), and VirtualJetProducer::fillDescriptionsFromVirtualJetProducer().

Referenced by ~CSJetProducer().

126  {
127 
128  edm::ParameterSetDescription descCSJetProducer;
130  fillDescriptionsFromCSJetProducer(descCSJetProducer);
132  descCSJetProducer.add<string>("jetCollInstanceName", "" );
134  descCSJetProducer.add<bool> ("sumRecHits", false);
135 
137  descriptions.add("CSJetProducer",descCSJetProducer);
138 
139 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)
static void fillDescriptionsFromCSJetProducer(edm::ParameterSetDescription &desc)
void CSJetProducer::fillDescriptionsFromCSJetProducer ( edm::ParameterSetDescription desc)
static

Definition at line 141 of file CSJetProducer.cc.

References edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

Referenced by fillDescriptions(), and ~CSJetProducer().

141  {
142 
143  desc.add<double>("csRParam",-1.);
144  desc.add<double>("csAlpha",2.);
145 
146  desc.add<edm::InputTag>("etaMap",edm::InputTag("hiFJRhoProducer","mapEtaEdges") );
147  desc.add<edm::InputTag>("rho",edm::InputTag("hiFJRhoProducer","mapToRho") );
148  desc.add<edm::InputTag>("rhom",edm::InputTag("hiFJRhoProducer","mapToRhoM") );
149 
150 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void CSJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 26 of file CSJetProducer.cc.

References VirtualJetProducer::fjClusterSeq_, and VirtualJetProducer::produce().

Referenced by ~CSJetProducer().

27 {
28  // use the default production from one collection
29  VirtualJetProducer::produce( iEvent, iSetup );
30  //use runAlgorithm of this class
31 
32  //Delete allocated memory. It is allocated every time runAlgorithm is called
33  fjClusterSeq_.reset();
34 }
ClusterSequencePtr fjClusterSeq_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void CSJetProducer::runAlgorithm ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements VirtualJetProducer.

Definition at line 37 of file CSJetProducer.cc.

References csAlpha_, csRParam_, boostedElectronIsolation_cff::deltaR, VirtualJetProducer::doAreaFastjet_, VirtualJetProducer::doRhoFastjet_, MillePedeFileConverter_cfg::e, hiFJRhoProducer::etaRanges, etaToken_, Exception, VirtualJetProducer::fjAreaDefinition_, VirtualJetProducer::fjClusterSeq_, VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJetDefinition_, VirtualJetProducer::fjJets_, edm::Event::getByToken(), VirtualJetProducer::jetPtMin_, join(), ResonanceBuilder::mass, HadronAndPartonSelector_cfi::particles, funct::pow(), EnergyCorrector::pt, HiRecoPFJets_cff::rhom, rhomToken_, rhoToken_, mathSSE::sqrt(), and VirtualJetProducer::voronoiRfact_.

Referenced by ~CSJetProducer().

38 {
39  // run algorithm
40  if ( !doAreaFastjet_ && !doRhoFastjet_) {
41  fjClusterSeq_ = ClusterSequencePtr( new fastjet::ClusterSequence( fjInputs_, *fjJetDefinition_ ) );
42  } else if (voronoiRfact_ <= 0) {
43  fjClusterSeq_ = ClusterSequencePtr( new fastjet::ClusterSequenceArea( fjInputs_, *fjJetDefinition_ , *fjAreaDefinition_ ) );
44  } else {
45  fjClusterSeq_ = ClusterSequencePtr( new fastjet::ClusterSequenceVoronoiArea( fjInputs_, *fjJetDefinition_ , fastjet::VoronoiAreaSpec(voronoiRfact_) ) );
46  }
47 
48  fjJets_.clear();
49  std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
50 
51  //Get local rho and rhom map
55 
56  iEvent.getByToken(etaToken_, etaRanges);
57  iEvent.getByToken(rhoToken_, rhoRanges);
58  iEvent.getByToken(rhomToken_, rhomRanges);
59 
60  //Check if size of eta and background density vectors is the same
61  unsigned int bkgVecSize = etaRanges->size();
62  if(bkgVecSize<1) { throw cms::Exception("WrongBkgInput") << "Producer needs vector with background estimates\n"; }
63  if(bkgVecSize != (rhoRanges->size()+1) || bkgVecSize != (rhomRanges->size()+1) ) {
64  throw cms::Exception("WrongBkgInput") << "Size of etaRanges (" << bkgVecSize << ") and rhoRanges (" << rhoRanges->size() << ") and/or rhomRanges (" << rhomRanges->size() << ") vectors inconsistent\n";
65  }
66 
67 
68  //Allow the background densities to change within the jet
69 
70  for(fastjet::PseudoJet& ijet : tempJets ) {
71 
72  //----------------------------------------------------------------------
73  // sift ghosts and particles in the input jet
74  std::vector<fastjet::PseudoJet> particles, ghosts;
75  fastjet::SelectorIsPureGhost().sift(ijet.constituents(), ghosts, particles);
76  unsigned long nParticles=particles.size();
77  if(nParticles==0) continue; //don't subtract ghost jets
78 
79  //assign rho and rhom to ghosts according to local eta-dependent map
80  double rho = 1e-6;
81  double rhom = 1e-6;
82  for(fastjet::PseudoJet& ighost : ghosts) {
83 
84  if(ighost.eta()<=etaRanges->at(0) || bkgVecSize==1) {
85  rho = rhoRanges->at(0);
86  rhom = rhomRanges->at(0);
87  } else if(ighost.eta()>=etaRanges->at(bkgVecSize-1)) {
88  rho = rhoRanges->at(bkgVecSize-2);
89  rhom = rhomRanges->at(bkgVecSize-2);
90  } else {
91  for(unsigned int ie = 0; ie<(bkgVecSize-1); ie++) {
92  if(ighost.eta()>=etaRanges->at(ie) && ighost.eta()<etaRanges->at(ie+1)) {
93  rho = rhoRanges->at(ie);
94  rhom = rhomRanges->at(ie);
95  break;
96  }
97  }
98  }
99  double pt = rho*ighost.area();
100  double mass_squared=std::pow(rhom*ighost.area()+pt,2)-std::pow(pt,2);
101  double mass=0;
102  if (mass_squared>0) mass=sqrt(mass_squared);
103  ighost.reset_momentum_PtYPhiM(pt,ighost.rap(),ighost.phi(),mass);
104  }
105 
106  //----------------------------------------------------------------------
107  //from here use official fastjet contrib package
108 
109  fastjet::contrib::ConstituentSubtractor subtractor;
110  subtractor.set_distance_type(fastjet::contrib::ConstituentSubtractor::deltaR); // distance in eta-phi plane
111  subtractor.set_max_distance(csRParam_); // free parameter for the maximal allowed distance between particle i and ghost k
112  subtractor.set_alpha(csAlpha_); // free parameter for the distance measure (the exponent of particle pt). Note that in older versions of the package alpha was multiplied by two but in newer versions this is not the case anymore
113  subtractor.set_do_mass_subtraction(true);
114  subtractor.set_remove_all_zero_pt_particles(true);
115 
116  std::vector<fastjet::PseudoJet> subtracted_particles = subtractor.do_subtraction(particles,ghosts);
117 
118  //Create subtracted jets
119  fastjet::PseudoJet subtracted_jet=join(subtracted_particles);
120  if(subtracted_jet.perp()>0.)
121  fjJets_.push_back( subtracted_jet );
122  }
123  fjJets_ = fastjet::sorted_by_pt(fjJets_);
124 }
std::vector< fastjet::PseudoJet > fjJets_
double csAlpha_
for constituent subtraction : R parameter
Definition: CSJetProducer.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< std::vector< double > > rhoToken_
Definition: CSJetProducer.h:45
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
T sqrt(T t)
Definition: SSEVec.h:18
edm::EDGetTokenT< std::vector< double > > etaToken_
for HI constituent subtraction : alpha (power of pt in metric)
Definition: CSJetProducer.h:44
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
edm::EDGetTokenT< std::vector< double > > rhomToken_
Definition: CSJetProducer.h:46
AreaDefinitionPtr fjAreaDefinition_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr

Member Data Documentation

double cms::CSJetProducer::csAlpha_
protected

for constituent subtraction : R parameter

Definition at line 41 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

double cms::CSJetProducer::csRParam_
protected

Definition at line 40 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

edm::EDGetTokenT<std::vector<double> > cms::CSJetProducer::etaToken_
protected

for HI constituent subtraction : alpha (power of pt in metric)

Definition at line 44 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

edm::EDGetTokenT<std::vector<double> > cms::CSJetProducer::rhomToken_
protected

Definition at line 46 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

edm::EDGetTokenT<std::vector<double> > cms::CSJetProducer::rhoToken_
protected

Definition at line 45 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().