CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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

double getModulatedRhoFactor (double phi, double eventPlane2, double eventPlane3, double par1, double par2)
 
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::CandidatePtr
getConstituents (const std::vector< fastjet::PseudoJet > &fjConstituents)
 
CaloGeometry const & getGeometry (edm::EventSetup const &) const
 
HcalTopology const & getTopology (edm::EventSetup const &) const
 
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_
 flowFit chi2/ndof minimum compatability requirement More...
 
double maxFlowChi2Prob_
 flowFit chi2/ndof minimum compatability requirement More...
 
double minFlowChi2Prob_
 flag to turn on/off flow-modulated rho and rhom More...
 
edm::EDGetTokenT< std::vector
< double > > 
rhoFlowFitParamsToken_
 
edm::EDGetTokenT< std::vector
< double > > 
rhomToken_
 
edm::EDGetTokenT< std::vector
< double > > 
rhoToken_
 
bool useModulatedRho_
 for HI constituent subtraction : alpha (power of pt in metric) More...
 
- Protected Attributes inherited from VirtualJetProducer
int activeAreaRepeats_
 
bool applyWeight_
 
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::VertexCollection
input_vertex_token_
 
edm::EDGetTokenT
< edm::ValueMap< float > > 
input_weights_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_
 
std::shared_ptr< PileUpSubtractorsubtractor_
 
bool useDeterministicSeed_
 
bool useExplicitGhosts_
 
int verbosity_
 
reco::Particle::Point vertex_
 
double voronoiRfact_
 
edm::ValueMap< float > weights_
 
bool writeCompound_
 
bool writeJetsWithConst_
 

Additional Inherited Members

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

Detailed Description

Definition at line 24 of file CSJetProducer.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file CSJetProducer.cc.

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

19  : VirtualJetProducer(conf),
20  csRParam_(-1.0),
21  csAlpha_(0.),
22  useModulatedRho_(conf.getParameter<bool>("useModulatedRho")),
23  minFlowChi2Prob_(conf.getParameter<double>("minFlowChi2Prob")),
24  maxFlowChi2Prob_(conf.getParameter<double>("maxFlowChi2Prob")) {
25  //get eta range, rho and rhom map
26  etaToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>("etaMap"));
27  rhoToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>("rho"));
28  rhomToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>("rhom"));
29  csRParam_ = conf.getParameter<double>("csRParam");
30  csAlpha_ = conf.getParameter<double>("csAlpha");
31  if (useModulatedRho_)
32  rhoFlowFitParamsToken_ = consumes<std::vector<double>>(conf.getParameter<edm::InputTag>("rhoFlowFitParams"));
33 }
double csAlpha_
for constituent subtraction : R parameter
Definition: CSJetProducer.h:40
bool useModulatedRho_
for HI constituent subtraction : alpha (power of pt in metric)
Definition: CSJetProducer.h:42
edm::EDGetTokenT< std::vector< double > > rhoToken_
Definition: CSJetProducer.h:47
edm::EDGetTokenT< std::vector< double > > rhoFlowFitParamsToken_
Definition: CSJetProducer.h:49
double maxFlowChi2Prob_
flowFit chi2/ndof minimum compatability requirement
Definition: CSJetProducer.h:44
edm::EDGetTokenT< std::vector< double > > etaToken_
flowFit chi2/ndof minimum compatability requirement
Definition: CSJetProducer.h:46
edm::EDGetTokenT< std::vector< double > > rhomToken_
Definition: CSJetProducer.h:48
VirtualJetProducer(const edm::ParameterSet &iConfig)
double minFlowChi2Prob_
flag to turn on/off flow-modulated rho and rhom
Definition: CSJetProducer.h:43
cms::CSJetProducer::~CSJetProducer ( )
inlineoverride

Definition at line 28 of file CSJetProducer.h.

28 {}

Member Function Documentation

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

Definition at line 162 of file CSJetProducer.cc.

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

162  {
163  edm::ParameterSetDescription descCSJetProducer;
165  fillDescriptionsFromCSJetProducer(descCSJetProducer);
167  descCSJetProducer.add<string>("jetCollInstanceName", "");
169  descCSJetProducer.add<bool>("sumRecHits", false);
170 
172  descriptions.add("CSJetProducer", descCSJetProducer);
173 }
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 175 of file CSJetProducer.cc.

References edm::ParameterSetDescription::add().

Referenced by fillDescriptions().

175  {
176  desc.add<double>("csRParam", -1.);
177  desc.add<double>("csAlpha", 2.);
178  desc.add<bool>("useModulatedRho", false);
179  desc.add<double>("minFlowChi2Prob", 0.05);
180  desc.add<double>("maxFlowChi2Prob", 0.95);
181  desc.add<edm::InputTag>("etaMap", {"hiFJRhoProducer", "mapEtaEdges"});
182  desc.add<edm::InputTag>("rho", {"hiFJRhoProducer", "mapToRho"});
183  desc.add<edm::InputTag>("rhom", {"hiFJRhoProducer", "mapToRhoM"});
184  desc.add<edm::InputTag>("rhoFlowFitParams", {"hiFJRhoFlowModulationProducer", "rhoFlowFitParams"});
185 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double CSJetProducer::getModulatedRhoFactor ( double  phi,
double  eventPlane2,
double  eventPlane3,
double  par1,
double  par2 
)
protected

Definition at line 187 of file CSJetProducer.cc.

References funct::cos().

Referenced by runAlgorithm().

188  {
189  // get the rho modulation as function of phi
190  // flow modulation fit is done in RecoHI/HiJetAlgos/plugins/HiFJRhoFlowModulationProducer
191  return 1. + 2. * par1 * cos(2. * (phi - eventPlane2)) + par2 * cos(3. * (phi - eventPlane3));
192 }
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void CSJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 35 of file CSJetProducer.cc.

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

35  {
36  // use the default production from one collection
37  VirtualJetProducer::produce(iEvent, iSetup);
38  //use runAlgorithm of this class
39 
40  //Delete allocated memory. It is allocated every time runAlgorithm is called
41  fjClusterSeq_.reset();
42 }
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 45 of file CSJetProducer.cc.

References csAlpha_, csRParam_, HLT_FULL_cff::deltaR, VirtualJetProducer::doAreaFastjet_, VirtualJetProducer::doRhoFastjet_, HLT_FULL_cff::etaRanges, etaToken_, Exception, VirtualJetProducer::fjAreaDefinition_, VirtualJetProducer::fjClusterSeq_, VirtualJetProducer::fjInputs_, VirtualJetProducer::fjJetDefinition_, VirtualJetProducer::fjJets_, edm::Event::getByToken(), getModulatedRhoFactor(), VirtualJetProducer::jetPtMin_, join(), ResonanceBuilder::mass, maxFlowChi2Prob_, minFlowChi2Prob_, funct::pow(), DiDispStaMuonMonitor_cfi::pt, HLT_FULL_cff::rhoFlowFitParams, rhoFlowFitParamsToken_, rhomToken_, rhoToken_, mathSSE::sqrt(), useModulatedRho_, hgcalPerformanceValidation::val, and VirtualJetProducer::voronoiRfact_.

45  {
46  // run algorithm
47  if (!doAreaFastjet_ && !doRhoFastjet_) {
48  fjClusterSeq_ = std::make_shared<fastjet::ClusterSequence>(fjInputs_, *fjJetDefinition_);
49  } else if (voronoiRfact_ <= 0) {
51  ClusterSequencePtr(new fastjet::ClusterSequenceArea(fjInputs_, *fjJetDefinition_, *fjAreaDefinition_));
52  } else {
54  new fastjet::ClusterSequenceVoronoiArea(fjInputs_, *fjJetDefinition_, fastjet::VoronoiAreaSpec(voronoiRfact_)));
55  }
56 
57  fjJets_.clear();
58  std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
59 
60  //Get local rho and rhom map
65  iEvent.getByToken(etaToken_, etaRanges);
66  iEvent.getByToken(rhoToken_, rhoRanges);
67  iEvent.getByToken(rhomToken_, rhomRanges);
68  if (useModulatedRho_)
69  iEvent.getByToken(rhoFlowFitParamsToken_, rhoFlowFitParams);
70 
71  //Check if size of eta and background density vectors is the same
72  unsigned int bkgVecSize = etaRanges->size();
73  if (bkgVecSize < 1) {
74  throw cms::Exception("WrongBkgInput") << "Producer needs vector with background estimates\n";
75  }
76  if (bkgVecSize != (rhoRanges->size() + 1) || bkgVecSize != (rhomRanges->size() + 1)) {
77  throw cms::Exception("WrongBkgInput")
78  << "Size of etaRanges (" << bkgVecSize << ") and rhoRanges (" << rhoRanges->size() << ") and/or rhomRanges ("
79  << rhomRanges->size() << ") vectors inconsistent\n";
80  }
81  bool minProb = false;
82  bool maxProb = false;
83  if (useModulatedRho_) {
84  if (!rhoFlowFitParams->empty()) {
85  double val = ROOT::Math::chisquared_cdf_c(rhoFlowFitParams->at(5), rhoFlowFitParams->at(6));
86  minProb = val > minFlowChi2Prob_;
87  maxProb = val < maxFlowChi2Prob_;
88  }
89  }
90 
91  //Allow the background densities to change within the jet
92 
93  for (fastjet::PseudoJet& ijet : tempJets) {
94  //----------------------------------------------------------------------
95  // sift ghosts and particles in the input jet
96  std::vector<fastjet::PseudoJet> particles, ghosts;
97  fastjet::SelectorIsPureGhost().sift(ijet.constituents(), ghosts, particles);
98  unsigned long nParticles = particles.size();
99  if (nParticles == 0)
100  continue; //don't subtract ghost jets
101 
102  //assign rho and rhom to ghosts according to local eta-dependent map + modulation as function of phi
103  for (fastjet::PseudoJet& ighost : ghosts) {
104  double rhoModulationFactor = 1.;
105  double ghostPhi = ighost.phi_std();
106 
107  if (useModulatedRho_) {
108  if (!rhoFlowFitParams->empty()) {
109  if (minProb && maxProb) {
110  rhoModulationFactor = getModulatedRhoFactor(ghostPhi,
111  rhoFlowFitParams->at(2),
112  rhoFlowFitParams->at(4),
113  rhoFlowFitParams->at(1),
114  rhoFlowFitParams->at(3));
115  }
116  }
117  }
118 
119  int32_t ghostPos = -1;
120  auto const ighostEta = ighost.eta();
121  if (ighostEta <= etaRanges->at(0) || bkgVecSize == 1) {
122  ghostPos = 0;
123  } else if (ighostEta >= etaRanges->at(bkgVecSize - 1)) {
124  ghostPos = rhoRanges->size() - 1;
125  } else {
126  for (unsigned int ie = 0; ie < (bkgVecSize - 1); ie++) {
127  if (ighostEta >= etaRanges->at(ie) && ighostEta < etaRanges->at(ie + 1)) {
128  ghostPos = ie;
129  break;
130  }
131  }
132  }
133  double pt = rhoRanges->at(ghostPos) * ighost.area() * rhoModulationFactor;
134  double mass_squared =
135  std::pow(rhoModulationFactor * rhomRanges->at(ghostPos) * ighost.area() + pt, 2) - std::pow(pt, 2);
136  double mass = (mass_squared > 0) ? sqrt(mass_squared) : 0;
137  ighost.reset_momentum_PtYPhiM(pt, ighost.rap(), ighost.phi(), mass);
138  }
139 
140  //----------------------------------------------------------------------
141  //from here use official fastjet contrib package
142 
143  fastjet::contrib::ConstituentSubtractor subtractor;
144  subtractor.set_distance_type(fastjet::contrib::ConstituentSubtractor::deltaR); // distance in eta-phi plane
145  subtractor.set_max_distance(
146  csRParam_); // free parameter for the maximal allowed distance between particle i and ghost k
147  subtractor.set_alpha(
148  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
149  subtractor.set_do_mass_subtraction();
150  subtractor.set_remove_all_zero_pt_particles(true);
151 
152  std::vector<fastjet::PseudoJet> subtracted_particles = subtractor.do_subtraction(particles, ghosts);
153 
154  //Create subtracted jets
155  fastjet::PseudoJet subtracted_jet = join(subtracted_particles);
156  if (subtracted_jet.perp() > 0.)
157  fjJets_.push_back(subtracted_jet);
158  }
159  fjJets_ = fastjet::sorted_by_pt(fjJets_);
160 }
std::vector< fastjet::PseudoJet > fjJets_
double csAlpha_
for constituent subtraction : R parameter
Definition: CSJetProducer.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
bool useModulatedRho_
for HI constituent subtraction : alpha (power of pt in metric)
Definition: CSJetProducer.h:42
std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
edm::EDGetTokenT< std::vector< double > > rhoToken_
Definition: CSJetProducer.h:47
tuple rhoFlowFitParams
edm::EDGetTokenT< std::vector< double > > rhoFlowFitParamsToken_
Definition: CSJetProducer.h:49
double maxFlowChi2Prob_
flowFit chi2/ndof minimum compatability requirement
Definition: CSJetProducer.h:44
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
T sqrt(T t)
Definition: SSEVec.h:19
double getModulatedRhoFactor(double phi, double eventPlane2, double eventPlane3, double par1, double par2)
edm::EDGetTokenT< std::vector< double > > etaToken_
flowFit chi2/ndof minimum compatability requirement
Definition: CSJetProducer.h:46
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
edm::EDGetTokenT< std::vector< double > > rhomToken_
Definition: CSJetProducer.h:48
AreaDefinitionPtr fjAreaDefinition_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
double minFlowChi2Prob_
flag to turn on/off flow-modulated rho and rhom
Definition: CSJetProducer.h:43

Member Data Documentation

double cms::CSJetProducer::csAlpha_
protected

for constituent subtraction : R parameter

Definition at line 40 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

double cms::CSJetProducer::csRParam_
protected

Definition at line 39 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

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

flowFit chi2/ndof minimum compatability requirement

Definition at line 46 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

double cms::CSJetProducer::maxFlowChi2Prob_
protected

flowFit chi2/ndof minimum compatability requirement

Definition at line 44 of file CSJetProducer.h.

Referenced by runAlgorithm().

double cms::CSJetProducer::minFlowChi2Prob_
protected

flag to turn on/off flow-modulated rho and rhom

Definition at line 43 of file CSJetProducer.h.

Referenced by runAlgorithm().

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

Definition at line 49 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

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

Definition at line 48 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

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

Definition at line 47 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().

bool cms::CSJetProducer::useModulatedRho_
protected

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

Definition at line 42 of file CSJetProducer.h.

Referenced by CSJetProducer(), and runAlgorithm().