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