Changeset 35cdc46 in git for external/fastjet/tools
- Timestamp:
- Sep 3, 2014, 3:18:54 PM (10 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- be2222c
- Parents:
- 5b5a56b
- Location:
- external/fastjet/tools
- Files:
-
- 2 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
external/fastjet/tools/BackgroundEstimatorBase.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: BackgroundEstimatorBase.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 -
external/fastjet/tools/BackgroundEstimatorBase.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_BACKGROUND_ESTIMATOR_BASE_HH__ 3 3 4 // STARTHEADER5 // $Id: BackgroundEstimatorBase.hh 2689 2011-11-14 14:51:06Z soyez$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: BackgroundEstimatorBase.hh 3516 2014-08-01 14:07:58Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequenceAreaBase.hh> … … 43 45 /// 44 46 /// Abstract base class that provides the basic interface for classes 45 /// that estimate levels of background radiation in hadr ion and47 /// that estimate levels of background radiation in hadron and 46 48 /// heavy-ion collider events. 47 ///48 49 /// 49 50 class BackgroundEstimatorBase { … … 99 100 /// determination of sigma 100 101 virtual bool has_sigma() {return false;} 101 //\} 102 102 103 //---------------------------------------------------------------- 104 // now do the same thing for rho_m and sigma_m 105 106 /// returns rho_m, the purely longitudinal, particle-mass-induced 107 /// component of the background density per unit area 108 virtual double rho_m() const{ 109 throw Error("rho_m() not supported for this Background Estimator"); 110 } 111 112 /// returns sigma_m, a measure of the fluctuations in the purely 113 /// longitudinal, particle-mass-induced component of the background 114 /// density per unit area; must be multipled by sqrt(area) to get 115 /// fluctuations for a region of a given area. 116 virtual double sigma_m() const { 117 throw Error("sigma_m() not supported for this Background Estimator"); 118 } 119 120 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 121 virtual double rho_m(const PseudoJet & /*jet*/){ 122 throw Error("rho_m(jet) not supported for this Background Estimator"); 123 } 124 125 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 126 virtual double sigma_m(const PseudoJet & /*jet*/) { 127 throw Error("sigma_m(jet) not supported for this Background Estimator"); 128 } 129 130 /// Returns true if this background estimator has support for 131 /// determination of rho_m. 132 /// 133 /// Note that support for sigma_m is automatic is one has sigma and 134 /// rho_m support. 135 virtual bool has_rho_m() const {return false;} 136 //\} 137 103 138 104 139 /// @name configuring the behaviour … … 114 149 /// The BackgroundRescalingYPolynomial class can be used to get a 115 150 /// rescaling that depends just on rapidity. 151 /// 152 /// There is currently no support for different rescaling classes 153 /// for rho and rho_m determinations. 116 154 virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class_in) { _rescaling_class = rescaling_class_in; } 117 155 -
external/fastjet/tools/Boost.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Boost.hh 2689 2011-11-14 14:51:06Z soyez$1 //FJSTARTHEADER 2 // $Id: Boost.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_TOOL_BOOST_HH__ -
external/fastjet/tools/CASubJetTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: CASubJetTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/CASubJetTagger.hh> -
external/fastjet/tools/CASubJetTagger.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: CASubJetTagger.hh 2616 2011-09-30 18:03:40Z salam $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: CASubJetTagger.hh 3433 2014-07-23 08:17:03Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __CASUBJET_TAGGER_HH__ -
external/fastjet/tools/Filter.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Filter.cc 3633 2014-08-15 13:23:52Z soyez $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/Filter.hh" 32 #include "fastjet/tools/Recluster.hh" 30 33 #include <fastjet/ClusterSequenceActiveAreaExplicitGhosts.hh> 31 34 #include <cassert> … … 45 48 // class description 46 49 string Filter::description() const { 50 if (!_initialised){ 51 return "uninitialised Filter"; 52 } 53 47 54 ostringstream ostr; 48 55 ostr << "Filter with subjet_def = "; … … 73 80 // by the filtering 74 81 PseudoJet Filter::result(const PseudoJet &jet) const { 82 if (!_initialised){ 83 //Q: do we throw or do we return an empty PJ? 84 throw Error("uninitialised Filter"); 85 } 86 75 87 // start by getting the list of subjets (including a list of sanity 76 88 // checks) … … 78 90 // _set_filtered_elements_cafilt) 79 91 vector<PseudoJet> subjets; 80 JetDefinition subjet_def; 81 bool discard_area; 82 // NB: on return, subjet_def is set to the jet definition actually 83 // used (so that we can make use of its recombination scheme 84 // when joining the jets to be kept). 85 _set_filtered_elements(jet, subjets, subjet_def, discard_area); 92 //JetDefinition subjet_def; 93 bool ca_optimised = _set_filtered_elements(jet, subjets); 94 95 // apply subtraction if needed: 96 if (_subtractor){ 97 subjets = (*_subtractor)(subjets); 98 } else if (_rho!=0){ 99 if (subjets.size()>0){ 100 const ClusterSequenceAreaBase *csab = subjets[0].validated_csab(); 101 for (unsigned int i=0;i<subjets.size();i++){ 102 subjets[i]=csab->subtracted_jet(subjets[i], _rho); 103 } 104 } 105 } 86 106 87 107 // now build the vector of kept and rejected subjets … … 94 114 95 115 // gather the info under the form of a PseudoJet 96 return _finalise(jet, kept, rejected, subjet_def, discard_area);116 return _finalise(jet, kept, rejected, ca_optimised); 97 117 } 98 118 99 119 100 120 // sets filtered_elements to be all the subjets on which filtering will work 101 void Filter::_set_filtered_elements(const PseudoJet & jet, 102 vector<PseudoJet> & filtered_elements, 103 JetDefinition & subjet_def, 104 bool & discard_area) const { 105 // sanity checks 106 //------------------------------------------------------------------- 107 // make sure that the jet has constituents 108 if (! jet.has_constituents()) 109 throw Error("Filter can only be applied on jets having constituents"); 121 // 122 // return true when the subjets have been optained using teh optimised 123 // method for C/A 124 bool Filter::_set_filtered_elements(const PseudoJet & jet, 125 vector<PseudoJet> & filtered_elements) const { 126 // create the recluster instance 127 Recluster recluster; 128 if ((_Rfilt>=0) || (_Rfiltfunc)) 129 recluster = Recluster(cambridge_algorithm, (_Rfiltfunc) ? (*_Rfiltfunc)(jet) : _Rfilt, Recluster::keep_all); 130 else 131 recluster = Recluster(_subjet_def, false, Recluster::keep_all); 110 132 111 // for a whole variety of checks, we shall need the "recursive" 112 // pieces of the jet (the jet itself or recursing down to its most 113 // fundamental pieces). 114 // So we do compute these once and for all 115 vector<PseudoJet> all_pieces; //.clear(); 116 if ((!_get_all_pieces(jet, all_pieces)) || (all_pieces.size()==0)) 117 throw Error("Attempt to filter a jet that has no associated ClusterSequence or is not a superposition of jets associated with a ClusterSequence"); 118 119 // if the filter uses subtraction, make sure we have a CS that supports area and has 120 // explicit ghosts 121 if (_uses_subtraction()) { 122 if (!jet.has_area()) 123 throw Error("Attempt to filter and subtract (non-zero rho or subtractor) without area info for the original jet"); 124 125 if (!_check_explicit_ghosts(all_pieces)) 126 throw Error("Attempt to filter and subtract (non-zero rho or subtractor) without explicit ghosts"); 127 } 128 129 // if we're dealing with a dynamic determination of the filtering 130 // radius, do it now 131 if ((_Rfilt>=0) || (_Rfiltfunc)){ 132 double Rfilt = (_Rfiltfunc) ? (*_Rfiltfunc)(jet) : _Rfilt; 133 const JetDefinition::Recombiner * common_recombiner = _get_common_recombiner(all_pieces); 134 if (common_recombiner) { 135 if (typeid(*common_recombiner) == typeid(JetDefinition::DefaultRecombiner)) { 136 RecombinationScheme scheme = 137 static_cast<const JetDefinition::DefaultRecombiner *>(common_recombiner)->scheme(); 138 subjet_def = JetDefinition(cambridge_algorithm, Rfilt, scheme); 139 } else { 140 subjet_def = JetDefinition(cambridge_algorithm, Rfilt, common_recombiner); 141 } 142 } else { 143 subjet_def = JetDefinition(cambridge_algorithm, Rfilt); 144 } 145 } else { 146 subjet_def = _subjet_def; 147 } 148 149 // get the jet definition to be use and whether we can apply our 150 // simplified C/A+C/A filter 151 // 152 // we apply C/A clustering iff 153 // - the request subjet_def is C/A 154 // - the jet is either directly coming from C/A or if it is a 155 // superposition of C/A jets 156 // - the pieces agree with the recombination scheme of subjet_def 157 //------------------------------------------------------------------ 158 bool simple_cafilt = _check_ca(all_pieces); 159 160 // extract the subjets 161 //------------------------------------------------------------------- 162 discard_area = false; 163 if (simple_cafilt){ 164 // first make sure that 'filtered_elements' is empty 165 filtered_elements.clear(); 166 _set_filtered_elements_cafilt(jet, filtered_elements, subjet_def.R()); 167 // in the following case, areas can be erroneous and will be discarded 168 discard_area = (!_uses_subtraction()) && (jet.has_area()) && (!_check_explicit_ghosts(all_pieces)); 169 } else { 170 // here we'll simply recluster the jets. 171 // 172 // To include an area support we need 173 // - the jet to have an area 174 // - subtraction requested or explicit ghosts 175 bool do_areas = (jet.has_area()) && ((_uses_subtraction()) || (_check_explicit_ghosts(all_pieces))); 176 _set_filtered_elements_generic(jet, filtered_elements, subjet_def, do_areas); 177 } 178 179 // order the filtered elements in pt 180 filtered_elements = sorted_by_pt(filtered_elements); 133 // get the subjets 134 //JetDefinition subjet_def; 135 return recluster.get_new_jets_and_def(jet, filtered_elements); 181 136 } 182 183 // set the filtered elements in the simple case of C/A+C/A184 //185 // WATCH OUT: this could be recursively called, so filtered elements186 // of 'jet' are APPENDED to 'filtered_elements'187 void Filter::_set_filtered_elements_cafilt(const PseudoJet & jet,188 vector<PseudoJet> & filtered_elements,189 double Rfilt) const{190 // we know that the jet is either a C/A jet or a superposition of191 // such pieces192 if (jet.has_associated_cluster_sequence()){193 // just extract the exclusive subjets of 'jet'194 const ClusterSequence *cs = jet.associated_cluster_sequence();195 vector<PseudoJet> local_fe;196 197 double dcut = Rfilt / cs->jet_def().R();198 if (dcut>=1.0){199 local_fe.push_back(jet);200 } else {201 dcut *= dcut;202 local_fe = jet.exclusive_subjets(dcut);203 }204 205 // subtract the jets if needed206 // Note that this one would work on pieces!!207 //-----------------------------------------------------------------208 if (_uses_subtraction()){209 const ClusterSequenceAreaBase * csab = jet.validated_csab();210 for (unsigned int i=0;i<local_fe.size();i++) {211 if (_subtractor) {212 local_fe[i] = (*_subtractor)(local_fe[i]);213 } else {214 local_fe[i] = csab->subtracted_jet(local_fe[i], _rho);215 }216 }217 }218 219 copy(local_fe.begin(), local_fe.end(), back_inserter(filtered_elements));220 return;221 }222 223 // just recurse into the pieces224 const vector<PseudoJet> & pieces = jet.pieces();225 for (vector<PseudoJet>::const_iterator it = pieces.begin();226 it!=pieces.end(); it++)227 _set_filtered_elements_cafilt(*it, filtered_elements, Rfilt);228 }229 230 231 // set the filtered elements in the generic re-clustering case (wo232 // subtraction)233 void Filter::_set_filtered_elements_generic(const PseudoJet & jet,234 vector<PseudoJet> & filtered_elements,235 const JetDefinition & subjet_def,236 bool do_areas) const{237 // create a new, internal, ClusterSequence from the jet constituents238 // get the subjets directly from there239 //240 // If the jet has area support then we separate the ghosts from the241 // "regular" particles so the subjets will also have area242 // support. Note that we do this regardless of whether rho is zero243 // or not.244 //245 // Note that to be able to separate the ghosts, one needs explicit246 // ghosts!!247 // ---------------------------------------------------------------248 if (do_areas){249 vector<PseudoJet> all_constituents = jet.constituents();250 vector<PseudoJet> regular_constituents, ghosts;251 252 for (vector<PseudoJet>::iterator it = all_constituents.begin();253 it != all_constituents.end(); it++){254 if (it->is_pure_ghost())255 ghosts.push_back(*it);256 else257 regular_constituents.push_back(*it);258 }259 260 // figure out the ghost area from the 1st ghost (if none, any value261 // would probably do as the area will be 0 and subtraction will have262 // no effect!)263 double ghost_area = (ghosts.size()) ? ghosts[0].area() : 0.01;264 ClusterSequenceActiveAreaExplicitGhosts * csa265 = new ClusterSequenceActiveAreaExplicitGhosts(regular_constituents,266 subjet_def,267 ghosts, ghost_area);268 269 // get the subjets: we use the subtracted or unsubtracted ones270 // depending on rho or _subtractor being non-zero271 if (_uses_subtraction()) {272 if (_subtractor) {273 filtered_elements = (*_subtractor)(csa->inclusive_jets());274 } else {275 filtered_elements = csa->subtracted_jets(_rho);276 }277 } else {278 filtered_elements = csa->inclusive_jets();279 }280 281 // allow the cs to be deleted when it's no longer used282 csa->delete_self_when_unused();283 } else {284 ClusterSequence * cs = new ClusterSequence(jet.constituents(), subjet_def);285 filtered_elements = cs->inclusive_jets();286 // allow the cs to be deleted when it's no longer used287 cs->delete_self_when_unused();288 }289 }290 291 137 292 138 // gather the information about what is kept and rejected under the … … 295 141 vector<PseudoJet> & kept, 296 142 vector<PseudoJet> & rejected, 297 const JetDefinition & subjet_def, 298 const bool discard_area) const { 299 // figure out which recombiner to use 300 const JetDefinition::Recombiner &rec = *(subjet_def.recombiner()); 143 bool ca_optimisation_used) const { 144 PseudoJet filtered_jet; 301 145 302 // create an appropriate structure and transfer the info to it 303 PseudoJet filtered_jet = join<StructureType>(kept, rec); 146 if (kept.size()+rejected.size()>0){ 147 // figure out which recombiner to use 148 const JetDefinition::Recombiner &rec = (kept.size()>0) 149 ? *(kept[0].associated_cs()->jet_def().recombiner()) 150 : *(rejected[0].associated_cs()->jet_def().recombiner()); 151 152 // create an appropriate structure and transfer the info to it 153 filtered_jet = join<StructureType>(kept, rec); 154 } else { 155 filtered_jet = join<StructureType>(kept); 156 } 304 157 StructureType *fs = (StructureType*) filtered_jet.structure_non_const_ptr(); 305 // fs->_original_jet = jet;306 158 fs->_rejected = rejected; 159 160 // if we've used C/A optimisation, we need to get rid of the area 161 // information if it comes from a non-explicit-ghost clustering. 162 // (because in that case it can be erroneous due the lack of 163 // information about empty areas) 164 if ((ca_optimisation_used) && (kept.size()+rejected.size()>0)){ 165 bool has_non_explicit_ghost_area = (kept.size()>0) 166 ? (kept[0].has_area() && kept[0].validated_csab()->has_explicit_ghosts()) 167 : (rejected[0].has_area() && rejected[0].validated_csab()->has_explicit_ghosts()); 168 if (has_non_explicit_ghost_area) 169 fs->discard_area(); 170 } 307 171 308 if (discard_area){309 // safety check: make sure there is an area to discard!!!310 assert(fs->_area_4vector_ptr);311 delete fs->_area_4vector_ptr;312 fs->_area_4vector_ptr=0;313 }314 315 172 return filtered_jet; 316 173 } 317 174 318 // various checks319 //----------------------------------------------------------------------320 321 // get the pieces down to the fundamental pieces322 //323 // Note that this just checks that there is an associated CS to the324 // fundamental pieces, not that it is still valid325 bool Filter::_get_all_pieces(const PseudoJet &jet, vector<PseudoJet> &all_pieces) const{326 if (jet.has_associated_cluster_sequence()){327 all_pieces.push_back(jet);328 return true;329 }330 331 if (jet.has_pieces()){332 const vector<PseudoJet> pieces = jet.pieces();333 for (vector<PseudoJet>::const_iterator it=pieces.begin(); it!=pieces.end(); it++)334 if (!_get_all_pieces(*it, all_pieces)) return false;335 return true;336 }337 338 return false;339 }340 341 // get the common recombiner to all pieces (NULL if none)342 //343 // Note that if the jet has an associated cluster sequence that is no344 // longer valid, an error will be thrown (needed since it could be the345 // 1st check called after the enumeration of the pieces)346 const JetDefinition::Recombiner* Filter::_get_common_recombiner(const vector<PseudoJet> &all_pieces) const{347 const JetDefinition & jd_ref = all_pieces[0].validated_cs()->jet_def();348 for (unsigned int i=1; i<all_pieces.size(); i++)349 if (!all_pieces[i].validated_cs()->jet_def().has_same_recombiner(jd_ref)) return NULL;350 351 return jd_ref.recombiner();352 }353 354 // check if the jet (or all its pieces) have explicit ghosts355 // (assuming the jet has area support356 //357 // Note that if the jet has an associated cluster sequence that is no358 // longer valid, an error will be thrown (needed since it could be the359 // 1st check called after the enumeration of the pieces)360 bool Filter::_check_explicit_ghosts(const vector<PseudoJet> &all_pieces) const{361 for (vector<PseudoJet>::const_iterator it=all_pieces.begin(); it!=all_pieces.end(); it++)362 if (! it->validated_csab()->has_explicit_ghosts()) return false;363 return true;364 }365 366 // check if one can apply the simplification for C/A subjets367 //368 // This includes:369 // - the subjet definition asks for C/A subjets370 // - all the pieces share the same CS371 // - that CS is C/A with the same recombiner as the subjet def372 // - the filtering radius is not larger than any of the pairwise373 // distance between the pieces374 //375 // Note that if the jet has an associated cluster sequence that is no376 // longer valid, an error will be thrown (needed since it could be the377 // 1st check called after the enumeration of the pieces)378 bool Filter::_check_ca(const vector<PseudoJet> &all_pieces) const{379 if (_subjet_def.jet_algorithm() != cambridge_algorithm) return false;380 381 // check that the 1st of all the pieces (we're sure there is at382 // least one) is coming from a C/A clustering. Then check that all383 // the following pieces share the same ClusterSequence384 const ClusterSequence * cs_ref = all_pieces[0].validated_cs();385 if (cs_ref->jet_def().jet_algorithm() != cambridge_algorithm) return false;386 for (unsigned int i=1; i<all_pieces.size(); i++)387 if (all_pieces[i].validated_cs() != cs_ref) return false;388 389 // check that the 1st peice has the same recombiner as the one used390 // for the subjet clustering391 // Note that since they share the same CS, checking the 2st one is enough392 if (!cs_ref->jet_def().has_same_recombiner(_subjet_def)) return false;393 394 // we also have to make sure that the filtering radius is not larger395 // than any of the inter-pieces distance396 double Rfilt2 = _subjet_def.R();397 Rfilt2 *= Rfilt2;398 for (unsigned int i=0; i<all_pieces.size()-1; i++){399 for (unsigned int j=i+1; j<all_pieces.size(); j++){400 if (all_pieces[i].squared_distance(all_pieces[j]) < Rfilt2) return false;401 }402 }403 404 return true;405 }406 407 //----------------------------------------------------------------------408 // FilterInterface implementation409 //----------------------------------------------------------------------410 411 175 412 176 FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh -
external/fastjet/tools/Filter.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_TOOLS_FILTER_HH__ 3 3 4 // STARTHEADER5 // $Id: Filter.hh 2694 2011-11-14 22:27:51Z salam$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: Filter.hh 3494 2014-07-30 20:38:48Z soyez $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequence.hh> … … 98 100 /// Note: this is just for derived classes 99 101 /// a Filter initialised through this constructor will not work! 100 Filter() : _Rfiltfunc(0) {};102 Filter() : _Rfiltfunc(0), _initialised(false){}; 101 103 102 104 /// define a filter that decomposes a jet into subjets using a … … 113 115 /// ghosts 114 116 Filter(JetDefinition subjet_def, Selector selector, double rho = 0.0) : 115 _subjet_def(subjet_def), _Rfiltfunc(0), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0) {}117 _subjet_def(subjet_def), _Rfiltfunc(0), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0), _initialised(true) {} 116 118 117 119 /// Same as the full constructor (see above) but just specifying the radius … … 121 123 /// \param Rfilt the filtering radius 122 124 Filter(double Rfilt, Selector selector, double rho = 0.0) : 123 _Rfiltfunc(0), _Rfilt(Rfilt), _selector(selector), _rho(rho), _subtractor(0) {125 _Rfiltfunc(0), _Rfilt(Rfilt), _selector(selector), _rho(rho), _subtractor(0), _initialised(true) { 124 126 if (_Rfilt<0) 125 127 throw Error("Attempt to create a Filter with a negative filtering radius"); … … 133 135 /// \param Rfilt_func the filtering radius function of a PseudoJet 134 136 Filter(FunctionOfPseudoJet<double> *Rfilt_func, Selector selector, double rho = 0.0) : 135 _Rfiltfunc(Rfilt_func), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0) {}137 _Rfiltfunc(Rfilt_func), _Rfilt(-1), _selector(selector), _rho(rho), _subtractor(0), _initialised(true) {} 136 138 137 139 /// default dtor … … 140 142 /// Set a subtractor that is applied to all individual subjets before 141 143 /// deciding which ones to keep. It takes precedence over a non-zero rho. 142 void set_subtractor(const Transformer* subtractor) {_subtractor = subtractor;}144 void set_subtractor(const FunctionOfPseudoJet<PseudoJet> * subtractor) {_subtractor = subtractor;} 143 145 144 146 /// runs the filtering and sets kept and rejected to be the jets of interest … … 159 161 /// It also sets the subjet_def to be used in joining things (the bit of 160 162 /// subjet def that is of interest for later is the recombiner). 161 void _set_filtered_elements(const PseudoJet & jet,162 std::vector<PseudoJet> & filtered_elements,163 JetDefinition & subjet_def,164 bool & discard_area) const;163 /// 164 /// this returns true if teh optimisation trick for C/A reclustering has been used 165 bool _set_filtered_elements(const PseudoJet & jet, 166 std::vector<PseudoJet> & filtered_elements) const; 165 167 166 /// set the filtered elements in the simple case of C/A+C/A167 void _set_filtered_elements_cafilt(const PseudoJet & jet,168 std::vector<PseudoJet> & filtered_elements,169 double Rfilt) const;170 171 /// set the filtered elements in the generic re-clustering case172 void _set_filtered_elements_generic(const PseudoJet & jet,173 std::vector<PseudoJet> & filtered_elements,174 const JetDefinition & subjet_def,175 bool do_areas) const;176 177 168 /// gather the information about what is kept and rejected under the 178 169 /// form of a PseudoJet with a special ClusterSequenceInfo 170 /// 171 /// The last argument (ca_optimisation_used) should be true if the 172 /// optimisation trick for C/A reclustering has been used (in which 173 /// case some extra tests have to be run for non-explicit-ghost 174 /// areas) 179 175 PseudoJet _finalise(const PseudoJet & jet, 180 176 std::vector<PseudoJet> & kept, 181 177 std::vector<PseudoJet> & rejected, 182 const JetDefinition & subjet_def, 183 const bool discard_area) const; 184 185 // a series of checks 186 //-------------------------------------------------------------------- 187 /// get the pieces down to the fundamental pieces 188 bool _get_all_pieces(const PseudoJet &jet, std::vector<PseudoJet> &all_pieces) const; 189 190 /// get the common recombiner to all pieces (NULL if none) 191 const JetDefinition::Recombiner* _get_common_recombiner(const std::vector<PseudoJet> &all_pieces) const; 192 193 /// check if one can apply the simplified trick for C/A subjets 194 bool _check_ca(const std::vector<PseudoJet> &all_pieces) const; 195 196 /// check if the jet (or all its pieces) have explicit ghosts 197 /// (assuming the jet has area support 198 /// 199 /// Note that if the jet has an associated cluster sequence that is no 200 /// longer valid, an error will be thrown 201 bool _check_explicit_ghosts(const std::vector<PseudoJet> &all_pieces) const; 178 bool ca_optimisation_used) const; 202 179 203 180 bool _uses_subtraction() const {return (_subtractor || _rho != 0);} … … 209 186 Selector _selector; ///< the subjet selection criterium 210 187 double _rho; ///< the background density (used for subtraction when possible) 211 const Transformer * _subtractor; ///< for subtracting bkgd density from subjets 188 const FunctionOfPseudoJet<PseudoJet> * _subtractor; ///< for subtracting bkgd density from subjets 189 190 bool _initialised; ///< true when the Filter has been properly intialised 212 191 }; 213 192 -
external/fastjet/tools/GridMedianBackgroundEstimator.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: GridMedianBackgroundEstimator.cc 3555 2014-08-11 09:56:35Z salam $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 … … 32 34 33 35 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 36 34 37 35 38 //---------------------------------------------------------------------- … … 39 42 // of the specified particles. 40 43 void GridMedianBackgroundEstimator::set_particles(const vector<PseudoJet> & particles) { 41 fill(_scalar_pt.begin(), _scalar_pt.end(), 0.0); 42 for (unsigned i = 0; i < particles.size(); i++) { 43 int j = igrid(particles[i]); 44 if (j >= 0){ 45 if (_rescaling_class == 0) 46 _scalar_pt[j] += particles[i].perp(); 47 else 48 _scalar_pt[j] += particles[i].perp()/(*_rescaling_class)(particles[i]); 44 vector<double> scalar_pt(n_tiles(), 0.0); 45 46 #ifdef FASTJET_GMBGE_USEFJGRID 47 assert(all_tiles_equal_area()); 48 //assert(n_good_tiles() == n_tiles()); // not needed now that we have an implementation 49 #endif 50 51 // check if we need to compute only rho or both rho and rho_m 52 if (_enable_rho_m){ 53 // both rho and rho_m 54 // 55 // this requires a few other variables 56 vector<double> scalar_dt(n_tiles(), 0.0); 57 double pt, dt; 58 for (unsigned i = 0; i < particles.size(); i++) { 59 int j = tile_index(particles[i]); 60 if (j >= 0){ 61 pt = particles[i].pt(); 62 dt = particles[i].mt() - pt; 63 if (_rescaling_class == 0){ 64 scalar_pt[j] += pt; 65 scalar_dt[j] += dt; 66 } else { 67 double r = (*_rescaling_class)(particles[i]); 68 scalar_pt[j] += pt/r; 69 scalar_dt[j] += dt/r; 70 } 71 } 72 } 73 // sort things for _percentile 74 sort(scalar_dt.begin(), scalar_dt.end()); 75 76 // compute rho_m and sigma_m (see comment below for the 77 // normaliosation of sigma) 78 double p50 = _percentile(scalar_dt, 0.5); 79 _rho_m = p50 / mean_tile_area(); 80 _sigma_m = (p50-_percentile(scalar_dt, (1.0-0.6827)/2.0))/sqrt(mean_tile_area()); 81 } else { 82 // only rho 83 //fill(_scalar_pt.begin(), _scalar_pt.end(), 0.0); 84 for (unsigned i = 0; i < particles.size(); i++) { 85 int j = tile_index(particles[i]); 86 if (j >= 0){ 87 if (_rescaling_class == 0){ 88 scalar_pt[j] += particles[i].pt(); 89 } else { 90 scalar_pt[j] += particles[i].pt()/(*_rescaling_class)(particles[i]); 91 } 92 } 49 93 } 50 94 } 51 sort(_scalar_pt.begin(), _scalar_pt.end()); 95 96 // if there are some "bad" tiles, then we need to exclude them from 97 // the calculation of the median. We'll do this by condensing the 98 // scalar_pt vector down to just the values for the tiles that are 99 // good. 100 // 101 // tested answers look right in "issue" 2014-08-08-testing-rect-grid 102 if (n_good_tiles() != n_tiles()) { 103 int newn = 0; 104 for (unsigned i = 0; i < scalar_pt.size(); i++) { 105 if (tile_is_good(i)) { 106 // clang gets confused with the SharedPtr swap if we don't 107 // have std:: here 108 std::swap(scalar_pt[i],scalar_pt[newn]); 109 newn++; 110 } 111 } 112 scalar_pt.resize(newn); 113 } 114 115 // in all cases, carry on with the computation of rho 116 // 117 // first sort 118 sort(scalar_pt.begin(), scalar_pt.end()); 119 120 // then compute rho 121 // 122 // watch out: by definition, our sigma is the standard deviation of 123 // the pt density multiplied by the square root of the cell area 124 double p50 = _percentile(scalar_pt, 0.5); 125 _rho = p50 / mean_tile_area(); 126 _sigma = (p50-_percentile(scalar_pt, (1.0-0.6827)/2.0))/sqrt(mean_tile_area()); 52 127 53 128 _has_particles = true; … … 61 136 double GridMedianBackgroundEstimator::rho() const { 62 137 verify_particles_set(); 63 return _ percentile(_scalar_pt, 0.5) / _cell_area;138 return _rho; 64 139 } 65 140 … … 71 146 double GridMedianBackgroundEstimator::sigma() const{ 72 147 verify_particles_set(); 73 // watch out: by definition, our sigma is the standard deviation of 74 // the pt density multiplied by the square root of the cell area 75 return (_percentile(_scalar_pt, 0.5) - 76 _percentile(_scalar_pt, (1.0-0.6827)/2.0) 77 )/sqrt(_cell_area); 148 return _sigma; 78 149 } 79 150 … … 85 156 // determination. 86 157 double GridMedianBackgroundEstimator::rho(const PseudoJet & jet) { 87 verify_particles_set();158 //verify_particles_set(); 88 159 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 89 160 return rescaling*rho(); … … 95 166 // the position of a given jet. As for rho(jet), it is non-const. 96 167 double GridMedianBackgroundEstimator::sigma(const PseudoJet & jet){ 97 verify_particles_set();168 //verify_particles_set(); 98 169 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 99 170 return rescaling*sigma(); 171 } 172 173 //---------------------------------------------------------------------- 174 // returns rho_m (particle-masses contribution to the 4-vector density) 175 double GridMedianBackgroundEstimator::rho_m() const { 176 if (! _enable_rho_m){ 177 throw Error("GridMediamBackgroundEstimator: rho_m requested but rho_m calculation has been disabled."); 178 } 179 verify_particles_set(); 180 return _rho_m; 181 } 182 183 184 //---------------------------------------------------------------------- 185 // returns sigma_m (particle-masses contribution to the 4-vector 186 // density); must be multipled by sqrt(area) to get fluctuations 187 // for a region of a given area. 188 double GridMedianBackgroundEstimator::sigma_m() const{ 189 if (! _enable_rho_m){ 190 throw Error("GridMediamBackgroundEstimator: sigma_m requested but rho_m/sigma_m calculation has been disabled."); 191 } 192 verify_particles_set(); 193 return _sigma_m; 194 } 195 196 //---------------------------------------------------------------------- 197 // returns rho_m locally at the position of a given jet. As for 198 // rho(jet), it is non-const. 199 double GridMedianBackgroundEstimator::rho_m(const PseudoJet & jet) { 200 //verify_particles_set(); 201 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 202 return rescaling*rho_m(); 203 } 204 205 206 //---------------------------------------------------------------------- 207 // returns sigma_m locally at the position of a given jet. As for 208 // rho(jet), it is non-const. 209 double GridMedianBackgroundEstimator::sigma_m(const PseudoJet & jet){ 210 //verify_particles_set(); 211 double rescaling = (_rescaling_class == 0) ? 1.0 : (*_rescaling_class)(jet); 212 return rescaling*sigma_m(); 100 213 } 101 214 … … 112 225 string GridMedianBackgroundEstimator::description() const { 113 226 ostringstream desc; 227 #ifdef FASTJET_GMBGE_USEFJGRID 228 desc << "GridMedianBackgroundEstimator, with " << RectangularGrid::description(); 229 #else 114 230 desc << "GridMedianBackgroundEstimator, with grid extension |y| < " << _ymax 115 << " and requested grid spacing = " << _requested_grid_spacing; 231 << ", and grid cells of size dy x dphi = " << _dy << " x " << _dphi 232 << " (requested size = " << _requested_grid_spacing << ")"; 233 #endif 116 234 return desc.str(); 117 235 } … … 144 262 145 263 264 #ifndef FASTJET_GMBGE_USEFJGRID 146 265 //---------------------------------------------------------------------- 147 266 // protected material … … 168 287 169 288 _ntotal = _nphi * _ny; 170 _scalar_pt.resize(_ntotal);171 _ cell_area = _dy * _dphi;172 } 173 174 175 //---------------------------------------------------------------------- 176 // retrieve the grid cellindex for a given PseudoJet177 int GridMedianBackgroundEstimator:: igrid(const PseudoJet & p) const {289 //_scalar_pt.resize(_ntotal); 290 _tile_area = _dy * _dphi; 291 } 292 293 294 //---------------------------------------------------------------------- 295 // retrieve the grid tile index for a given PseudoJet 296 int GridMedianBackgroundEstimator::tile_index(const PseudoJet & p) const { 178 297 // directly taking int does not work for values between -1 and 0 179 298 // so use floor instead … … 193 312 if (iphi == _nphi) iphi = 0; // just in case of rounding errors 194 313 195 int igrid_res = iy*_nphi + iphi; 196 assert (igrid_res >= 0 && igrid_res < _ny*_nphi); 197 return igrid_res; 198 } 314 int index_res = iy*_nphi + iphi; 315 assert (index_res >= 0 && index_res < _ny*_nphi); 316 return index_res; 317 } 318 #endif // FASTJET_GMBGE_USEFJGRID 319 199 320 200 321 -
external/fastjet/tools/GridMedianBackgroundEstimator.hh
r5b5a56b r35cdc46 2 2 #define __GRID_MEDIAN_BACKGROUND_ESTIMATOR_HH__ 3 3 4 // STARTHEADER5 // $Id: GridMedianBackgroundEstimator.hh 2580 2011-09-13 17:25:43Z salam $6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: GridMedianBackgroundEstimator.hh 3610 2014-08-13 09:49:28Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 33 35 #include "fastjet/tools/BackgroundEstimatorBase.hh" 36 37 // if defined then we'll use the RectangularGrid class 38 // 39 // (For FastJet 3.2, maybe remove the symbol and simply clean up the 40 // code below to use exclusively the RectangularGrid) 41 #define FASTJET_GMBGE_USEFJGRID 42 43 #ifdef FASTJET_GMBGE_USEFJGRID 44 #include "fastjet/RectangularGrid.hh" 45 #endif 46 47 34 48 35 49 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 61 75 /// rho() [Without rescaling, they are identical] 62 76 /// 63 class GridMedianBackgroundEstimator : public BackgroundEstimatorBase { 77 class GridMedianBackgroundEstimator : public BackgroundEstimatorBase 78 #ifdef FASTJET_GMBGE_USEFJGRID 79 , RectangularGrid 80 #endif 81 { 82 64 83 public: 65 84 /// @name constructors and destructors 66 85 //\{ 86 #ifdef FASTJET_GMBGE_USEFJGRID 67 87 //---------------------------------------------------------------- 68 88 /// \param ymax maximal absolute rapidity extent of the grid … … 71 91 /// periodicity in azimuthal angle (size, not area) 72 92 GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) : 93 RectangularGrid(ymax, requested_grid_spacing), 94 _has_particles(false), _enable_rho_m(true) {} 95 96 //---------------------------------------------------------------- 97 /// Constructor based on a user's fully specified RectangularGrid 98 GridMedianBackgroundEstimator(const RectangularGrid & grid) : 99 RectangularGrid(grid), 100 _has_particles(false), _enable_rho_m(true) { 101 if (!RectangularGrid::is_initialised()) 102 throw Error("attempt to construct GridMedianBackgroundEstimator with uninitialised RectangularGrid"); 103 } 104 105 #else // alternative in old framework where we didn't have the rectangular grid 106 GridMedianBackgroundEstimator(double ymax, double requested_grid_spacing) : 73 107 _ymin(-ymax), _ymax(ymax), 74 108 _requested_grid_spacing(requested_grid_spacing), 75 _has_particles(false){setup_grid();} 109 _has_particles(false), _enable_rho_m(true) 110 { 111 setup_grid(); 112 } 113 #endif // FASTJET_GMBGE_USEFJGRID 114 76 115 //\} 77 116 … … 84 123 /// of the specified particles. 85 124 void set_particles(const std::vector<PseudoJet> & particles); 125 126 /// determine whether the automatic calculation of rho_m and sigma_m 127 /// is enabled (by default true) 128 void set_compute_rho_m(bool enable){ _enable_rho_m = enable;} 86 129 87 130 //\} … … 114 157 bool has_sigma() {return true;} 115 158 159 //----------------------------------------------------------------- 160 /// Returns rho_m, the purely longitudinal, particle-mass-induced 161 /// component of the background density per unit area 162 double rho_m() const; 163 164 /// returns sigma_m, a measure of the fluctuations in the purely 165 /// longitudinal, particle-mass-induced component of the background 166 /// density per unit area; must be multipled by sqrt(area) to get 167 /// fluctuations for a region of a given area. 168 double sigma_m() const; 169 170 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 171 double rho_m(const PseudoJet & jet); 172 173 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 174 double sigma_m(const PseudoJet & jet); 175 176 /// Returns true if this background estimator has support for 177 /// determination of rho_m. 178 /// 179 /// Note that support for sigma_m is automatic is one has sigma and 180 /// rho_m support. 181 bool has_rho_m() const {return _enable_rho_m;} 182 183 116 184 /// returns the area of the grid cells (all identical, but 117 185 /// referred to as "mean" area for uniformity with JetMedianBGE). 118 double mean_area() const {return _cell_area;}186 double mean_area() const {return mean_tile_area();} 119 187 //\} 120 188 … … 134 202 /// Note that this has to be called BEFORE any attempt to do an 135 203 /// actual computation 204 /// 205 /// The same profile will be used for both pt and mt (this is 206 /// probabaly a good approximation since the particle density 207 /// changes is what dominates the rapidity profile) 136 208 virtual void set_rescaling_class(const FunctionOfPseudoJet<double> * rescaling_class); 137 209 … … 149 221 150 222 private: 223 224 #ifndef FASTJET_GMBGE_USEFJGRID 225 151 226 /// configure the grid 152 227 void setup_grid(); 153 228 154 229 /// retrieve the grid cell index for a given PseudoJet 155 int igrid(const PseudoJet & p) const; 230 int tile_index(const PseudoJet & p) const; 231 232 // information about the grid 233 double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _tile_area; 234 int _ny, _nphi, _ntotal; 235 236 int n_tiles() const {return _ntotal;} 237 int n_good_tiles() const {return n_tiles();} 238 int tile_is_good(int /* itile */) const {return true;} 239 240 double mean_tile_area() const {return _tile_area;} 241 #endif // FASTJET_GMBGE_USEFJGRID 242 156 243 157 244 /// verify that particles have been set and throw an error if not 158 245 void verify_particles_set() const; 159 246 160 // information about the grid161 double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing, _cell_area;162 int _ny, _nphi, _ntotal;163 164 247 // information abotu the event 165 std::vector<double> _scalar_pt; 248 //std::vector<double> _scalar_pt; 249 double _rho, _sigma, _rho_m, _sigma_m; 166 250 bool _has_particles; 167 168 // various warnings to let people aware of potential dangers 251 bool _enable_rho_m; 252 253 // various warnings to inform people of potential dangers 169 254 LimitedWarning _warning_rho_of_jet; 170 255 LimitedWarning _warning_rescaling; -
external/fastjet/tools/JHTopTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: JHTopTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/JHTopTagger.hh> -
external/fastjet/tools/JHTopTagger.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_JH_TOP_TAGGER_HH__ 3 3 4 // STARTHEADER5 // $Id: JHTopTagger.hh 2689 2011-11-14 14:51:06Z soyez$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: JHTopTagger.hh 3433 2014-07-23 08:17:03Z salam $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 -
external/fastjet/tools/JetMedianBackgroundEstimator.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: JetMedianBackgroundEstimator.cc 3517 2014-08-01 14:23:13Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/JetMedianBackgroundEstimator.hh" … … 31 33 #include <fastjet/ClusterSequenceStructure.hh> 32 34 #include <iostream> 35 #include <sstream> 33 36 34 37 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh … … 37 40 38 41 double BackgroundJetScalarPtDensity::result(const PseudoJet & jet) const { 39 std::vector<PseudoJet> constituents = jet.constituents(); 42 // do not include the ghosts in the list of constituents to have a 43 // correct behaviour when _pt_power is <= 0 44 std::vector<PseudoJet> constituents = (!SelectorIsPureGhost())(jet.constituents()); 40 45 double scalar_pt = 0; 41 46 for (unsigned i = 0; i < constituents.size(); i++) { … … 43 48 } 44 49 return scalar_pt / jet.area(); 50 } 51 52 53 std::string BackgroundJetScalarPtDensity::description() const { 54 ostringstream oss; 55 oss << "BackgroundScalarJetPtDensity"; 56 if (_pt_power != 1.0) oss << " with pt_power = " << _pt_power; 57 return oss.str(); 45 58 } 46 59 … … 72 85 const JetDefinition &jet_def, 73 86 const AreaDefinition &area_def) 74 : _rho_range(rho_range), _jet_def(jet_def), _area_def(area_def) 87 : _rho_range(rho_range), _jet_def(jet_def), _area_def(area_def){ 75 88 76 89 // initialise things decently … … 261 274 262 275 //---------------------------------------------------------------------- 276 // returns rho_m (particle-masses contribution to the 4-vector density) 277 double JetMedianBackgroundEstimator::rho_m() const { 278 if (! has_rho_m()){ 279 throw Error("JetMediamBackgroundEstimator: rho_m requested but rho_m calculation is disabled (either eplicitly or due to the presence of a jet density class)."); 280 } 281 if (_rho_range.takes_reference()) 282 throw Error("The background estimation is obtained from a selector that takes a reference jet. rho(PseudoJet) should be used in that case"); 283 _recompute_if_needed(); 284 return _rho_m; 285 } 286 287 288 //---------------------------------------------------------------------- 289 // returns sigma_m (particle-masses contribution to the 4-vector 290 // density); must be multipled by sqrt(area) to get fluctuations 291 // for a region of a given area. 292 double JetMedianBackgroundEstimator::sigma_m() const{ 293 if (! has_rho_m()){ 294 throw Error("JetMediamBackgroundEstimator: sigma_m requested but rho_m/sigma_m calculation is disabled (either explicitly or due to the presence of a jet density class)."); 295 } 296 if (_rho_range.takes_reference()) 297 throw Error("The background estimation is obtained from a selector that takes a reference jet. rho(PseudoJet) should be used in that case"); 298 _recompute_if_needed(); 299 return _sigma_m; 300 } 301 302 //---------------------------------------------------------------------- 303 // returns rho_m locally at the position of a given jet. As for 304 // rho(jet), it is non-const. 305 double JetMedianBackgroundEstimator::rho_m(const PseudoJet & jet) { 306 _recompute_if_needed(jet); 307 double our_rho = _rho_m; 308 if (_rescaling_class != 0) { 309 our_rho *= (*_rescaling_class)(jet); 310 } 311 return our_rho; 312 } 313 314 315 //---------------------------------------------------------------------- 316 // returns sigma_m locally at the position of a given jet. As for 317 // rho(jet), it is non-const. 318 double JetMedianBackgroundEstimator::sigma_m(const PseudoJet & jet){ 319 _recompute_if_needed(jet); 320 double our_sigma = _sigma_m; 321 if (_rescaling_class != 0) { 322 our_sigma *= (*_rescaling_class)(jet); 323 } 324 return our_sigma; 325 } 326 327 //---------------------------------------------------------------------- 263 328 // configuring behaviour 264 329 //---------------------------------------------------------------------- … … 271 336 set_provide_fj2_sigma(false); 272 337 338 _enable_rho_m = true; 339 273 340 // reset the computed values 274 341 _rho = _sigma = 0.0; 342 _rho_m = _sigma_m = 0.0; 275 343 _n_jets_used = _n_empty_jets = 0; 276 344 _empty_area = _mean_area = 0.0; … … 289 357 // is used (as occurs also if this function is not called). 290 358 void JetMedianBackgroundEstimator::set_jet_density_class(const FunctionOfPseudoJet<double> * jet_density_class_in) { 291 _warnings_preliminary.warn("JetMedianBackgroundEstimator::set_jet_density_class: density classes are still preliminary in FastJet 3. 0. Their interface may differ in future releases (without guaranteeing backward compatibility).");359 _warnings_preliminary.warn("JetMedianBackgroundEstimator::set_jet_density_class: density classes are still preliminary in FastJet 3.1. Their interface may differ in future releases (without guaranteeing backward compatibility). Note that since FastJet 3.1, rho_m and sigma_m are accessible direclty in JetMedianBackgroundEstimator and GridMedianBackgroundEstimator(with no need for a density class)."); 292 360 _jet_density_class = jet_density_class_in; 293 361 _uptodate = false; … … 338 406 // fill the vector of pt/area (or the quantity from the jet density class) 339 407 // - in the range 340 vector<double> vector_for_median; 408 vector<double> vector_for_median_pt; 409 vector<double> vector_for_median_dt; 341 410 double total_area = 0.0; 342 411 _n_jets_used = 0; … … 346 415 347 416 // compute the pt/area for the selected jets 417 double median_input_pt, median_input_dt=0.0; 418 BackgroundJetPtMDensity m_density; 419 bool do_rho_m = has_rho_m(); 348 420 for (unsigned i = 0; i < selected_jets.size(); i++) { 349 421 const PseudoJet & current_jet = selected_jets[i]; 350 422 351 423 double this_area = (_use_area_4vector) ? current_jet.area_4vector().perp() : current_jet.area(); 352 353 424 if (this_area>0){ 354 double median_input; 425 // for the pt component, we either use pt or the user-provided 426 // density class 355 427 if (_jet_density_class == 0) { 356 median_input = current_jet.perp()/this_area;428 median_input_pt = current_jet.perp()/this_area; 357 429 } else { 358 median_input = (*_jet_density_class)(current_jet);430 median_input_pt = (*_jet_density_class)(current_jet); 359 431 } 432 433 // handle the rho_m part if requested 434 // note that we're using the scalar area as a normalisation inside the 435 // density class! 436 if (do_rho_m) 437 median_input_dt = m_density(current_jet); 438 439 // perform rescaling if needed 360 440 if (_rescaling_class != 0) { 361 median_input /= (*_rescaling_class)(current_jet); 441 double resc = (*_rescaling_class)(current_jet);; 442 median_input_pt /= resc; 443 median_input_dt /= resc; 362 444 } 363 vector_for_median.push_back(median_input); 445 446 // store the result for future computation of the median 447 vector_for_median_pt.push_back(median_input_pt); 448 if (do_rho_m) 449 vector_for_median_dt.push_back(median_input_dt); 450 364 451 total_area += this_area; 365 452 _n_jets_used++; … … 367 454 _warnings_zero_area.warn("JetMedianBackgroundEstimator::_compute(...): discarded jet with zero area. Zero-area jets may be due to (i) too large a ghost area (ii) a jet being outside the ghost range (iii) the computation not being done using an appropriate algorithm (kt;C/A)."); 368 455 } 369 370 456 } 371 457 372 458 // there is nothing inside our region, so answer will always be zero 373 if (vector_for_median .size() == 0) {459 if (vector_for_median_pt.size() == 0) { 374 460 _rho = 0.0; 375 461 _sigma = 0.0; 462 _rho_m = 0.0; 463 _sigma_m = 0.0; 376 464 _mean_area = 0.0; 377 465 return; … … 392 480 393 481 double stand_dev; 394 _median_and_stddev(vector_for_median , _n_empty_jets, _rho, stand_dev,482 _median_and_stddev(vector_for_median_pt, _n_empty_jets, _rho, stand_dev, 395 483 _provide_fj2_sigma); 396 484 … … 398 486 _mean_area = total_area / total_njets; 399 487 _sigma = stand_dev * sqrt(_mean_area); 488 489 // compute the rho_m part now 490 if (do_rho_m){ 491 _median_and_stddev(vector_for_median_dt, _n_empty_jets, _rho_m, stand_dev, 492 _provide_fj2_sigma); 493 _sigma_m = stand_dev * sqrt(_mean_area); 494 } 400 495 401 496 // record that the computation has been performed … … 439 534 440 535 441 442 536 FASTJET_END_NAMESPACE 443 537 -
external/fastjet/tools/JetMedianBackgroundEstimator.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_BACKGROUND_ESTIMATOR_HH__ 3 3 4 // STARTHEADER5 // $Id: JetMedianBackgroundEstimator.hh 2689 2011-11-14 14:51:06Z soyez $4 //FJSTARTHEADER 5 // $Id: JetMedianBackgroundEstimator.hh 3517 2014-08-01 14:23:13Z soyez $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/ClusterSequenceAreaBase.hh> … … 121 123 /// 122 124 JetMedianBackgroundEstimator(const Selector &rho_range = SelectorIdentity()) 123 : _rho_range(rho_range), _jet_def(JetDefinition()) { reset(); } 125 : _rho_range(rho_range), _jet_def(JetDefinition()), 126 _enable_rho_m(true){ reset(); } 124 127 125 128 … … 168 171 } 169 172 173 /// determine whether the automatic calculation of rho_m and sigma_m 174 /// is enabled (by default true) 175 void set_compute_rho_m(bool enable){ _enable_rho_m = enable;} 176 170 177 //\} 171 178 … … 201 208 virtual bool has_sigma() {return true;} 202 209 210 //---------------------------------------------------------------- 211 // now do the same thing for rho_m and sigma_m 212 213 /// returns rho_m, the purely longitudinal, particle-mass-induced 214 /// component of the background density per unit area 215 virtual double rho_m() const; 216 217 /// returns sigma_m, a measure of the fluctuations in the purely 218 /// longitudinal, particle-mass-induced component of the background 219 /// density per unit area; must be multipled by sqrt(area) to get 220 /// fluctuations for a region of a given area. 221 virtual double sigma_m() const; 222 223 /// Returns rho_m locally at the jet position. As for rho(jet), it is non-const. 224 virtual double rho_m(const PseudoJet & /*jet*/); 225 226 /// Returns sigma_m locally at the jet position. As for rho(jet), it is non-const. 227 virtual double sigma_m(const PseudoJet & /*jet*/); 228 229 /// Returns true if this background estimator has support for 230 /// determination of rho_m. 231 /// 232 /// In te presence of a density class, support for rho_m is 233 /// automatically disabled 234 /// 235 /// Note that support for sigma_m is automatic is one has sigma and 236 /// rho_m support. 237 virtual bool has_rho_m() const {return _enable_rho_m && (_jet_density_class == 0);} 203 238 //\} 204 239 … … 208 243 /// Returns the mean area of the jets used to actually compute the 209 244 /// background properties in the last call of rho() or sigma() 245 /// If the configuration has changed in the meantime, throw an error. 210 246 double mean_area() const{ 211 _recompute_if_needed(); 247 if (!_uptodate) 248 throw Error("JetMedianBackgroundEstimator::mean_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 249 //_recompute_if_needed(); 212 250 return _mean_area; 213 251 } … … 215 253 /// returns the number of jets used to actually compute the 216 254 /// background properties in the last call of rho() or sigma() 255 /// If the configuration has changed in the meantime, throw an error. 217 256 unsigned int n_jets_used() const{ 218 _recompute_if_needed(); 257 if (!_uptodate) 258 throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 259 //_recompute_if_needed(); 219 260 return _n_jets_used; 261 } 262 263 /// returns the jets used to actually compute the background 264 /// properties 265 std::vector<PseudoJet> jets_used() const{ 266 if (!_uptodate) throw Error("JetMedianBackgroundEstimator::n_jets_used(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 267 _check_csa_alive(); 268 std::vector<PseudoJet> tmp_jets = _rho_range(_included_jets); 269 std::vector<PseudoJet> used_jets; 270 for (unsigned int i=0; i<tmp_jets.size(); i++){ 271 if (tmp_jets[i].area()>0) used_jets.push_back(tmp_jets[i]); 272 } 273 return used_jets; 220 274 } 221 275 … … 223 277 /// the selector) that is not occupied by jets. The value is that 224 278 /// for the last call of rho() or sigma() 279 /// If the configuration has changed in the meantime, throw an error. 225 280 /// 226 281 /// The answer is defined to be zero if the area calculation … … 234 289 /// call to the ClusterSequenceAreaBase function. 235 290 double empty_area() const{ 236 _recompute_if_needed(); 291 if (!_uptodate) 292 throw Error("JetMedianBackgroundEstimator::empty_area(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 293 //_recompute_if_needed(); 237 294 return _empty_area; 238 295 } … … 241 298 /// background properties. The value is that for the last call of 242 299 /// rho() or sigma(). 300 /// If the configuration has changed in the meantime, throw an error. 243 301 /// 244 302 /// If the area has explicit ghosts the result is zero; for active … … 250 308 /// call to the ClusterSequenceAreaBase function. 251 309 double n_empty_jets() const{ 252 _recompute_if_needed(); 310 if (!_uptodate) 311 throw Error("JetMedianBackgroundEstimator::n_empty_jets(): one may not retrieve information about the last call to rho() or sigma() when the configuration has changed in the meantime."); 312 //_recompute_if_needed(); 253 313 return _n_empty_jets; 254 314 } … … 361 421 /// Issue a warning otherwise 362 422 void _check_jet_alg_good_for_median() const; 363 423 364 424 // the basic parameters of this class (passed through the variou ctors) 365 425 Selector _rho_range; ///< range to compute the background in … … 368 428 std::vector<PseudoJet> _included_jets; ///< jets to be used 369 429 370 // the tunable aprameters of the class430 // the tunable parameters of the class 371 431 bool _use_area_4vector; 372 432 bool _provide_fj2_sigma; 373 433 const FunctionOfPseudoJet<double> * _jet_density_class; 374 434 //SharedPtr<BackgroundRescalingBase> _rescaling_class_sharedptr; 435 bool _enable_rho_m; 375 436 376 437 // the actual results of the computation 377 438 mutable double _rho; ///< background estimated density per unit area 378 439 mutable double _sigma; ///< background estimated fluctuations 440 mutable double _rho_m; ///< "mass" background estimated density per unit area 441 mutable double _sigma_m; ///< "mass" background estimated fluctuations 379 442 mutable double _mean_area; ///< mean area of the jets used to estimate the background 380 443 mutable unsigned int _n_jets_used; ///< number of jets used to estimate the background … … 429 492 virtual double result(const PseudoJet & jet) const; 430 493 431 virtual std::string description() const {return "BackgroundScalarJetPtDensity";}494 virtual std::string description() const; 432 495 433 496 private: -
external/fastjet/tools/MassDropTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: MassDropTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/MassDropTagger.hh> -
external/fastjet/tools/MassDropTagger.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: MassDropTagger.hh 2731 2011-11-21 12:15:21Z soyez$1 //FJSTARTHEADER 2 // $Id: MassDropTagger.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_MASS_DROP_TAGGER_HH__ -
external/fastjet/tools/Pruner.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Pruner.cc 3481 2014-07-29 17:24:12Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/Pruner.hh" … … 47 49 //---------------------------------------------------------------------- 48 50 // alternative (dynamic) ctor 49 // \param jet_def the jet definition for the internal clustering51 // \param jet_def the jet definition for the internal clustering 50 52 // \param zcut_dyn dynamic pt-fraction cut in the pruning 51 53 // \param Rcut_dyn dynamic angular distance cut in the pruning 52 54 Pruner::Pruner(const JetDefinition &jet_def, 53 FunctionOfPseudoJet<double> *zcut_dyn,54 FunctionOfPseudoJet<double> *Rcut_dyn)55 const FunctionOfPseudoJet<double> *zcut_dyn, 56 const FunctionOfPseudoJet<double> *Rcut_dyn) 55 57 : _jet_def(jet_def), _zcut(0), _Rcut_factor(0), 56 58 _zcut_dyn(zcut_dyn), _Rcut_dyn(Rcut_dyn), _get_recombiner_from_jet(false) { … … 74 76 double zcut = (_zcut_dyn) ? (*_zcut_dyn)(jet) : _zcut; 75 77 PruningPlugin * pruning_plugin; 78 76 79 // for some constructors, we get the recombiner from the 77 // input jet -- some acrobatics are needed (see plans for FJ3.1 78 // for a hopefully better solution). 80 // input jet -- some acrobatics are needed 79 81 if (_get_recombiner_from_jet) { 80 const JetDefinition::Recombiner * common_recombiner = 81 _get_common_recombiner(jet); 82 if (common_recombiner) { 83 JetDefinition jet_def = _jet_def; 84 if (typeid(*common_recombiner) == typeid(JetDefinition::DefaultRecombiner)) { 85 RecombinationScheme scheme = 86 static_cast<const JetDefinition::DefaultRecombiner *>(common_recombiner)->scheme(); 87 jet_def.set_recombination_scheme(scheme); 88 } else { 89 jet_def.set_recombiner(common_recombiner); 90 } 91 pruning_plugin = new PruningPlugin(jet_def, zcut, Rcut); 92 } else { 93 // if there wasn't a common recombiner, we just use the default 94 // recombiner that was in _jet_def 95 pruning_plugin = new PruningPlugin(_jet_def, zcut, Rcut); 96 } 82 JetDefinition jet_def = _jet_def; 83 84 // if all the pieces have a shared recombiner, we'll use that 85 // one. Otherwise, use the one from _jet_def as a fallback. 86 JetDefinition jet_def_for_recombiner; 87 if (_check_common_recombiner(jet, jet_def_for_recombiner)){ 88 jet_def.set_recombiner(jet_def_for_recombiner); 89 } 90 pruning_plugin = new PruningPlugin(jet_def, zcut, Rcut); 97 91 } else { 98 92 pruning_plugin = new PruningPlugin(_jet_def, zcut, Rcut); … … 122 116 PseudoJet result_local = SelectorNHardest(1)(cs->inclusive_jets())[0]; 123 117 PrunerStructure * s = new PrunerStructure(result_local); 118 s->_Rcut = Rcut; 119 s->_zcut = zcut; 124 120 result_local.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(s)); 125 121 … … 155 151 } 156 152 157 // see if there is a common recombiner among the pieces; if there 158 // is return a pointer to it; otherwise, return NULL. 159 // 160 // NB: this way of doing things is not ideal, because quite some work 161 // is needed to get a correct handling of the final recombiner 162 // (e.g. default v. non-default). In future add 163 // set_recombiner(jet_def) to JetDefinition, maybe also add 164 // an invalid_scheme to the default recombiner and then 165 // do all the work below directly with a JetDefinition directly 166 // together with JD::has_same_recombiner(...) 167 const JetDefinition::Recombiner * Pruner::_get_common_recombiner(const PseudoJet &jet) const{ 168 if (jet.has_associated_cluster_sequence()) 169 return jet.validated_cs()->jet_def().recombiner(); 153 // see if there is a common recombiner among the pieces; if there is 154 // return true and set jet_def_for_recombiner so that the recombiner 155 // can be taken from that JetDefinition. Otherwise, return 156 // false. 'assigned' is initially false; when true, each time we meet 157 // a new jet definition, we'll check it shares the same recombiner as 158 // jet_def_for_recombiner. 159 bool Pruner::_check_common_recombiner(const PseudoJet &jet, 160 JetDefinition &jet_def_for_recombiner, 161 bool assigned) const{ 162 if (jet.has_associated_cluster_sequence()){ 163 // if the jet def for recombination has already been assigned, check if we have the same 164 if (assigned) 165 return jet.validated_cs()->jet_def().has_same_recombiner(jet_def_for_recombiner); 166 167 // otherwise, assign it. 168 jet_def_for_recombiner = jet.validated_cs()->jet_def(); 169 assigned = true; 170 return true; 171 } 170 172 171 173 // if the jet has pieces, recurse in the pieces 172 174 if (jet.has_pieces()){ 173 175 vector<PseudoJet> pieces = jet.pieces(); 174 if (pieces.size() == 0) return 0; 175 const JetDefinition::Recombiner * reco = _get_common_recombiner(pieces[0]); 176 for (unsigned int i=1;i<pieces.size(); i++) 177 if (_get_common_recombiner(pieces[i]) != reco) return 0; 176 if (pieces.size() == 0) return false; 177 for (unsigned int i=0;i<pieces.size(); i++) 178 if (!_check_common_recombiner(pieces[i], jet_def_for_recombiner, assigned)) return false; 178 179 // never returned false, so we're OK. 179 return reco;180 return true; 180 181 } 181 182 182 183 // return false for any other (unknown) structure 183 return 0;184 return false; 184 185 } 185 186 -
external/fastjet/tools/Pruner.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_TOOLS_PRUNER_HH__ 3 3 4 // STARTHEADER5 // $Id: Pruner.hh 2616 2011-09-30 18:03:40Z salam$6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 //FJSTARTHEADER 5 // $Id: Pruner.hh 3481 2014-07-29 17:24:12Z soyez $ 6 // 7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include "fastjet/ClusterSequence.hh" … … 43 45 class PruningRecombiner; 44 46 class PruningPlugin; 47 48 // This tells third-party code that the pruner structure 49 // stores Rcut info; the alternative is for the user to 50 // get the information from the version number 51 #define FASTJET_PRUNER_STRUCTURE_STORES_RCUT 45 52 46 53 //---------------------------------------------------------------------- … … 135 142 /// \param Rcut_dyn dynamic angular distance cut in the pruning 136 143 Pruner(const JetDefinition &jet_def, 137 FunctionOfPseudoJet<double> *zcut_dyn,138 FunctionOfPseudoJet<double> *Rcut_dyn);144 const FunctionOfPseudoJet<double> *zcut_dyn, 145 const FunctionOfPseudoJet<double> *Rcut_dyn); 139 146 140 147 /// action on a single jet … … 152 159 bool _check_explicit_ghosts(const PseudoJet &jet) const; 153 160 154 /// return a pointer to a "common" recombiner if there is one, 155 /// alternatively a null pointer. 156 const JetDefinition::Recombiner * _get_common_recombiner(const PseudoJet &jet) const; 161 /// see if there is a common recombiner among the pieces; if there 162 /// is return true and set jet_def_for_recombiner so that the 163 /// recombiner can be taken from that JetDefinition. Otherwise, 164 /// return false. 'assigned' is initially false; when true, each 165 /// time we meet a new jet definition, we'll check it shares the 166 /// same recombiner as jet_def_for_recombiner. 167 bool _check_common_recombiner(const PseudoJet &jet, 168 JetDefinition &jet_def_for_recombiner, 169 bool assigned=false) const; 157 170 158 171 JetDefinition _jet_def; ///< the internal jet definition 159 172 double _zcut; ///< the pt-fraction cut 160 173 double _Rcut_factor; ///< the angular separation cut factor 161 FunctionOfPseudoJet<double> *_zcut_dyn; ///< dynamic zcut162 FunctionOfPseudoJet<double> *_Rcut_dyn; ///< dynamic Rcut174 const FunctionOfPseudoJet<double> *_zcut_dyn; ///< dynamic zcut 175 const FunctionOfPseudoJet<double> *_Rcut_dyn; ///< dynamic Rcut 163 176 bool _get_recombiner_from_jet; ///< true for minimal constructor, 164 177 ///< causes recombiner to be set equal … … 194 207 std::vector<PseudoJet> extra_jets() const; 195 208 209 /// return the value of Rcut that was used for this specific pruning. 210 double Rcut() const {return _Rcut;} 211 212 /// return the value of Rcut that was used for this specific pruning. 213 double zcut() const {return _zcut;} 214 196 215 protected: 197 216 friend class Pruner; ///< to allow setting the internal information 217 218 private: 219 double _Rcut, _zcut; 198 220 }; 199 221 -
external/fastjet/tools/RestFrameNSubjettinessTagger.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: RestFrameNSubjettinessTagger.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/RestFrameNSubjettinessTagger.hh> -
external/fastjet/tools/RestFrameNSubjettinessTagger.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_RESTFRAMENSUBJETTINESS_TAGGER_HH__ 3 3 4 // STARTHEADER5 // $Id: RestFrameNSubjettinessTagger.hh 2689 2011-11-14 14:51:06Z soyez$4 //FJSTARTHEADER 5 // $Id: RestFrameNSubjettinessTagger.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/PseudoJet.hh> -
external/fastjet/tools/Subtractor.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: Subtractor.cc 3594 2014-08-12 15:25:11Z soyez $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include "fastjet/tools/Subtractor.hh" … … 38 40 39 41 42 //---------------------------------------------------------------------- 43 // ctor 40 44 Subtractor::Subtractor(double rho) : _bge(0), _rho(rho) { 41 45 assert(_rho>0.0); 46 set_defaults(); 42 47 } 43 48 49 //---------------------------------------------------------------------- 50 void Subtractor::set_defaults(){ 51 _use_rho_m = false; // likely to change in future releases!! 52 _safe_mass = false; // likely to change in future releases!! 53 54 _sel_known_vertex = Selector(); 55 _sel_leading_vertex = Selector(); 56 } 57 58 //---------------------------------------------------------------------- 59 // perform the subtraction of a given jet 44 60 PseudoJet Subtractor::result(const PseudoJet & jet) const { 45 61 if (!jet.has_area()){ 46 62 throw Error("Trying to subtract a jet without area support"); 47 63 } 48 64 65 PseudoJet known_lv, known_pu; 66 PseudoJet unknown = jet; 67 if (_sel_known_vertex.worker()){ 68 // separate the jet constituents in 3 groups: 69 // unknown vertex 70 // known vertex, leading vertex 71 // known vertex, non-leading vertex (PU) 72 vector<PseudoJet> constits_unknown, constits_known; 73 _sel_known_vertex.sift(jet.constituents(), 74 constits_known, 75 constits_unknown); 76 vector<PseudoJet> constits_known_lv, constits_known_pu; 77 _sel_leading_vertex.sift(constits_known, 78 constits_known_lv, 79 constits_known_pu); 80 81 // For the parts related to the known vertices (LV or PU), we just 82 // sum the 4-momenta. For the unknown part, we assign it the full 83 // jet area. 84 known_lv = (constits_known_lv.size()!=0) 85 ? SelectorIdentity().sum(constits_known_lv) : 0.0*jet; 86 known_pu = (constits_known_pu.size()!=0) 87 ? SelectorIdentity().sum(constits_known_pu) : 0.0*jet; 88 if (constits_unknown.size()==0){ 89 // no need for any form of subtraction! 90 PseudoJet subtracted_jet = jet; 91 subtracted_jet.reset_momentum(known_lv); 92 return subtracted_jet; 93 } 94 unknown = jet; // that keeps all info including area 95 unknown.reset_momentum(SelectorIdentity().sum(constits_unknown)); 96 } else { 97 known_lv = jet; // ensures correct rap-phi! 98 known_lv *= 0.0; 99 known_pu = known_lv; 100 } 101 102 // prepare for the subtraction and compute the 4-vector to be 103 // subtracted 104 PseudoJet subtracted_jet = jet; 105 PseudoJet to_subtract = known_pu + _amount_to_subtract(unknown); 106 107 // sanity check for the transverse momentum 108 if (to_subtract.pt2() < jet.pt2() ) { 109 // this subtraction should retain the jet's structural 110 // information 111 subtracted_jet -= to_subtract; 112 } else { 113 // this sets the jet's momentum while maintaining all of the jet's 114 // structural information 115 subtracted_jet.reset_momentum(known_lv); 116 return subtracted_jet; 117 } 118 119 // make sure that in the end the pt is at least the one known to 120 // come from the leading vertex 121 if (subtracted_jet.pt2() < known_lv.pt2()){ 122 subtracted_jet.reset_momentum(known_lv); 123 return subtracted_jet; 124 } 125 126 // sanity check for the mass (if needed) 127 if ((_safe_mass) && (subtracted_jet.m2() < known_lv.m2())){ 128 // in this case, we keep pt and phi as obtained from the 129 // subtraction above and take rap and m from the part that comes 130 // from the leading vertex (or the original jet if nothing comes 131 // from the leading vertex) 132 subtracted_jet.reset_momentum(PtYPhiM(subtracted_jet.pt(), 133 known_lv.rap(), 134 subtracted_jet.phi(), 135 known_lv.m())); 136 } 137 138 return subtracted_jet; 139 } 140 141 //---------------------------------------------------------------------- 142 std::string Subtractor::description() const{ 143 if (_bge != 0) { 144 string desc = "Subtractor that uses the following background estimator to determine rho: "+_bge->description(); 145 if (use_rho_m()) desc += "; including the rho_m correction"; 146 if (safe_mass()) desc += "; including mass safety tests"; 147 if (_sel_known_vertex.worker()){ 148 desc += "; using known vertex selection: "+_sel_known_vertex.description()+" and leading vertex selection: "+_sel_leading_vertex.description(); 149 } 150 return desc; 151 } else if (_rho != _invalid_rho) { 152 ostringstream ostr; 153 ostr << "Subtractor that uses a fixed value of rho = " << _rho; 154 return ostr.str(); 155 } else { 156 return "Uninitialised subtractor"; 157 } 158 } 159 160 //---------------------------------------------------------------------- 161 // compute the 4-vector that should be subtracted from the given 162 // jet 163 PseudoJet Subtractor::_amount_to_subtract(const PseudoJet &jet) const{ 164 // the "transverse momentum" part 49 165 double rho; 50 166 if (_bge != 0) { … … 56 172 } 57 173 58 PseudoJet subtracted_jet = jet; 59 PseudoJet area4vect = jet.area_4vector(); 60 // sanity check 61 if (rho*area4vect.perp() < jet.perp() ) { 62 // this subtraction should retain the jet's structural 63 // information 64 subtracted_jet -= rho*area4vect; 65 } else { 66 // this sets the jet's momentum to zero while 67 // maintaining all of the jet's structural information 68 subtracted_jet *= 0; 174 PseudoJet area = jet.area_4vector(); 175 PseudoJet to_subtract = rho*area; 176 177 double const rho_m_warning_threshold = 1e-5; 178 179 // add an optional contribution from the unknown particles masses 180 if (_use_rho_m){ 181 assert(_bge != 0); // test done in "set_use_rho_m()" 182 to_subtract += _bge->rho_m(jet) * PseudoJet(0.0, 0.0, area.pz(), area.E()); 183 } else if (_bge && 184 _bge->has_rho_m() && 185 _bge->rho_m(jet) > rho_m_warning_threshold * rho) { 186 _unused_rho_m_warning.warn("Background estimator indicates non-zero rho_m, but use_rho_m()==false in subtractor; consider calling set_use_rho_m(true) to include the rho_m information"); 69 187 } 70 return subtracted_jet; 188 189 return to_subtract; 71 190 } 72 191 73 //----------------------------------------------------------------------74 std::string Subtractor::description() const{75 if (_bge != 0) {76 return "Subtractor that uses the following background estimator to determine rho: "+_bge->description();77 } else if (_rho != _invalid_rho) {78 ostringstream ostr;79 ostr << "Subtractor that uses a fixed value of rho = " << _rho;80 return ostr.str();81 } else {82 return "Uninitialised subtractor";83 }84 }85 192 86 193 FASTJET_END_NAMESPACE -
external/fastjet/tools/Subtractor.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Subtractor.hh 2577 2011-09-13 15:11:38Z salam$3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez1 //FJSTARTHEADER 2 // $Id: Subtractor.hh 3584 2014-08-12 12:40:10Z soyez $ 3 // 4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_TOOLS_SUBTRACTOR_HH__ … … 61 63 /// define a subtractor based on a BackgroundEstimator 62 64 Subtractor(BackgroundEstimatorBase * bge) : 63 _bge(bge), _rho(-1.0) { }65 _bge(bge), _rho(-1.0) { set_defaults(); } 64 66 65 67 /// define a subtractor that uses a fixed value of rho, the background … … 68 70 69 71 /// default constructor 70 Subtractor() : _bge(0), _rho(_invalid_rho) { }72 Subtractor() : _bge(0), _rho(_invalid_rho) { set_defaults(); } 71 73 72 74 /// default dtor 73 75 virtual ~Subtractor(){}; 76 77 /// @name configuring the behaviour 78 //\{ 79 //---------------------------------------------------------------- 80 81 /// reset all parameters to default values 82 /// 83 /// Note: by default, the rho_m term is not included and the safety 84 /// test for the mass is not done. This is mostly for backwards 85 /// compatibility with FastJet 3.0 and is highly likely to change in 86 /// a future release of FastJet 87 void set_defaults(); 88 89 /// when 'use_rho_m' is true, include in the subtraction the 90 /// correction from rho_m, the purely longitudinal, 91 /// particle-mass-induced component of the background density per 92 /// unit area 93 /// 94 /// Note: this will be switched off by default (for backwards 95 /// compatibility with FastJet 3.0) but is highly likely to change 96 /// in a future release of FastJet 97 void set_use_rho_m(bool use_rho_m_in = true){ 98 if (_bge == 0) { 99 throw Error("Subtractor: rho_m support works only for Subtractors constructed with background estimator"); 100 } 101 _use_rho_m=use_rho_m_in; 102 } 103 104 /// returns whether or not the rho_m component is used 105 bool use_rho_m() const{ return _use_rho_m;} 106 107 /// when 'safe_mass' is true, ensure that the mass of the subtracted 108 /// 4-vector remain positive 109 /// 110 /// when true, if the subtracted mass is negative, we return a 111 /// 4-vector with 0 mass, pt and phi from the subtracted 4-vector 112 /// and the rapidity of the original, unsubtracted jet. 113 /// 114 /// Note: this will be switched off by default (for backwards 115 /// compatibility with FastJet 3.0) but is highly likely to change 116 /// in a future release of FastJet 117 void set_safe_mass(bool safe_mass_in=true){ _safe_mass=safe_mass_in;} 118 119 /// returns whether or not safety tests on the mass are included 120 bool safe_mass() const{ return _safe_mass;} 121 122 /// This is mostly intended for cherge-hadron-subtracted type of 123 /// events where we wich to use vertex information to improve the 124 /// subtraction. 125 /// 126 /// Given the following parameters: 127 /// \param sel_known_vertex selects the particles with a 128 /// known vertex origin 129 /// \param sel_leading_vertex amongst the particles with a 130 /// known vertex origin, select those 131 /// coming from the leading vertex 132 /// Momentum identified as coming from the leading vertex will be 133 /// kept, momentum identified as coming from a non-leading vertex 134 /// will be eliminated and a regular area-median subtraction will be 135 /// applied on the 4-vector sum of the particles with unknown vertex 136 /// origin. 137 /// 138 /// When this is set, we shall ensure that the pt of the subtracted 139 /// 4-vector is at least the pt of the particles that are known to 140 /// come from the leading vertex (if it fails, subtraction returns 141 /// the component that is known to come from the leading vertex --- 142 /// or, the original unsubtracted jet if it contains no particles 143 /// from the leading vertex). Furthermore, when safe_mass() is on, we 144 /// also impose a similar constraint on the mass of the subtracted 145 /// 4-vector (if the test fails, the longitudinal part of the 146 /// subtracted 4-vector is taken from the component that is known to 147 /// come from the leading vertex). 148 void set_known_selectors(const Selector &sel_known_vertex, 149 const Selector &sel_leading_vertex){ 150 _sel_known_vertex = sel_known_vertex; 151 _sel_leading_vertex = sel_leading_vertex; 152 } 153 154 //\} 155 156 /// @name description and action 157 //\{ 158 //---------------------------------------------------------------- 74 159 75 160 /// returns a jet that's subtracted … … 82 167 virtual std::string description() const; 83 168 169 //\} 84 170 protected: 171 /// compute the 4-vector that should be subtracted from the given 172 /// jet 173 PseudoJet _amount_to_subtract(const PseudoJet &jet) const; 85 174 86 175 /// the tool used to estimate the background … … 89 178 /// the fixed value of rho to use if the user has selected that option 90 179 double _rho; 180 181 // configuration parameters/flags 182 bool _use_rho_m; ///< include the rho_m correction 183 bool _safe_mass; ///< ensures that the subtracted mass is +ve 184 185 Selector _sel_known_vertex; ///< selects the particles with a 186 ///< known vertex origin 187 Selector _sel_leading_vertex; ///< amongst the particles with a 188 ///< known vertex origin, select those 189 ///< coming from the leading vertex 91 190 92 191 /// a value of rho that is used as a default to label that the stored … … 98 197 // that's not allowed in an include file. 99 198 static const double _invalid_rho; 199 200 mutable LimitedWarning _unused_rho_m_warning; 100 201 }; 101 202 -
external/fastjet/tools/TopTaggerBase.cc
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id $1 //FJSTARTHEADER 2 // $Id: TopTaggerBase.cc 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #include <fastjet/tools/TopTaggerBase.hh> -
external/fastjet/tools/TopTaggerBase.hh
r5b5a56b r35cdc46 2 2 #define __FASTJET_TOP_TAGGER_BASE_HH__ 3 3 4 // STARTHEADER5 // $Id: TopTaggerBase.hh 2689 2011-11-14 14:51:06Z soyez$4 //FJSTARTHEADER 5 // $Id: TopTaggerBase.hh 3433 2014-07-23 08:17:03Z salam $ 6 6 // 7 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 8 8 // 9 9 //---------------------------------------------------------------------- … … 16 16 // 17 17 // The algorithms that underlie FastJet have required considerable 18 // development and are described in hep-ph/0512210. If you use 18 // development. They are described in the original FastJet paper, 19 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 19 20 // FastJet as part of work towards a scientific publication, please 20 // include a citation to the FastJet paper. 21 // quote the version you use and include a citation to the manual and 22 // optionally also to hep-ph/0512210. 21 23 // 22 24 // FastJet is distributed in the hope that it will be useful, … … 28 30 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 29 31 //---------------------------------------------------------------------- 30 // ENDHEADER32 //FJENDHEADER 31 33 32 34 #include <fastjet/internal/base.hh> -
external/fastjet/tools/Transformer.hh
r5b5a56b r35cdc46 1 // STARTHEADER2 // $Id: Transformer.hh 2577 2011-09-13 15:11:38Z salam $1 //FJSTARTHEADER 2 // $Id: Transformer.hh 3433 2014-07-23 08:17:03Z salam $ 3 3 // 4 // Copyright (c) 2005-201 1, Matteo Cacciari, Gavin P. Salam and Gregory Soyez4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 5 5 // 6 6 //---------------------------------------------------------------------- … … 13 13 // 14 14 // The algorithms that underlie FastJet have required considerable 15 // development and are described in hep-ph/0512210. If you use 15 // development. They are described in the original FastJet paper, 16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use 16 17 // FastJet as part of work towards a scientific publication, please 17 // include a citation to the FastJet paper. 18 // quote the version you use and include a citation to the manual and 19 // optionally also to hep-ph/0512210. 18 20 // 19 21 // FastJet is distributed in the hope that it will be useful, … … 25 27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 26 28 //---------------------------------------------------------------------- 27 // ENDHEADER29 //FJENDHEADER 28 30 29 31 #ifndef __FASTJET_TRANSFORMER_HH__
Note:
See TracChangeset
for help on using the changeset viewer.