CMS 3D CMS Logo

VirtualJetProducer.cc
Go to the documentation of this file.
1 //
3 // VirtualJetProducer
4 // ------------------
5 //
6 // 04/21/2009 Philipp Schieferdecker <philipp.schieferdecker@cern.ch>
8 
14 
18 
27 
42 
43 #include "fastjet/SISConePlugin.hh"
44 #include "fastjet/CMSIterativeConePlugin.hh"
45 #include "fastjet/ATLASConePlugin.hh"
46 #include "fastjet/CDFMidPointPlugin.hh"
47 
48 #include <iostream>
49 #include <memory>
50 #include <algorithm>
51 #include <limits>
52 #include <cmath>
53 #include <vdt/vdtMath.h>
54 
55 using namespace std;
56 using namespace edm;
57 
58 namespace reco {
59  namespace helper {
61  bool operator()(const fastjet::PseudoJet& t1, const fastjet::PseudoJet& t2) const {
62  return t1.perp2() > t2.perp2();
63  }
64  };
65 
66  } // namespace helper
67 } // namespace reco
68 
69 //______________________________________________________________________________
70 const char* const VirtualJetProducer::JetType::names[] = {
71  "BasicJet", "GenJet", "CaloJet", "PFJet", "TrackJet", "PFClusterJet"};
72 
73 //______________________________________________________________________________
75  const char* const* pos = std::find(names, names + LastJetType, name);
76  if (pos == names + LastJetType) {
77  std::string errorMessage = "Requested jetType not supported: " + name + "\n";
78  throw cms::Exception("Configuration", errorMessage);
79  }
80  return (Type)(pos - names);
81 }
82 
84  if (writeCompound_) {
85  produces<reco::BasicJetCollection>();
86  }
87 
88  if (writeJetsWithConst_) {
89  produces<reco::PFCandidateCollection>(tag).setBranchAlias(alias);
90  produces<reco::PFJetCollection>();
91  } else {
92  if (makeCaloJet(jetTypeE)) {
93  produces<reco::CaloJetCollection>(tag).setBranchAlias(alias);
94  } else if (makePFJet(jetTypeE)) {
95  produces<reco::PFJetCollection>(tag).setBranchAlias(alias);
96  } else if (makeGenJet(jetTypeE)) {
97  produces<reco::GenJetCollection>(tag).setBranchAlias(alias);
98  } else if (makeTrackJet(jetTypeE)) {
99  produces<reco::TrackJetCollection>(tag).setBranchAlias(alias);
100  } else if (makePFClusterJet(jetTypeE)) {
101  produces<reco::PFClusterJetCollection>(tag).setBranchAlias(alias);
102  } else if (makeBasicJet(jetTypeE)) {
103  produces<reco::BasicJetCollection>(tag).setBranchAlias(alias);
104  }
105  }
106 }
107 
109 // construction / destruction
111 
112 //______________________________________________________________________________
114  moduleLabel_ = iConfig.getParameter<string>("@module_label");
115  src_ = iConfig.getParameter<edm::InputTag>("src");
116  srcPVs_ = iConfig.getParameter<edm::InputTag>("srcPVs");
117  jetType_ = iConfig.getParameter<string>("jetType");
118  jetAlgorithm_ = iConfig.getParameter<string>("jetAlgorithm");
119  rParam_ = iConfig.getParameter<double>("rParam");
120  inputEtMin_ = iConfig.getParameter<double>("inputEtMin");
121  inputEMin_ = iConfig.getParameter<double>("inputEMin");
122  jetPtMin_ = iConfig.getParameter<double>("jetPtMin");
123  doPVCorrection_ = iConfig.getParameter<bool>("doPVCorrection");
124  doAreaFastjet_ = iConfig.getParameter<bool>("doAreaFastjet");
125  doRhoFastjet_ = iConfig.getParameter<bool>("doRhoFastjet");
126  jetCollInstanceName_ = iConfig.getParameter<string>("jetCollInstanceName");
127  doPUOffsetCorr_ = iConfig.getParameter<bool>("doPUOffsetCorr");
128  puSubtractorName_ = iConfig.getParameter<string>("subtractorName");
129  useExplicitGhosts_ =
130  iConfig.getParameter<bool>("useExplicitGhosts"); // use explicit ghosts in the fastjet clustering sequence?
131  doAreaDiskApprox_ = iConfig.getParameter<bool>("doAreaDiskApprox");
132  voronoiRfact_ = iConfig.getParameter<double>(
133  "voronoiRfact"); // Voronoi-based area calculation allows for an empirical scale factor
134  rhoEtaMax_ = iConfig.getParameter<double>(
135  "Rho_EtaMax"); // do fasjet area / rho calcluation? => accept corresponding parameters
136  ghostEtaMax_ = iConfig.getParameter<double>("Ghost_EtaMax");
137  activeAreaRepeats_ = iConfig.getParameter<int>("Active_Area_Repeats");
138  ghostArea_ = iConfig.getParameter<double>("GhostArea");
139  restrictInputs_ = iConfig.getParameter<bool>("restrictInputs"); // restrict inputs to first "maxInputs" towers?
140  maxInputs_ = iConfig.getParameter<unsigned int>("maxInputs");
141  writeCompound_ = iConfig.getParameter<bool>(
142  "writeCompound"); // Check to see if we are writing compound jets for substructure and jet grooming
143  writeJetsWithConst_ = iConfig.getParameter<bool>("writeJetsWithConst"); //write subtracted jet constituents
144  doFastJetNonUniform_ = iConfig.getParameter<bool>("doFastJetNonUniform");
145  puCenters_ = iConfig.getParameter<vector<double>>("puCenters");
146  puWidth_ = iConfig.getParameter<double>("puWidth");
147  nExclude_ = iConfig.getParameter<unsigned int>("nExclude");
148  useDeterministicSeed_ = iConfig.getParameter<bool>("useDeterministicSeed");
149  minSeed_ = iConfig.getParameter<unsigned int>("minSeed");
150  verbosity_ = iConfig.getParameter<int>("verbosity");
151  applyWeight_ = iConfig.getParameter<bool>("applyWeight");
152  if (applyWeight_) {
153  edm::InputTag srcWeights = iConfig.getParameter<edm::InputTag>("srcWeights");
154  if (srcWeights.label() == src_.label())
155  LogWarning("VirtualJetProducer")
156  << "Particle and weights collection have the same label. You may be applying the same weights twice.\n";
157  if (!srcWeights.label().empty())
158  input_weights_token_ = consumes<edm::ValueMap<float>>(srcWeights);
159  }
160 
161  anomalousTowerDef_ = std::make_unique<AnomalousTower>(iConfig);
162 
163  input_vertex_token_ = consumes<reco::VertexCollection>(srcPVs_);
164  input_candidateview_token_ = consumes<reco::CandidateView>(src_);
165  input_candidatefwdptr_token_ =
166  consumes<vector<edm::FwdPtr<reco::PFCandidate>>>(iConfig.getParameter<edm::InputTag>("src"));
167  input_packedcandidatefwdptr_token_ =
168  consumes<vector<edm::FwdPtr<pat::PackedCandidate>>>(iConfig.getParameter<edm::InputTag>("src"));
169  input_gencandidatefwdptr_token_ =
170  consumes<vector<edm::FwdPtr<reco::GenParticle>>>(iConfig.getParameter<edm::InputTag>("src"));
171  input_packedgencandidatefwdptr_token_ =
172  consumes<vector<edm::FwdPtr<pat::PackedGenParticle>>>(iConfig.getParameter<edm::InputTag>("src"));
173 
174  //
175  // additional parameters to think about:
176  // - overlap threshold (set to 0.75 for the time being)
177  // - p parameter for generalized kT (set to -2 for the time being)
178  // - fastjet PU subtraction parameters (not yet considered)
179  //
180  if (jetAlgorithm_ == "Kt")
181  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(fastjet::kt_algorithm, rParam_);
182 
183  else if (jetAlgorithm_ == "CambridgeAachen")
184  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(fastjet::cambridge_algorithm, rParam_);
185 
186  else if (jetAlgorithm_ == "AntiKt")
187  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(fastjet::antikt_algorithm, rParam_);
188 
189  else if (jetAlgorithm_ == "GeneralizedKt")
190  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(fastjet::genkt_algorithm, rParam_, -2);
191 
192  else if (jetAlgorithm_ == "SISCone") {
193  fjPlugin_ = PluginPtr(new fastjet::SISConePlugin(rParam_, 0.75, 0, 0.0, false, fastjet::SISConePlugin::SM_pttilde));
194  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(&*fjPlugin_);
195 
196  } else if (jetAlgorithm_ == "IterativeCone") {
197  fjPlugin_ = PluginPtr(new fastjet::CMSIterativeConePlugin(rParam_, 1.0));
198  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(&*fjPlugin_);
199 
200  } else if (jetAlgorithm_ == "CDFMidPoint") {
201  fjPlugin_ = PluginPtr(new fastjet::CDFMidPointPlugin(rParam_, 0.75));
202  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(&*fjPlugin_);
203 
204  } else if (jetAlgorithm_ == "ATLASCone") {
205  fjPlugin_ = PluginPtr(new fastjet::ATLASConePlugin(rParam_));
206  fjJetDefinition_ = std::make_shared<fastjet::JetDefinition>(&*fjPlugin_);
207 
208  } else {
209  throw cms::Exception("Invalid jetAlgorithm") << "Jet algorithm for VirtualJetProducer is invalid, Abort!\n";
210  }
211 
212  jetTypeE = JetType::byName(jetType_);
213 
214  if (doPUOffsetCorr_) {
215  if (puSubtractorName_.empty()) {
216  LogWarning("VirtualJetProducer")
217  << "Pile Up correction on; however, pile up type is not specified. Using default... \n";
218  subtractor_ = std::make_shared<PileUpSubtractor>(iConfig, consumesCollector());
219  } else
220  subtractor_ = std::shared_ptr<PileUpSubtractor>(
221  PileUpSubtractorFactory::get()->create(puSubtractorName_, iConfig, consumesCollector()));
222  }
223 
224  // do approximate disk-based area calculation => warn if conflicting request
225  if (doAreaDiskApprox_ && doAreaFastjet_)
226  throw cms::Exception("Conflicting area calculations")
227  << "Both the calculation of jet area via fastjet and via an analytical disk approximation have been requested. "
228  "Please decide on one.\n";
229 
230  if (doAreaFastjet_ || doRhoFastjet_) {
231  if (voronoiRfact_ <= 0) {
232  fjActiveArea_ = std::make_shared<fastjet::GhostedAreaSpec>(ghostEtaMax_, activeAreaRepeats_, ghostArea_);
233 
234  if (!useExplicitGhosts_) {
235  fjAreaDefinition_ = std::make_shared<fastjet::AreaDefinition>(fastjet::active_area, *fjActiveArea_);
236  } else {
237  fjAreaDefinition_ =
238  std::make_shared<fastjet::AreaDefinition>(fastjet::active_area_explicit_ghosts, *fjActiveArea_);
239  }
240  }
241  fjSelector_ = std::make_shared<fastjet::Selector>(fastjet::SelectorAbsRapMax(rhoEtaMax_));
242  }
243 
244  if ((doFastJetNonUniform_) && (puCenters_.empty()))
245  throw cms::Exception("doFastJetNonUniform")
246  << "Parameter puCenters for doFastJetNonUniform is not defined." << std::endl;
247 
248  // make the "produces" statements
249  makeProduces(moduleLabel_, jetCollInstanceName_);
250  produces<vector<double>>("rhos");
251  produces<vector<double>>("sigmas");
252  produces<double>("rho");
253  produces<double>("sigma");
254 }
255 
256 //______________________________________________________________________________
258 
260 // implementation of member functions
262 
263 //______________________________________________________________________________
265  // If requested, set the fastjet random seed to a deterministic function
266  // of the run/lumi/event.
267  // NOTE!!! The fastjet random number sequence is a global singleton.
268  // Thus, we have to create an object and get access to the global singleton
269  // in order to change it.
270  if (useDeterministicSeed_) {
271  fastjet::GhostedAreaSpec gas;
272  std::vector<int> seeds(2);
273  unsigned int runNum_uint = static_cast<unsigned int>(iEvent.id().run());
274  unsigned int evNum_uint = static_cast<unsigned int>(iEvent.id().event());
275  seeds[0] = std::max(runNum_uint, minSeed_ + 3) + 3 * evNum_uint;
276  seeds[1] = std::max(runNum_uint, minSeed_ + 5) + 5 * evNum_uint;
277  gas.set_random_status(seeds);
278  }
279 
280  LogDebug("VirtualJetProducer") << "Entered produce\n";
281  //determine signal vertex2
282  vertex_ = reco::Jet::Point(0, 0, 0);
283  if ((makeCaloJet(jetTypeE) || makePFJet(jetTypeE)) && doPVCorrection_) {
284  LogDebug("VirtualJetProducer") << "Adding PV info\n";
286  iEvent.getByToken(input_vertex_token_, pvCollection);
287  if (!pvCollection->empty())
288  vertex_ = pvCollection->begin()->position();
289  }
290 
291  // Get Weights Collection
292  if ((applyWeight_) && (!input_weights_token_.isUninitialized()))
293  weights_ = iEvent.get(input_weights_token_);
294 
295  // For Pileup subtraction using offset correction:
296  // set up geometry map
297  if (doPUOffsetCorr_) {
298  subtractor_->setupGeometryMap(iEvent, iSetup);
299  }
300 
301  // clear data
302  LogDebug("VirtualJetProducer") << "Clear data\n";
303  fjInputs_.clear();
304  fjJets_.clear();
305  inputs_.clear();
306 
307  // get inputs and convert them to the fastjet format (fastjet::PeudoJet)
309 
313  edm::Handle<std::vector<edm::FwdPtr<pat::PackedGenParticle>>> packedgeninputsHandleAsFwdPtr;
314 
315  bool isView = iEvent.getByToken(input_candidateview_token_, inputsHandle);
316  if (isView) {
317  if (inputsHandle->empty()) {
318  output(iEvent, iSetup);
319  return;
320  }
321  for (size_t i = 0; i < inputsHandle->size(); ++i) {
322  inputs_.push_back(inputsHandle->ptrAt(i));
323  }
324  } else {
325  bool isPF = iEvent.getByToken(input_candidatefwdptr_token_, pfinputsHandleAsFwdPtr);
326  bool isPFFwdPtr = iEvent.getByToken(input_packedcandidatefwdptr_token_, packedinputsHandleAsFwdPtr);
327  bool isGen = iEvent.getByToken(input_gencandidatefwdptr_token_, geninputsHandleAsFwdPtr);
328  bool isGenFwdPtr = iEvent.getByToken(input_packedgencandidatefwdptr_token_, packedgeninputsHandleAsFwdPtr);
329 
330  if (isPF) {
331  if (pfinputsHandleAsFwdPtr->empty()) {
332  output(iEvent, iSetup);
333  return;
334  }
335  for (size_t i = 0; i < pfinputsHandleAsFwdPtr->size(); ++i) {
336  if ((*pfinputsHandleAsFwdPtr)[i].ptr().isAvailable()) {
337  inputs_.push_back((*pfinputsHandleAsFwdPtr)[i].ptr());
338  } else if ((*pfinputsHandleAsFwdPtr)[i].backPtr().isAvailable()) {
339  inputs_.push_back((*pfinputsHandleAsFwdPtr)[i].backPtr());
340  }
341  }
342  } else if (isPFFwdPtr) {
343  if (packedinputsHandleAsFwdPtr->empty()) {
344  output(iEvent, iSetup);
345  return;
346  }
347  for (size_t i = 0; i < packedinputsHandleAsFwdPtr->size(); ++i) {
348  if ((*packedinputsHandleAsFwdPtr)[i].ptr().isAvailable()) {
349  inputs_.push_back((*packedinputsHandleAsFwdPtr)[i].ptr());
350  } else if ((*packedinputsHandleAsFwdPtr)[i].backPtr().isAvailable()) {
351  inputs_.push_back((*packedinputsHandleAsFwdPtr)[i].backPtr());
352  }
353  }
354  } else if (isGen) {
355  if (geninputsHandleAsFwdPtr->empty()) {
356  output(iEvent, iSetup);
357  return;
358  }
359  for (size_t i = 0; i < geninputsHandleAsFwdPtr->size(); ++i) {
360  if ((*geninputsHandleAsFwdPtr)[i].ptr().isAvailable()) {
361  inputs_.push_back((*geninputsHandleAsFwdPtr)[i].ptr());
362  } else if ((*geninputsHandleAsFwdPtr)[i].backPtr().isAvailable()) {
363  inputs_.push_back((*geninputsHandleAsFwdPtr)[i].backPtr());
364  }
365  }
366  } else if (isGenFwdPtr) {
367  if (geninputsHandleAsFwdPtr->empty()) {
368  output(iEvent, iSetup);
369  return;
370  }
371  for (size_t i = 0; i < packedgeninputsHandleAsFwdPtr->size(); ++i) {
372  if ((*packedgeninputsHandleAsFwdPtr)[i].ptr().isAvailable()) {
373  inputs_.push_back((*packedgeninputsHandleAsFwdPtr)[i].ptr());
374  } else if ((*packedgeninputsHandleAsFwdPtr)[i].backPtr().isAvailable()) {
375  inputs_.push_back((*packedgeninputsHandleAsFwdPtr)[i].backPtr());
376  }
377  }
378  } else {
379  throw cms::Exception("Invalid Jet Inputs")
380  << "Did not specify appropriate inputs for VirtualJetProducer, Abort!\n";
381  }
382  }
383  LogDebug("VirtualJetProducer") << "Got inputs\n";
384 
385  // Convert candidates to fastjet::PseudoJets.
386  // Also correct to Primary Vertex. Will modify fjInputs_
387  // and use inputs_
388  fjInputs_.reserve(inputs_.size());
389  inputTowers();
390  LogDebug("VirtualJetProducer") << "Inputted towers\n";
391 
392  // For Pileup subtraction using offset correction:
393  // Subtract pedestal.
394  if (doPUOffsetCorr_) {
395  subtractor_->setDefinition(fjJetDefinition_);
396  subtractor_->reset(inputs_, fjInputs_, fjJets_);
397  subtractor_->calculatePedestal(fjInputs_);
398  subtractor_->subtractPedestal(fjInputs_);
399  LogDebug("VirtualJetProducer") << "Subtracted pedestal\n";
400  }
401  // Run algorithm. Will modify fjJets_ and allocate fjClusterSeq_.
402  // This will use fjInputs_
403  runAlgorithm(iEvent, iSetup);
404 
405  // if ( doPUOffsetCorr_ ) {
406  // subtractor_->setAlgorithm(fjClusterSeq_);
407  // }
408 
409  LogDebug("VirtualJetProducer") << "Ran algorithm\n";
410  // For Pileup subtraction using offset correction:
411  // Now we find jets and need to recalculate their energy,
412  // mark towers participated in jet,
413  // remove occupied towers from the list and recalculate mean and sigma
414  // put the initial towers collection to the jet,
415  // and subtract from initial towers in jet recalculated mean and sigma of towers
416  if (doPUOffsetCorr_) {
417  LogDebug("VirtualJetProducer") << "Do PUOffsetCorr\n";
418  vector<fastjet::PseudoJet> orphanInput;
419  subtractor_->calculateOrphanInput(orphanInput);
420  subtractor_->calculatePedestal(orphanInput);
421  subtractor_->offsetCorrectJets();
422  }
423  // Write the output jets.
424  // This will (by default) call the member function template
425  // "writeJets", but can be overridden.
426  // this will use inputs_
427  output(iEvent, iSetup);
428  LogDebug("VirtualJetProducer") << "Wrote jets\n";
429 
430  // Clear the work vectors so that memory is free for other modules.
431  // Use the trick of swapping with an empty vector so that the memory
432  // is actually given back rather than silently kept.
433  decltype(fjInputs_)().swap(fjInputs_);
434  decltype(fjJets_)().swap(fjJets_);
435  decltype(inputs_)().swap(inputs_);
436 
437  return;
438 }
439 
440 //______________________________________________________________________________
441 
443  auto inBegin = inputs_.begin(), inEnd = inputs_.end(), i = inBegin;
444  for (; i != inEnd; ++i) {
445  auto const& input = **i;
446  // std::cout << "CaloTowerVI jets " << input->pt() << " " << input->et() << ' '<< input->energy() << ' ' << (isAnomalousTower(input) ? " bad" : " ok") << std::endl;
447  if (edm::isNotFinite(input.pt()))
448  continue;
449  if (input.et() < inputEtMin_)
450  continue;
451  if (input.energy() < inputEMin_)
452  continue;
453  if (isAnomalousTower(*i))
454  continue;
455  // Change by SRR : this is no longer an error nor warning, this can happen with PU mitigation algos.
456  // Also switch to something more numerically safe. (VI: 10^-42GeV????)
457  if (input.pt() < 100 * std::numeric_limits<double>::epsilon()) {
458  continue;
459  }
460  if (makeCaloJet(jetTypeE) && doPVCorrection_) {
461  const CaloTower& tower = dynamic_cast<const CaloTower&>(input);
462  auto const& ct = tower.p4(vertex_); // very expensive as computed in eta/phi
463  fjInputs_.emplace_back(ct.px(), ct.py(), ct.pz(), ct.energy());
464  fjInputs_.back().set_user_index(i - inBegin);
465  //std::cout << "tower:" << *tower << '\n';
466  } else {
467  /*
468  if(makePFJet(jetTypeE)) {
469  reco::PFCandidate& pfc = (reco::PFCandidate&)input;
470  std::cout << "PF cand:" << pfc << '\n';
471  }
472  */
473  if (!applyWeight_) {
474  fjInputs_.emplace_back(input.px(), input.py(), input.pz(), input.energy());
475  fjInputs_.back().set_user_index(i - inBegin);
476  } else {
477  if (input_weights_token_.isUninitialized())
478  throw cms::Exception("InvalidInput")
479  << "applyWeight set to True, but no weights given in VirtualJetProducer\n";
480  float w = weights_[*i];
481  if (w > 0) {
482  fjInputs_.emplace_back(input.px() * w, input.py() * w, input.pz() * w, input.energy() * w);
483  fjInputs_.back().set_user_index(i - inBegin);
484  }
485  }
486  }
487  }
488 
489  if (restrictInputs_ && fjInputs_.size() > maxInputs_) {
491  std::sort(fjInputs_.begin(), fjInputs_.end(), pTComparator);
492  fjInputs_.resize(maxInputs_);
493  edm::LogWarning("JetRecoTooManyEntries")
494  << "Too many inputs in the event, limiting to first " << maxInputs_ << ". Output is suspect.";
495  }
496 }
497 
498 //______________________________________________________________________________
500  if (!makeCaloJet(jetTypeE))
501  return false;
502  else
503  return (*anomalousTowerDef_)(*input);
504 }
505 
506 //------------------------------------------------------------------------------
507 // This is pure virtual.
508 //______________________________________________________________________________
509 // void VirtualJetProducer::runAlgorithm( edm::Event & iEvent, edm::EventSetup const& iSetup,
510 // std::vector<edm::Ptr<reco::Candidate> > const & inputs_);
511 
512 //______________________________________________________________________________
513 void VirtualJetProducer::copyConstituents(const vector<fastjet::PseudoJet>& fjConstituents, reco::Jet* jet) {
514  for (unsigned int i = 0; i < fjConstituents.size(); ++i) {
515  int index = fjConstituents[i].user_index();
516  if (index >= 0 && static_cast<unsigned int>(index) < inputs_.size())
517  jet->addDaughter(inputs_[index]);
518  }
519 }
520 
521 //______________________________________________________________________________
522 vector<reco::CandidatePtr> VirtualJetProducer::getConstituents(const vector<fastjet::PseudoJet>& fjConstituents) {
523  vector<reco::CandidatePtr> result;
524  result.reserve(fjConstituents.size() / 2);
525  for (unsigned int i = 0; i < fjConstituents.size(); i++) {
526  auto index = fjConstituents[i].user_index();
527  if (index >= 0 && static_cast<unsigned int>(index) < inputs_.size()) {
528  result.emplace_back(inputs_[index]);
529  }
530  }
531  return result;
532 }
533 
534 //_____________________________________________________________________________
535 
537  // Write jets and constitutents. Will use fjJets_, inputs_
538  // and fjClusterSeq_
539 
540  if (writeCompound_) {
541  // Write jets and subjets
542  switch (jetTypeE) {
543  case JetType::CaloJet:
544  writeCompoundJets<reco::CaloJet>(iEvent, iSetup);
545  break;
546  case JetType::PFJet:
547  writeCompoundJets<reco::PFJet>(iEvent, iSetup);
548  break;
549  case JetType::GenJet:
550  writeCompoundJets<reco::GenJet>(iEvent, iSetup);
551  break;
552  case JetType::BasicJet:
553  writeCompoundJets<reco::BasicJet>(iEvent, iSetup);
554  break;
555  default:
556  throw cms::Exception("InvalidInput") << "invalid jet type in CompoundJetProducer\n";
557  break;
558  };
559  } else if (writeJetsWithConst_) {
560  // Write jets and new constituents.
561  writeJetsWithConstituents<reco::PFJet>(iEvent, iSetup);
562  } else {
563  switch (jetTypeE) {
564  case JetType::CaloJet:
565  writeJets<reco::CaloJet>(iEvent, iSetup);
566  break;
567  case JetType::PFJet:
568  writeJets<reco::PFJet>(iEvent, iSetup);
569  break;
570  case JetType::GenJet:
571  writeJets<reco::GenJet>(iEvent, iSetup);
572  break;
573  case JetType::TrackJet:
574  writeJets<reco::TrackJet>(iEvent, iSetup);
575  break;
576  case JetType::PFClusterJet:
577  writeJets<reco::PFClusterJet>(iEvent, iSetup);
578  break;
579  case JetType::BasicJet:
580  writeJets<reco::BasicJet>(iEvent, iSetup);
581  break;
582  default:
583  throw cms::Exception("InvalidInput") << "invalid jet type in VirtualJetProducer\n";
584  break;
585  };
586  }
587 }
588 
589 namespace {
590  template <typename T>
591  struct Area {
592  static float get(T const&) { return 0; }
593  };
594 
595  template <>
596  struct Area<reco::CaloJet> {
597  static float get(reco::CaloJet const& jet) { return jet.getSpecific().mTowersArea; }
598  };
599 } // namespace
600 
601 template <typename T>
603  // std::cout << "writeJets " << typeid(T).name()
604  // << (doRhoFastjet_ ? " doRhoFastjet " : "")
605  // << (doAreaFastjet_ ? " doAreaFastjet " : "")
606  // << (doAreaDiskApprox_ ? " doAreaDiskApprox " : "")
607  // << std::endl;
608 
609  if (doRhoFastjet_) {
610  // declare jet collection without the two jets,
611  // for unbiased background estimation.
612  std::vector<fastjet::PseudoJet> fjexcluded_jets;
613  fjexcluded_jets = fjJets_;
614 
615  if (fjexcluded_jets.size() > 2)
616  fjexcluded_jets.resize(nExclude_);
617 
618  if (doFastJetNonUniform_) {
619  auto rhos = std::make_unique<std::vector<double>>();
620  auto sigmas = std::make_unique<std::vector<double>>();
621  int nEta = puCenters_.size();
622  rhos->reserve(nEta);
623  sigmas->reserve(nEta);
624  fastjet::ClusterSequenceAreaBase const* clusterSequenceWithArea =
625  dynamic_cast<fastjet::ClusterSequenceAreaBase const*>(fjClusterSeq_.get());
626 
627  if (clusterSequenceWithArea == nullptr) {
628  if (!fjJets_.empty()) {
629  throw cms::Exception("LogicError") << "fjClusterSeq is not initialized while inputs are present\n ";
630  }
631  } else {
632  for (int ie = 0; ie < nEta; ++ie) {
633  double eta = puCenters_[ie];
634  double etamin = eta - puWidth_;
635  double etamax = eta + puWidth_;
636  fastjet::RangeDefinition range_rho(etamin, etamax);
637  fastjet::BackgroundEstimator bkgestim(*clusterSequenceWithArea, range_rho);
638  bkgestim.set_excluded_jets(fjexcluded_jets);
639  rhos->push_back(bkgestim.rho());
640  sigmas->push_back(bkgestim.sigma());
641  }
642  }
643  iEvent.put(std::move(rhos), "rhos");
644  iEvent.put(std::move(sigmas), "sigmas");
645  } else {
646  auto rho = std::make_unique<double>(0.0);
647  auto sigma = std::make_unique<double>(0.0);
648  double mean_area = 0;
649 
650  fastjet::ClusterSequenceAreaBase const* clusterSequenceWithArea =
651  dynamic_cast<fastjet::ClusterSequenceAreaBase const*>(fjClusterSeq_.get());
652  if (clusterSequenceWithArea == nullptr) {
653  if (!fjJets_.empty()) {
654  throw cms::Exception("LogicError") << "fjClusterSeq is not initialized while inputs are present\n ";
655  }
656  } else {
657  clusterSequenceWithArea->get_median_rho_and_sigma(*fjSelector_, false, *rho, *sigma, mean_area);
658  if ((*rho < 0) || (edm::isNotFinite(*rho))) {
659  edm::LogError("BadRho") << "rho value is " << *rho << " area:" << mean_area
660  << " and n_empty_jets: " << clusterSequenceWithArea->n_empty_jets(*fjSelector_)
661  << " with range " << fjSelector_->description() << ". Setting rho to rezo.";
662  *rho = 0;
663  }
664  }
665  iEvent.put(std::move(rho), "rho");
666  iEvent.put(std::move(sigma), "sigma");
667  }
668  } // doRhoFastjet_
669 
670  // produce output jet collection
671 
672  using namespace reco;
673 
674  // allocate fjJets_.size() Ts in vector
675  auto jets = std::make_unique<std::vector<T>>(fjJets_.size());
676 
677  if (!fjJets_.empty()) {
678  // Distance between jet centers and overlap area -- for disk-based area calculation
679  using RIJ = std::pair<double, double>;
680  std::vector<RIJ> rijStorage(fjJets_.size() * (fjJets_.size() / 2));
681  RIJ* rij[fjJets_.size()];
682  unsigned int k = 0;
683  for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) {
684  rij[ijet] = &rijStorage[k];
685  k += ijet;
686  }
687 
688  float etaJ[fjJets_.size()], phiJ[fjJets_.size()];
689 
690  auto orParam_ = 1. / rParam_;
691  // fill jets
692  for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) {
693  auto& jet = (*jets)[ijet];
694 
695  // get the fastjet jet
696  const fastjet::PseudoJet& fjJet = fjJets_[ijet];
697  // get the constituents from fastjet
698  std::vector<fastjet::PseudoJet> const& fjConstituents = fastjet::sorted_by_pt(fjJet.constituents());
699  // convert them to CandidatePtr vector
700  std::vector<CandidatePtr> const& constituents = getConstituents(fjConstituents);
701 
702  // write the specifics to the jet (simultaneously sets 4-vector, vertex).
703  // These are overridden functions that will call the appropriate
704  // specific allocator.
705  if ((applyWeight_) && (makePFJet(jetTypeE)))
706  writeSpecific(dynamic_cast<reco::PFJet&>(jet),
707  Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()),
708  vertex_,
709  constituents,
710  iSetup,
711  &weights_);
712  else
714  jet, Particle::LorentzVector(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E()), vertex_, constituents, iSetup);
715  phiJ[ijet] = jet.phi();
716  etaJ[ijet] = jet.eta();
717  jet.setIsWeighted(applyWeight_);
718  }
719 
720  // calcuate the jet area
721  for (unsigned int ijet = 0; ijet < fjJets_.size(); ++ijet) {
722  // calcuate the jet area
723  double jetArea = 0.0;
724  // get the fastjet jet
725  const auto& fjJet = fjJets_[ijet];
726  if (doAreaFastjet_ && fjJet.has_area()) {
727  jetArea = fjJet.area();
728  } else if (doAreaDiskApprox_) {
729  // Here it is assumed that fjJets_ is in decreasing order of pT,
730  // which should happen in FastjetJetProducer::runAlgorithm()
731  jetArea = M_PI;
732  RIJ* distance = rij[ijet];
733  for (unsigned jJet = 0; jJet < ijet; ++jJet) {
734  distance[jJet].first = std::sqrt(reco::deltaR2(etaJ[ijet], phiJ[ijet], etaJ[jJet], phiJ[jJet])) * orParam_;
736  jetArea -= distance[jJet].second;
737  for (unsigned kJet = 0; kJet < jJet; ++kJet) {
739  distance[kJet].first,
740  rij[jJet][kJet].first,
741  distance[jJet].second,
742  distance[kJet].second,
743  rij[jJet][kJet].second);
744  } // end loop over harder jets
745  } // end loop over harder jets
746  jetArea *= (rParam_ * rParam_);
747  }
748  auto& jet = (*jets)[ijet];
749  jet.setJetArea(jetArea);
750 
751  if (doPUOffsetCorr_) {
752  jet.setPileup(subtractor_->getPileUpEnergy(ijet));
753  } else {
754  jet.setPileup(0.0);
755  }
756 
757  // std::cout << "area " << ijet << " " << jetArea << " " << Area<T>::get(jet) << std::endl;
758  // std::cout << "JetVI " << ijet << ' '<< jet.pt() << " " << jet.et() << ' '<< jet.energy() << ' '<< jet.mass() << std::endl;
759  }
760  }
761  // put the jets in the collection
762  iEvent.put(std::move(jets), jetCollInstanceName_);
763 }
764 
766 template <class T>
768  if (verbosity_ >= 1) {
769  std::cout << "<VirtualJetProducer::writeCompoundJets (moduleLabel = " << moduleLabel_ << ")>:" << std::endl;
770  }
771 
772  // get a list of output jets
773  auto jetCollection = std::make_unique<reco::BasicJetCollection>();
774  // get a list of output subjets
775  auto subjetCollection = std::make_unique<std::vector<T>>();
776 
777  // This will store the handle for the subjets after we write them
778  edm::OrphanHandle<std::vector<T>> subjetHandleAfterPut;
779  // this is the mapping of subjet to hard jet
780  std::vector<std::vector<int>> indices;
781  // this is the list of hardjet 4-momenta
782  std::vector<math::XYZTLorentzVector> p4_hardJets;
783  // this is the hardjet areas
784  std::vector<double> area_hardJets;
785 
786  // Loop over the hard jets
787  std::vector<fastjet::PseudoJet>::const_iterator it = fjJets_.begin(), iEnd = fjJets_.end(), iBegin = fjJets_.begin();
788  indices.resize(fjJets_.size());
789  for (; it != iEnd; ++it) {
790  fastjet::PseudoJet const& localJet = *it;
791  unsigned int jetIndex = it - iBegin;
792  // Get the 4-vector for the hard jet
793  p4_hardJets.push_back(math::XYZTLorentzVector(localJet.px(), localJet.py(), localJet.pz(), localJet.e()));
794  double localJetArea = 0.0;
795  if (doAreaFastjet_ && localJet.has_area()) {
796  localJetArea = localJet.area();
797  }
798  area_hardJets.push_back(localJetArea);
799 
800  // create the subjet list
801  std::vector<fastjet::PseudoJet> constituents;
802  if (it->has_pieces()) {
803  constituents = it->pieces();
804  } else if (it->has_constituents()) {
805  constituents = it->constituents();
806  }
807 
808  std::vector<fastjet::PseudoJet>::const_iterator itSubJetBegin = constituents.begin(), itSubJet = itSubJetBegin,
809  itSubJetEnd = constituents.end();
810  for (; itSubJet != itSubJetEnd; ++itSubJet) {
811  fastjet::PseudoJet const& subjet = *itSubJet;
812  if (verbosity_ >= 1) {
813  std::cout << "subjet #" << (itSubJet - itSubJetBegin) << ": Pt = " << subjet.pt() << ", eta = " << subjet.eta()
814  << ", phi = " << subjet.phi() << ", mass = " << subjet.m()
815  << " (#constituents = " << subjet.constituents().size() << ")" << std::endl;
816  std::vector<fastjet::PseudoJet> subjet_constituents = subjet.constituents();
817  int idx_constituent = 0;
818  for (std::vector<fastjet::PseudoJet>::const_iterator constituent = subjet_constituents.begin();
819  constituent != subjet_constituents.end();
820  ++constituent) {
821  if (constituent->pt() < 1.e-3)
822  continue; // CV: skip ghosts
823  std::cout << " constituent #" << idx_constituent << ": Pt = " << constituent->pt()
824  << ", eta = " << constituent->eta() << ", phi = " << constituent->phi() << ","
825  << " mass = " << constituent->m() << std::endl;
826  ++idx_constituent;
827  }
828  }
829 
830  if (verbosity_ >= 1) {
831  std::cout << "subjet #" << (itSubJet - itSubJetBegin) << ": Pt = " << subjet.pt() << ", eta = " << subjet.eta()
832  << ", phi = " << subjet.phi() << ", mass = " << subjet.m()
833  << " (#constituents = " << subjet.constituents().size() << ")" << std::endl;
834  std::vector<fastjet::PseudoJet> subjet_constituents = subjet.constituents();
835  int idx_constituent = 0;
836  for (std::vector<fastjet::PseudoJet>::const_iterator constituent = subjet_constituents.begin();
837  constituent != subjet_constituents.end();
838  ++constituent) {
839  if (constituent->pt() < 1.e-3)
840  continue; // CV: skip ghosts
841  std::cout << " constituent #" << idx_constituent << ": Pt = " << constituent->pt()
842  << ", eta = " << constituent->eta() << ", phi = " << constituent->phi() << ","
843  << " mass = " << constituent->m() << std::endl;
844  ++idx_constituent;
845  }
846  }
847 
848  math::XYZTLorentzVector p4Subjet(subjet.px(), subjet.py(), subjet.pz(), subjet.e());
849  reco::Particle::Point point(0, 0, 0);
850 
851  // This will hold ptr's to the subjets
852  std::vector<reco::CandidatePtr> subjetConstituents;
853 
854  // Get the transient subjet constituents from fastjet
855  std::vector<fastjet::PseudoJet> subjetFastjetConstituents = subjet.constituents();
856  std::vector<reco::CandidatePtr> constituents = getConstituents(subjetFastjetConstituents);
857 
858  indices[jetIndex].push_back(subjetCollection->size());
859 
860  // Add the concrete subjet type to the subjet list to write to event record
861  subjetCollection->push_back(*std::make_unique<T>());
862  auto& jet = subjetCollection->back();
863  if ((applyWeight_) && (makePFJet(jetTypeE)))
864  reco::writeSpecific(dynamic_cast<reco::PFJet&>(jet), p4Subjet, point, constituents, iSetup, &weights_);
865  else
866  reco::writeSpecific(jet, p4Subjet, point, constituents, iSetup);
867  jet.setIsWeighted(applyWeight_);
868  double subjetArea = 0.0;
869  if (doAreaFastjet_ && itSubJet->has_area()) {
870  subjetArea = itSubJet->area();
871  }
872  jet.setJetArea(subjetArea);
873  }
874  }
875 
876  // put subjets into event record
877  subjetHandleAfterPut = iEvent.put(std::move(subjetCollection), jetCollInstanceName_);
878 
879  // Now create the hard jets with ptr's to the subjets as constituents
880  std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_hardJets.begin(), ip4Begin = p4_hardJets.begin(),
881  ip4End = p4_hardJets.end();
882 
883  for (; ip4 != ip4End; ++ip4) {
884  int p4_index = ip4 - ip4Begin;
885  std::vector<int>& ind = indices[p4_index];
886  std::vector<reco::CandidatePtr> i_hardJetConstituents;
887  // Add the subjets to the hard jet
888  for (std::vector<int>::const_iterator isub = ind.begin(); isub != ind.end(); ++isub) {
889  reco::CandidatePtr candPtr(subjetHandleAfterPut, *isub, false);
890  i_hardJetConstituents.push_back(candPtr);
891  }
892  reco::Particle::Point point(0, 0, 0);
893  reco::BasicJet toput(*ip4, point, i_hardJetConstituents);
894  toput.setJetArea(area_hardJets[ip4 - ip4Begin]);
895  jetCollection->push_back(toput);
896  }
897 
898  // put hard jets into event record
899  // Store the Orphan handle for adding HTT information
901 
902  if (fromHTTTopJetProducer_) {
903  addHTTTopJetTagInfoCollection(iEvent, iSetup, oh);
904  }
905 }
906 
908 template <class T>
910  if (verbosity_ >= 1) {
911  std::cout << "<VirtualJetProducer::writeJetsWithConstituents (moduleLabel = " << moduleLabel_ << ")>:" << std::endl;
912  }
913 
914  // get a list of output jets MV: make this compatible with template
915  auto jetCollection = std::make_unique<reco::PFJetCollection>();
916 
917  // this is the mapping of jet to constituents
918  std::vector<std::vector<int>> indices;
919  // this is the list of jet 4-momenta
920  std::vector<math::XYZTLorentzVector> p4_Jets;
921  // this is the jet areas
922  std::vector<double> area_Jets;
923 
924  // get a list of output constituents
925  auto constituentCollection = std::make_unique<reco::PFCandidateCollection>();
926 
927  // This will store the handle for the constituents after we write them
928  edm::OrphanHandle<reco::PFCandidateCollection> constituentHandleAfterPut;
929 
930  // Loop over the jets and extract constituents
931  std::vector<fastjet::PseudoJet> constituentsSub;
932  std::vector<fastjet::PseudoJet>::const_iterator it = fjJets_.begin(), iEnd = fjJets_.end(), iBegin = fjJets_.begin();
933  indices.resize(fjJets_.size());
934 
935  for (; it != iEnd; ++it) {
936  fastjet::PseudoJet const& localJet = *it;
937  unsigned int jetIndex = it - iBegin;
938  // Get the 4-vector for the hard jet
939  p4_Jets.push_back(math::XYZTLorentzVector(localJet.px(), localJet.py(), localJet.pz(), localJet.e()));
940  double localJetArea = 0.0;
941  if (doAreaFastjet_ && localJet.has_area()) {
942  localJetArea = localJet.area();
943  }
944  area_Jets.push_back(localJetArea);
945 
946  // create the constituent list
947  std::vector<fastjet::PseudoJet> constituents, ghosts;
948  if (it->has_pieces())
949  constituents = it->pieces();
950  else if (it->has_constituents())
951  fastjet::SelectorIsPureGhost().sift(it->constituents(), ghosts, constituents); //filter out ghosts
952 
953  //loop over constituents of jet (can be subjets or normal constituents)
954  indices[jetIndex].reserve(constituents.size());
955  constituentsSub.reserve(constituentsSub.size() + constituents.size());
956  for (fastjet::PseudoJet const& constit : constituents) {
957  indices[jetIndex].push_back(constituentsSub.size());
958  constituentsSub.push_back(constit);
959  }
960  }
961 
962  //Loop over constituents and store in the event
963  static const reco::PFCandidate dummySinceTranslateIsNotStatic;
964  for (fastjet::PseudoJet const& constit : constituentsSub) {
965  auto orig = inputs_[constit.user_index()];
966  auto id = dummySinceTranslateIsNotStatic.translatePdgIdToType(orig->pdgId());
967  reco::PFCandidate pCand(reco::PFCandidate(orig->charge(), orig->p4(), id));
969  pVec.SetPxPyPzE(constit.px(), constit.py(), constit.pz(), constit.e());
970  pCand.setP4(pVec);
971  pCand.setSourceCandidatePtr(orig->sourceCandidatePtr(0));
972  constituentCollection->push_back(pCand);
973  }
974  // put constituents into event record
975  constituentHandleAfterPut = iEvent.put(std::move(constituentCollection), jetCollInstanceName_);
976 
977  // Now create the jets with ptr's to the constituents
978  std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_Jets.begin(), ip4Begin = p4_Jets.begin(),
979  ip4End = p4_Jets.end();
980 
981  for (; ip4 != ip4End; ++ip4) {
982  int p4_index = ip4 - ip4Begin;
983  std::vector<int>& ind = indices[p4_index];
984  std::vector<reco::CandidatePtr> i_jetConstituents;
985  // Add the constituents to the jet
986  for (std::vector<int>::const_iterator iconst = ind.begin(); iconst != ind.end(); ++iconst) {
987  reco::CandidatePtr candPtr(constituentHandleAfterPut, *iconst, false);
988  i_jetConstituents.push_back(candPtr);
989  }
990  if (!i_jetConstituents.empty()) { //only keep jets which have constituents after subtraction
991  reco::Particle::Point point(0, 0, 0);
993  reco::writeSpecific(jet, *ip4, point, i_jetConstituents, iSetup);
994  jet.setJetArea(area_Jets[ip4 - ip4Begin]);
995  jetCollection->emplace_back(jet);
996  }
997  }
998 
999  // put jets into event record
1001 }
1002 
1003 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
1006  fillDescriptionsFromVirtualJetProducer(desc);
1007  desc.add<string>("jetCollInstanceName", "");
1008 
1009  // addDefault must be used here instead of add unless
1010  // all the classes that inherit from this class redefine
1011  // the fillDescriptions function. Otherwise, the autogenerated
1012  // cfi filenames are the same and conflict.
1013  descriptions.addDefault(desc);
1014 }
1015 
1017  desc.add<edm::InputTag>("src", edm::InputTag("particleFlow"));
1018  desc.add<edm::InputTag>("srcPVs", edm::InputTag(""));
1019  desc.add<string>("jetType", "PFJet");
1020  desc.add<string>("jetAlgorithm", "AntiKt");
1021  desc.add<double>("rParam", 0.4);
1022  desc.add<double>("inputEtMin", 0.0);
1023  desc.add<double>("inputEMin", 0.0);
1024  desc.add<double>("jetPtMin", 5.);
1025  desc.add<bool>("doPVCorrection", false);
1026  desc.add<bool>("doAreaFastjet", false);
1027  desc.add<bool>("doRhoFastjet", false);
1028  desc.add<bool>("doPUOffsetCorr", false);
1029  desc.add<double>("puPtMin", 10.);
1030  desc.add<double>("nSigmaPU", 1.0);
1031  desc.add<double>("radiusPU", 0.5);
1032  desc.add<string>("subtractorName", "");
1033  desc.add<bool>("useExplicitGhosts", false);
1034  desc.add<bool>("doAreaDiskApprox", false);
1035  desc.add<double>("voronoiRfact", -0.9);
1036  desc.add<double>("Rho_EtaMax", 4.4);
1037  desc.add<double>("Ghost_EtaMax", 5.);
1038  desc.add<int>("Active_Area_Repeats", 1);
1039  desc.add<double>("GhostArea", 0.01);
1040  desc.add<bool>("restrictInputs", false);
1041  desc.add<unsigned int>("maxInputs", 1);
1042  desc.add<bool>("writeCompound", false);
1043  desc.add<bool>("writeJetsWithConst", false);
1044  desc.add<bool>("doFastJetNonUniform", false);
1045  desc.add<bool>("useDeterministicSeed", false);
1046  desc.add<unsigned int>("minSeed", 14327);
1047  desc.add<int>("verbosity", 0);
1048  desc.add<double>("puWidth", 0.);
1049  desc.add<unsigned int>("nExclude", 0);
1050  desc.add<unsigned int>("maxBadEcalCells", 9999999);
1051  desc.add<unsigned int>("maxBadHcalCells", 9999999);
1052  desc.add<unsigned int>("maxProblematicEcalCells", 9999999);
1053  desc.add<unsigned int>("maxProblematicHcalCells", 9999999);
1054  desc.add<unsigned int>("maxRecoveredEcalCells", 9999999);
1055  desc.add<unsigned int>("maxRecoveredHcalCells", 9999999);
1056  vector<double> puCentersDefault;
1057  desc.add<vector<double>>("puCenters", puCentersDefault);
1058  desc.add<bool>("applyWeight", false);
1059  desc.add<edm::InputTag>("srcWeights", edm::InputTag(""));
1060  desc.add<double>("minimumTowersFraction", 0.);
1061 }
ConfigurationDescriptions.h
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
RefProd.h
VirtualJetProducer::output
virtual void output(edm::Event &iEvent, edm::EventSetup const &iSetup)
Definition: VirtualJetProducer.cc:536
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
VirtualJetProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: VirtualJetProducer.cc:264
CaloJetCollection.h
GenJetCollection.h
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
Handle.h
BackgroundEstimator.h
reco::helper::GreaterByPtPseudoJet::operator()
bool operator()(const fastjet::PseudoJet &t1, const fastjet::PseudoJet &t2) const
Definition: VirtualJetProducer.cc:61
reco::writeSpecific
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)
Definition: JetSpecific.cc:34
mps_fire.i
i
Definition: mps_fire.py:428
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
edm::View::empty
bool empty() const
fastjet::BackgroundEstimator::set_excluded_jets
void set_excluded_jets(const std::vector< PseudoJet > &excluded_jets)
Definition: BackgroundEstimator.h:130
reco::LeafCandidate::Point
math::XYZPoint Point
point in the space
Definition: LeafCandidate.h:27
ESHandle.h
VirtualJetProducer::JetType::Type
Type
Definition: VirtualJetProducer.h:41
HLT_FULL_cff.nEta
nEta
Definition: HLT_FULL_cff.py:6586
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
PFCandidate.h
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm
HLT enums.
Definition: AlignableModifier.h:19
VirtualJetProducer::makeProduces
virtual void makeProduces(std::string s, std::string tag="")
Definition: VirtualJetProducer.cc:83
gather_cfg.cout
cout
Definition: gather_cfg.py:144
VirtualJetProducer::JetType::names
static const char *const names[]
Definition: VirtualJetProducer.h:50
pos
Definition: PixelAliasList.h:18
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
PFJetCollection.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
PFClusterJetCollection.h
btagElecInJet_cfi.CaloJet
CaloJet
Definition: btagElecInJet_cfi.py:4
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
BasicJetCollection.h
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
fastjet::BackgroundEstimator
Definition: BackgroundEstimator.h:41
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle< reco::VertexCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
muonTiming_cfi.etamin
etamin
Definition: muonTiming_cfi.py:30
geometryDiff.epsilon
int epsilon
Definition: geometryDiff.py:26
VirtualJetProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: VirtualJetProducer.cc:1004
CandidateFwd.h
reco::Jet::setJetArea
virtual void setJetArea(float fArea)
set jet area
Definition: Jet.h:101
VirtualJetProducer::VirtualJetProducer
VirtualJetProducer(const edm::ParameterSet &iConfig)
Definition: VirtualJetProducer.cc:113
reco::BasicJet
Jets made from CaloTowers.
Definition: BasicJet.h:19
MakerMacros.h
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
PVValHelper::eta
Definition: PVValidationHelpers.h:70
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
LeafCandidate.h
anotherprimaryvertexanalyzer_cfi.pvCollection
pvCollection
Definition: anotherprimaryvertexanalyzer_cfi.py:4
VirtualJetProducer::copyConstituents
virtual void copyConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents, reco::Jet *jet)
Definition: VirtualJetProducer.cc:513
TrackJetCollection.h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
VirtualJetProducer.h
ParameterSetDescription.h
jetfilter_cfi.jetCollection
jetCollection
Definition: jetfilter_cfi.py:4
fastjet::BackgroundEstimator::sigma
double sigma()
get the sigma
Definition: BackgroundEstimator.h:64
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
VirtualJetProducer::PluginPtr
std::shared_ptr< fastjet::JetDefinition::Plugin > PluginPtr
Definition: VirtualJetProducer.h:74
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View::size
size_type size() const
Vertex.h
VirtualJetProducerHelper.h
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:231
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
RefVector.h
VirtualJetProducer::isAnomalousTower
virtual bool isAnomalousTower(reco::CandidatePtr input)
Definition: VirtualJetProducer.cc:499
Event.h
deltaR.h
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
VirtualJetProducer::JetType::byName
static Type byName(const std::string &name)
Definition: VirtualJetProducer.cc:74
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
helper
Definition: helper.py:1
iEvent
int iEvent
Definition: GenABIO.cc:224
CaloTower
Definition: CaloTower.h:26
VirtualJetProducer::inputTowers
virtual void inputTowers()
Definition: VirtualJetProducer.cc:442
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
VirtualJetProducer::writeJets
void writeJets(edm::Event &iEvent, edm::EventSetup const &iSetup)
Definition: VirtualJetProducer.cc:602
HLT_FULL_cff.srcWeights
srcWeights
Definition: HLT_FULL_cff.py:8647
edm::Ptr< Candidate >
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition: JetExtendedAssociation.h:25
VertexFwd.h
reco::LeafCandidate::setP4
void setP4(const LorentzVector &p4) final
set 4-momentum
Definition: LeafCandidate.h:158
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Ref.h
edm::OrphanHandle
Definition: EDProductfwd.h:39
VirtualJetProducer::getConstituents
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
Definition: VirtualJetProducer.cc:522
isFinite.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
T
long double T
Definition: Basic3DVectorLD.h:48
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
metsig::jet
Definition: SignAlgoResolutions.h:47
edm::ValueMap< float >
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:128
Exception
Definition: hltDiff.cc:245
muonTiming_cfi.etamax
etamax
Definition: muonTiming_cfi.py:23
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
EventSetup.h
reco::PFCandidate::translatePdgIdToType
ParticleType translatePdgIdToType(int pdgid) const
Definition: PFCandidate.cc:209
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
VirtualJetProducer::~VirtualJetProducer
~VirtualJetProducer() override
Definition: VirtualJetProducer.cc:257
mps_fire.result
result
Definition: mps_fire.py:311
ConsumesCollector.h
cms::Exception
Definition: Exception.h:70
VirtualJetProducer::writeCompoundJets
void writeCompoundJets(edm::Event &iEvent, edm::EventSetup const &iSetup)
function template to write out the outputs
Definition: VirtualJetProducer.cc:767
nanoDQM_cfi.GenJet
GenJet
Definition: nanoDQM_cfi.py:262
VirtualJetProducer::writeJetsWithConstituents
void writeJetsWithConstituents(edm::Event &iEvent, edm::EventSetup const &iSetup)
function template to write out the outputs
Definition: VirtualJetProducer.cc:909
View.h
reco::helper::GreaterByPtPseudoJet
Definition: VirtualJetProducer.cc:60
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
fastjet::BackgroundEstimator::rho
double rho()
synonym for median rho [[do we have this? Both?]]
Definition: BackgroundEstimator.h:61
edm::Event
Definition: Event.h:73
reco::PFCandidate::setSourceCandidatePtr
void setSourceCandidatePtr(const PFCandidatePtr &ptr)
Definition: PFCandidate.h:120
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::View::ptrAt
Ptr< value_type > ptrAt(size_type i) const
edm::InputTag
Definition: InputTag.h:15
reco::helper::VirtualJetProducerHelper::intersection
double intersection(double r12)
Definition: VirtualJetProducerHelper.h:14
VirtualJetProducer::fillDescriptionsFromVirtualJetProducer
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)
Definition: VirtualJetProducer.cc:1016