6 #include "fastjet/contrib/ConstituentSubtractor.hh" 49 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
61 unsigned int bkgVecSize = etaRanges->size();
62 if(bkgVecSize<1) {
throw cms::Exception(
"WrongBkgInput") <<
"Producer needs vector with background estimates\n"; }
63 if(bkgVecSize != (rhoRanges->size()+1) || bkgVecSize != (rhomRanges->size()+1) ) {
64 throw cms::Exception(
"WrongBkgInput") <<
"Size of etaRanges (" << bkgVecSize <<
") and rhoRanges (" << rhoRanges->size() <<
") and/or rhomRanges (" << rhomRanges->size() <<
") vectors inconsistent\n";
70 for(fastjet::PseudoJet& ijet : tempJets ) {
74 std::vector<fastjet::PseudoJet>
particles, ghosts;
75 fastjet::SelectorIsPureGhost().sift(ijet.constituents(), ghosts,
particles);
76 unsigned long nParticles=particles.size();
77 if(nParticles==0)
continue;
82 for(fastjet::PseudoJet& ighost : ghosts) {
84 if(ighost.eta()<=etaRanges->at(0) || bkgVecSize==1) {
85 rho = rhoRanges->at(0);
86 rhom = rhomRanges->at(0);
87 }
else if(ighost.eta()>=etaRanges->at(bkgVecSize-1)) {
88 rho = rhoRanges->at(bkgVecSize-2);
89 rhom = rhomRanges->at(bkgVecSize-2);
91 for(
unsigned int ie = 0; ie<(bkgVecSize-1); ie++) {
92 if(ighost.eta()>=etaRanges->at(ie) && ighost.eta()<etaRanges->at(ie+1)) {
93 rho = rhoRanges->at(ie);
94 rhom = rhomRanges->at(ie);
99 double pt = rho*ighost.area();
102 if (mass_squared>0) mass=
sqrt(mass_squared);
103 ighost.reset_momentum_PtYPhiM(pt,ighost.rap(),ighost.phi(),
mass);
109 fastjet::contrib::ConstituentSubtractor subtractor;
113 subtractor.set_do_mass_subtraction(
true);
114 subtractor.set_remove_all_zero_pt_particles(
true);
116 std::vector<fastjet::PseudoJet> subtracted_particles = subtractor.do_subtraction(particles,ghosts);
119 fastjet::PseudoJet subtracted_jet=
join(subtracted_particles);
120 if(subtracted_jet.perp()>0.)
121 fjJets_.push_back( subtracted_jet );
132 descCSJetProducer.
add<
string>(
"jetCollInstanceName",
"" );
134 descCSJetProducer.
add<
bool> (
"sumRecHits",
false);
137 descriptions.
add(
"CSJetProducer",descCSJetProducer);
143 desc.
add<
double>(
"csRParam",-1.);
144 desc.
add<
double>(
"csAlpha",2.);
T getParameter(std::string const &) const
std::vector< fastjet::PseudoJet > fjJets_
double csAlpha_
for constituent subtraction : R parameter
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< std::vector< double > > rhoToken_
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::EDGetTokenT< std::vector< double > > etaToken_
for HI constituent subtraction : alpha (power of pt in metric)
static std::string join(char **cmd)
void runAlgorithm(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< std::vector< double > > rhomToken_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
AreaDefinitionPtr fjAreaDefinition_
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)
static void fillDescriptionsFromCSJetProducer(edm::ParameterSetDescription &desc)
Power< A, B >::type pow(const A &a, const B &b)
boost::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
JetDefPtr fjJetDefinition_