43 #include "fastjet/SISConePlugin.hh" 44 #include "fastjet/CMSIterativeConePlugin.hh" 45 #include "fastjet/ATLASConePlugin.hh" 46 #include "fastjet/CDFMidPointPlugin.hh" 53 #include <vdt/vdtMath.h> 62 bool operator()(
const fastjet::PseudoJet & t1,
const fastjet::PseudoJet &
t2 )
const {
63 return t1.perp2() > t2.perp2();
72 "BasicJet",
"GenJet",
"CaloJet",
"PFJet",
"TrackJet",
"PFClusterJet" 81 if (pos ==
names + LastJetType) {
82 std::string errorMessage=
"Requested jetType not supported: "+name+
"\n";
93 if ( writeCompound_ ) {
94 produces<reco::BasicJetCollection>();
97 if (makeCaloJet(jetTypeE)) {
98 produces<reco::CaloJetCollection>(
tag).setBranchAlias(alias);
100 else if (makePFJet(jetTypeE)) {
101 produces<reco::PFJetCollection>(
tag).setBranchAlias(alias);
103 else if (makeGenJet(jetTypeE)) {
104 produces<reco::GenJetCollection>(
tag).setBranchAlias(alias);
106 else if (makeTrackJet(jetTypeE)) {
107 produces<reco::TrackJetCollection>(
tag).setBranchAlias(alias);
109 else if (makePFClusterJet(jetTypeE)) {
110 produces<reco::PFClusterJetCollection>(
tag).setBranchAlias(alias);
112 else if (makeBasicJet(jetTypeE)) {
113 produces<reco::BasicJetCollection>(
tag).setBranchAlias(alias);
124 moduleLabel_ = iConfig.
getParameter<
string> (
"@module_label");
128 jetAlgorithm_ = iConfig.
getParameter<
string> (
"jetAlgorithm");
130 inputEtMin_ = iConfig.
getParameter<
double> (
"inputEtMin");
131 inputEMin_ = iConfig.
getParameter<
double> (
"inputEMin");
133 doPVCorrection_ = iConfig.
getParameter<
bool> (
"doPVCorrection");
134 doAreaFastjet_ = iConfig.
getParameter<
bool> (
"doAreaFastjet");
135 doRhoFastjet_ = iConfig.
getParameter<
bool> (
"doRhoFastjet");
136 jetCollInstanceName_ = iConfig.
getParameter<
string> (
"jetCollInstanceName");
137 doPUOffsetCorr_ = iConfig.
getParameter<
bool> (
"doPUOffsetCorr");
138 puSubtractorName_ = iConfig.
getParameter<
string> (
"subtractorName");
139 useExplicitGhosts_ = iConfig.
getParameter<
bool> (
"useExplicitGhosts");
140 doAreaDiskApprox_ = iConfig.
getParameter<
bool> (
"doAreaDiskApprox");
141 voronoiRfact_ = iConfig.
getParameter<
double> (
"voronoiRfact");
142 rhoEtaMax_ = iConfig.
getParameter<
double> (
"Rho_EtaMax");
143 ghostEtaMax_ = iConfig.
getParameter<
double> (
"Ghost_EtaMax");
144 activeAreaRepeats_ = iConfig.
getParameter<
int> (
"Active_Area_Repeats");
145 ghostArea_ = iConfig.
getParameter<
double> (
"GhostArea");
146 restrictInputs_ = iConfig.
getParameter<
bool> (
"restrictInputs");
147 maxInputs_ = iConfig.
getParameter<
unsigned int>(
"maxInputs");
148 writeCompound_ = iConfig.
getParameter<
bool> (
"writeCompound");
149 doFastJetNonUniform_ = iConfig.
getParameter<
bool> (
"doFastJetNonUniform");
150 puCenters_ = iConfig.
getParameter<vector<double> >(
"puCenters");
152 nExclude_ = iConfig.
getParameter<
unsigned int>(
"nExclude");
153 useDeterministicSeed_ = iConfig.
getParameter<
bool> (
"useDeterministicSeed");
154 minSeed_ = iConfig.
getParameter<
unsigned int>(
"minSeed");
157 anomalousTowerDef_ = auto_ptr<AnomalousTower>(
new AnomalousTower(iConfig));
159 input_vertex_token_ = consumes<reco::VertexCollection>(srcPVs_);
160 input_candidateview_token_ = consumes<reco::CandidateView>(src_);
161 input_candidatefwdptr_token_ = consumes<vector<edm::FwdPtr<reco::PFCandidate> > >(iConfig.
getParameter<
edm::InputTag>(
"src"));
162 input_packedcandidatefwdptr_token_ = consumes<vector<edm::FwdPtr<pat::PackedCandidate> > >(iConfig.
getParameter<
edm::InputTag>(
"src"));
169 if (jetAlgorithm_==
"Kt")
170 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(fastjet::kt_algorithm,rParam_));
172 else if (jetAlgorithm_==
"CambridgeAachen")
173 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(fastjet::cambridge_algorithm,rParam_) );
175 else if (jetAlgorithm_==
"AntiKt")
176 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(fastjet::antikt_algorithm,rParam_) );
178 else if (jetAlgorithm_==
"GeneralizedKt")
179 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(fastjet::genkt_algorithm,rParam_,-2) );
181 else if (jetAlgorithm_==
"SISCone") {
183 fjPlugin_ =
PluginPtr(
new fastjet::SISConePlugin(rParam_,0.75,0,0.0,
false,fastjet::SISConePlugin::SM_pttilde) );
184 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(&*fjPlugin_) );
186 }
else if (jetAlgorithm_==
"IterativeCone") {
188 fjPlugin_ =
PluginPtr(
new fastjet::CMSIterativeConePlugin(rParam_,1.0));
189 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(&*fjPlugin_));
191 }
else if (jetAlgorithm_==
"CDFMidPoint") {
193 fjPlugin_ =
PluginPtr(
new fastjet::CDFMidPointPlugin(rParam_,0.75));
194 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(&*fjPlugin_));
196 }
else if (jetAlgorithm_==
"ATLASCone") {
198 fjPlugin_ =
PluginPtr(
new fastjet::ATLASConePlugin(rParam_));
199 fjJetDefinition_=
JetDefPtr(
new fastjet::JetDefinition(&*fjPlugin_));
202 throw cms::Exception(
"Invalid jetAlgorithm") <<
"Jet algorithm for VirtualJetProducer is invalid, Abort!\n";
207 if ( doPUOffsetCorr_ ) {
208 if(puSubtractorName_.empty()){
209 LogWarning(
"VirtualJetProducer") <<
"Pile Up correction on; however, pile up type is not specified. Using default... \n";
210 subtractor_ = boost::shared_ptr<PileUpSubtractor>(
new PileUpSubtractor(iConfig, consumesCollector()));
211 }
else subtractor_ = boost::shared_ptr<PileUpSubtractor>(
216 if (doAreaDiskApprox_ && doAreaFastjet_)
217 throw cms::Exception(
"Conflicting area calculations") <<
"Both the calculation of jet area via fastjet and via an analytical disk approximation have been requested. Please decide on one.\n";
219 if ( doAreaFastjet_ || doRhoFastjet_ ) {
221 if (voronoiRfact_ <= 0) {
222 fjActiveArea_ =
ActiveAreaSpecPtr(
new fastjet::GhostedAreaSpec(ghostEtaMax_,activeAreaRepeats_,ghostArea_));
223 fjActiveArea_->set_fj2_placement(
true);
225 if ( !useExplicitGhosts_ ) {
226 fjAreaDefinition_ =
AreaDefinitionPtr(
new fastjet::AreaDefinition(fastjet::active_area, *fjActiveArea_ ) );
228 fjAreaDefinition_ =
AreaDefinitionPtr(
new fastjet::AreaDefinition(fastjet::active_area_explicit_ghosts, *fjActiveArea_ ) );
231 fjRangeDef_ =
RangeDefPtr(
new fastjet::RangeDefinition(rhoEtaMax_) );
234 if( ( doFastJetNonUniform_ ) && ( puCenters_.size() == 0 ) )
235 throw cms::Exception(
"doFastJetNonUniform") <<
"Parameter puCenters for doFastJetNonUniform is not defined." << std::endl;
238 makeProduces( moduleLabel_, jetCollInstanceName_ );
239 produces<vector<double> >(
"rhos");
240 produces<vector<double> >(
"sigmas");
241 produces<double>(
"rho");
242 produces<double>(
"sigma");
266 if ( useDeterministicSeed_ ) {
267 fastjet::GhostedAreaSpec gas;
268 std::vector<int> seeds(2);
269 unsigned int runNum_uint = static_cast <
unsigned int> (iEvent.
id().
run());
270 unsigned int evNum_uint = static_cast <
unsigned int> (iEvent.
id().
event());
271 seeds[0] =
std::max(runNum_uint,minSeed_ + 3) + 3 * evNum_uint;
272 seeds[1] =
std::max(runNum_uint,minSeed_ + 5) + 5 * evNum_uint;
273 gas.set_random_status(seeds);
276 LogDebug(
"VirtualJetProducer") <<
"Entered produce\n";
279 if ( (makeCaloJet(jetTypeE) || makePFJet(jetTypeE)) &&doPVCorrection_) {
280 LogDebug(
"VirtualJetProducer") <<
"Adding PV info\n";
282 iEvent.
getByToken(input_vertex_token_ , pvCollection);
283 if (pvCollection->size()>0) vertex_=pvCollection->begin()->position();
288 if ( doPUOffsetCorr_ ) {
289 subtractor_->setupGeometryMap(iEvent, iSetup);
293 LogDebug(
"VirtualJetProducer") <<
"Clear data\n";
304 bool isView = iEvent.
getByToken(input_candidateview_token_, inputsHandle);
306 if ( inputsHandle->
size() == 0) {
310 for (
size_t i = 0;
i < inputsHandle->
size(); ++
i) {
311 inputs_.push_back(inputsHandle->
ptrAt(
i));
314 bool isPF = iEvent.
getByToken(input_candidatefwdptr_token_, pfinputsHandleAsFwdPtr);
316 if ( pfinputsHandleAsFwdPtr->size() == 0) {
320 for (
size_t i = 0;
i < pfinputsHandleAsFwdPtr->size(); ++
i) {
321 if ( (*pfinputsHandleAsFwdPtr)[
i].ptr().isAvailable() ) {
322 inputs_.push_back( (*pfinputsHandleAsFwdPtr)[
i].ptr() );
324 else if ( (*pfinputsHandleAsFwdPtr)[
i].backPtr().isAvailable() ) {
325 inputs_.push_back( (*pfinputsHandleAsFwdPtr)[
i].backPtr() );
329 iEvent.
getByToken(input_packedcandidatefwdptr_token_, packedinputsHandleAsFwdPtr);
330 if ( packedinputsHandleAsFwdPtr->size() == 0) {
334 for (
size_t i = 0;
i < packedinputsHandleAsFwdPtr->size(); ++
i) {
335 if ( (*packedinputsHandleAsFwdPtr)[
i].ptr().isAvailable() ) {
336 inputs_.push_back( (*packedinputsHandleAsFwdPtr)[
i].ptr() );
338 else if ( (*packedinputsHandleAsFwdPtr)[
i].backPtr().isAvailable() ) {
339 inputs_.push_back( (*packedinputsHandleAsFwdPtr)[
i].backPtr() );
344 LogDebug(
"VirtualJetProducer") <<
"Got inputs\n";
349 fjInputs_.reserve(inputs_.size());
351 LogDebug(
"VirtualJetProducer") <<
"Inputted towers\n";
355 if ( doPUOffsetCorr_ ) {
356 subtractor_->setDefinition(fjJetDefinition_);
357 subtractor_->reset(inputs_,fjInputs_,fjJets_);
358 subtractor_->calculatePedestal(fjInputs_);
359 subtractor_->subtractPedestal(fjInputs_);
360 LogDebug(
"VirtualJetProducer") <<
"Subtracted pedestal\n";
364 runAlgorithm( iEvent, iSetup );
370 LogDebug(
"VirtualJetProducer") <<
"Ran algorithm\n";
377 if ( doPUOffsetCorr_ ) {
378 LogDebug(
"VirtualJetProducer") <<
"Do PUOffsetCorr\n";
379 vector<fastjet::PseudoJet> orphanInput;
380 subtractor_->calculateOrphanInput(orphanInput);
381 subtractor_->calculatePedestal(orphanInput);
382 subtractor_->offsetCorrectJets();
389 LogDebug(
"VirtualJetProducer") <<
"Wrote jets\n";
394 decltype(fjInputs_)().
swap(fjInputs_);
395 decltype(fjJets_)().
swap(fjJets_);
396 decltype(inputs_)().
swap(inputs_);
405 auto inBegin = inputs_.begin(),
406 inEnd = inputs_.end(),
i = inBegin;
407 for (;
i != inEnd; ++
i ) {
411 if (
input.et() <inputEtMin_)
continue;
412 if (
input.energy()<inputEMin_)
continue;
413 if (isAnomalousTower(*
i))
continue;
419 if (makeCaloJet(jetTypeE)&&doPVCorrection_) {
421 auto const & ct = tower.
p4(vertex_);
422 fjInputs_.emplace_back(ct.px(),ct.py(),ct.pz(),ct.energy());
435 fjInputs_.back().set_user_index(
i - inBegin);
438 if ( restrictInputs_ && fjInputs_.size() > maxInputs_ ) {
440 std::sort(fjInputs_.begin(), fjInputs_.end(), pTComparator);
441 fjInputs_.resize(maxInputs_);
442 edm::LogWarning(
"JetRecoTooManyEntries") <<
"Too many inputs in the event, limiting to first " << maxInputs_ <<
". Output is suspect.";
449 if (!makeCaloJet(jetTypeE))
452 return (*anomalousTowerDef_)(*input);
465 for (
unsigned int i=0;
i<fjConstituents.size();++
i) {
466 int index = fjConstituents[
i].user_index();
467 if ( index >= 0 && static_cast<unsigned int>(index) < inputs_.size() )
474 vector<reco::CandidatePtr>
477 vector<reco::CandidatePtr>
result; result.reserve(fjConstituents.size()/2);
478 for (
unsigned int i=0;
i<fjConstituents.size();
i++) {
479 auto index = fjConstituents[
i].user_index();
480 if (
index >= 0 && static_cast<unsigned int>(
index) < inputs_.size() ) {
481 result.emplace_back(inputs_[
index]);
495 if ( !writeCompound_ ) {
498 writeJets<reco::CaloJet>(
iEvent, iSetup);
500 case JetType::PFJet :
501 writeJets<reco::PFJet>(
iEvent, iSetup);
503 case JetType::GenJet :
504 writeJets<reco::GenJet>(
iEvent, iSetup);
506 case JetType::TrackJet :
507 writeJets<reco::TrackJet>(
iEvent, iSetup);
509 case JetType::PFClusterJet :
510 writeJets<reco::PFClusterJet>(
iEvent, iSetup);
512 case JetType::BasicJet :
513 writeJets<reco::BasicJet>(
iEvent, iSetup);
516 throw cms::Exception(
"InvalidInput") <<
"invalid jet type in VirtualJetProducer\n";
523 writeCompoundJets<reco::CaloJet>(
iEvent, iSetup );
525 case JetType::PFJet :
526 writeCompoundJets<reco::PFJet>(
iEvent, iSetup );
528 case JetType::GenJet :
529 writeCompoundJets<reco::GenJet>(
iEvent, iSetup );
531 case JetType::BasicJet :
532 writeCompoundJets<reco::BasicJet>(
iEvent, iSetup );
535 throw cms::Exception(
"InvalidInput") <<
"invalid jet type in CompoundJetProducer\n";
542 template<
typename T >
543 struct Area {
static float get(
T const &) {
return 0;}};
547 return jet.getSpecific().mTowersArea;
552 template<
typename T >
564 std::vector<fastjet::PseudoJet> fjexcluded_jets;
565 fjexcluded_jets=fjJets_;
567 if(fjexcluded_jets.size()>2) fjexcluded_jets.resize(nExclude_);
569 if(doFastJetNonUniform_){
570 auto rhos = std::make_unique<std::vector<double>>();
571 auto sigmas = std::make_unique<std::vector<double>>();
572 int nEta = puCenters_.size();
574 sigmas->reserve(nEta);
575 fastjet::ClusterSequenceAreaBase
const* clusterSequenceWithArea =
576 dynamic_cast<fastjet::ClusterSequenceAreaBase
const *
> ( &*fjClusterSeq_ );
578 if (clusterSequenceWithArea ==
nullptr ){
579 if (fjJets_.size() > 0) {
580 throw cms::Exception(
"LogicError")<<
"fjClusterSeq is not initialized while inputs are present\n ";
583 for(
int ie = 0; ie <
nEta; ++ie){
584 double eta = puCenters_[ie];
585 double etamin=eta-puWidth_;
586 double etamax=eta+puWidth_;
587 fastjet::RangeDefinition range_rho(etamin,etamax);
590 rhos->push_back(bkgestim.
rho());
591 sigmas->push_back(bkgestim.
sigma());
597 auto rho = std::make_unique<double>(0.0);
598 auto sigma = std::make_unique<double>(0.0);
599 double mean_area = 0;
601 fastjet::ClusterSequenceAreaBase
const* clusterSequenceWithArea =
602 dynamic_cast<fastjet::ClusterSequenceAreaBase
const *
> ( &*fjClusterSeq_ );
609 if (clusterSequenceWithArea ==
nullptr ){
610 if (fjJets_.size() > 0) {
611 throw cms::Exception(
"LogicError")<<
"fjClusterSeq is not initialized while inputs are present\n ";
614 clusterSequenceWithArea->get_median_rho_and_sigma(*fjRangeDef_,
false,*rho,*
sigma,mean_area);
616 edm::LogError(
"BadRho") <<
"rho value is " << *rho <<
" area:" << mean_area <<
" and n_empty_jets: " << clusterSequenceWithArea->n_empty_jets(*fjRangeDef_) <<
" with range " << fjRangeDef_->description()
617 <<
". Setting rho to rezo.";
628 using namespace reco;
631 auto jets = std::make_unique<std::vector<T>>(fjJets_.size());
634 using RIJ = std::pair<double,double>;
635 std::vector<RIJ> rijStorage(fjJets_.size()*(fjJets_.size()/2));
636 RIJ * rij[fjJets_.size()];
638 for (
unsigned int ijet=0;ijet<fjJets_.size();++ijet) {
639 rij[ijet] = &rijStorage[
k]; k+=ijet;
642 float etaJ[fjJets_.size()], phiJ[fjJets_.size()];
644 auto orParam_ = 1./rParam_;
646 for (
unsigned int ijet=0;ijet<fjJets_.size();++ijet) {
647 auto &
jet = (*jets)[ijet];
649 const fastjet::PseudoJet& fjJet = fjJets_[ijet];
651 std::vector<fastjet::PseudoJet>
const & fjConstituents = fastjet::sorted_by_pt(fjJet.constituents());
653 std::vector<CandidatePtr>
const & constituents = getConstituents(fjConstituents);
664 constituents, iSetup);
665 phiJ[ijet] =
jet.phi();
666 etaJ[ijet] =
jet.eta();
670 for (
unsigned int ijet=0;ijet<fjJets_.size();++ijet) {
674 const auto & fjJet = fjJets_[ijet];
675 if ( doAreaFastjet_ && fjJet.has_area() ) {
676 jetArea = fjJet.area();
678 else if ( doAreaDiskApprox_ ) {
683 for (
unsigned jJet = 0; jJet < ijet; ++jJet) {
686 jetArea -=distance[jJet].second;
687 for (
unsigned kJet = 0; kJet < jJet; ++kJet) {
689 distance[jJet].
second, distance[kJet].second, rij[jJet][kJet].second);
692 jetArea *= (rParam_*rParam_);
694 auto &
jet = (*jets)[ijet];
695 jet.setJetArea (jetArea);
698 jet.setPileup(subtractor_->getPileUpEnergy(ijet));
715 if ( verbosity_ >= 1 ) {
716 std::cout <<
"<VirtualJetProducer::writeCompoundJets (moduleLabel = " << moduleLabel_ <<
")>:" << std::endl;
720 auto jetCollection = std::make_unique<reco::BasicJetCollection>();
722 auto subjetCollection = std::make_unique<std::vector<T>>();
727 std::vector< std::vector<int> > indices;
729 std::vector<math::XYZTLorentzVector> p4_hardJets;
731 std::vector<double> area_hardJets;
734 std::vector<fastjet::PseudoJet>::const_iterator it = fjJets_.begin(),
735 iEnd = fjJets_.end(),
736 iBegin = fjJets_.begin();
737 indices.resize( fjJets_.size() );
738 for ( ; it != iEnd; ++it ) {
739 fastjet::PseudoJet
const & localJet = *it;
740 unsigned int jetIndex = it - iBegin;
743 double localJetArea = 0.0;
744 if ( doAreaFastjet_ && localJet.has_area() ) {
745 localJetArea = localJet.area();
747 area_hardJets.push_back( localJetArea );
750 std::vector<fastjet::PseudoJet> constituents;
751 if ( it->has_pieces() ) {
752 constituents = it->pieces();
753 }
else if ( it->has_constituents() ) {
754 constituents = it->constituents();
757 std::vector<fastjet::PseudoJet>::const_iterator itSubJetBegin = constituents.begin(),
758 itSubJet = itSubJetBegin, itSubJetEnd = constituents.end();
759 for (; itSubJet != itSubJetEnd; ++itSubJet ){
761 fastjet::PseudoJet
const & subjet = *itSubJet;
762 if ( verbosity_ >= 1 ) {
763 std::cout <<
"subjet #" << (itSubJet - itSubJetBegin) <<
": Pt = " << subjet.pt() <<
", eta = " << subjet.eta() <<
", phi = " << subjet.phi() <<
", mass = " << subjet.m()
764 <<
" (#constituents = " << subjet.constituents().size() <<
")" << std::endl;
765 std::vector<fastjet::PseudoJet> subjet_constituents = subjet.constituents();
766 int idx_constituent = 0;
767 for ( std::vector<fastjet::PseudoJet>::const_iterator constituent = subjet_constituents.begin();
768 constituent != subjet_constituents.end(); ++constituent ) {
769 if ( constituent->pt() < 1.e-3 )
continue;
770 std::cout <<
" constituent #" << idx_constituent <<
": Pt = " << constituent->pt() <<
", eta = " << constituent->eta() <<
", phi = " << constituent->phi() <<
"," 771 <<
" mass = " << constituent->m() << std::endl;
776 if ( verbosity_ >= 1 ) {
777 std::cout <<
"subjet #" << (itSubJet - itSubJetBegin) <<
": Pt = " << subjet.pt() <<
", eta = " << subjet.eta() <<
", phi = " << subjet.phi() <<
", mass = " << subjet.m()
778 <<
" (#constituents = " << subjet.constituents().size() <<
")" << std::endl;
779 std::vector<fastjet::PseudoJet> subjet_constituents = subjet.constituents();
780 int idx_constituent = 0;
781 for ( std::vector<fastjet::PseudoJet>::const_iterator constituent = subjet_constituents.begin();
782 constituent != subjet_constituents.end(); ++constituent ) {
783 if ( constituent->pt() < 1.e-3 )
continue;
784 std::cout <<
" constituent #" << idx_constituent <<
": Pt = " << constituent->pt() <<
", eta = " << constituent->eta() <<
", phi = " << constituent->phi() <<
"," 785 <<
" mass = " << constituent->m() << std::endl;
794 std::vector<reco::CandidatePtr> subjetConstituents;
797 std::vector<fastjet::PseudoJet> subjetFastjetConstituents = subjet.constituents();
798 std::vector<reco::CandidatePtr> constituents =
799 getConstituents(subjetFastjetConstituents );
801 indices[jetIndex].push_back( subjetCollection->size() );
806 double subjetArea = 0.0;
807 if ( doAreaFastjet_ && itSubJet->has_area() ){
808 subjetArea = itSubJet->area();
810 jet.setJetArea( subjetArea );
811 subjetCollection->push_back( jet );
816 subjetHandleAfterPut = iEvent.
put(
std::move(subjetCollection), jetCollInstanceName_);
819 std::vector<math::XYZTLorentzVector>::const_iterator ip4 = p4_hardJets.begin(),
820 ip4Begin = p4_hardJets.begin(),
821 ip4End = p4_hardJets.end();
823 for ( ; ip4 != ip4End; ++ip4 ) {
824 int p4_index = ip4 - ip4Begin;
825 std::vector<int> & ind = indices[p4_index];
826 std::vector<reco::CandidatePtr> i_hardJetConstituents;
828 for( std::vector<int>::const_iterator isub = ind.begin();
829 isub != ind.end(); ++isub ) {
831 i_hardJetConstituents.push_back( candPtr );
835 toput.
setJetArea( area_hardJets[ip4 - ip4Begin] );
836 jetCollection->push_back( toput );
843 if (fromHTTTopJetProducer_){
844 addHTTTopJetTagInfoCollection( iEvent, iSetup, oh);
853 fillDescriptionsFromVirtualJetProducer(desc);
854 desc.
add<
string>(
"jetCollInstanceName",
"" );
855 descriptions.
add(
"VirtualJetProducer",desc);
862 desc.
add<
string>(
"jetType",
"PFJet" );
863 desc.
add<
string>(
"jetAlgorithm",
"AntiKt" );
864 desc.
add<
double>(
"rParam", 0.4 );
865 desc.
add<
double>(
"inputEtMin", 0.0 );
866 desc.
add<
double>(
"inputEMin", 0.0 );
867 desc.
add<
double>(
"jetPtMin", 5. );
868 desc.
add<
bool> (
"doPVCorrection",
false );
869 desc.
add<
bool> (
"doAreaFastjet",
false );
870 desc.
add<
bool> (
"doRhoFastjet",
false );
871 desc.
add<
bool> (
"doPUOffsetCorr",
false );
872 desc.
add<
double>(
"puPtMin", 10.);
873 desc.
add<
double>(
"nSigmaPU", 1.0 );
874 desc.
add<
double>(
"radiusPU", 0.5 );
875 desc.
add<
string>(
"subtractorName",
"" );
876 desc.
add<
bool> (
"useExplicitGhosts",
false );
877 desc.
add<
bool> (
"doAreaDiskApprox",
false );
878 desc.
add<
double>(
"voronoiRfact", -0.9 );
879 desc.
add<
double>(
"Rho_EtaMax", 4.4 );
880 desc.
add<
double>(
"Ghost_EtaMax", 5. );
881 desc.
add<
int> (
"Active_Area_Repeats", 1 );
882 desc.
add<
double>(
"GhostArea", 0.01 );
883 desc.
add<
bool> (
"restrictInputs",
false );
884 desc.
add<
unsigned int> (
"maxInputs", 1 );
885 desc.
add<
bool> (
"writeCompound",
false );
886 desc.
add<
bool> (
"doFastJetNonUniform",
false );
887 desc.
add<
bool> (
"useDeterministicSeed",
false );
888 desc.
add<
unsigned int> (
"minSeed", 14327 );
889 desc.
add<
int> (
"verbosity", 0 );
890 desc.
add<
double>(
"puWidth", 0. );
891 desc.
add<
unsigned int>(
"nExclude", 0 );
892 desc.
add<
unsigned int>(
"maxBadEcalCells", 9999999 );
893 desc.
add<
unsigned int>(
"maxBadHcalCells", 9999999 );
894 desc.
add<
unsigned int>(
"maxProblematicEcalCells", 9999999 );
895 desc.
add<
unsigned int>(
"maxProblematicHcalCells", 9999999 );
896 desc.
add<
unsigned int>(
"maxRecoveredEcalCells", 9999999 );
897 desc.
add<
unsigned int>(
"maxRecoveredHcalCells", 9999999 );
898 vector<double> puCentersDefault;
899 desc.
add<vector<double>>(
"puCenters", puCentersDefault);
boost::shared_ptr< fastjet::AreaDefinition > AreaDefinitionPtr
void writeJets(edm::Event &iEvent, edm::EventSetup const &iSetup)
T getParameter(std::string const &) const
EventNumber_t event() const
boost::shared_ptr< fastjet::JetDefinition > JetDefPtr
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Jets made from CaloTowers.
static const HistoName names[]
math::PtEtaPhiMLorentzVector p4(double vtxZ) const
virtual std::vector< reco::CandidatePtr > getConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Ptr< value_type > ptrAt(size_type i) const
virtual void inputTowers()
Base class for all types of Jets.
boost::shared_ptr< fastjet::JetDefinition::Plugin > PluginPtr
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void copyConstituents(const std::vector< fastjet::PseudoJet > &fjConstituents, reco::Jet *jet)
Jets made from CaloTowers.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static std::string const input
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
boost::shared_ptr< fastjet::RangeDefinition > RangeDefPtr
U second(std::pair< T, U > const &p)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual bool isAnomalousTower(reco::CandidatePtr input)
virtual void setJetArea(float fArea)
set jet area
double intersection(double r12)
virtual ~VirtualJetProducer()
auto const T2 &decltype(t1.eta()) t2
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
virtual void makeProduces(std::string s, std::string tag="")
math::XYZPoint Point
point in the space
void set_excluded_jets(const std::vector< PseudoJet > &excluded_jets)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double rho()
synonym for median rho [[do we have this? Both?]]
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const char *const names[]
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
double sigma()
get the sigma
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
VirtualJetProducer(const edm::ParameterSet &iConfig)
boost::shared_ptr< fastjet::GhostedAreaSpec > ActiveAreaSpecPtr
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)
static Type byName(const std::string &name)
T get(const Candidate &c)
*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
math::PtEtaPhiELorentzVectorF LorentzVector
math::XYZPoint Point
point in the space
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)