28 moduleLabel_(iConfig.getParameter<std::string>(
"@module_label")),
54 minMVA1prongNoEleMatchWOgWOgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWOgWOgsfBL");
55 minMVA1prongNoEleMatchWOgWgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWOgWgsfBL");
56 minMVA1prongNoEleMatchWgWOgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWgWOgsfBL");
57 minMVA1prongNoEleMatchWgWgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWgWgsfBL");
58 minMVA1prongWOgWOgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongWOgWOgsfBL");
59 minMVA1prongWOgWgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongWOgWgsfBL");
60 minMVA1prongWgWOgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongWgWOgsfBL");
61 minMVA1prongWgWgsfBL_ = iConfig.
getParameter<
double>(
"minMVA1prongWgWgsfBL");
62 minMVA1prongNoEleMatchWOgWOgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWOgWOgsfEC");
63 minMVA1prongNoEleMatchWOgWgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWOgWgsfEC");
64 minMVA1prongNoEleMatchWgWOgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWgWOgsfEC");
65 minMVA1prongNoEleMatchWgWgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongNoEleMatchWgWgsfEC");
66 minMVA1prongWOgWOgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongWOgWOgsfEC");
67 minMVA1prongWOgWgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongWOgWgsfEC");
68 minMVA1prongWgWOgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongWgWOgsfEC");
69 minMVA1prongWgWgsfEC_ = iConfig.
getParameter<
double>(
"minMVA1prongWgWgsfEC");
70 minMVA3prongMatch_ = iConfig.
getParameter<
double>(
"minMVA3prongMatch");
71 minMVA3prongNoMatch_ = iConfig.
getParameter<
double>(
"minMVA3prongNoMatch");
94 mva_->Initialize_from_file(method_,
95 inputFileName1prongNoEleMatchWOgWOgsfBL_.fullPath(),
96 inputFileName1prongNoEleMatchWOgWgsfBL_.
fullPath(),
97 inputFileName1prongNoEleMatchWgWOgsfBL_.
fullPath(),
98 inputFileName1prongNoEleMatchWgWgsfBL_.
fullPath(),
99 inputFileName1prongWOgWOgsfBL_.
fullPath(),
100 inputFileName1prongWOgWgsfBL_.
fullPath(),
101 inputFileName1prongWgWOgsfBL_.
fullPath(),
102 inputFileName1prongWgWgsfBL_.
fullPath(),
103 inputFileName1prongNoEleMatchWOgWOgsfEC_.
fullPath(),
104 inputFileName1prongNoEleMatchWOgWgsfEC_.
fullPath(),
105 inputFileName1prongNoEleMatchWgWOgsfEC_.
fullPath(),
106 inputFileName1prongNoEleMatchWgWgsfEC_.
fullPath(),
107 inputFileName1prongWOgWOgsfEC_.
fullPath(),
108 inputFileName1prongWOgWgsfEC_.
fullPath(),
109 inputFileName1prongWgWOgsfEC_.
fullPath(),
110 inputFileName1prongWgWgsfEC_.
fullPath());
114 produces<PFTauDiscriminator>(
"category");
120 double discriminate(
const PFTauRef&);
130 bool isInEcalCrack(
double)
const;
137 file.open(fileName.c_str());
139 <<
"Failed to open MVA file = " << fileName <<
" !!\n";
140 std::ostringstream buffer_zipped;
141 while ( file.good() ) {
142 buffer_zipped << (char)file.get();
147 std::ostringstream buffer_unzipped;
148 buffer_unzipped << gunzip.
rdbuf();
150 return buffer_unzipped.str();
205 evt.
getByLabel(srcGsfElectrons_, gsfElectrons_);
211 double workingPoint = 1.;
213 bool isGsfElectronMatched =
false;
218 if( (*thePFTauRef).leadPFChargedHadrCand().isNonnull()) {
219 for ( reco::GsfElectronCollection::const_iterator theGsfElectron = gsfElectrons_->begin();
220 theGsfElectron != gsfElectrons_->end(); ++theGsfElectron ) {
221 if ( theGsfElectron->pt() > 10. ) {
222 double deltaREleTau =
deltaR(theGsfElectron->p4(), thePFTauRef->p4());
224 if ( deltaREleTau < 0.3 ) {
225 double mva_match = mva_->MVAValue(*thePFTauRef, *theGsfElectron);
226 double workingPoint_match = 0.;
227 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
228 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
230 if ( thePFTauRef->signalPFChargedHadrCands().size() == 1 ) {
232 Float_t TauEtaAtEcalEntrance = -99.;
233 float sumEtaTimesEnergy = 0;
235 for(
unsigned int j = 0 ;
j < ((*thePFTauRef).signalPFCands()).
size() ;
j++){
237 sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
238 sumEnergy += pfcandidate->energy();
240 if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
242 if (isInEcalCrack(TauEtaAtEcalEntrance)){
245 category_output_->setValue(tauIndex_, category);
256 double mvaCut = 999.;
257 if ( TMath::Abs(thePFTauRef->eta()) < 1.5 ) {
258 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
260 mvaCut = minMVA1prongWOgWOgsfBL_;
261 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
263 mvaCut = minMVA1prongWOgWgsfBL_;
264 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
266 mvaCut = minMVA1prongWgWOgsfBL_;
267 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
269 mvaCut = minMVA1prongWgWgsfBL_;
272 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
274 mvaCut = minMVA1prongWOgWOgsfEC_;
275 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
277 mvaCut = minMVA1prongWOgWgsfEC_;
278 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
280 mvaCut = minMVA1prongWgWOgsfEC_;
281 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
283 mvaCut = minMVA1prongWgWgsfEC_;
286 workingPoint_match = (mva_match > mvaCut);
290 workingPoint_match = (mva_match > minMVA3prongMatch_);
293 workingPoint =
TMath::Min(workingPoint, workingPoint_match);
294 isGsfElectronMatched =
true;
299 if ( !isGsfElectronMatched ) {
300 mva = mva_->MVAValue(*thePFTauRef);
301 size_t numSignalPFGammaCands = thePFTauRef->signalPFGammaCands().size();
302 bool hasGsfTrack = thePFTauRef->leadPFChargedHadrCand()->gsfTrackRef().
isNonnull();
303 if ( thePFTauRef->signalPFChargedHadrCands().size() == 1 ) {
305 Float_t TauEtaAtEcalEntrance = -99.;
306 float sumEtaTimesEnergy = 0;
308 for(
unsigned int j = 0 ;
j < ((*thePFTauRef).signalPFCands()).
size() ;
j++){
310 sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
311 sumEnergy += pfcandidate->energy();
313 if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
315 if (isInEcalCrack(TauEtaAtEcalEntrance)){
318 category_output_->setValue(tauIndex_, category);
329 double mvaCut = 999.;
330 if ( TMath::Abs(thePFTauRef->eta()) < 1.5 ) {
331 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
333 mvaCut = minMVA1prongNoEleMatchWOgWOgsfBL_;
334 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
336 mvaCut = minMVA1prongNoEleMatchWOgWgsfBL_;
337 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
339 mvaCut = minMVA1prongNoEleMatchWgWOgsfBL_;
340 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
342 mvaCut = minMVA1prongNoEleMatchWgWgsfBL_;
345 if ( numSignalPFGammaCands == 0 && !hasGsfTrack ) {
347 mvaCut = minMVA1prongNoEleMatchWOgWOgsfEC_;
348 }
else if ( numSignalPFGammaCands == 0 && hasGsfTrack ) {
350 mvaCut = minMVA1prongNoEleMatchWOgWgsfEC_;
351 }
else if ( numSignalPFGammaCands >= 1 && !hasGsfTrack ) {
353 mvaCut = minMVA1prongNoEleMatchWgWOgsfEC_;
354 }
else if ( numSignalPFGammaCands >= 1 && hasGsfTrack ) {
356 mvaCut = minMVA1prongNoEleMatchWgWgsfEC_;
359 workingPoint = (mva > mvaCut);
363 workingPoint = (mva > minMVA3prongNoMatch_);
379 category_output_->setValue(tauIndex_, category);
392 evt.
put(category_output_,
"category");
400 return (eta>1.460 && eta<1.558);
double minMVA3prongMatch_
double minMVA1prongNoEleMatchWOgWgsfBL_
T getParameter(std::string const &) const
edm::FileInPath inputFileName1prongNoEleMatchWOgWgsfEC_
double minMVA1prongWOgWgsfEC_
std::auto_ptr< PFTauDiscriminator > category_output_
edm::FileInPath inputFileName1prongNoEleMatchWgWgsfBL_
bool isInEcalCrack(double) const
edm::FileInPath inputFileName1prongWOgWgsfEC_
edm::FileInPath inputFileName1prongWgWgsfBL_
double minMVA3prongNoMatch_
edm::Handle< TauCollection > taus_
double minMVA1prongNoEleMatchWOgWOgsfEC_
edm::FileInPath inputFileName1prongNoEleMatchWgWOgsfEC_
edm::FileInPath inputFileName1prongNoEleMatchWgWgsfEC_
edm::FileInPath inputFileName1prongWOgWOgsfEC_
void endEvent(edm::Event &)
edm::FileInPath inputFileName1prongWgWgsfEC_
double minMVA1prongNoEleMatchWOgWOgsfBL_
double deltaR(double eta1, double phi1, double eta2, double phi2)
double minMVA1prongWgWOgsfEC_
double minMVA1prongNoEleMatchWOgWgsfEC_
PFRecoTauDiscriminationAgainstElectronMVA3(const edm::ParameterSet &iConfig)
bool isNonnull() const
Checks for non-null.
edm::InputTag srcGsfElectrons_
double minMVA1prongWOgWOgsfBL_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::FileInPath inputFileName1prongWgWOgsfEC_
double minMVA1prongNoEleMatchWgWgsfEC_
edm::Handle< reco::GsfElectronCollection > gsfElectrons_
edm::FileInPath inputFileName1prongNoEleMatchWOgWOgsfBL_
double discriminate(const PFTauRef &)
double minMVA1prongWgWgsfBL_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::FileInPath inputFileName1prongNoEleMatchWOgWOgsfEC_
double minMVA1prongWOgWgsfBL_
double minMVA1prongWgWgsfEC_
DEFINE_FWK_MODULE(CosmicTrackingParticleSelector)
edm::FileInPath inputFileName1prongWOgWgsfBL_
double minMVA1prongWOgWOgsfEC_
edm::FileInPath inputFileName1prongWgWOgsfBL_
double minMVA1prongNoEleMatchWgWgsfBL_
void beginEvent(const edm::Event &, const edm::EventSetup &)
double minMVA1prongNoEleMatchWgWOgsfBL_
edm::FileInPath inputFileName1prongNoEleMatchWOgWgsfBL_
std::string readZippedFile(const std::string &fileName)
edm::FileInPath inputFileName1prongWOgWOgsfBL_
~PFRecoTauDiscriminationAgainstElectronMVA3()
AntiElectronIDMVA3 * mva_
double minMVA1prongWgWOgsfBL_
std::string fullPath() const
edm::FileInPath inputFileName1prongNoEleMatchWgWOgsfBL_
tuple size
Write out results.
double minMVA1prongNoEleMatchWgWOgsfEC_