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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 CSJetProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~CSJetProducer ()
 
- Public Member Functions inherited from VirtualJetProducer
std::string jetType () const
 
 VirtualJetProducer (const edm::ParameterSet &iConfig)
 
virtual ~VirtualJetProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Member Functions

virtual void runAlgorithm (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
- 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 Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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_
 
RangeDefPtr fjRangeDef_
 
bool fromHTTTopJetProducer_
 
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::RangeDefinition > RangeDefPtr
 
- 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

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)
virtual cms::CSJetProducer::~CSJetProducer ( )
inlinevirtual

Member Function Documentation

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

Definition at line 125 of file CSJetProducer.cc.

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

Referenced by ~CSJetProducer().

125  {
126 
127  edm::ParameterSetDescription descCSJetProducer;
129  fillDescriptionsFromCSJetProducer(descCSJetProducer);
131  descCSJetProducer.add<string>("jetCollInstanceName", "" );
133  descCSJetProducer.add<bool> ("sumRecHits", false);
134 
136  descriptions.add("CSJetProducer",descCSJetProducer);
137 
138 }
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 140 of file CSJetProducer.cc.

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

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

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

Reimplemented from VirtualJetProducer.

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_
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void CSJetProducer::runAlgorithm ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
protectedvirtual

Implements VirtualJetProducer.

Definition at line 37 of file CSJetProducer.cc.

References csAlpha_, csRParam_, 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 
115  std::vector<fastjet::PseudoJet> subtracted_particles = subtractor.do_subtraction(particles,ghosts);
116 
117  //Create subtracted jets
118  fastjet::PseudoJet subtracted_jet=join(subtracted_particles);
119  if(subtracted_jet.perp()>0.)
120  fjJets_.push_back( subtracted_jet );
121  }
122  fjJets_ = fastjet::sorted_by_pt(fjJets_);
123 }
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:460
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
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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().