15 for ( std::map<int, double>::iterator iter = esigma_.begin();
16 iter != esigma_.end(); ++iter ){
17 iter->second = s*(iter->second);
24 dropZeroTowers_(iConfig.getUntrackedParameter<bool>(
"dropZeroTowers",
true)),
32 std::string ifname =
"RecoHI/HiJetAlgos/data/PU_DATA.root";
34 fPU = (TF1*)inf->Get(
"fPU");
35 fMean = (TF1*)inf->Get(
"fMean");
36 fRMS = (TF1*)inf->Get(
"fRMS");
37 hC = (TH1D*)inf->Get(
"hC");
39 for(
int i = 0;
i < 40; ++
i){
40 hEta.push_back((TH1D*)inf->Get(Form(
"hEta_%d",
i)));
41 hEtaMean.push_back((TH1D*)inf->Get(Form(
"hEtaMean_%d",
i)));
42 hEtaRMS.push_back((TH1D*)inf->Get(Form(
"hEtaRMS_%d",
i)));
49 LogDebug(
"PileUpSubtractor")<<
"The subtractor setting up geometry...\n";
70 for(std::vector<DetId>::const_iterator did=alldid.begin(); did != alldid.end(); did++){
73 if( (hid).depth() == 1 ) {
76 if((hid).
ieta() != ietaold){
77 ietaold = (hid).
ieta();
107 LogDebug(
"PileUpSubtractor")<<
"The subtractor subtracting pedestals...\n";
110 vector<fastjet::PseudoJet> newcoll;
112 for (vector<fastjet::PseudoJet>::iterator input_object = coll.begin (),
113 fjInputsEnd = coll.end();
114 input_object != fjInputsEnd; ++input_object) {
121 double Original_Et = itow->et();
123 Original_Et =
getEt(itow);
126 double etnew = Original_Et -
getPU(it,1,1);
127 float mScale = etnew/input_object->Et();
128 if(etnew < 0.) mScale = 0.;
131 input_object->pz()*mScale, input_object->e()*mScale);
133 int index = input_object->user_index();
134 input_object->reset ( towP4.px(),
138 input_object->set_user_index(index);
157 LogDebug(
"PileUpSubtractor")<<
"The subtractor correcting jets...\n";
160 using namespace reco;
169 fastjet::ClusterSequence newseq( *
fjInputs_, def );
170 (*fjClusterSeq_) = newseq;
173 (*fjClusterSeq_) = newseq;
181 vector<fastjet::PseudoJet>::iterator pseudojetTMP =
fjJets_->begin (),
183 for (; pseudojetTMP != jetsEnd; ++pseudojetTMP) {
185 int ijet = pseudojetTMP -
fjJets_->begin();
188 std::vector<fastjet::PseudoJet> towers =
191 double newjetet = 0.;
192 for(vector<fastjet::PseudoJet>::const_iterator ito = towers.begin(),
193 towEnd = towers.end();
198 int it =
ieta( originalTower );
199 double Original_Et = originalTower->et();
202 Original_Et =
getEt(originalTower);
205 double etnew = Original_Et -
getPU(it,1,1);
206 if(etnew < 0.) etnew = 0;
207 newjetet = newjetet + etnew;
212 double mScale = newjetet/pseudojetTMP->Et();
213 int cshist = pseudojetTMP->cluster_hist_index();
214 pseudojetTMP->reset(pseudojetTMP->px()*mScale, pseudojetTMP->py()*mScale,
215 pseudojetTMP->pz()*mScale, pseudojetTMP->e()*mScale);
216 pseudojetTMP->set_cluster_hist_index(cshist);
231 for(
unsigned int i = 0;
i< hitids.size(); ++
i){
236 double et = energy*
sin(pos.
theta());
249 return getPU(it,1,0);
254 return getPU(it,0,1);
259 return getPU(it,1,1);
276 double centerweight = (
centrality_ -
hC->GetBinCenter(hbin));
277 double lowerweight = (
centrality_ -
hC->GetBinLowEdge(hbin));
278 double upperweight = (
centrality_ -
hC->GetBinLowEdge(hbin+1));
280 em *= lowerweight*upperweight;
281 er *= lowerweight*upperweight;
282 n += lowerweight*upperweight;
287 n += upperweight*centerweight;
293 n += lowerweight*centerweight;
300 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
int def(FILE *, FILE *, int)
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.
std::vector< fastjet::PseudoJet > * fjJets_
virtual void offsetCorrectJets()
std::map< int, double > esigma_
std::vector< TH1D * > hEtaRMS
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
ParametrizedSubtractor(const edm::ParameterSet &iConfig)
int ieta(const reco::CandidatePtr &in) const
Geom::Theta< T > theta() const
std::vector< fastjet::PseudoJet > * fjInputs_
std::map< int, int > ntowersWithJets_
T const * get() const
Returns C++ pointer to the item.
std::vector< TH1D * > hEta
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)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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)
void rescaleRMS(double s)