2 #include "fastjet/PseudoJet.hh" 3 #include "fastjet/ClusterSequence.hh" 10 src_(iConfig.getParameter<
edm::InputTag>(
"src")),
12 Njets_(iConfig.getParameter<
std::vector<unsigned> >(
"Njets")),
13 cuts_(iConfig.getParameter<
std::vector<
std::
string>>(
"cuts")),
14 ecftype_(iConfig.getParameter<
std::
string>(
"ecftype")),
15 alpha_(iConfig.getParameter<double>(
"alpha")),
16 beta_(iConfig.getParameter<double>(
"beta"))
20 throw cms::Exception(
"ConfigurationError") <<
"cuts and Njets must be the same size in ECFAdder" << std::endl;
23 for ( std::vector<unsigned>::const_iterator
n =
Njets_.begin();
n !=
Njets_.end(); ++
n )
25 std::ostringstream ecfN_str;
26 std::shared_ptr<fastjet::FunctionOfPseudoJet<double> > pfunc;
29 ecfN_str <<
"ecf" << *
n;
30 pfunc.reset(
new fastjet::contrib::EnergyCorrelator( *n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R ) );
33 ecfN_str <<
"ecfC" << *
n;
34 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorCseries( *n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R ) );
37 ecfN_str <<
"ecfD" << *
n;
38 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorGeneralizedD2(
alpha_,
beta_, fastjet::contrib::EnergyCorrelator::pt_R ) );
41 ecfN_str <<
"ecfN" << *
n;
42 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorNseries( *n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R ) );
45 ecfN_str <<
"ecfM" << *
n;
46 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorMseries( *n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R ) );
49 ecfN_str <<
"ecfU" << *
n;
50 pfunc.reset(
new fastjet::contrib::EnergyCorrelatorUseries( *n,
beta_, fastjet::contrib::EnergyCorrelator::pt_R ) );
53 produces<edm::ValueMap<float> >(ecfN_str.str());
71 for ( std::vector<unsigned>::const_iterator
n =
Njets_.begin();
n !=
Njets_.end(); ++
n )
74 std::vector<float> ecfN;
75 ecfN.reserve(jets->size());
89 auto outT = std::make_unique<edm::ValueMap<float>>();
91 fillerT.insert(jets, ecfN.begin(), ecfN.end());
101 std::vector<fastjet::PseudoJet> FJparticles;
102 for (
unsigned k = 0;
k <
object->numberOfDaughters(); ++
k)
108 if ( dp->numberOfDaughters() == 0 ) {
109 FJparticles.push_back( fastjet::PseudoJet( dp->px(), dp->py(), dp->pz(), dp->energy() ) );
111 auto subjet =
dynamic_cast<reco::Jet const *
>( dp.
get() );
112 for (
unsigned l = 0;
l < subjet->numberOfDaughters(); ++
l ) {
113 if ( subjet !=
nullptr ) {
115 FJparticles.push_back( fastjet::PseudoJet( ddp->px(), ddp->py(), ddp->pz(), ddp->energy() ) );
117 edm::LogWarning(
"MissingJetConstituent") <<
"BasicJet constituent required for ECF computation is missing!";
123 edm::LogWarning(
"MissingJetConstituent") <<
"Jet constituent required for ECF computation is missing!";
140 iDesc.
setComment(
"Energy Correlation Functions adder");
143 iDesc.
add<std::vector<unsigned> >(
"Njets", {1,2,3} )->setComment(
"Number of jets to emulate");
144 iDesc.
add<std::vector<std::string>> (
"cuts", {
"",
"",
""})->setComment(
"Jet selections for each N value. Size must match Njets.");
145 iDesc.
add<
double>(
"alpha",1.0)->
setComment(
"alpha factor, only valid for N2");
146 iDesc.
add<
double>(
"beta",1.0)->
setComment(
"angularity factor");
147 iDesc.
add<
std::string>(
"ecftype",
"")->setComment(
"ECF type: ECF or empty; C; D; N; M; U;");
148 descriptions.
add(
"ECFAdder", iDesc);
void setComment(std::string const &value)
std::vector< std::shared_ptr< fastjet::FunctionOfPseudoJet< double > > > routine_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ECFAdder(const edm::ParameterSet &iConfig)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
T const * get() const
Returns C++ pointer to the item.
Base class for all types of Jets.
float getECF(unsigned index, const edm::Ptr< reco::Jet > &object) const
std::vector< StringCutObjectSelector< reco::Jet > > selectors_
std::vector< std::string > variables_
std::vector< std::string > cuts_
void setComment(std::string const &value)
edm::EDGetTokenT< edm::View< reco::Jet > > src_token_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< unsigned > Njets_
bool isNonnull() const
Checks for non-null.
static std::string join(char **cmd)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator