if(_max_eta<=0)throwError("ConstituentSubtractor::initialize_common: The value for eta cut was not set or it is negative. It needs to be set before using the function initialize");
if(_masses_to_zero&&_do_mass_subtraction)throwError("ConstituentSubtractor::initialize_common: It is specified to do mass subtraction and also to keep the masses at zero. Something is wrong.");
if(_masses_to_zero&&_scale_fourmomentum)throwError("ConstituentSubtractor::initialize_common: It is specified to do scaling of fourmomenta and also to keep the masses at zero. Something is wrong.");
if(_do_mass_subtraction&&_scale_fourmomentum)throwError("ConstituentSubtractor::initialize_common: It is specified to do mass subtraction and also to do scaling of fourmomenta. Something is wrong.");
throwError("ConstituentSubtractor::result() constituent subtraction needs a BackgroundEstimator or a value for rho.");
}
if(_ghosts_constructed)throwError("ConstituentSubtractor::result() The ghosts are constructed, but they are not needed when using this function. When you want to perform jet-by-jet correction, initialize a new ConstituentSubtractor without construction of ghosts.");
elsethrowError("ConstituentSubtractor::subtract_event: It was requested to use closeby hard proxies but they were not provided in this function!");
}
elseif(hard_proxies)throwError("ConstituentSubtractor::subtract_event: Hard proxies were provided but the set_use_hard_proxies function was not used before initialization. It needs to be called before initialization!");
throwError("ConstituentSubtractor: The provided background estimator for rho_m has no support to compute rho_m, and other option to get it is not available in ConstituentSubtractor.");
}
#endif // end of code specific to FJ >= 3.1
#if FASTJET_VERSION_NUMBER < 30100
throwError("ConstituentSubtractor: You provided a background estimator for rho_m, but this is not supported in ConstituentSubtractor when using fastjet version smaller than 30100.");
#endif
}
elseif(_common_bge){
// since FJ 3.1.0, some background estimators have an automatic internal calculation of rho_m
#if FASTJET_VERSION_NUMBER >= 30100
// check if the BGE has internal support for rho_m
_warning_unused_rhom.warn("ConstituentSubtractor:: Background estimator indicates non-zero rho_m, but the ConstituentSubtractor does not use rho_m information, nor the masses are set to zero, nor the 4-momentum is scaled. Consider calling set_common_bge_for_rho_and_rhom() to include the rho_m information; or call set_keep_original_masses(false) to set masses for all particles to zero; or call set_scale_fourmomentum to scale the fourmomentum.");
if(skip_particles_outside_phi_range)if((switched&&particles_phi[i]>particle_phi_min&&particles_phi[i]<particle_phi_max)||(!switched&&(particles_phi[i]<particle_phi_min||particles_phi[i]>particle_phi_max)))continue;// speed optimization only, this line has no effect on the subtraction performance
CS_distances.push_back(std::make_pair(CS_distance,std::make_pair(i,j)));// have tried to use emplace_back and tuple here - did not lead to any speed improvement
// Particles with zero pt and zero mass are removed by default. The user can decide to keep them by using function "set_remove_particles_with_zero_pt_and_mass" - then the mass is set to zero and the pt is set to very small value (1e-50).
// Particles with zero pt and non-zero mass (i.e. massive particles at rest) are kept with very small pt (1e-50). The user can use function "set_remove_all_zero_pt_particles" to remove them or he/she can decide in his/her code if to remove or not to remove them.
elsethrowError("ConstituentSubtractor::set_common_bge_for_rho_and_rhom: This function should be not used with false! Read the instructions for mass subtraction in the header file.");
if(!_bge_rho)throwError("ConstituentSubtractor::set_common_bge_for_rho_and_rhom() is not allowed when _bge_rho is not set!");
if(_bge_rhom)throwError("ConstituentSubtractor::set_common_bge_for_rho_and_rhom() is not allowed in the presence of an existing background estimator for rho_m.");
if(_externally_supplied_rho_rhom)throwError("ConstituentSubtractor::set_common_bge_for_rho_and_rhom() is not allowed when supplying externally the values for rho and rho_m.");
if(!jmbge)throwError("ConstituentSubtractor::set_common_bge_for_rho_and_rhom() is currently only allowed for background estimators of JetMedianBackgroundEstimator type.");
#if FASTJET_VERSION_NUMBER >= 30100
}
#endif
_common_bge=true;
}
// setting this to true will result in rho_m being estimated using bge_rhom->rho_m() instead of bge_rhom->rho()
throw Error("ConnstituentSubtractor::use_rhom_from_bge_rhom() can only be used with FastJet >=3.1.");
#else
if (!_bge_rhom) throw Error("ConstituentSubtractor::use_rhom_from_bge_rhom() requires a background estimator for rho_m.");
if (!(_bge_rhom->has_rho_m())) throw Error("ConstituentSubtractor::use_rhom_from_bge_rhom() requires rho_m support for the background estimator for rho_m.");
descr<<" Using externally supplied rho = "<<_rho<<" and rho_m = "<<_rhom<<std::endl;
}else{
if(_bge_rhom&&_bge_rho){
descr<<" Using rho estimation: "<<_bge_rho->description()<<std::endl;
descr<<" Using rho_m estimation: "<<_bge_rhom->description()<<std::endl;
}else{
if(_bge_rho)descr<<" Using rho estimation: "<<_bge_rho->description()<<std::endl;
elsedescr<<" No externally supplied rho, nor background estimator"<<std::endl;
}
}
if(_do_mass_subtraction){
descr<<" The mass part (delta_m) will be also corrected."<<std::endl;
if(_common_bge)descr<<" using the same background estimator for rho_m as for rho"<<std::endl;
elsedescr<<" using different background estimator for rho_m as for rho"<<std::endl;
}
elseif(_masses_to_zero)descr<<" The masses of all particles will be set to zero."<<std::endl;
elseif(_scale_fourmomentum)descr<<" The masses will be corrected by scaling the whole 4-momentum."<<std::endl;
elsedescr<<" The original mass of the particles will be kept."<<std::endl;
if(!_scale_fourmomentum){
if(_fix_pseudorapidity)descr<<" The pseudo-rapidity of the particles will be kept unchanged (not rapidity)."<<std::endl;
elsedescr<<" The rapidity of the particles will be kept unchanged (not pseudo-rapidity)."<<std::endl;
}
if(_use_nearby_hard)descr<<" Using information about nearby hard proxies with parameters _nearby_hard_radius="<<_nearby_hard_radius<<" and _nearby_hard_factor="<<_nearby_hard_factor<<std::endl;
elsedescr<<" The information about nearby hard proxies will not be used."<<std::endl;
if(value>vec[size-1])returnsize;// if the value is larger than the maximal possible rapidity, than setting min to size - then also max is set to size, and nothing will be run in the loop
if(value<vec[0])return0;// if the value is lower than the minimal possible rapidity, than setting max to 0 - then also min is set to 0, and nothing will be run in the loop
if(value>=vec[size-1])returnsize;// it is higher by one to account for the "<" comparison in the for loop
for(inti=0;i<nIterations;++i){
unsignedinttest=(upperBound+lowerBound)/2;
if(value>=vec[test]){
if(value<vec[test+1])returntest+1;// it is higher by one to account for the "<" comparison in the for loop
lowerBound=test;
}
else{
if(value>=vec[test-1])returntest;// it is higher by one to account for the "<" comparison in the for loop
_ghosts_rapidity_sorted=true;// the ghosts are now sorted according to rapidity. This variable needs to be set to true to be able to use faster algorithm in "do_subtraction".