#include <GeneratorTau.h>
Definition at line 28 of file GeneratorTau.h.
kElectron | |
kMuon | |
kOneProng0pi0 | |
kOneProng1pi0 | |
kOneProng2pi0 | |
kThreeProng0pi0 | |
kThreeProng1pi0 | |
kOther | |
kUndefined |
Definition at line 31 of file GeneratorTau.h.
GeneratorTau::GeneratorTau | ( | const reco::GenParticle & | input | ) | [inline] |
Definition at line 37 of file GeneratorTau.h.
References NULL, and theLeadTrack_.
:GenParticle(input){ theLeadTrack_ = NULL; };
GeneratorTau::GeneratorTau | ( | ) |
Definition at line 183 of file GeneratorTau.cc.
{ }
GeneratorTau::~GeneratorTau | ( | ) | [inline] |
Definition at line 42 of file GeneratorTau.h.
{};
GeneratorTau::tauDecayModeEnum GeneratorTau::computeDecayMode | ( | const reco::GenParticle * | theTau | ) |
find the decay products, in terms of the PDG table (eg 1 pi0, 1 pi+, etc)
Definition at line 48 of file GeneratorTau.cc.
References abs, decayToPDGClassification(), kElectron, kMuon, kOneProng0pi0, kOneProng1pi0, kOneProng2pi0, kOther, kThreeProng0pi0, kThreeProng1pi0, kUndefined, NULL, patZpeak::numMuons, convertSQLitetoXML_cfg::output, reco::LeafCandidate::pdgId(), and reco::LeafCandidate::status().
Referenced by init().
{ //return kUndefined if not a tau if (theTau == NULL || std::abs(theTau->pdgId()) != 15 || theTau->status() != 2) return kUndefined; tauDecayModeEnum output; //counters to determine decay type (adapted from Ricardo's code) int numElectrons = 0; int numMuons = 0; int numChargedPions = 0; int numNeutralPions = 0; int numNeutrinos = 0; int numOtherParticles = 0; std::vector<const reco::GenParticle* > pdgDecayProductTypes; GeneratorTau::decayToPDGClassification(theTau, pdgDecayProductTypes); for (std::vector<const reco::GenParticle* >::const_iterator decayProduct = pdgDecayProductTypes.begin(); decayProduct != pdgDecayProductTypes.end(); ++decayProduct) { int pdg_id = std::abs( (*decayProduct)->pdgId() ); //edm::LogInfo("GeneratorTau") << "Has decay product w/ PDG ID: " << pdg_id; if (pdg_id == 11) numElectrons++; else if (pdg_id == 13) numMuons++; else if (pdg_id == 211) numChargedPions++; else if (pdg_id == 111) numNeutralPions++; else if (pdg_id == 12 || pdg_id == 14 || pdg_id == 16) numNeutrinos++; else if (pdg_id != 22) numOtherParticles++; } output = kOther; //determine tauDecayMode if ( numOtherParticles == 0 ){ if ( numElectrons == 1 ){ //--- tau decays into electrons output = kElectron; } else if ( numMuons == 1 ){ //--- tau decays into muons output = kMuon; } else { //--- hadronic tau decays switch ( numChargedPions ){ case 1 : switch ( numNeutralPions ){ case 0 : output = kOneProng0pi0; break; case 1 : output = kOneProng1pi0; break; case 2 : output = kOneProng2pi0; break; } break; case 3 : switch ( numNeutralPions ){ case 0 : output = kThreeProng0pi0; break; case 1 : output = kThreeProng1pi0; break; } break; } } } return output; }
void GeneratorTau::computeStableDecayProducts | ( | const reco::GenParticle * | theParticle, |
std::vector< const reco::GenParticle * > & | container | ||
) |
Definition at line 161 of file GeneratorTau.cc.
References reco::Candidate::Candidate(), reco::CompositeRefCandidateT< D >::daughter(), reco::CompositeRefCandidateT< GenParticleRefVector >::daughter(), reco::CompositeRefCandidateT< D >::numberOfDaughters(), and reco::LeafCandidate::status().
Referenced by init().
{ if (theParticle) { if (theParticle->status() == 1) //status = 1 indicates final state particle { //edm::LogInfo("GeneratorTau") << "computeStableDecayProducts: Found a final state daughter with status: " << theParticle->status() << " Num stable decay products so far: " << container.size(); container.push_back(theParticle); } else { unsigned int nDaughters = theParticle->numberOfDaughters(); for (size_t dIter = 0; dIter < nDaughters; ++dIter) { const Candidate * daughter = theParticle->daughter(dIter); //edm::LogInfo("Debug") << "Recursing on daughter with PDG: " << daughter->pdgId(); GeneratorTau::computeStableDecayProducts(static_cast<const reco::GenParticle*>(daughter), container); } } } }
LorentzVector GeneratorTau::convertHepMCFourVec | ( | const reco::GenParticle * | theParticle | ) |
std::vector< LorentzVector > GeneratorTau::convertMCVectorToLorentzVectors | ( | const std::vector< const reco::GenParticle * > & | theList | ) | const |
Definition at line 231 of file GeneratorTau.cc.
References convertSQLitetoXML_cfg::output.
Referenced by getChargedPions(), getGammas(), and getVisibleFourVectors().
void GeneratorTau::decayToPDGClassification | ( | const reco::GenParticle * | theParticle, |
std::vector< const reco::GenParticle * > & | container | ||
) |
Return list of stable & "semi-stable" tau decay products (e.g. decay the rhos)
Definition at line 129 of file GeneratorTau.cc.
References abs, reco::Candidate::Candidate(), reco::CompositeRefCandidateT< D >::daughter(), reco::CompositeRefCandidateT< GenParticleRefVector >::daughter(), genNeutralPions_, reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::LeafCandidate::pdgId(), and reco::LeafCandidate::status().
Referenced by computeDecayMode().
{ if (theParticle) { //edm::LogInfo("Debug") << "It's non-null"; int pdgId = std::abs(theParticle->pdgId()); //edm::LogInfo("Debug") << "PDGID = " << pdgId << " Status = " << theStatus; if (theParticle->status() == 1 || pdgId == 211 || pdgId == 111 || pdgId == 11 || pdgId == 13) { //edm::LogInfo("Debug") << "Adding to container..."; container.push_back(theParticle); //add neutral pions and this step.... if (pdgId == 111) genNeutralPions_.push_back(theParticle); } else { unsigned int nDaughters = theParticle->numberOfDaughters(); for (size_t dIter = 0; dIter < nDaughters; ++dIter) { const Candidate * daughter = theParticle->daughter(dIter); //edm::LogInfo("Debug") << "Recursing on daughter with PDG: " << daughter->pdgId(); GeneratorTau::decayToPDGClassification(static_cast<const reco::GenParticle*>(daughter), container); } } } }
const reco::GenParticle * GeneratorTau::findLeadTrack | ( | ) |
Definition at line 13 of file GeneratorTau.cc.
References genChargedPions_, NULL, convertSQLitetoXML_cfg::output, and theLeadTrack_.
Referenced by init().
{ std::vector<const reco::GenParticle*>::const_iterator thePion = genChargedPions_.begin(); double maxPt = 0; const reco::GenParticle* output = NULL; for (; thePion != genChargedPions_.end(); ++thePion) { if ((*thePion)->pt() > maxPt) { maxPt = (*thePion)->pt(); output = (*thePion); } } theLeadTrack_ = output; return output; }
float GeneratorTau::getChargedOpeningAngle | ( | ) | const |
Definition at line 40 of file GeneratorTau.cc.
References genChargedPions_, and getOpeningAngle().
{ return getOpeningAngle(genChargedPions_); }
std::vector< LorentzVector > GeneratorTau::getChargedPions | ( | ) | const |
Definition at line 287 of file GeneratorTau.cc.
References convertMCVectorToLorentzVectors(), and genChargedPions_.
{ return convertMCVectorToLorentzVectors(genChargedPions_); }
tauDecayModeEnum GeneratorTau::getDecayType | ( | ) | const [inline] |
float GeneratorTau::getGammaOpeningAngle | ( | ) | const |
Definition at line 44 of file GeneratorTau.cc.
References genGammas_, and getOpeningAngle().
{ return getOpeningAngle(genGammas_); }
std::vector< LorentzVector > GeneratorTau::getGammas | ( | ) | const |
Definition at line 291 of file GeneratorTau.cc.
References convertMCVectorToLorentzVectors(), and genGammas_.
{ return convertMCVectorToLorentzVectors(genGammas_); }
std::vector< const reco::Candidate * > GeneratorTau::getGenChargedPions | ( | ) | const |
Definition at line 243 of file GeneratorTau.cc.
References genChargedPions_, and convertSQLitetoXML_cfg::output.
Referenced by TruthTauDecayModeProducer::produce().
{ std::vector<const reco::Candidate*> output; std::vector<const GenParticle*>::const_iterator iter; for (iter = genChargedPions_.begin(); iter != genChargedPions_.end(); ++iter) output.push_back(static_cast<const reco::Candidate*>(*iter)); return output; }
std::vector< const reco::Candidate * > GeneratorTau::getGenGammas | ( | ) | const |
Definition at line 261 of file GeneratorTau.cc.
References genGammas_, and convertSQLitetoXML_cfg::output.
{ std::vector<const reco::Candidate*> output; std::vector<const GenParticle*>::const_iterator iter; for (iter = genGammas_.begin(); iter != genGammas_.end(); ++iter) output.push_back(static_cast<const reco::Candidate*>(*iter)); return output; }
std::vector< const reco::Candidate * > GeneratorTau::getGenNeutralPions | ( | ) | const |
Definition at line 252 of file GeneratorTau.cc.
References genNeutralPions_, and convertSQLitetoXML_cfg::output.
Referenced by TruthTauDecayModeProducer::produce().
{ std::vector<const reco::Candidate*> output; std::vector<const GenParticle*>::const_iterator iter; for (iter = genNeutralPions_.begin(); iter != genNeutralPions_.end(); ++iter) output.push_back(static_cast<const reco::Candidate*>(*iter)); return output; }
std::vector< const reco::Candidate * > GeneratorTau::getGenNu | ( | ) | const |
Definition at line 279 of file GeneratorTau.cc.
References genNus_, and convertSQLitetoXML_cfg::output.
const reco::Candidate * GeneratorTau::getLeadTrack | ( | ) | const |
Definition at line 9 of file GeneratorTau.cc.
References reco::Candidate::Candidate(), and theLeadTrack_.
{ return static_cast<const Candidate*>(theLeadTrack_); }
float GeneratorTau::getOpeningAngle | ( | const std::vector< const reco::GenParticle * > & | aCollection | ) | const |
Definition at line 28 of file GeneratorTau.cc.
References angleFinder, convertSQLitetoXML_cfg::output, reco::LeafCandidate::p4(), and theLeadTrack_.
Referenced by getChargedOpeningAngle(), and getGammaOpeningAngle().
{ double output = 0; std::vector<const reco::GenParticle*>::const_iterator theObject = theCollection.begin(); for (; theObject != theCollection.end(); ++theObject) { if (output < angleFinder(theLeadTrack_->p4(), (*theObject)->p4())) output = angleFinder(theLeadTrack_->p4(), (*theObject)->p4()); } return output; }
std::vector< const reco::Candidate * > GeneratorTau::getStableDecayProducts | ( | ) | const |
Definition at line 270 of file GeneratorTau.cc.
References convertSQLitetoXML_cfg::output, and stableDecayProducts_.
{ std::vector<const reco::Candidate*> output; std::vector<const GenParticle*>::const_iterator iter; for (iter = stableDecayProducts_.begin(); iter != stableDecayProducts_.end(); ++iter) output.push_back(static_cast<const reco::Candidate*>(*iter)); return output; }
LorentzVector GeneratorTau::getVisibleFourVector | ( | ) | const |
Definition at line 299 of file GeneratorTau.cc.
References getVisibleFourVectors(), and convertSQLitetoXML_cfg::output.
Referenced by getVisNuAngle().
{ LorentzVector output; std::vector<LorentzVector> tempForSum = getVisibleFourVectors(); for (std::vector<LorentzVector>::iterator iter = tempForSum.begin(); iter != tempForSum.end(); ++iter) output += (*iter); return output; }
std::vector< LorentzVector > GeneratorTau::getVisibleFourVectors | ( | ) | const |
Definition at line 295 of file GeneratorTau.cc.
References convertMCVectorToLorentzVectors(), and visibleDecayProducts_.
Referenced by getVisibleFourVector().
{ return convertMCVectorToLorentzVectors(visibleDecayProducts_); }
float GeneratorTau::getVisNuAngle | ( | ) | const |
Definition at line 3 of file GeneratorTau.cc.
References angleFinder, getVisibleFourVector(), and reco::LeafCandidate::p4().
{ LorentzVector suckVector = getVisibleFourVector(); LorentzVector suckNuVector = this->p4() - suckVector; return angleFinder(suckVector, suckNuVector); }
void GeneratorTau::init | ( | void | ) |
Definition at line 189 of file GeneratorTau.cc.
References abs, aFinalStateTau_, computeDecayMode(), computeStableDecayProducts(), findLeadTrack(), genChargedPions_, genGammas_, genNus_, kUndefined, stableDecayProducts_, theDecayMode_, theLeadTrack_, and visibleDecayProducts_.
Referenced by TruthTauDecayModeProducer::produce().
{ //make sure this tau really decays theDecayMode_ = kUndefined; aFinalStateTau_ = false; //get Decaymode //edm::LogInfo("GeneratorTau") << "Computing decay mode.."; theDecayMode_ = computeDecayMode(this); //make sure it is a real tau decay if (theDecayMode_ != kUndefined) { aFinalStateTau_ = true; //edm::LogInfo("GeneratorTau") << "Found decay type: " << theDecayMode_ << ", computing stable decay products."; //get the stable decay products computeStableDecayProducts(this, stableDecayProducts_); //from the stable products, fill the lists //edm::LogInfo("GeneratorTau") << "Found " << stableDecayProducts_.size() << " stable decay products, filtering."; for (std::vector<const reco::GenParticle*>::const_iterator iter = stableDecayProducts_.begin(); iter != stableDecayProducts_.end(); ++iter) { //fill vectors int pdg_id = std::abs( (*iter)->pdgId() ); if (pdg_id == 16 || pdg_id == 12 || pdg_id == 14) genNus_.push_back( (*iter) ); else { visibleDecayProducts_.push_back( (*iter) ); if (pdg_id == 211 || (*iter)->charge() != 0) genChargedPions_.push_back( (*iter) ); else if (pdg_id == 22) genGammas_.push_back( (*iter) ); } } // find the lead charged object theLeadTrack_ = findLeadTrack(); } }
bool GeneratorTau::isFinalStateTau | ( | ) | const [inline] |
Definition at line 51 of file GeneratorTau.h.
References aFinalStateTau_.
Referenced by TruthTauDecayModeProducer::produce().
{return aFinalStateTau_;};
int GeneratorTau::aFinalStateTau_ [private] |
Definition at line 89 of file GeneratorTau.h.
Referenced by init(), and isFinalStateTau().
Angle<LorentzVector> GeneratorTau::angleFinder [private] |
Definition at line 75 of file GeneratorTau.h.
Referenced by getOpeningAngle(), and getVisNuAngle().
DeltaR<LorentzVector> GeneratorTau::deltaRFinder [private] |
Definition at line 76 of file GeneratorTau.h.
std::vector<const reco::GenParticle*> GeneratorTau::genChargedPions_ [private] |
Definition at line 81 of file GeneratorTau.h.
Referenced by findLeadTrack(), getChargedOpeningAngle(), getChargedPions(), getGenChargedPions(), and init().
std::vector<const reco::GenParticle*> GeneratorTau::genGammas_ [private] |
Definition at line 83 of file GeneratorTau.h.
Referenced by getGammaOpeningAngle(), getGammas(), getGenGammas(), and init().
std::vector<const reco::GenParticle*> GeneratorTau::genNeutralPions_ [private] |
Definition at line 82 of file GeneratorTau.h.
Referenced by decayToPDGClassification(), and getGenNeutralPions().
std::vector<const reco::GenParticle*> GeneratorTau::genNus_ [private] |
Definition at line 85 of file GeneratorTau.h.
Referenced by getGenNu(), and init().
std::vector<const reco::GenParticle*> GeneratorTau::stableDecayProducts_ [private] |
Definition at line 84 of file GeneratorTau.h.
Referenced by getStableDecayProducts(), and init().
tauDecayModeEnum GeneratorTau::theDecayMode_ [private] |
Definition at line 88 of file GeneratorTau.h.
Referenced by getDecayType(), and init().
const reco::GenParticle* GeneratorTau::theLeadTrack_ [private] |
Definition at line 86 of file GeneratorTau.h.
Referenced by findLeadTrack(), GeneratorTau(), getLeadTrack(), getOpeningAngle(), and init().
std::vector<const reco::GenParticle*> GeneratorTau::visibleDecayProducts_ [private] |
Definition at line 80 of file GeneratorTau.h.
Referenced by getVisibleFourVectors(), and init().