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");
36 fMean = (TF1*)inf->Get(
"fMean");
37 fRMS = (TF1*)inf->Get(
"fRMS");
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;
132 fastjet::ClusterSequence newseq(*
fjInputs_, def);
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) {
192 double et = energy *
sin(pos.
theta());
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;
double getEt(const reco::CandidatePtr &in) const
T getUntrackedParameter(std::string const &, T const &) const
int def(FILE *, FILE *, int)
std::vector< double > jetOffset_
double getEta(const reco::CandidatePtr &in) const
std::map< int, double > esigma_
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
double getMeanAtTower(const reco::CandidatePtr &in) const override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< fastjet::PseudoJet > * fjJets_
std::vector< TH1D * > hEtaRMS
T const * get() const
Returns C++ pointer to the item.
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
int ieta(const reco::CandidatePtr &in) const
Geom::Theta< T > theta() const
std::vector< fastjet::PseudoJet > * fjInputs_
std::map< int, double > emean_
std::vector< TH1D * > hEta
edm::EDGetTokenT< reco::Centrality > centTag_
void offsetCorrectJets() override
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
const std::vector< DetId > & constituents() const
double getPU(int ieta, bool addMean, bool addSigma) const
int iphi(const reco::CandidatePtr &in) const
CaloTowerDetId id() const
ActiveAreaSpecPtr fjActiveArea_
ClusterSequencePtr fjClusterSeq_
T getParameter(std::string const &) const
double getSigmaAtTower(const reco::CandidatePtr &in) const override
void subtractPedestal(std::vector< fastjet::PseudoJet > &coll) override
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)
void setupGeometryMap(edm::Event &iEvent, const edm::EventSetup &iSetup) override
ParametrizedSubtractor(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
void rescaleRMS(double s)