18 for ( std::map<int, double>::iterator iter = esigma_.begin();
19 iter != esigma_.end(); ++iter ){
20 iter->second = s*(iter->second);
27 dropZeroTowers_(iConfig.getUntrackedParameter<bool>(
"dropZeroTowers",
true)),
36 std::string ifname =
"RecoHI/HiJetAlgos/data/PU_DATA.root";
38 fPU = (TF1*)inf->Get(
"fPU");
39 fMean = (TF1*)inf->Get(
"fMean");
40 fRMS = (TF1*)inf->Get(
"fRMS");
41 hC = (TH1D*)inf->Get(
"hC");
43 for(
int i = 0;
i < 40; ++
i){
44 hEta.push_back((TH1D*)inf->Get(Form(
"hEta_%d",
i)));
45 hEtaMean.push_back((TH1D*)inf->Get(Form(
"hEtaMean_%d",
i)));
46 hEtaRMS.push_back((TH1D*)inf->Get(Form(
"hEtaRMS_%d",
i)));
53 LogDebug(
"PileUpSubtractor")<<
"The subtractor setting up geometry...\n";
77 for(std::vector<DetId>::const_iterator did=alldid.begin(); did != alldid.end(); did++){
80 if( (hid).
depth() == 1 ) {
83 if((hid).
ieta() != ietaold){
84 ietaold = (hid).
ieta();
114 LogDebug(
"PileUpSubtractor")<<
"The subtractor subtracting pedestals...\n";
117 vector<fastjet::PseudoJet> newcoll;
119 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin (),
120 fjInputsEnd = coll.end();
121 input_object != fjInputsEnd; ++input_object) {
128 double Original_Et = itow->et();
130 Original_Et =
getEt(itow);
133 double etnew = Original_Et -
getPU(it,1,1);
134 float mScale = etnew/input_object->Et();
135 if(etnew < 0.) mScale = 0.;
138 input_object->pz()*mScale, input_object->e()*mScale);
140 int index = input_object->user_index();
141 input_object->reset ( towP4.px(),
145 input_object->set_user_index(index);
164 LogDebug(
"PileUpSubtractor")<<
"The subtractor correcting jets...\n";
167 using namespace reco;
176 fastjet::ClusterSequence newseq( *
fjInputs_, def );
177 (*fjClusterSeq_) = newseq;
180 (*fjClusterSeq_) = newseq;
188 vector<fastjet::PseudoJet>::iterator pseudojetTMP =
fjJets_->begin (),
190 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
192 int ijet = pseudojetTMP -
fjJets_->begin();
195 std::vector<fastjet::PseudoJet>
towers =
198 double newjetet = 0.;
199 for(vector<fastjet::PseudoJet>::const_iterator ito = towers.begin(),
200 towEnd = towers.end();
205 int it =
ieta( originalTower );
206 double Original_Et = originalTower->et();
209 Original_Et =
getEt(originalTower);
212 double etnew = Original_Et -
getPU(it,1,1);
213 if(etnew < 0.) etnew = 0;
214 newjetet = newjetet + etnew;
219 double mScale = newjetet/pseudojetTMP->Et();
220 int cshist = pseudojetTMP->cluster_hist_index();
221 pseudojetTMP->reset(pseudojetTMP->px()*mScale, pseudojetTMP->py()*mScale,
222 pseudojetTMP->pz()*mScale, pseudojetTMP->e()*mScale);
223 pseudojetTMP->set_cluster_hist_index(cshist);
238 for(
unsigned int i = 0;
i< hitids.size(); ++
i){
243 double et = energy*
sin(pos.
theta());
256 return getPU(it,1,0);
261 return getPU(it,0,1);
266 return getPU(it,1,1);
283 double centerweight = (
centrality_ -
hC->GetBinCenter(hbin));
284 double lowerweight = (
centrality_ -
hC->GetBinLowEdge(hbin));
285 double upperweight = (
centrality_ -
hC->GetBinLowEdge(hbin+1));
287 em *= lowerweight*upperweight;
288 er *= lowerweight*upperweight;
289 n += lowerweight*upperweight;
294 n += upperweight*centerweight;
300 n += lowerweight*centerweight;
307 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)