Changeset 49234af in git for external/fastjet/plugins/SISCone/SISConePlugin.cc
- Timestamp:
- Dec 9, 2014, 1:27:13 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 37deb3b, 9e991f8
- Parents:
- f6b6ee7 (diff), e7e90df (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/plugins/SISCone/SISConePlugin.cc
rf6b6ee7 r49234af 21 21 four_vector.E); 22 22 } 23 24 //====================================================================== 25 // wrap-up around siscone's user-defined scales 26 namespace siscone_plugin_internal{ 27 /// @ingroup internal 28 /// \class SISConeUserScale 29 /// class that makes the transition between the internal SISCone 30 /// user-defined scale choice (using SISCone's Cjet) and 31 /// user-defined scale choices in the plugn above (using FastJet's 32 /// PseudoJets) 33 class SISConeUserScale : public siscone::Csplit_merge::Cuser_scale_base{ 34 public: 35 /// ctor takes the "fastjet-style" user-defined scale as well as a 36 /// reference to the current cluster sequence (to access the 37 /// particles if needed) 38 SISConeUserScale(const SISConePlugin::UserScaleBase *user_scale, 39 const ClusterSequence &cs) 40 : _user_scale(user_scale), _cs(cs){} 41 42 /// returns the scale associated to a given jet 43 virtual double operator()(const siscone::Cjet &jet) const{ 44 return _user_scale->result(_build_PJ_from_Cjet(jet)); 45 } 46 47 /// returns true id the scasle associated to jet a is larger than 48 /// the scale associated to jet b 49 virtual bool is_larger(const siscone::Cjet &a, const siscone::Cjet &b) const{ 50 return _user_scale->is_larger(_build_PJ_from_Cjet(a), _build_PJ_from_Cjet(b)); 51 } 52 53 private: 54 /// constructs a PseudoJet from a siscone::Cjet 55 /// 56 /// Note that it is tempting to overload the PseudoJet ctor. This 57 /// would not work because down the line we need to access the 58 /// original PseudoJet through the ClusterSequence and therefore 59 /// the PseudoJet structure needs to be aware of the 60 /// ClusterSequence. 61 PseudoJet _build_PJ_from_Cjet(const siscone::Cjet &jet) const{ 62 PseudoJet j(jet.v.px, jet.v.py, jet.v.pz, jet.v.E); 63 j.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>( 64 new SISConePlugin::UserScaleBaseStructureType<siscone::Cjet>(jet,_cs))); 65 return j; 66 } 67 68 const SISConePlugin::UserScaleBase *_user_scale; 69 const ClusterSequence & _cs; 70 }; 71 } 72 73 // end of the internal material 74 //====================================================================== 23 75 24 76 … … 45 97 desc << "SISCone jet algorithm with " ; 46 98 desc << "cone_radius = " << cone_radius () << ", "; 47 desc << "overlap_threshold = " << overlap_threshold () << ", "; 99 if (_progressive_removal) 100 desc << "progressive-removal mode, "; 101 else 102 desc << "overlap_threshold = " << overlap_threshold () << ", "; 48 103 desc << "n_pass_max = " << n_pass_max () << ", "; 49 104 desc << "protojet_ptmin = " << protojet_ptmin() << ", "; 50 desc << sm_scale_string << ", "; 51 desc << "caching turned " << (caching() ? on : off); 52 desc << ", SM stop scale = " << _split_merge_stopping_scale; 105 if (_progressive_removal && _user_scale) { 106 desc << "using a user-defined scale for ordering of stable cones"; 107 string user_scale_desc = _user_scale->description(); 108 if (user_scale_desc != "") desc << " (" << user_scale_desc << ")"; 109 } else { 110 desc << sm_scale_string; 111 } 112 if (!_progressive_removal){ 113 desc << ", caching turned " << (caching() ? on : off); 114 desc << ", SM stop scale = " << _split_merge_stopping_scale; 115 } 53 116 54 117 // add a note to the description if we use the pt-weighted splitting … … 85 148 bool new_siscone = true; // by default we'll be running it 86 149 87 if (caching() ) {150 if (caching() && !_progressive_removal) { 88 151 89 152 // Establish if we have a cached run with the same R, npass and … … 138 201 // run the jet finding 139 202 //cout << "plg sms: " << split_merge_scale() << endl; 140 siscone->compute_jets(siscone_momenta, cone_radius(), overlap_threshold(), 141 n_pass_max(), protojet_or_ghost_ptmin(), 142 Esplit_merge_scale(split_merge_scale())); 203 if (_progressive_removal){ 204 // handle the optional user-defined scale choice 205 SharedPtr<siscone_plugin_internal::SISConeUserScale> internal_scale; 206 if (_user_scale){ 207 internal_scale.reset(new siscone_plugin_internal::SISConeUserScale(_user_scale, clust_seq)); 208 siscone->set_user_scale(internal_scale.get()); 209 } 210 siscone->compute_jets_progressive_removal(siscone_momenta, cone_radius(), 211 n_pass_max(), protojet_or_ghost_ptmin(), 212 Esplit_merge_scale(split_merge_scale())); 213 } else { 214 siscone->compute_jets(siscone_momenta, cone_radius(), overlap_threshold(), 215 n_pass_max(), protojet_or_ghost_ptmin(), 216 Esplit_merge_scale(split_merge_scale())); 217 } 143 218 } else { 144 219 // rerun the jet finding … … 155 230 SISConeExtras * extras = new SISConeExtras(n); 156 231 232 // the ordering in which the inclusive jets are transfered here is 233 // deliberate and ensures that when a user asks for 234 // inclusive_jets(), they are provided in the order in which SISCone 235 // created them. 157 236 for (int ijet = njet-1; ijet >= 0; ijet--) { 158 237 const Cjet & jet = siscone->jets[ijet]; // shorthand … … 207 286 208 287 // give the extras object to the cluster sequence. 209 clust_seq.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras)); 288 // 289 // As of v3.1 of FastJet, extras are automatically owned (as 290 // SharedPtr) by the ClusterSequence and auto_ptr is deprecated. So 291 // we can use a simple pointer here 292 //clust_seq.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras)); 293 clust_seq.plugin_associate_extras(extras); 210 294 } 211 295 … … 215 299 } 216 300 301 // //====================================================================== 302 // // material to handle user-defined scales 303 // 304 // //-------------------------------------------------- 305 // // SISCone structure type 306 // 307 // // the textual descripotion 308 // std::string SISConePlugin::UserScaleBase::StructureType::description() const{ 309 // return "PseudoJet wrapping a siscone::Cjet stable cone"; 310 // } 311 // 312 // // retrieve the constituents 313 // // 314 // // if you simply need to iterate over the constituents, it will be 315 // // faster to access them via constituent(i) 316 // vector<PseudoJet> SISConePlugin::UserScaleBase::StructureType::constituents(const PseudoJet &) const{ 317 // vector<PseudoJet> constits; 318 // constits.reserve(_jet.n); 319 // for (unsigned int i=0; i<(unsigned int)_jet.n;i++) 320 // constits.push_back(constituent(i)); 321 // return constits; 322 // } 323 // 324 // // returns the number of constituents 325 // unsigned int SISConePlugin::UserScaleBase::StructureType::size() const{ 326 // return _jet.n; 327 // } 328 // 329 // // returns the index (in the original particle list) of the ith 330 // // constituent 331 // int SISConePlugin::UserScaleBase::StructureType::constituent_index(unsigned int i) const{ 332 // return _jet.contents[i]; 333 // } 334 // 335 // // returns the ith constituent (as a PseusoJet) 336 // const PseudoJet & SISConePlugin::UserScaleBase::StructureType::constituent(unsigned int i) const{ 337 // return _cs.jets()[_jet.contents[i]]; 338 // } 339 // 340 // // returns the scalar pt of this stable cone 341 // double SISConePlugin::UserScaleBase::StructureType::pt_tilde() const{ 342 // return _jet.pt_tilde; 343 // } 344 // 345 // // returns the sm_var2 (signed ordering variable squared) for this stable cone 346 // double SISConePlugin::UserScaleBase::StructureType::ordering_var2() const{ 347 // return _jet.sm_var2; 348 // } 349 350 217 351 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
Note:
See TracChangeset
for help on using the changeset viewer.