33 for(
unsigned int i = 0;
i < niso.size();
i++)
34 all.push_back(niso[
i]);
36 for(
unsigned int i = 0; i < rings.size(); i++)
37 all.insert(all.end(), rings[
i].begin(), rings[
i].end());
39 for(
unsigned int i = 0; i < shapes.size(); i++)
40 all.insert(all.end(), shapes[
i].begin(), shapes[
i].end());
54 rhoProducer_(iConfig.getParameter<edm::InputTag>(
"rhoProducer")),
55 gbrfFilePath_(iConfig.getParameter<edm::
FileInPath>(
"gbrfFilePath")),
56 returnMVA_(iConfig.getParameter<bool>(
"returnMVA")),
57 mvaMin_(iConfig.getParameter<double>(
"mvaMin")),
62 prediscriminantFailValue_ = -1;
64 prediscriminantFailValue_ = 0;
67 TFile *gbrfFile =
new TFile(gbrfFilePath_.fullPath().data());
68 gbrfTauIso_ = (
GBRForest *)(gbrfFile->Get(
"gbrfTauIso"));
74 double discriminate(
const PFTauRef& pfTau);
91 event.getByLabel(rhoProducer_, hRho);
98 vector<float> mvainput = isoRings.
getVector();
99 mvainput.push_back(rho_);
100 double mvaValue = gbrfTauIso_->GetClassifier(&mvainput[0]);
102 return returnMVA_ ? mvaValue : mvaValue > mvaMin_;
108 vector<vector<float> > rings(3, vector<float>(5));
109 vector<vector<float> > shapes(3, vector<float>(5));
110 vector<float> isoptsum(3);
112 for(
unsigned int i = 0;
i < pfTau->isolationPFCands().size();
i++)
117 float deta = pfTau->eta() - pf->eta();
119 float dr =
reco::deltaR(pfTau->eta(), pfTau->phi(), pf->eta(), pf->phi());
123 if(pf->charge() != 0) pftype = 0;
124 else if(pf->particleId() == PFCandidate::gamma) pftype = 1;
131 if(dr < 0.1) rings[pftype][0] += pf->pt();
132 else if(dr < 0.2) rings[pftype][1] += pf->pt();
133 else if(dr < 0.3) rings[pftype][2] += pf->pt();
134 else if(dr < 0.4) rings[pftype][3] += pf->pt();
135 else if(dr < 0.5) rings[pftype][4] += pf->pt();
138 shapes[pftype][0] += pf->pt() * deta;
139 shapes[pftype][1] += pf->pt() * dphi;
140 shapes[pftype][2] += pf->pt() * deta*deta;
141 shapes[pftype][3] += pf->pt() * dphi*dphi;
142 shapes[pftype][4] += pf->pt() * deta*dphi;
143 isoptsum[pftype] += pf->pt();
147 for(
unsigned int i = 0;
i < shapes.size();
i++)
149 for(
unsigned int j = 0;
j < shapes[
i].size();
j++)
151 shapes[
i][
j] = isoptsum[
i] > 0 ? fabs(shapes[
i][
j]/isoptsum[
i]) : 0;
157 isoRings.
niso = niso;
158 isoRings.
rings = rings;
edm::FileInPath gbrfFilePath_
PFRecoTauDiscriminationByMVAIsolation(const edm::ParameterSet &iConfig)
#define DEFINE_FWK_MODULE(type)
~PFRecoTauDiscriminationByMVAIsolation()
vector< float > getVector()
edm::InputTag rhoProducer_
reco::tau::cone::IsoRings computeIsoRings(const PFTauRef &pfTau)
vector< vector< float > > shapes
void beginEvent(const edm::Event &evt, const edm::EventSetup &evtSetup)
vector< vector< float > > rings
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double deltaPhi(double phi1, double phi2)
double discriminate(const PFTauRef &pfTau)