/// rap_term(y) = bin content of the histogram at position y
///
/// You need to set the parameters event-by-event. Example where the TH1 histogram is filled with a random distribution. Do not use this histogram!!! Fill your own histogram with all particles (topoclusters) weighted by their pt using minimum bias events.
rescaling.use_rap_term(true); // this is useful to make sure that the histogram with rapidity dependence is defined. Set to false, if you do not want to use the rapidity rescaling
*/
///**** rescaling in heavy ion events using parametrized rapidity dependence: ****
// Set the seven parameters for rescaling using function
rescaling.use_rap_term(false);// set to true, if you have derived also the rapidity terms for the rescaling
///**** rescaling using rapidity dependence stored in root TH1 object: ****
// find the rapidity distribution of pileup particles from minimum bias events in a separate run. Fill a root TH1 histogram with this distribution.
// Here as an example where the TH1 histogram is filled with a random distribution. Do not use this!!! Fill it with all particles (topoclusters) weighted by their pt using minimum bias events.
subtractor.set_distance_type(contrib::ConstituentSubtractor::deltaR);// free parameter for the type of distance between particle i and ghost k. There are two options: "deltaR" or "angle" which are defined as deltaR=sqrt((y_i-y_k)^2+(phi_i-phi_k)^2) or Euclidean angle between the momenta
subtractor.set_max_distance(1);// free parameter for the maximal allowed distance between particle i and ghost k
subtractor.set_alpha(2);// free parameter for the distance measure (the exponent of particle pt). The larger the parameter alpha, the more are favoured the lower pt particles in the subtraction process
subtractor.set_ghost_area(0.01);// free parameter for the density of ghosts. The smaller, the better - but also the computation is slower.
// event loop
// read in input particles
vector<PseudoJet>hard_event,full_event;
read_event(hard_event,full_event);
doublemaxEta=4;// specify the maximal rapidity for the particles used in the subtraction
doublemaxEta_jet=3;// the maximal rapidity for selected jets
// keep the particles up to 4 units in rapidity
hard_event=SelectorAbsEtaMax(maxEta)(hard_event);
full_event=SelectorAbsEtaMax(maxEta)(full_event);
cout<<"# read an event with "<<hard_event.size()<<" signal particles and "<<full_event.size()-hard_event.size()<<" background particles with pseudo-rapidity |eta|<4"<<endl;
AreaDefinitionarea_def(active_area_explicit_ghosts,GhostedAreaSpec(maxEta,1));// the area definiton is used only for the jet backgroud estimator. It is not important for the ConstituentSubtractor when subtracting the whole event - this is not true when subtracting the individual jets
bge_rho.set_jet_density_class(scalarPtDensity);// this changes the computation of pt of patches from vector sum to scalar sum. The scalar sum seems more reasonable.
// setting the TH1 rescaling:
bge_rho.set_rescaling_class(&rescaling);
bge_rho.set_particles(full_event);
subtractor.set_background_estimator(&bge_rho);
// this sets the same background estimator to be used for deltaMass density, rho_m, as for pt density, rho:
subtractor.set_common_bge_for_rho_and_rhom(true);// for massless input particles it does not make any difference (rho_m is always zero)