#include <RecoTauTag/TauTagTools/src/TauMVADiscriminator.cc>
Public Member Functions | |
TauMVADiscriminator (const edm::ParameterSet &) | |
~TauMVADiscriminator () | |
Private Types | |
typedef vector< Handle < PFTauDiscriminator > >::const_iterator | DiscriminantHandleIterator |
typedef vector< Handle < PFTauDiscriminator > > | DiscriminantHandleList |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | beginRun (const edm::Run &run, const edm::EventSetup &) |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
string | computerName_ |
PFTauDiscriminantManager | discriminantManager_ |
double | failValue_ |
std::vector < PhysicsTools::Variable::Value > | mvaComputerInput_ |
DiscriminantList | myDiscriminants_ |
InputTag | pfTauDecayModeSrc_ |
std::vector< InputTag > | preDiscriminants_ |
Definition at line 54 of file TauMVADiscriminator.cc.
typedef vector<Handle<PFTauDiscriminator> >::const_iterator TauMVADiscriminator::DiscriminantHandleIterator [private] |
Definition at line 61 of file TauMVADiscriminator.cc.
typedef vector<Handle<PFTauDiscriminator> > TauMVADiscriminator::DiscriminantHandleList [private] |
Definition at line 60 of file TauMVADiscriminator.cc.
TauMVADiscriminator::TauMVADiscriminator | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 77 of file TauMVADiscriminator.cc.
References PFTauDiscriminants::PFTauDiscriminantManager::addDiscriminant(), PFTauDiscriminants::DiscriminantList::begin(), discriminantManager_, PFTauDiscriminants::DiscriminantList::end(), and myDiscriminants_.
00077 : 00078 pfTauDecayModeSrc_(iConfig.getParameter<InputTag>("pfTauDecayModeSrc")), 00079 preDiscriminants_(iConfig.getParameter<std::vector<InputTag> >("preDiscriminants")), 00080 failValue_(iConfig.getParameter<double>("prefailValue")), 00081 computerName_(iConfig.getParameter<string>("computerName")) 00082 { 00083 produces<PFTauDiscriminator>(); 00084 00085 for(DiscriminantList::const_iterator aDiscriminant = myDiscriminants_.begin(); 00086 aDiscriminant != myDiscriminants_.end(); 00087 ++aDiscriminant) 00088 { 00089 discriminantManager_.addDiscriminant(*aDiscriminant); 00090 } 00091 00092 }
TauMVADiscriminator::~TauMVADiscriminator | ( | ) |
void TauMVADiscriminator::beginJob | ( | const edm::EventSetup & | iSetup | ) | [private, virtual] |
void TauMVADiscriminator::beginRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
void TauMVADiscriminator::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 100 of file TauMVADiscriminator.cc.
References PFTauDiscriminants::PFTauDiscriminantManager::buildMVAComputerLink(), computerName_, GenMuonPlsPt100GeV_cfg::cout, discriminantManager_, lat::endl(), reco::Particle::eta(), failValue_, PhysicsTools::Calibration::MVAComputerContainer::find(), edm::EventSetup::get(), edm::Event::getByLabel(), reco::PFTauDecayMode::getDecayMode(), mvaComputerInput_, reco::PFTauDecayMode::neutralPions(), output(), pfTauDecayModeSrc_, preDiscriminants_, edm::ESHandle< T >::product(), reco::Particle::pt(), edm::Event::put(), HcalSimpleRecAlgoImpl::reco(), PFTauDiscriminants::PFTauDiscriminantManager::setEventData(), and std.
00101 { 00102 using namespace edm; 00103 using namespace std; 00104 using namespace reco; 00105 00106 Handle<PFTauDecayModeAssociation> pfTauDecayModes; 00107 iEvent.getByLabel(pfTauDecayModeSrc_, pfTauDecayModes); 00108 00109 //initialize discriminant vector w/ the RefProd of the tau collection 00110 auto_ptr<PFTauDiscriminator> outputProduct(new PFTauDiscriminator(pfTauDecayModes->keyProduct())); 00111 00112 //get appropriate MVA setup (specified in CFG file) 00113 ESHandle<PhysicsTools::Calibration::MVAComputerContainer> mvaHandle; 00114 iSetup.get<BTauGenericMVAJetTagComputerRcd>().get(mvaHandle); 00115 PhysicsTools::MVAComputer mvaComputer(&mvaHandle.product()->find(computerName_)); 00116 00117 DiscriminantHandleList otherDiscriminants; 00118 for(std::vector<InputTag>::const_iterator iDiscriminant = preDiscriminants_.begin(); 00119 iDiscriminant != preDiscriminants_.end(); 00120 ++iDiscriminant) 00121 { 00122 Handle<PFTauDiscriminator> tempDiscriminantHandle; 00123 iEvent.getByLabel(*iDiscriminant, tempDiscriminantHandle); 00124 otherDiscriminants.push_back(tempDiscriminantHandle); 00125 } 00126 00127 size_t numberOfTaus = pfTauDecayModes->size(); 00128 for(size_t iDecayMode = 0; iDecayMode < numberOfTaus; ++iDecayMode) 00129 { 00130 double output = failValue_; 00131 00132 // Check if this tau fails one of the specified discriminants 00133 // This is needed as applying these discriminants on a tau w/o a 00134 // lead track doesn't do much good 00135 bool passesPreDiscriminant = true; 00136 00137 for(DiscriminantHandleIterator iDiscriminant = otherDiscriminants.begin(); 00138 iDiscriminant != otherDiscriminants.end(); 00139 ++iDiscriminant) 00140 { 00141 float thisDiscriminant = (*iDiscriminant)->value(iDecayMode); 00142 if (thisDiscriminant < 0.5) 00143 { 00144 passesPreDiscriminant = false; 00145 break; 00146 } 00147 } 00148 00149 if (passesPreDiscriminant) 00150 { 00151 mvaComputerInput_.clear(); 00152 const PFTauDecayMode& theTauDecayMode = pfTauDecayModes->value(iDecayMode); 00153 //sets the current tau decay mode as the active object 00154 discriminantManager_.setEventData(theTauDecayMode, iEvent); 00155 //applies associated discriminants (see ctor) and constructs the appropriate MVA framework input 00156 discriminantManager_.buildMVAComputerLink(mvaComputerInput_); 00157 output = mvaComputer.eval(mvaComputerInput_); 00158 #undef EK_MVA_DEBUG 00159 #ifdef EK_MVA_DEBUG 00160 std::cout << "Passed PreDisc. DecayMode: " << theTauDecayMode.getDecayMode() << " Pt " << theTauDecayMode.pt() 00161 << " eta: " << theTauDecayMode.eta() << " neutral Pt: " << theTauDecayMode.neutralPions().pt() << " MVA: " << output << std::endl; 00162 #endif 00163 } 00164 00165 outputProduct->setValue(iDecayMode, output); 00166 } 00167 iEvent.put(outputProduct); 00168 }
string TauMVADiscriminator::computerName_ [private] |
Definition at line 72 of file TauMVADiscriminator.cc.
Referenced by produce(), and TauMVADiscriminator().
double TauMVADiscriminator::failValue_ [private] |
std::vector<PhysicsTools::Variable::Value> TauMVADiscriminator::mvaComputerInput_ [private] |
std::vector<InputTag> TauMVADiscriminator::preDiscriminants_ [private] |