13 minimumTowersFraction_(iConfig.getParameter<double>(
"minimumTowersFraction")),
14 sumRecHits_(iConfig.getParameter<
bool>(
"sumRecHits")),
15 dropZeroTowers_(iConfig.getUntrackedParameter<
bool>(
"dropZeroTowers",
true)) {
20 for (std::map<int, double>::iterator iter =
esigma_.begin(); iter !=
esigma_.end(); ++iter) {
21 iter->second =
s * (iter->second);
26 LogDebug(
"PileUpSubtractor") <<
"The subtractor correcting jets...\n";
45 vector<fastjet::PseudoJet>::iterator pseudojetTMP =
fjJets_->begin(), jetsEnd =
fjJets_->end();
46 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
47 int ijet = pseudojetTMP -
fjJets_->begin();
50 std::vector<fastjet::PseudoJet>
towers = sorted_by_pt(pseudojetTMP->constituents());
53 for (vector<fastjet::PseudoJet>::const_iterator ito =
towers.begin(), towEnd =
towers.end(); ito != towEnd; ++ito) {
55 int it =
ieta(originalTower);
56 double Original_Et = originalTower->
et();
60 newjetet = newjetet + etnew;
67 LogDebug(
"PileUpSubtractor") <<
"The subtractor subtracting pedestals...\n";
71 vector<fastjet::PseudoJet> newcoll;
73 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin(), fjInputsEnd = coll.end();
74 input_object != fjInputsEnd;
81 double Original_Et = itow->
et();
83 Original_Et =
getEt(itow);
86 double etnew = Original_Et - (*(
emean_.find(it))).second - (*(
esigma_.find(it))).second;
87 float mScale = etnew / input_object->Et();
92 input_object->py() * mScale,
93 input_object->pz() * mScale,
94 input_object->e() * mScale);
96 int index = input_object->user_index();
97 input_object->reset_momentum(towP4.px(), towP4.py(), towP4.pz(), towP4.energy());
98 input_object->set_user_index(
index);
101 newcoll.push_back(*input_object);
109 LogDebug(
"PileUpSubtractor") <<
"The subtractor calculating pedestals...\n";
111 map<int, double> emean2;
112 map<int, int> ntowers;
114 int ietaold = -10000;
126 for (vector<fastjet::PseudoJet>::const_iterator input_object = coll.begin(), fjInputsEnd = coll.end();
127 input_object != fjInputsEnd;
130 ieta0 =
ieta(originalTower);
131 double Original_Et = originalTower->
et();
133 Original_Et =
getEt(originalTower);
136 if (ieta0 - ietaold != 0) {
138 emean2[ieta0] = emean2[ieta0] + Original_Et * Original_Et;
143 emean2[ieta0] = emean2[ieta0] + Original_Et * Original_Et;
149 int it = (*gt).first;
151 double e1 = (*(
emean_.find(it))).second;
152 double e2 = (*emean2.find(it)).
second;
155 LogDebug(
"PileUpSubtractor") <<
" ieta : " << it <<
" number of towers : " <<
nt <<
" e1 : " <<
e1 <<
" e2 : " << e2
168 LogDebug(
"PileUpSubtractor") <<
" ieta : " << it <<
" Pedestals : " <<
emean_[it] <<
" " <<
esigma_[it] <<
"\n";
173 LogDebug(
"PileUpSubtractor") <<
"The subtractor calculating orphan input...\n";
177 vector<int> jettowers;
178 vector<pair<int, int> > excludedTowers;
180 for (
auto const& pseudojetTMP : *
fjJets_) {
187 auto exclude =
find(excludedTowers.begin(), excludedTowers.end(), pair<int, int>(im.ieta(), im.iphi()));
188 if (
dr <
radiusPU_ && exclude == excludedTowers.end() &&
192 excludedTowers.push_back(pair<int, int>(im.ieta(), im.iphi()));
197 int index = it.user_index();
200 auto exclude =
find(excludedTowers.begin(), excludedTowers.end(), pair<int, int>(ie, ip));
201 if (exclude != excludedTowers.end()) {
202 jettowers.push_back(
index);
213 int index = it.user_index();
214 vector<int>::const_iterator itjet =
find(jettowers.begin(), jettowers.end(),
index);
215 if (itjet == jettowers.end()) {
217 fastjet::PseudoJet orphan(originalTower->
px(), originalTower->
py(), originalTower->
pz(), originalTower->
energy());
218 orphan.set_user_index(
index);
220 orphanInput.push_back(orphan);
226 const CaloTower* ctc = dynamic_cast<const CaloTower*>(
in.get());
234 const CaloTower* ctc = dynamic_cast<const CaloTower*>(
in.get());