15 for ( std::map<int, double>::iterator
iter = esigma_.begin();
24 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)));
50 LogDebug(
"PileUpSubtractor")<<
"The subtractor setting up geometry...\n";
71 for(std::vector<DetId>::const_iterator did=alldid.begin(); did != alldid.end(); did++){
74 if( (hid).depth() == 1 ) {
77 if((hid).
ieta() != ietaold){
78 ietaold = (hid).
ieta();
108 LogDebug(
"PileUpSubtractor")<<
"The subtractor subtracting pedestals...\n";
111 vector<fastjet::PseudoJet> newcoll;
113 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin (),
114 fjInputsEnd = coll.end();
115 input_object != fjInputsEnd; ++input_object) {
122 double Original_Et = itow->et();
124 Original_Et =
getEt(itow);
127 double etnew = Original_Et -
getPU(it,1,1);
128 float mScale = etnew/input_object->Et();
129 if(etnew < 0.) mScale = 0.;
132 input_object->pz()*mScale, input_object->e()*mScale);
134 int index = input_object->user_index();
135 input_object->reset ( towP4.px(),
139 input_object->set_user_index(index);
158 LogDebug(
"PileUpSubtractor")<<
"The subtractor correcting jets...\n";
161 using namespace reco;
170 fastjet::ClusterSequence newseq( *
fjInputs_, def );
171 (*fjClusterSeq_) = newseq;
174 (*fjClusterSeq_) = newseq;
182 vector<fastjet::PseudoJet>::iterator pseudojetTMP =
fjJets_->begin (),
184 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
186 int ijet = pseudojetTMP -
fjJets_->begin();
189 std::vector<fastjet::PseudoJet> towers =
192 double newjetet = 0.;
193 for(vector<fastjet::PseudoJet>::const_iterator ito = towers.begin(),
194 towEnd = towers.end();
199 int it =
ieta( originalTower );
200 double Original_Et = originalTower->et();
203 Original_Et =
getEt(originalTower);
206 double etnew = Original_Et -
getPU(it,1,1);
207 if(etnew < 0.) etnew = 0;
208 newjetet = newjetet + etnew;
213 double mScale = newjetet/pseudojetTMP->Et();
214 int cshist = pseudojetTMP->cluster_hist_index();
215 pseudojetTMP->reset(pseudojetTMP->px()*mScale, pseudojetTMP->py()*mScale,
216 pseudojetTMP->pz()*mScale, pseudojetTMP->e()*mScale);
217 pseudojetTMP->set_cluster_hist_index(cshist);
232 for(
unsigned int i = 0;
i< hitids.size(); ++
i){
237 double et = energy*
sin(pos.
theta());
250 return getPU(it,1,0);
255 return getPU(it,0,1);
260 return getPU(it,1,1);
277 double centerweight = (
centrality_ -
hC->GetBinCenter(hbin));
278 double lowerweight = (
centrality_ -
hC->GetBinLowEdge(hbin));
279 double upperweight = (
centrality_ -
hC->GetBinLowEdge(hbin+1));
281 em *= lowerweight*upperweight;
282 er *= lowerweight*upperweight;
283 n += lowerweight*upperweight;
288 n += upperweight*centerweight;
294 n += lowerweight*centerweight;
301 return addMean*em*cm + addSigma*
nSigmaPU_*er*cr;
double getEt(const reco::CandidatePtr &in) const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< double > jetOffset_
virtual void calculatePedestal(std::vector< fastjet::PseudoJet > const &coll)
double getEta(const reco::CandidatePtr &in) const
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< fastjet::PseudoJet > * fjJets_
virtual void offsetCorrectJets()
std::map< int, double > esigma_
std::vector< TH1D * > hEtaRMS
T const * get() const
Returns C++ pointer to the item.
std::map< int, int > geomtowers_
std::vector< fastjet::PseudoJet > fjOriginalInputs_
Sin< T >::type sin(const T &t)
virtual double getSigmaAtTower(const reco::CandidatePtr &in) const
virtual double getPileUpAtTower(const reco::CandidatePtr &in) const
std::vector< TH1D * > hEtaMean
int ieta(const reco::CandidatePtr &in) const
Geom::Theta< T > theta() const
std::vector< fastjet::PseudoJet > * fjInputs_
std::map< int, int > ntowersWithJets_
std::vector< TH1D * > hEta
edm::EDGetTokenT< reco::Centrality > centTag_
const std::vector< DetId > & constituents() const
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
virtual void subtractPedestal(std::vector< fastjet::PseudoJet > &coll)
virtual double getMeanAtTower(const reco::CandidatePtr &in) 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 const * product() const
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
char data[epos_bytes_allocation]
CaloGeometry const * geo_
std::map< int, double > emean_
virtual void calculateOrphanInput(std::vector< fastjet::PseudoJet > &orphanInput)
std::vector< HcalDetId > allgeomid_
virtual void setupGeometryMap(edm::Event &iEvent, const edm::EventSetup &iSetup)
ParametrizedSubtractor(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
void rescaleRMS(double s)