15 std::cout <<
"Info: DQM is not yet used in METManager."<<std::endl;
28 std::map<std::string, GenericBenchmark>::const_iterator
i =
GenBenchmarkMap_.find( Name );
31 std::cout <<
"Error in METManager::FillHisto(string): " << Name <<
" is not in GenBenchmarkMap_" << std::endl;
36 std::vector<reco::MET> vmet1;
37 std::vector<reco::MET> vmet2;
38 vmet1.push_back(
MET1_);
39 vmet2.push_back(
MET2_);
40 GenBenchmarkMap_[Name].fill(&vmet2,&vmet1,
true,
false,
false,-1.,-1.,-1.,999.);
101 double trueMEY = 0.0;
102 double trueMEX = 0.0;;
103 double true_met = 0.0;;
104 double true_set = 0.0;;
107 for(
unsigned i = 0;
i < (*genParticleList).size();
i++ ) {
111 if( (*genParticleList)[
i].status() == 1 && fabs((*genParticleList)[
i].
eta()) < 5.0 ) {
113 bool ignoreThisPart=
false;
127 if (!ignoreThisPart) {
130 trueMEX -= (*genParticleList)[
i].et()*
cos((*genParticleList)[
i].
phi());
131 trueMEY -= (*genParticleList)[
i].et()*
sin((*genParticleList)[
i].
phi());
132 true_set += (*genParticleList)[
i].pt();
136 true_met =
sqrt( trueMEX*trueMEX + trueMEY*trueMEY );
156 gDirectory->cd(path.c_str());
159 gDirectory->mkdir(
"Benchmarks");
164 gDirectory->cd(path.c_str());
165 gDirectory->mkdir(GenBenchmarkName.c_str());
168 gDirectory->cd(path.c_str());
175 GenBenchmark.
setup(
NULL,
true, -200., 200., -3.2, 3.2,
true);
192 double NeutralEMEt = 0.0;
193 double NeutralHadEt = 0.0;
194 double ChargedEMEt = 0.0;
195 double ChargedHadEt = 0.0;
197 double type6Et = 0.0;
198 double type7Et = 0.0;
200 for (
unsigned int pfc=0;pfc<pfCandidates.size();++pfc) {
201 double phi = pfCandidates[pfc].phi();
202 double theta = pfCandidates[pfc].theta();
203 double e = pfCandidates[pfc].energy();
204 double et = e*
sin(theta);
205 sum_ez += e*
cos(theta);
207 sum_ex += et*
cos(phi);
208 sum_ey += et*
sin(phi);
211 if (pfCandidates[pfc].particleId() == 1) ChargedHadEt += et;
212 if (pfCandidates[pfc].particleId() == 2) ChargedEMEt += et;
213 if (pfCandidates[pfc].particleId() == 3) MuonEt += et;
214 if (pfCandidates[pfc].particleId() == 4) NeutralEMEt += et;
215 if (pfCandidates[pfc].particleId() == 5) NeutralHadEt += et;
216 if (pfCandidates[pfc].particleId() == 6) type6Et += et;
217 if (pfCandidates[pfc].particleId() == 7) type7Et += et;
221 const double Et_total=NeutralEMEt+NeutralHadEt+ChargedEMEt+ChargedHadEt+MuonEt+type6Et+type7Et;
223 double met =
sqrt( sum_ex*sum_ex + sum_ey*sum_ey );
224 const LorentzVector
p4( -sum_ex, -sum_ey, 0.0, met);
225 const Point vtx(0.0,0.0,0.0);
236 reco::PFMET specificPFMET( specific, sum_et, p4, vtx );
237 return specificPFMET;
247 if (
MET1_.
pt()>MET1cut && (fabs(deltaMET)>DeltaMETcut || fabs(deltaPhi)>DeltaPhicut))
249 std::cout <<
" =====================PFMETBenchmark =================" << std::endl;
250 std::cout <<
"process entry "<< entry << std::endl;
251 std::cout <<
"Delta MET = " << deltaMET << std::endl;
255 std::cout <<
"Delta Phi = " << deltaPhi << std::endl;
263 const std::vector<reco::CaloJet> corr_caloJets)
269 const std::vector<reco::CaloJet> corr_caloJets)
275 const std::vector<reco::CaloJet> corr_caloJets)
const
279 double caloJetCorPX = 0.0;
280 double caloJetCorPY = 0.0;
281 double caloJetCorSET = 0.0;
283 if (caloJets.size()>0 && corr_caloJets.size()==0)
std::cout <<
"No corrected calo jets found !" << std::endl;
287 for(
unsigned int caloJetc=0;caloJetc<caloJets.size();++caloJetc)
293 for(
unsigned int corr_caloJetc=0;corr_caloJetc<corr_caloJets.size();++corr_caloJetc)
299 Float_t
DeltaPhi = corr_caloJets[corr_caloJetc].phi() - caloJets[caloJetc].phi();
300 Float_t DeltaEta = corr_caloJets[corr_caloJetc].eta() - caloJets[caloJetc].eta();
301 Float_t DeltaR2 = DeltaPhi*DeltaPhi + DeltaEta*DeltaEta;
302 if( DeltaR2 < 0.0001 && caloJets[caloJetc].pt() > 20.0 )
304 caloJetCorPX += (corr_caloJets[corr_caloJetc].px() - caloJets[caloJetc].px());
305 caloJetCorPY += (corr_caloJets[corr_caloJetc].py() - caloJets[caloJetc].py());
306 caloJetCorSET += (corr_caloJets[corr_caloJetc].pt() - caloJets[caloJetc].pt());
310 const double corr_calomet=
sqrt((MET.
px()-caloJetCorPX)*(MET.
px()-caloJetCorPX)+(MET.
py()-caloJetCorPY)*(MET.
py()-caloJetCorPY));
311 const double corr_set=MET.
sumEt()+caloJetCorSET;
void propagateJECtoMET1(const std::vector< reco::CaloJet > caloJets, const std::vector< reco::CaloJet > corr_caloJets)
propagate the Jet Energy Corrections to the MET
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
void addGenBenchmark(std::string GenBenchmarkName)
setup a genericBenchmark
double NeutralHadFraction
METManager(std::string outmetfilename)
double ChargedHadFraction
void write()
Write the output root file of the genericBenchmark.
void setfile(TFile *file)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
reco::MET recomputePFMET(const reco::PFCandidateCollection &) const
void coutTailEvents(const int entry, const double DeltaMETcut, const double DeltaPhicut, const double MET1cut) const
cout events in tail of Delta(MET1,MET2)
reco::MET computeGenMET(const reco::GenParticleCollection *) const
private functions
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void FillHisto(std::string)
std::pair< std::string, MonitorElement * > entry
void setMET2(const reco::MET *)
Cos< T >::type cos(const T &t)
std::string outmetfilename_
MET made from Particle Flow Candidates.
void propagateJECtoMET2(const std::vector< reco::CaloJet > caloJets, const std::vector< reco::CaloJet > corr_caloJets)
void setMET1(const reco::MET *)
reco::MET MET1_
data members
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual double px() const
x coordinate of momentum vector
virtual double pt() const
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< unsigned int > vIgnoreParticlesIDs_
std::map< std::string, GenericBenchmark > GenBenchmarkMap_
map of GenericBenchmarks, the key is his name
std::vector< double > trueMetSpecificEtaCut_
std::vector< unsigned int > trueMetSpecificIdCut_
void SetIgnoreParticlesIDs(const std::vector< unsigned int > *)
static double deltaPhi(const T *, const U *)
void setup(DQMStore *DQM=NULL, bool PlotAgainstReco_=true, float minDeltaEt=-100., float maxDeltaEt=50., float minDeltaPhi=-0.5, float maxDeltaPhi=0.5, bool doMetPlots=false)
virtual double phi() const
momentum azimuthal angle
virtual double py() const
y coordinate of momentum vector
reco::MET propagateJEC(const reco::MET &, const std::vector< reco::CaloJet > caloJets, const std::vector< reco::CaloJet > corr_caloJets) const
math::PtEtaPhiELorentzVectorF LorentzVector
void SetSpecificIdCut(const std::vector< unsigned int > *, const std::vector< double > *)