9 #include "Math/ProbFuncMathCore.h" 11 #include "fastjet/contrib/ConstituentSubtractor.hh" 22 useModulatedRho_(conf.getParameter<
bool>(
"useModulatedRho")),
23 minFlowChi2Prob_(conf.getParameter<double>(
"minFlowChi2Prob")),
24 maxFlowChi2Prob_(conf.getParameter<double>(
"maxFlowChi2Prob")) {
58 std::vector<fastjet::PseudoJet> tempJets = fastjet::sorted_by_pt(
fjClusterSeq_->inclusive_jets(
jetPtMin_));
72 unsigned int bkgVecSize =
etaRanges->size();
74 throw cms::Exception(
"WrongBkgInput") <<
"Producer needs vector with background estimates\n";
76 if (bkgVecSize != (rhoRanges->size() + 1) || bkgVecSize != (rhomRanges->size() + 1)) {
78 <<
"Size of etaRanges (" << bkgVecSize <<
") and rhoRanges (" << rhoRanges->size() <<
") and/or rhomRanges (" 79 << rhomRanges->size() <<
") vectors inconsistent\n";
94 for (fastjet::PseudoJet& ijet : tempJets) {
97 std::vector<fastjet::PseudoJet>
particles, ghosts;
98 fastjet::SelectorIsPureGhost().sift(ijet.constituents(), ghosts,
particles);
99 unsigned long nParticles =
particles.size();
104 for (fastjet::PseudoJet& ighost : ghosts) {
105 double rhoModulationFactor = 1.;
106 double ghostPhi = ighost.phi_std();
116 int32_t ghostPos = -1;
117 auto const ighostEta = ighost.eta();
118 if (ighostEta <= etaRanges->at(0) || bkgVecSize == 1) {
120 }
else if (ighostEta >=
etaRanges->at(bkgVecSize - 1)) {
121 ghostPos = rhoRanges->size() - 1;
123 for (
unsigned int ie = 0; ie < (bkgVecSize - 1); ie++) {
130 double pt = rhoRanges->at(ghostPos) * ighost.area() * rhoModulationFactor;
131 double mass_squared =
132 std::pow(rhoModulationFactor * rhomRanges->at(ghostPos) * ighost.area() +
pt, 2) -
std::pow(
pt, 2);
133 double mass = (mass_squared > 0) ?
sqrt(mass_squared) : 0;
134 ighost.reset_momentum_PtYPhiM(
pt, ighost.rap(), ighost.phi(),
mass);
140 fastjet::contrib::ConstituentSubtractor subtractor;
142 subtractor.set_max_distance(
144 subtractor.set_alpha(
146 subtractor.set_do_mass_subtraction();
147 subtractor.set_remove_all_zero_pt_particles(
true);
149 std::vector<fastjet::PseudoJet> subtracted_particles = subtractor.do_subtraction(
particles, ghosts);
152 fastjet::PseudoJet subtracted_jet =
join(subtracted_particles);
154 fjJets_.push_back(subtracted_jet);
164 descCSJetProducer.
add<
string>(
"jetCollInstanceName",
"");
166 descCSJetProducer.
add<
bool>(
"sumRecHits",
false);
169 descriptions.
add(
"CSJetProducer", descCSJetProducer);
173 desc.add<
double>(
"csRParam", -1.);
174 desc.add<
double>(
"csAlpha", 2.);
175 desc.add<
bool>(
"useModulatedRho",
false);
176 desc.add<
double>(
"minFlowChi2Prob", 0.05);
177 desc.add<
double>(
"maxFlowChi2Prob", 0.95);
181 desc.add<
edm::InputTag>(
"rhoFlowFitParams", {
"hiFJRhoFlowModulationProducer",
"rhoFlowFitParams"});
187 int nFlow = (flowComponents->size() - 4) / 2;
188 double modulationValue = 1;
189 double firstFlowComponent = flowComponents->at(nFlow * 2 + 3);
190 for (
int iFlow = 0; iFlow < nFlow; iFlow++) {
191 modulationValue += 2.0 * flowComponents->at(2 * iFlow + 1) *
192 cos((iFlow + firstFlowComponent) * (phi - flowComponents->at(2 * iFlow + 2)));
194 return modulationValue;
T getParameter(std::string const &) const
std::vector< fastjet::PseudoJet > fjJets_
double csAlpha_
for constituent subtraction : R parameter
bool useModulatedRho_
for HI constituent subtraction : alpha (power of pt in metric)
std::shared_ptr< fastjet::ClusterSequence > ClusterSequencePtr
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
double getModulatedRhoFactor(const double phi, const edm::Handle< std::vector< double >> &flowParameters)
edm::EDGetTokenT< std::vector< double > > rhoToken_
edm::EDGetTokenT< std::vector< double > > rhoFlowFitParamsToken_
double maxFlowChi2Prob_
flowFit chi2/ndof minimum compatability requirement
std::vector< fastjet::PseudoJet > fjInputs_
ClusterSequencePtr fjClusterSeq_
Cos< T >::type cos(const T &t)
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Namespace of DDCMS conversion namespace.
edm::EDGetTokenT< std::vector< double > > etaToken_
flowFit chi2/ndof minimum compatability requirement
static std::string join(char **cmd)
void runAlgorithm(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< std::vector< double > > rhomToken_
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
AreaDefinitionPtr fjAreaDefinition_
static void fillDescriptionsFromVirtualJetProducer(edm::ParameterSetDescription &desc)
static void fillDescriptionsFromCSJetProducer(edm::ParameterSetDescription &desc)
Power< A, B >::type pow(const A &a, const B &b)
double minFlowChi2Prob_
flag to turn on/off flow-modulated rho and rhom
JetDefPtr fjJetDefinition_