9 for (std::map<int, double>::iterator iter = esigma_.begin(); iter != esigma_.end(); ++iter) {
10 iter->second =
s * (iter->second);
15 LogDebug(
"PileUpSubtractor") <<
"The subtractor correcting jets...\n";
20 (*fjInputs_) = fjOriginalInputs_;
21 rescaleRMS(nSigmaPU_);
22 subtractPedestal(*fjInputs_);
23 const fastjet::JetDefinition&
def = fjClusterSeq_->jet_def();
24 if (!doAreaFastjet_ && !doRhoFastjet_) {
25 fastjet::ClusterSequence newseq(*fjInputs_,
def);
26 (*fjClusterSeq_) = newseq;
28 fastjet::ClusterSequenceArea newseq(*fjInputs_,
def, *fjActiveArea_);
29 (*fjClusterSeq_) = newseq;
32 (*fjJets_) = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
34 jetOffset_.reserve(fjJets_->size());
36 vector<fastjet::PseudoJet>::iterator pseudojetTMP = fjJets_->begin(), jetsEnd = fjJets_->end();
37 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
38 int ijet = pseudojetTMP - fjJets_->begin();
41 std::vector<fastjet::PseudoJet>
towers = sorted_by_pt(fjClusterSeq_->constituents(*pseudojetTMP));
44 for (vector<fastjet::PseudoJet>::const_iterator ito =
towers.begin(), towEnd =
towers.end(); ito != towEnd; ++ito) {
46 int it =
ieta(originalTower);
47 double Original_Et = originalTower->
et();
48 double etnew = Original_Et - (*emean_.find(-
it)).
second - (*esigma_.find(-
it)).
second;
51 newjetet = newjetet + etnew;
52 jetOffset_[ijet] += Original_Et - etnew;
58 LogDebug(
"PileUpSubtractor") <<
"The subtractor subtracting pedestals...\n";
62 vector<fastjet::PseudoJet> newcoll;
64 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin(), fjInputsEnd = coll.end();
65 input_object != fjInputsEnd;
72 double Original_Et = itow->
et();
74 Original_Et =
getEt(itow);
77 double etnew = Original_Et - (*(emean_.find(-
it))).second - (*(esigma_.find(-
it))).second;
78 float mScale = etnew / input_object->Et();
83 input_object->py() * mScale,
84 input_object->pz() * mScale,
85 input_object->e() * mScale);
87 int index = input_object->user_index();
88 input_object->reset(towP4.px(), towP4.py(), towP4.pz(), towP4.energy());
89 input_object->set_user_index(
index);
91 if (etnew > 0. && dropZeroTowers_)
92 newcoll.push_back(*input_object);
100 LogDebug(
"PileUpSubtractor") <<
"The subtractor calculating pedestals...\n";
102 map<int, double> emean2;
103 map<int, int> ntowers;
105 int ietaold = -10000;
110 for (
int i = ietamin_;
i < ietamax_ + 1;
i++) {
117 for (vector<fastjet::PseudoJet>::const_iterator input_object = coll.begin(), fjInputsEnd = coll.end();
118 input_object != fjInputsEnd;
121 ieta0 =
ieta(originalTower);
122 double Original_Et = originalTower->
et();
124 Original_Et =
getEt(originalTower);
127 if (ieta0 - ietaold != 0) {
128 emean_[ieta0] = emean_[ieta0] + Original_Et;
129 emean2[ieta0] = emean2[ieta0] + Original_Et * Original_Et;
133 emean_[ieta0] = emean_[ieta0] + Original_Et;
134 emean2[ieta0] = emean2[ieta0] + Original_Et * Original_Et;
139 for (map<int, int>::const_iterator
gt = geomtowers_.begin();
gt != geomtowers_.end();
gt++) {
140 int it = (*gt).first;
142 double e1 = (*(emean_.find(
it))).second;
143 double e2 = (*emean2.find(
it)).
second;
144 int nt = (*gt).second - (*(ntowersWithJets_.find(
it))).second;
146 LogDebug(
"PileUpSubtractor") <<
" ieta : " <<
it <<
" number of towers : " <<
nt <<
" e1 : " <<
e1 <<
" e2 : " << e2
154 esigma_[
it] = nSigmaPU_ *
sqrt(eee);
159 LogDebug(
"PileUpSubtractor") <<
" ieta : " <<
it <<
" Pedestals : " << emean_[
it] <<
" " << esigma_[
it] <<
"\n";
int def(FILE *, FILE *, int)
double getEta(const reco::CandidatePtr &in) const
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
virtual double et() const =0
transverse energy
Sin< T >::type sin(const T &t)
float getEt(float temp[nTowerEtaSLR][nTowerPhiSLR], int eta, int phi)
void calculatePedestal(std::vector< fastjet::PseudoJet > const &coll) override
U second(std::pair< T, U > const &p)
double getEt(const reco::CandidatePtr &in) const
void rescaleRMS(double s)
void offsetCorrectJets() override
void subtractPedestal(std::vector< fastjet::PseudoJet > &coll) override
CaloTowerDetId id() const