28 moduleLabel_(iConfig.getParameter<std::string>(
"@module_label")),
48 minMVA1prongNoEleMatchBL_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchBL");
49 minMVA1prongBL_ = iConfig.
getParameter<
double>(
"minMVA1prongBL");
50 minMVA1prongStripsWOgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongStripsWOgsfBL");
51 minMVA1prongStripsWgsfWOpfEleMvaBL_ = iConfig.
getParameter<
double>(
"minMVA1prongStripsWgsfWOpfEleMvaBL");
52 minMVA1prongStripsWgsfWpfEleMvaBL_ = iConfig.
getParameter<
double>(
"minMVA1prongStripsWgsfWpfEleMvaBL");
53 minMVA1prongNoEleMatchEC_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchEC");
54 minMVA1prongEC_ = iConfig.
getParameter<
double>(
"minMVA1prongEC");
55 minMVA1prongStripsWOgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongStripsWOgsfEC");
56 minMVA1prongStripsWgsfWOpfEleMvaEC_ = iConfig.
getParameter<
double>(
"minMVA1prongStripsWgsfWOpfEleMvaEC");
57 minMVA1prongStripsWgsfWpfEleMvaEC_ = iConfig.
getParameter<
double>(
"minMVA1prongStripsWgsfWpfEleMvaEC");
74 mva_->Initialize_from_file(method_,
75 inputFileName1prongNoEleMatchBL_.fullPath(),
77 inputFileName1prongStripsWOgsfBL_.
fullPath(),
78 inputFileName1prongStripsWgsfWOpfEleMvaBL_.
fullPath(),
79 inputFileName1prongStripsWgsfWpfEleMvaBL_.
fullPath(),
80 inputFileName1prongNoEleMatchEC_.
fullPath(),
82 inputFileName1prongStripsWOgsfEC_.
fullPath(),
83 inputFileName1prongStripsWgsfWOpfEleMvaEC_.
fullPath(),
84 inputFileName1prongStripsWgsfWpfEleMvaEC_.
fullPath());
88 produces<PFTauDiscriminator>(
"category");
94 double discriminate(
const PFTauRef&);
111 file.open(fileName.c_str());
113 <<
"Failed to open MVA file = " << fileName <<
" !!\n";
114 std::ostringstream buffer_zipped;
115 while ( file.good() ) {
116 buffer_zipped << (char)file.get();
121 std::ostringstream buffer_unzipped;
122 buffer_unzipped << gunzip.
rdbuf();
124 return buffer_unzipped.str();
165 evt.
getByLabel(srcGsfElectrons_, gsfElectrons_);
171 double workingPoint = 1.;
173 bool isGsfElectronMatched =
false;
174 if( (*thePFTauRef).leadPFChargedHadrCand().isNonnull()) {
175 for ( reco::GsfElectronCollection::const_iterator theGsfElectron = gsfElectrons_->begin();
176 theGsfElectron != gsfElectrons_->end(); ++theGsfElectron ) {
177 if ( theGsfElectron->pt() > 10. ) {
178 double deltaREleTau =
deltaR(theGsfElectron->p4(), thePFTauRef->p4());
179 if ( deltaREleTau < 0.3 ) {
180 double mva_match = mva_->MVAValue(*thePFTauRef, *theGsfElectron);
181 double workingPoint_match = 0.;
183 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
184 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
185 bool isPFElectron = (theGsfElectron->mvaOutput().mva > -0.1);
187 if ( thePFTauRef->signalPFChargedHadrCands().size() == 1 ) {
188 double mvaCut = 999.;
189 if ( TMath::Abs(thePFTauRef->eta()) < 1.5 ) {
190 if ( numSignalPFGammaCands == 0 ) {
192 mvaCut = minMVA1prongBL_;
193 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
195 mvaCut = minMVA1prongStripsWOgsfBL_;
196 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack && !isPFElectron ) {
198 mvaCut = minMVA1prongStripsWgsfWOpfEleMvaBL_;
199 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack && isPFElectron ) {
201 mvaCut = minMVA1prongStripsWgsfWpfEleMvaBL_;
204 if ( numSignalPFGammaCands == 0 ) {
206 mvaCut = minMVA1prongEC_;
207 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
209 mvaCut = minMVA1prongStripsWOgsfEC_;
210 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack && !isPFElectron ) {
212 mvaCut = minMVA1prongStripsWgsfWOpfEleMvaEC_;
213 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack && isPFElectron ) {
215 mvaCut = minMVA1prongStripsWgsfWpfEleMvaEC_;
218 workingPoint_match = (mva_match > mvaCut);
220 workingPoint_match = 1.;
224 workingPoint =
TMath::Min(workingPoint, workingPoint_match);
225 isGsfElectronMatched =
true;
231 if ( !isGsfElectronMatched ) {
232 mva = mva_->MVAValue(*thePFTauRef);
233 double mvaCut = 999.;
234 if ( TMath::Abs(thePFTauRef->eta()) < 1.5 ) {
236 mvaCut = minMVA1prongNoEleMatchBL_;
239 mvaCut = minMVA1prongNoEleMatchEC_;
241 workingPoint = (mva > mvaCut);
250 category_output_->setValue(tauIndex_, category);
263 evt.
put(category_output_,
"category");
edm::InputTag srcGsfElectrons_
T getParameter(std::string const &) const
edm::Handle< reco::GsfElectronCollection > gsfElectrons_
double discriminate(const PFTauRef &)
edm::FileInPath inputFileName1prongStripsWgsfWpfEleMvaEC_
AntiElectronIDMVA2 * mva_
double minMVA1prongStripsWgsfWOpfEleMvaBL_
edm::FileInPath inputFileName1prongStripsWgsfWOpfEleMvaEC_
edm::FileInPath inputFileName1prongNoEleMatchBL_
double deltaR(double eta1, double phi1, double eta2, double phi2)
bool isNonnull() const
Checks for non-null.
edm::FileInPath inputFileName1prongBL_
std::auto_ptr< PFTauDiscriminator > category_output_
double minMVA1prongStripsWOgsfBL_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::FileInPath inputFileName1prongEC_
edm::FileInPath inputFileName1prongStripsWgsfWOpfEleMvaBL_
double minMVA1prongStripsWgsfWpfEleMvaBL_
~PFRecoTauDiscriminationAgainstElectronMVA2()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double minMVA1prongStripsWgsfWpfEleMvaEC_
DEFINE_FWK_MODULE(CosmicTrackingParticleSelector)
void endEvent(edm::Event &)
edm::FileInPath inputFileName1prongNoEleMatchEC_
double minMVA1prongNoEleMatchEC_
edm::FileInPath inputFileName1prongStripsWOgsfBL_
edm::Handle< TauCollection > taus_
double minMVA1prongNoEleMatchBL_
void beginEvent(const edm::Event &, const edm::EventSetup &)
edm::FileInPath inputFileName1prongStripsWgsfWpfEleMvaBL_
edm::FileInPath inputFileName1prongStripsWOgsfEC_
std::string fullPath() const
double minMVA1prongStripsWgsfWOpfEleMvaEC_
std::string readZippedFile(const std::string &fileName)
PFRecoTauDiscriminationAgainstElectronMVA2(const edm::ParameterSet &iConfig)
double minMVA1prongStripsWOgsfEC_