18 for (std::map<int, double>::iterator iter = esigma_.begin(); iter != esigma_.end(); ++iter) {
19 iter->second =
s * (iter->second);
25 dropZeroTowers_(iConfig.getUntrackedParameter<
bool>(
"dropZeroTowers",
true)),
33 std::string ifname =
"RecoHI/HiJetAlgos/data/PU_DATA.root";
35 fPU = (TF1*)
inf->Get(
"fPU");
38 hC = (TH1D*)
inf->Get(
"hC");
40 for (
int i = 0;
i < 40; ++
i) {
41 hEta.push_back((TH1D*)
inf->Get(Form(
"hEta_%d",
i)));
42 hEtaMean.push_back((TH1D*)
inf->Get(Form(
"hEtaMean_%d",
i)));
43 hEtaRMS.push_back((TH1D*)
inf->Get(Form(
"hEtaRMS_%d",
i)));
48 LogDebug(
"PileUpSubtractor") <<
"The subtractor setting up geometry...\n";
78 LogDebug(
"PileUpSubtractor") <<
"The subtractor subtracting pedestals...\n";
81 vector<fastjet::PseudoJet> newcoll;
83 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin(), fjInputsEnd = coll.end();
84 input_object != fjInputsEnd;
91 double Original_Et = itow->et();
93 Original_Et =
getEt(itow);
96 double etnew = Original_Et -
getPU(it,
true,
true);
97 float mScale = etnew / input_object->Et();
102 input_object->py() * mScale,
103 input_object->pz() * mScale,
104 input_object->e() * mScale);
106 int index = input_object->user_index();
107 input_object->reset(towP4.px(), towP4.py(), towP4.pz(), towP4.energy());
108 input_object->set_user_index(
index);
110 newcoll.push_back(*input_object);
120 LogDebug(
"PileUpSubtractor") <<
"The subtractor correcting jets...\n";
123 using namespace reco;
133 (*fjClusterSeq_) = newseq;
136 (*fjClusterSeq_) = newseq;
144 vector<fastjet::PseudoJet>::iterator pseudojetTMP =
fjJets_->begin(), jetsEnd =
fjJets_->end();
145 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
146 int ijet = pseudojetTMP -
fjJets_->begin();
149 std::vector<fastjet::PseudoJet>
towers = sorted_by_pt(
fjClusterSeq_->constituents(*pseudojetTMP));
151 double newjetet = 0.;
152 for (vector<fastjet::PseudoJet>::const_iterator ito =
towers.begin(), towEnd =
towers.end(); ito != towEnd; ++ito) {
154 int it =
ieta(originalTower);
155 double Original_Et = originalTower->et();
158 Original_Et =
getEt(originalTower);
161 double etnew = Original_Et -
getPU(it,
true,
true);
164 newjetet = newjetet + etnew;
169 double mScale = newjetet / pseudojetTMP->Et();
170 int cshist = pseudojetTMP->cluster_hist_index();
171 pseudojetTMP->reset(pseudojetTMP->px() * mScale,
172 pseudojetTMP->py() * mScale,
173 pseudojetTMP->pz() * mScale,
174 pseudojetTMP->e() * mScale);
175 pseudojetTMP->set_cluster_hist_index(cshist);
188 for (
unsigned int i = 0;
i < hitids.size(); ++
i) {
205 return getPU(it,
true,
false);
210 return getPU(it,
false,
true);
215 return getPU(it,
true,
true);
230 int hbin = 40 -
bin_;
231 double centerweight = (
centrality_ -
hC->GetBinCenter(hbin));
232 double lowerweight = (
centrality_ -
hC->GetBinLowEdge(hbin));
233 double upperweight = (
centrality_ -
hC->GetBinLowEdge(hbin + 1));
235 em *= lowerweight * upperweight;
236 er *= lowerweight * upperweight;
237 n += lowerweight * upperweight;
242 n += upperweight * centerweight;
248 n += lowerweight * centerweight;
255 return addMean * em * cm + addSigma *
nSigmaPU_ * er * cr;
int def(FILE *, FILE *, int)
T getParameter(std::string const &) const
std::vector< double > jetOffset_
std::map< int, double > esigma_
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
const std::vector< DetId > & constituents() const
double getMeanAtTower(const reco::CandidatePtr &in) const override
std::vector< fastjet::PseudoJet > * fjJets_
std::vector< TH1D * > hEtaRMS
std::vector< fastjet::PseudoJet > fjOriginalInputs_
Sin< T >::type sin(const T &t)
void calculateOrphanInput(std::vector< fastjet::PseudoJet > &orphanInput) override
std::vector< TH1D * > hEtaMean
double getPileUpAtTower(const reco::CandidatePtr &in) const override
T getUntrackedParameter(std::string const &, T const &) const
std::vector< fastjet::PseudoJet > * fjInputs_
std::map< int, double > emean_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
std::vector< TH1D * > hEta
edm::EDGetTokenT< reco::Centrality > centTag_
void offsetCorrectJets() override
double getEta(const reco::CandidatePtr &in) const
int iphi(const reco::CandidatePtr &in) const
double getPU(int ieta, bool addMean, bool addSigma) const
double EtHFhitSum() const
ActiveAreaSpecPtr fjActiveArea_
ClusterSequencePtr fjClusterSeq_
double getEt(const reco::CandidatePtr &in) const
double getSigmaAtTower(const reco::CandidatePtr &in) const override
void subtractPedestal(std::vector< fastjet::PseudoJet > &coll) override
int ieta(const reco::CandidatePtr &in) const
void calculatePedestal(std::vector< fastjet::PseudoJet > const &coll) override
char data[epos_bytes_allocation]
CaloGeometry const * geo_
virtual void setupGeometryMap(edm::Event &iEvent, const edm::EventSetup &iSetup)
CaloTowerDetId id() const
void setupGeometryMap(edm::Event &iEvent, const edm::EventSetup &iSetup) override
ParametrizedSubtractor(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
void rescaleRMS(double s)