60 ntuple_ = fs->
make<TTree>(
"embeddingKineReweightNtuple",
"embeddingKineReweightNtuple");
90 for ( vInputTag::const_iterator srcWeight =
srcWeights_.begin();
92 std::string branchName = Form(
"%s_%s", srcWeight->label().data(), srcWeight->instance().data());
106 for (
unsigned iDaughter = 0; iDaughter < numDaughters; ++iDaughter ) {
109 if ( status == -1 || daughter->
status() ==
status ) daughters.push_back(daughter);
111 findDaughters(daughter, daughters, status);
119 for ( branchMap::iterator branch =
branches_.begin();
121 branch->second.valueF_ = 0.;
122 branch->second.valueI_ = 0;
132 genDiTau != genDiTaus->end(); ++genDiTau ) {
141 if ( !(genTau1 && genTau2) ) {
142 std::cerr <<
"Failed to find daughters of genDiTau --> skipping !!" << std::endl;
147 if ( genTau1->
charge() > +0.5 && genTau2->
charge() < -0.5 ) {
148 genTauPlus = genTau1;
149 genTauMinus = genTau2;
150 }
else if ( genTau1->
charge() < -0.5 && genTau2->
charge() > +0.5 ) {
151 genTauPlus = genTau2;
152 genTauMinus = genTau1;
154 std::cerr <<
"Failed to find daughters of genDiTau --> skipping !!" << std::endl;
161 genDiTau_ref = &(*genDiTau);
165 if ( !genDiTau_ref ) {
166 std::cerr <<
"Failed to find genDiTau --> skipping !!" << std::endl;
175 for ( reco::GenParticleCollection::const_iterator genParticle = genParticles->begin();
176 genParticle != genParticles->end(); ++genParticle ) {
177 if (
TMath::Abs(genParticle->pdgId()) == 23 ) {
178 std::vector<const reco::GenParticle*> daughters;
179 findDaughters(&(*genParticle), daughters, -1);
182 for ( std::vector<const reco::GenParticle*>::const_iterator daughter = daughters.
begin();
184 if ( (*daughter)->pdgId() == -13 ) genMuPlus = (*daughter);
185 if ( (*daughter)->pdgId() == +13 ) genMuMinus = (*daughter);
187 if ( genMuPlus && genMuMinus ) {
210 if ( recLeg1->size() >= 1 ) {
217 }
else if ( recLeg2->size() >= 1 ) {
223 int numJetsRawPtGt20 = 0;
224 int numJetsCorrPtGt20 = 0;
225 int numJetsRawPtGt30 = 0;
226 int numJetsCorrPtGt30 = 0;
227 for ( pat::JetCollection::const_iterator recJet = recJets->begin();
228 recJet != recJets->end(); ++recJet ) {
231 double rawJetPt = rawJetP4.pt();
232 double rawJetAbsEta =
TMath::Abs(rawJetP4.eta());
233 if ( rawJetAbsEta < 4.5 ) {
234 if ( rawJetPt > 20. ) ++numJetsRawPtGt20;
235 if ( rawJetPt > 30. ) ++numJetsRawPtGt30;
239 double corrJetPt = corrJetP4.pt();
240 double corrJetAbsEta =
TMath::Abs(corrJetP4.eta());
241 if ( corrJetAbsEta < 4.5 ) {
242 if ( corrJetPt > 20. ) ++numJetsCorrPtGt20;
243 if ( corrJetPt > 30. ) ++numJetsCorrPtGt30;
246 setValueI(
"numJetsRawPtGt20", numJetsRawPtGt20);
247 setValueI(
"numJetsCorrPtGt20", numJetsCorrPtGt20);
248 setValueI(
"numJetsRawPtGt30", numJetsRawPtGt30);
249 setValueI(
"numJetsCorrPtGt30", numJetsCorrPtGt30);
251 if ( genDiTau_ref ) {
277 for ( vInputTag::const_iterator srcWeight =
srcWeights_.begin();
281 std::string branchName = Form(
"%s_%s", srcWeight->label().data(), srcWeight->instance().data());
287 double genFilterInfo_weight = 1.;
288 bool genFilterInfo_isValid =
false;
289 if ( genFilterInfo->numEventsTried() > 0 ) {
290 genFilterInfo_weight = genFilterInfo->filterEfficiency();
291 genFilterInfo_isValid =
true;
293 setValueF(
"genFilterInfo", genFilterInfo_weight);
294 setValueI(
"genFilterInfoIsValid", genFilterInfo_isValid);
324 stream <<
"<EmbeddingKineReweightNtupleProducer::printBranches>:" << std::endl;
325 stream <<
" registered branches for module = " <<
moduleLabel_ << std::endl;
326 for ( branchMap::const_iterator branch =
branches_.begin();
328 stream <<
" " << branch->first << std::endl;
336 branchMap::iterator branch =
branches_.find(name);
338 branch->second.valueF_ =
value;
341 <<
"No branch with name = " << name <<
" defined !!\n";
348 branchMap::iterator branch =
branches_.find(name);
350 branch->second.valueI_ =
value;
353 <<
"No branch with name = " << name <<
" defined !!\n";
401 if ( zP4.pt() > 0. ) {
402 double qX = zP4.px();
403 double qY = zP4.py();
404 double qT = TMath::Sqrt(qX*qX + qY*qY);
405 double dX = recMEtP4.px() - genMEtP4.px();
406 double dY = recMEtP4.py() - genMEtP4.py();
407 double dParl = (dX*qX + dY*qY)/qT;
408 double dPerp = (dX*qY - dY*qX)/qT;
T getParameter(std::string const &) const
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
daughters::value_type daughterRef(size_type i) const
reference to daughter at given position
void printBranches(std::ostream &)
edm::InputTag srcGenDiTaus_
#define DEFINE_FWK_MODULE(type)
virtual int status() const
status word
const reco::GenParticle * mother(const reco::GenParticle &p, unsigned int imoth=0)
T * make(const Args &...args) const
make new ROOT object
bool isNonnull() const
Checks for non-null.
edm::InputTag srcGenFilterInfo_
virtual size_type numberOfDaughters() const
number of daughters
void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag srcGenCaloMEt_
void addBranchI(const std::string &)
edm::InputTag srcRecJets_
edm::View< reco::Candidate > CandidateView
~EmbeddingKineReweightNtupleProducer()
void addBranch_EnPxPyPz(const std::string &)
const_iterator end() const
last daughter const_iterator
virtual size_t numberOfDaughters() const
number of daughters
void setValueF(const std::string &, double)
edm::InputTag srcRecPFMEt_
edm::View< reco::MET > METView
const reco::GenParticle * daughter(const reco::GenParticle &p, unsigned int idau)
void addBranchF(const std::string &)
virtual int charge() const =0
electric charge
void addBranch_MEtResProjections(const std::string &)
edm::InputTag srcRecLeg2_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void setValue_EnPxPyPz(const std::string &, const reco::Candidate::LorentzVector &)
edm::InputTag srcGenPFMEt_
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
edm::InputTag srcRecCaloMEt_
edm::InputTag srcRecLeg1_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
T get() const
get a component
const_iterator begin() const
first daughter const_iterator
EmbeddingKineReweightNtupleProducer(const edm::ParameterSet &)
void setValueI(const std::string &, int)
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)
void setValue_MEtResProjections(const std::string &, const reco::Candidate::LorentzVector &, const reco::Candidate::LorentzVector &, const reco::Candidate::LorentzVector &)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
edm::InputTag srcSelectedMuons_
std::vector< edm::InputTag > vInputTag
edm::InputTag srcGenParticles_
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector