18 std::vector<float> QjetsVolatility;
19 QjetsVolatility.reserve(jets->size());
25 QjetsVolatility.push_back(-1);
30 vector<fastjet::PseudoJet> allconstits;
32 for (
unsigned k = 0;
k < newCand.getJetConstituents().size();
k++) {
34 allconstits.push_back(
35 fastjet::PseudoJet(thisParticle->px(), thisParticle->py(), thisParticle->pz(), thisParticle->energy()));
38 fastjet::JetDefinition jetDef(fastjet::cambridge_algorithm,
jetRad_);
40 jetDef.set_jet_algorithm(fastjet::antikt_algorithm);
42 jetDef.set_jet_algorithm(fastjet::cambridge_algorithm);
44 throw cms::Exception(
"GroomedJetFiller") <<
" unknown jet algorithm " << std::endl;
46 fastjet::ClusterSequence thisClustering_basic(allconstits, jetDef);
47 std::vector<fastjet::PseudoJet> out_jets_basic = sorted_by_pt(thisClustering_basic.inclusive_jets(
cutoff_));
49 if (out_jets_basic.size() !=
51 QjetsVolatility.push_back(-1);
58 std::vector<double> qjetmass;
60 vector<fastjet::PseudoJet> constits;
61 unsigned int nqjetconstits = out_jets_basic.at(0)
65 constits = out_jets_basic.at(0).constituents();
67 constits = out_jets_basic.at(0).associated_cluster_sequence()->exclusive_subjets_up_to(out_jets_basic.at(0),
76 fastjet::ClusterSequence qjet_seq(constits, qjet_def);
77 vector<fastjet::PseudoJet> inclusive_jets2 = sorted_by_pt(qjet_seq.inclusive_jets(
cutoff_));
78 if (!inclusive_jets2.empty()) {
79 qjetmass.push_back(inclusive_jets2[0].
m());
84 if (qjetmass.empty()) {
85 QjetsVolatility.push_back(-1);
89 double mean = std::accumulate(qjetmass.begin(), qjetmass.end(), 0) / qjetmass.size();
90 float totalsquared = 0.;
91 for (
unsigned int i = 0;
i < qjetmass.size();
i++) {
92 totalsquared += (qjetmass[
i] -
mean) * (qjetmass[
i] - mean);
94 float variance =
sqrt(totalsquared / qjetmass.size());
96 QjetsVolatility.push_back(variance / mean);
99 auto outQJV = std::make_unique<edm::ValueMap<float>>();
101 fillerQJV.insert(jets, QjetsVolatility.begin(), QjetsVolatility.end());
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void SetRNEngine(CLHEP::HepRandomEngine *rnEngine)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Base class for all types of Jets.
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
edm::EDGetTokenT< edm::View< reco::Jet > > src_token_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
StreamID streamID() const