9 for ( std::map<int, double>::iterator iter = esigma_.begin();
10 iter != esigma_.end(); ++iter ){
11 iter->second = s*(iter->second);
19 LogDebug(
"PileUpSubtractor")<<
"The subtractor correcting jets...\n";
24 (*fjInputs_) = fjOriginalInputs_;
25 rescaleRMS(nSigmaPU_);
26 subtractPedestal(*fjInputs_);
27 const fastjet::JetDefinition&
def = fjClusterSeq_->jet_def();
28 if ( !doAreaFastjet_ && !doRhoFastjet_) {
29 fastjet::ClusterSequence newseq( *fjInputs_,
def );
30 (*fjClusterSeq_) = newseq;
32 fastjet::ClusterSequenceArea newseq( *fjInputs_,
def , *fjActiveArea_ );
33 (*fjClusterSeq_) = newseq;
36 (*fjJets_) = fastjet::sorted_by_pt(fjClusterSeq_->inclusive_jets(jetPtMin_));
38 jetOffset_.reserve(fjJets_->size());
40 vector<fastjet::PseudoJet>::iterator pseudojetTMP = fjJets_->begin (),
41 jetsEnd = fjJets_->end();
42 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
44 int ijet = pseudojetTMP - fjJets_->begin();
47 std::vector<fastjet::PseudoJet> towers =
48 sorted_by_pt(fjClusterSeq_->constituents(*pseudojetTMP));
51 for(vector<fastjet::PseudoJet>::const_iterator ito = towers.begin(),
52 towEnd = towers.end();
57 int it = ieta( originalTower );
58 double Original_Et = originalTower->et();
59 double etnew = Original_Et - (*emean_.find(-it)).
second - (*esigma_.find(-it)).
second;
60 if(etnew < 0.) etnew = 0;
61 newjetet = newjetet + etnew;
62 jetOffset_[ijet] += Original_Et - etnew;
70 LogDebug(
"PileUpSubtractor")<<
"The subtractor subtracting pedestals...\n";
74 vector<fastjet::PseudoJet> newcoll;
76 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin (),
77 fjInputsEnd = coll.end();
78 input_object != fjInputsEnd; ++input_object) {
85 double Original_Et = itow->et();
87 Original_Et = getEt(itow);
90 double etnew = Original_Et - (*(emean_.find(-it))).second - (*(esigma_.find(-it))).second;
91 float mScale = etnew/input_object->Et();
92 if(etnew < 0.) mScale = 0.;
95 input_object->pz()*mScale, input_object->e()*mScale);
97 int index = input_object->user_index();
98 input_object->reset ( towP4.px(),
102 input_object->set_user_index(index);
104 if(etnew > 0. && dropZeroTowers_) newcoll.push_back(*input_object);
107 if(dropZeroTowers_) coll = newcoll;
113 LogDebug(
"PileUpSubtractor")<<
"The subtractor calculating pedestals...\n";
115 map<int,double> emean2;
116 map<int,int> ntowers;
118 int ietaold = -10000;
123 for(
int i = ietamin_;
i < ietamax_+1;
i++)
131 for (vector<fastjet::PseudoJet>::const_iterator input_object = coll.begin (),
132 fjInputsEnd = coll.end();
133 input_object != fjInputsEnd; ++input_object) {
136 ieta0 = ieta( originalTower );
137 double Original_Et = originalTower->et();
139 Original_Et = getEt(originalTower);
142 if( ieta0-ietaold != 0 )
144 emean_[ieta0] = emean_[ieta0]+Original_Et;
145 emean2[ieta0] = emean2[ieta0]+Original_Et*Original_Et;
151 emean_[ieta0] = emean_[ieta0]+Original_Et;
152 emean2[ieta0] = emean2[ieta0]+Original_Et*Original_Et;
158 for(map<int,int>::const_iterator
gt = geomtowers_.begin();
gt != geomtowers_.end();
gt++)
161 int it = (*gt).first;
163 double e1 = (*(emean_.find(it))).second;
164 double e2 = (*emean2.find(it)).
second;
165 int nt = (*gt).second - (*(ntowersWithJets_.find(it))).second;
167 LogDebug(
"PileUpSubtractor")<<
" ieta : "<<it<<
" number of towers : "<<nt<<
" e1 : "<<e1<<
" e2 : "<<e2<<
"\n";
171 double eee = e2/nt - e1*e1/(nt*
nt);
173 esigma_[it] = nSigmaPU_*
sqrt(eee);
180 LogDebug(
"PileUpSubtractor")<<
" ieta : "<<it<<
" Pedestals : "<<emean_[it]<<
" "<<esigma_[it]<<
"\n";
188 double et = energy*
sin(pos.
theta());
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
U second(std::pair< T, U > const &p)
T const * get() const
Returns C++ pointer to the item.
double getEta(const reco::CandidatePtr &in) const
CaloTowerDetId id() const
virtual void subtractPedestal(std::vector< fastjet::PseudoJet > &coll)
double getEt(const reco::CandidatePtr &in) const
virtual void calculatePedestal(std::vector< fastjet::PseudoJet > const &coll)
void rescaleRMS(double s)
virtual void offsetCorrectJets()