21 std::vector<reco::CandidatePtr> theFilteredPFCands;
22 for (std::vector<reco::CandidatePtr>::const_iterator iPFCand=thePFCands.begin();iPFCand!=thePFCands.end();++iPFCand) {
23 if ((**iPFCand).pt()>
minPt)theFilteredPFCands.push_back(*iPFCand);
25 std::vector<reco::CandidatePtr> theFilteredPFCandsInCone;
26 if (conemetric==
"DR"){
28 }
else if(conemetric==
"angle"){
30 }
else if(conemetric==
"area"){
34 double coneangle=theFixedAreaCone(myVector.theta(),myVector.phi(),0,conesize,errorFlag);
35 if (errorFlag!=0)
return theFilteredPFCandsInCone;
37 }
else return std::vector<reco::CandidatePtr>();
38 return theFilteredPFCandsInCone;
41 std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFCandsInCone(
PFCands_,myVector,conemetric,conesize,minPt);
42 return theFilteredPFCandsInCone;
46 return theFilteredPFCandsInCone;
51 const reco::Track* PFChargedHadrCand_track = (*iPFCand)->bestTrack();
52 if (PFChargedHadrCand_track ==
nullptr)
continue;
53 if (fabs(PFChargedHadrCand_track->
dz(myPV.
position())-refpoint_Z)<=PFChargedHadrCand_tracktorefpoint_maxDZ) filteredPFChargedHadrCands.push_back(*iPFCand);
56 std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFCandsInCone(filteredPFChargedHadrCands,myVector,conemetric,conesize,
minPt);
57 return theFilteredPFCandsInCone;
61 return theFilteredPFCandsInCone;
65 return theFilteredPFCandsInCone;
70 std::pair<std::vector<reco::CandidatePtr>,std::vector<reco::CandidatePtr>> myPFGammaCandsInEllipse =
PFCandidatesInEllipse_(leadCand_, rPhi, rEta, PFGammaCands_);
71 std::vector<reco::CandidatePtr> thePFGammaCandsInEllipse = myPFGammaCandsInEllipse.first;
72 std::vector<reco::CandidatePtr> thePFGammaCandsOutEllipse = myPFGammaCandsInEllipse.second;
73 std::vector<reco::CandidatePtr> theFilteredPFGammaCandsInEllipse;
74 for(std::vector<reco::CandidatePtr>::const_iterator iPFGammaCand = thePFGammaCandsInEllipse.begin(); iPFGammaCand != thePFGammaCandsInEllipse.end(); ++iPFGammaCand){
75 if((**iPFGammaCand).pt() <=
maxPt) theFilteredPFGammaCandsInEllipse.push_back(*iPFGammaCand);
76 else thePFGammaCandsOutEllipse.push_back(*iPFGammaCand);
78 std::pair<std::vector<reco::CandidatePtr>, std::vector<reco::CandidatePtr>> theFilteredPFGammaCandsInOutEllipse(theFilteredPFGammaCandsInEllipse, thePFGammaCandsOutEllipse);
80 return theFilteredPFGammaCandsInOutEllipse;
86 std::vector<reco::CandidatePtr> theFilteredPFCands;
87 for (std::vector<reco::CandidatePtr>::const_iterator iPFCand=thePFCands.begin();iPFCand!=thePFCands.end();++iPFCand) {
88 if ((**iPFCand).pt()>
minPt)theFilteredPFCands.push_back(*iPFCand);
90 std::vector<reco::CandidatePtr> theFilteredPFCandsInAnnulus;
91 if (outercone_metric==
"DR"){
92 if (innercone_metric==
"DR"){
94 }
else if(innercone_metric==
"angle"){
96 }
else if(innercone_metric==
"area"){
100 double innercone_angle=theFixedAreaSignalCone(myVector.theta(),myVector.phi(),0,innercone_size,errorFlag);
101 if (errorFlag!=0)
return theFilteredPFCandsInAnnulus;
103 }
else return std::vector<reco::CandidatePtr>();
104 }
else if(outercone_metric==
"angle"){
105 if (innercone_metric==
"DR"){
107 }
else if(innercone_metric==
"angle"){
109 }
else if(innercone_metric==
"area"){
113 double innercone_angle=theFixedAreaSignalCone(myVector.theta(),myVector.phi(),0,innercone_size,errorFlag);
114 if (errorFlag!=0)
return theFilteredPFCandsInAnnulus;
116 }
else return std::vector<reco::CandidatePtr>();
117 }
else if(outercone_metric==
"area"){
121 if (innercone_metric==
"DR"){
123 }
else if(innercone_metric==
"angle"){
124 double outercone_angle=theFixedAreaSignalCone(myVector.theta(),myVector.phi(),innercone_size,outercone_size,errorFlag);
125 if (errorFlag!=0)
return theFilteredPFCandsInAnnulus;
127 }
else if(innercone_metric==
"area"){
128 double innercone_angle=theFixedAreaSignalCone(myVector.theta(),myVector.phi(),0,innercone_size,errorFlag);
129 if (errorFlag!=0)
return theFilteredPFCandsInAnnulus;
130 double outercone_angle=theFixedAreaSignalCone(myVector.theta(),myVector.phi(),innercone_angle,outercone_size,errorFlag);
131 if (errorFlag!=0)
return theFilteredPFCandsInAnnulus;
133 }
else return std::vector<reco::CandidatePtr>();
135 return theFilteredPFCandsInAnnulus;
138 std::vector<reco::CandidatePtr> theFilteredPFCandsInAnnulus=
PFCandsInAnnulus(
PFCands_,myVector,innercone_metric,innercone_size,outercone_metric,outercone_size,minPt);
139 return theFilteredPFCandsInAnnulus;
142 std::vector<reco::CandidatePtr> theFilteredPFCandsInAnnulus=
PFCandsInAnnulus(
PFChargedHadrCands_,myVector,innercone_metric,innercone_size,outercone_metric,outercone_size,minPt);
143 return theFilteredPFCandsInAnnulus;
148 const reco::Track* PFChargedHadrCand_track = (*iPFCand)->bestTrack();
149 if (PFChargedHadrCand_track !=
nullptr) {
150 if (fabs((*PFChargedHadrCand_track).dz(myPV.
position())-refpoint_Z)<=PFChargedHadrCand_tracktorefpoint_maxDZ) filteredPFChargedHadrCands.push_back(*iPFCand);
151 }
else throw cms::Exception(
"Missing information") <<
"No associated track information is saved in charged hadron candidate.\n";
153 std::vector<reco::CandidatePtr> theFilteredPFCandsInAnnulus=
PFCandsInAnnulus(filteredPFChargedHadrCands,myVector,innercone_metric,innercone_size,outercone_metric,outercone_size,
minPt);
154 return theFilteredPFCandsInAnnulus;
157 std::vector<reco::CandidatePtr> theFilteredPFCandsInAnnulus=
PFCandsInAnnulus(
PFNeutrHadrCands_,myVector,innercone_metric,innercone_size,outercone_metric,outercone_size,minPt);
158 return theFilteredPFCandsInAnnulus;
161 std::vector<reco::CandidatePtr> theFilteredPFCandsInAnnulus=
PFCandsInAnnulus(
PFGammaCands_,myVector,innercone_metric,innercone_size,outercone_metric,outercone_size,minPt);
162 return theFilteredPFCandsInAnnulus;
168 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFCandsInCone(PFJet_XYZVector,matchingcone_metric,matchingcone_size,minPt);
170 if (theFilteredPFCandsInCone.size()>0.){
171 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand =theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
172 if((*iPFCand)->pt()>pt_cut) {
173 myleadPFCand=*iPFCand;
174 pt_cut=(**iPFCand).pt();
182 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFCandsInCone(myVector,matchingcone_metric,matchingcone_size,minPt);
184 if (!theFilteredPFCandsInCone.empty()){
185 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
186 if((*iPFCand)->pt()>pt_cut) {
187 myleadPFCand=*iPFCand;
188 pt_cut=(**iPFCand).pt();
198 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFChargedHadrCandsInCone(PFJet_XYZVector,matchingcone_metric,matchingcone_size,minPt);
200 if (theFilteredPFCandsInCone.size()>0.){
201 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand =theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
202 if((*iPFCand)->pt()>pt_cut) {
203 myleadPFCand=*iPFCand;
204 pt_cut=(**iPFCand).pt();
212 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFChargedHadrCandsInCone(myVector,matchingcone_metric,matchingcone_size,minPt);
214 if (!theFilteredPFCandsInCone.empty()){
215 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
216 if((*iPFCand)->pt()>pt_cut) {
217 myleadPFCand=*iPFCand;
218 pt_cut=(**iPFCand).pt();
228 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFNeutrHadrCandsInCone(PFJet_XYZVector,matchingcone_metric,matchingcone_size,minPt);
230 if (theFilteredPFCandsInCone.size()>0.){
231 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand =theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
232 if((*iPFCand)->pt()>pt_cut) {
233 myleadPFCand=*iPFCand;
234 pt_cut=(**iPFCand).pt();
242 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFNeutrHadrCandsInCone(myVector,matchingcone_metric,matchingcone_size,minPt);
244 if (!theFilteredPFCandsInCone.empty()){
245 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
246 if((*iPFCand)->pt()>pt_cut) {
247 myleadPFCand=*iPFCand;
248 pt_cut=(**iPFCand).pt();
258 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFGammaCandsInCone(PFJet_XYZVector,matchingcone_metric,matchingcone_size,minPt);
260 if (theFilteredPFCandsInCone.size()>0.){
261 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand =theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
262 if((*iPFCand)->pt()>pt_cut) {
263 myleadPFCand=*iPFCand;
264 pt_cut=(**iPFCand).pt();
272 const std::vector<reco::CandidatePtr> theFilteredPFCandsInCone=
PFGammaCandsInCone(myVector,matchingcone_metric,matchingcone_size,minPt);
274 if (!theFilteredPFCandsInCone.empty()){
275 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=theFilteredPFCandsInCone.begin();iPFCand!=theFilteredPFCandsInCone.end();iPFCand++){
276 if((*iPFCand)->pt()>pt_cut) {
277 myleadPFCand=*iPFCand;
278 pt_cut=(**iPFCand).pt();
288 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand = theInputCands.begin();
289 iPFCand != theInputCands.end();
292 if ( (*iPFCand)->pt() >
minPt )
293 theOutputCands.push_back(*iPFCand);
302 const double minChargedSize,
const double maxChargedSize,
const double minNeutralSize,
const double maxNeutralSize,
303 const double minChargedPt,
const double minNeutralPt,
304 const string& outlierCollectorConeMetric,
const double outlierCollectionMaxSize,
305 std::vector<reco::CandidatePtr>& signalChargedObjects, std::vector<reco::CandidatePtr>& outlierChargedObjects,
306 std::vector<reco::CandidatePtr>& signalGammaObjects, std::vector<reco::CandidatePtr>& outlierGammaObjects,
bool useScanningAxis)
308 if (theChargedCands.empty() && theGammaCands.empty())
311 std::vector<reco::CandidatePtr> filteredCands;
312 filteredCands.reserve(theChargedCands.size() + theGammaCands.size());
317 if (filteredCands.empty())
323 std::vector<uint32_t> filteredCandIndexes(numberOfCandidates);
325 filteredCandIndexes[theIndex] = theIndex;
330 sort(filteredCandIndexes.begin(), filteredCandIndexes.end(), myAngularSorter);
332 std::vector<reco::CandidatePtr> sortedCands;
333 for(std::vector<uint32_t>::const_iterator theSortedIndex = filteredCandIndexes.begin();
334 theSortedIndex != filteredCandIndexes.end();
337 sortedCands.push_back(filteredCands.at(*theSortedIndex));
341 std::vector<reco::CandidatePtr>::const_iterator signalObjectCandidate = sortedCands.begin();
342 double totalEnergySoFar = (**signalObjectCandidate).energy();
343 double totalEtSoFar = (**signalObjectCandidate).et();
346 ++signalObjectCandidate;
347 bool doneBuilding =
false;
348 while (!doneBuilding && signalObjectCandidate != sortedCands.end())
353 testAxis += (**signalObjectCandidate).momentum();
354 double currentDelToCenter = ptrToMetricFunction((**signalObjectCandidate).momentum(), testAxis);
355 double testEnergy = totalEnergySoFar + (**signalObjectCandidate).energy();
356 double testEt = totalEtSoFar + (**signalObjectCandidate).et();
357 bool isCharged = (**signalObjectCandidate).charge();
358 bool addThisObject =
true;
359 if (currentDelToCenter > ((isCharged)?maxChargedSize:maxNeutralSize) ) {
361 addThisObject =
false;
363 else if (currentDelToCenter > ((isCharged)?minChargedSize:minNeutralSize) )
366 double cutOffQuantity = coneSizeFormula.Eval(testEnergy, testEt);
367 if (currentDelToCenter > cutOffQuantity)
368 addThisObject =
false;
369 else if (useScanningAxis)
373 if (ptrToMetricFunction(testAxis, leadTrackVector) > cutOffQuantity)
374 addThisObject =
false;
379 axisVectorSoFar = testAxis;
380 totalEnergySoFar = testEnergy;
381 totalEtSoFar = testEt;
382 ++signalObjectCandidate;
390 double largest3DOpeningAngleSignal = 0.;
391 for (std::vector<reco::CandidatePtr>::const_iterator iterCand = sortedCands.begin();
392 iterCand != signalObjectCandidate;
396 if (angleToAxis > largest3DOpeningAngleSignal)
397 largest3DOpeningAngleSignal = angleToAxis;
399 if ((*iterCand)->charge())
400 signalChargedObjects.push_back(*iterCand);
402 signalGammaObjects.push_back(*iterCand);
407 double outlierCollectionComputedMaxSize = 0;
409 if (!outlierCollectorConeMetric.compare(
"angle"))
412 outlierCollectionComputedMaxSize = outlierCollectionMaxSize;
413 }
else if (!outlierCollectorConeMetric.compare(
"area"))
421 int errorFlagForConeSizeCalc = 0;
422 outlierCollectionComputedMaxSize = theFixedAreaCone(axisVectorSoFar.theta(), axisVectorSoFar.phi(), largest3DOpeningAngleSignal, outlierCollectionMaxSize, errorFlagForConeSizeCalc);
423 if (errorFlagForConeSizeCalc != 0)
425 edm::LogError(
"PFRecoTauAlgorithm") <<
"Error: " << errorFlagForConeSizeCalc <<
" when calculated const area annulus. Taking all non-signal PFJet consituents!";
426 outlierCollectionComputedMaxSize = 1000.;
428 }
else if (!outlierCollectorConeMetric.compare(
"DR"))
431 outlierCollectionComputedMaxSize = outlierCollectionMaxSize;
435 edm::LogWarning(
"PFRecoTauAlgorithm") <<
"Error in computeInsideOutContents(...): Outlier (isolation) collector cone metric (" << outlierCollectorConeMetric
436 <<
") is not recognized! All non-signal associated PFJet constituents will be included in the outliers!";
439 for (std::vector<reco::CandidatePtr>::const_iterator iterCand = signalObjectCandidate;
440 iterCand != sortedCands.end();
444 double outlierOpeningQuantity = outlierCollectionCalculator(axisVectorSoFar, (*iterCand)->momentum());
445 if (outlierOpeningQuantity > outlierCollectionComputedMaxSize)
break;
447 if ((*iterCand)->charge())
448 outlierChargedObjects.push_back(*iterCand);
450 outlierGammaObjects.push_back(*iterCand);
458 double myDiscriminator=0.;
459 if ((
int)
IsolPFCands_.size()<=IsolPFCands_maxN) myDiscriminator=1;
460 return myDiscriminator;
462 double PFTauElementsOperators::discriminatorByIsolPFCandsN(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFCands_maxN){
463 double myDiscriminator=0.;
465 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
466 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
467 if(!myleadPFCand)
return myDiscriminator;
470 const std::vector<reco::CandidatePtr> isolPFCands=
PFCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
471 if ((
int)isolPFCands.size()<=IsolPFCands_maxN) myDiscriminator=1;
472 return myDiscriminator;
474 double PFTauElementsOperators::discriminatorByIsolPFCandsN(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFCands_maxN){
475 double myDiscriminator=0;
477 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
478 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
479 if(!myleadPFCand)
return myDiscriminator;
482 const std::vector<reco::CandidatePtr> isolPFCands=
PFCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
483 if ((
int)isolPFCands.size()<=IsolPFCands_maxN) myDiscriminator=1;
484 return myDiscriminator;
487 double myDiscriminator=0.;
489 return myDiscriminator;
491 double PFTauElementsOperators::discriminatorByIsolPFChargedHadrCandsN(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFChargedHadrCands_maxN){
492 double myDiscriminator=0.;
494 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
495 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
496 if(!myleadPFCand)
return myDiscriminator;
499 std::vector<reco::CandidatePtr> isolPFChargedHadrCands=
PFChargedHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
500 if ((
int)isolPFChargedHadrCands.size()<=IsolPFChargedHadrCands_maxN) myDiscriminator=1;
501 return myDiscriminator;
503 double PFTauElementsOperators::discriminatorByIsolPFChargedHadrCandsN(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFChargedHadrCands_maxN){
504 double myDiscriminator=0;
506 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
507 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
508 if(!myleadPFCand)
return myDiscriminator;
511 std::vector<reco::CandidatePtr> isolPFChargedHadrCands=
PFChargedHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
512 if ((
int)isolPFChargedHadrCands.size()<=IsolPFChargedHadrCands_maxN) myDiscriminator=1;
513 return myDiscriminator;
516 double myDiscriminator=0.;
518 return myDiscriminator;
520 double PFTauElementsOperators::discriminatorByIsolPFNeutrHadrCandsN(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFNeutrHadrCands_maxN){
521 double myDiscriminator=0.;
523 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
524 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
525 if(!myleadPFCand)
return myDiscriminator;
528 std::vector<reco::CandidatePtr> isolPFNeutrHadrCands=
PFNeutrHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
529 if ((
int)isolPFNeutrHadrCands.size()<=IsolPFNeutrHadrCands_maxN) myDiscriminator=1;
530 return myDiscriminator;
532 double PFTauElementsOperators::discriminatorByIsolPFNeutrHadrCandsN(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFNeutrHadrCands_maxN){
533 double myDiscriminator=0;
535 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
536 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
537 if(!myleadPFCand)
return myDiscriminator;
540 std::vector<reco::CandidatePtr> isolPFNeutrHadrCands=
PFNeutrHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
541 if ((
int)isolPFNeutrHadrCands.size()<=IsolPFNeutrHadrCands_maxN) myDiscriminator=1;
542 return myDiscriminator;
545 double myDiscriminator=0.;
547 return myDiscriminator;
549 double PFTauElementsOperators::discriminatorByIsolPFGammaCandsN(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFGammaCands_maxN){
550 double myDiscriminator=0.;
552 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
553 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
554 if(!myleadPFCand)
return myDiscriminator;
557 std::vector<reco::CandidatePtr> isolPFGammaCands=
PFGammaCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
558 if ((
int)isolPFGammaCands.size()<=IsolPFGammaCands_maxN) myDiscriminator=1;
559 return myDiscriminator;
561 double PFTauElementsOperators::discriminatorByIsolPFGammaCandsN(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
int IsolPFGammaCands_maxN){
562 double myDiscriminator=0;
564 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
565 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
566 if(!myleadPFCand)
return myDiscriminator;
569 std::vector<reco::CandidatePtr> isolPFGammaCands=
PFGammaCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
570 if ((
int)isolPFGammaCands.size()<=IsolPFGammaCands_maxN) myDiscriminator=1;
571 return myDiscriminator;
574 double myIsolPFCandsEtSum=0.;
575 double myDiscriminator=0.;
576 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=
IsolPFCands_.begin();iPFCand!=
IsolPFCands_.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
577 if (myIsolPFCandsEtSum<=IsolPFCands_maxEtSum) myDiscriminator=1;
578 return myDiscriminator;
580 double PFTauElementsOperators::discriminatorByIsolPFCandsEtSum(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFCands_maxEtSum){
581 double myIsolPFCandsEtSum=0.;
582 double myDiscriminator=0.;
584 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
585 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
586 if(!myleadPFCand)
return myDiscriminator;
589 std::vector<reco::CandidatePtr> isolPFCands=
PFCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
590 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFCands.begin();iPFCand!=isolPFCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
591 if (myIsolPFCandsEtSum<=IsolPFCands_maxEtSum) myDiscriminator=1;
592 return myDiscriminator;
594 double PFTauElementsOperators::discriminatorByIsolPFCandsEtSum(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFCands_maxEtSum){
595 double myIsolPFCandsEtSum=0.;
596 double myDiscriminator=0;
598 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
599 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
600 if(!myleadPFCand)
return myDiscriminator;
603 std::vector<reco::CandidatePtr> isolPFCands=
PFCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
604 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFCands.begin();iPFCand!=isolPFCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
605 if (myIsolPFCandsEtSum<=IsolPFCands_maxEtSum) myDiscriminator=1;
606 return myDiscriminator;
609 double myIsolPFCandsEtSum=0.;
610 double myDiscriminator=0.;
612 if (myIsolPFCandsEtSum<=IsolPFChargedHadrCands_maxEtSum) myDiscriminator=1;
613 return myDiscriminator;
615 double PFTauElementsOperators::discriminatorByIsolPFChargedHadrCandsEtSum(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFChargedHadrCands_maxEtSum){
616 double myIsolPFCandsEtSum=0.;
617 double myDiscriminator=0.;
619 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
620 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
621 if(!myleadPFCand)
return myDiscriminator;
624 std::vector<reco::CandidatePtr> isolPFChargedHadrCands=
PFChargedHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
625 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFChargedHadrCands.begin();iPFCand!=isolPFChargedHadrCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
626 if (myIsolPFCandsEtSum<=IsolPFChargedHadrCands_maxEtSum) myDiscriminator=1;
627 return myDiscriminator;
629 double PFTauElementsOperators::discriminatorByIsolPFChargedHadrCandsEtSum(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFChargedHadrCands_maxEtSum){
630 double myIsolPFCandsEtSum=0.;
631 double myDiscriminator=0;
633 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
634 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
635 if(!myleadPFCand)
return myDiscriminator;
638 std::vector<reco::CandidatePtr> isolPFChargedHadrCands=
PFChargedHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
639 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFChargedHadrCands.begin();iPFCand!=isolPFChargedHadrCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
640 if (myIsolPFCandsEtSum<=IsolPFChargedHadrCands_maxEtSum) myDiscriminator=1;
641 return myDiscriminator;
644 double myIsolPFCandsEtSum=0.;
645 double myDiscriminator=0.;
647 if (myIsolPFCandsEtSum<=IsolPFNeutrHadrCands_maxEtSum) myDiscriminator=1;
648 return myDiscriminator;
650 double PFTauElementsOperators::discriminatorByIsolPFNeutrHadrCandsEtSum(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFNeutrHadrCands_maxEtSum){
651 double myIsolPFCandsEtSum=0.;
652 double myDiscriminator=0.;
654 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
655 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
656 if(!myleadPFCand)
return myDiscriminator;
659 std::vector<reco::CandidatePtr> isolPFNeutrHadrCands=
PFNeutrHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
660 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFNeutrHadrCands.begin();iPFCand!=isolPFNeutrHadrCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
661 if (myIsolPFCandsEtSum<=IsolPFNeutrHadrCands_maxEtSum) myDiscriminator=1;
662 return myDiscriminator;
664 double PFTauElementsOperators::discriminatorByIsolPFNeutrHadrCandsEtSum(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFNeutrHadrCands_maxEtSum){
665 double myIsolPFCandsEtSum=0.;
666 double myDiscriminator=0;
668 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
669 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
670 if(!myleadPFCand)
return myDiscriminator;
673 std::vector<reco::CandidatePtr> isolPFNeutrHadrCands=
PFNeutrHadrCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
674 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFNeutrHadrCands.begin();iPFCand!=isolPFNeutrHadrCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
675 if (myIsolPFCandsEtSum<=IsolPFNeutrHadrCands_maxEtSum) myDiscriminator=1;
676 return myDiscriminator;
679 double myIsolPFCandsEtSum=0.;
680 double myDiscriminator=0.;
681 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=
IsolPFGammaCands_.begin();iPFCand!=
IsolPFGammaCands_.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
682 if (myIsolPFCandsEtSum<=IsolPFGammaCands_maxEtSum) myDiscriminator=1;
683 return myDiscriminator;
685 double PFTauElementsOperators::discriminatorByIsolPFGammaCandsEtSum(
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFGammaCands_maxEtSum){
686 double myIsolPFCandsEtSum=0.;
687 double myDiscriminator=0.;
689 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
690 else myleadPFCand=
leadCand(matchingcone_metric,matchingcone_size,minPt_leadPFCand);
691 if(!myleadPFCand)
return myDiscriminator;
692 if(signalcone_size>=isolcone_size)
return 1.;
694 std::vector<reco::CandidatePtr> isolPFGammaCands=
PFGammaCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
695 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFGammaCands.begin();iPFCand!=isolPFGammaCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
696 if (myIsolPFCandsEtSum<=IsolPFGammaCands_maxEtSum) myDiscriminator=1;
697 return myDiscriminator;
699 double PFTauElementsOperators::discriminatorByIsolPFGammaCandsEtSum(
const math::XYZVector& myVector,
string matchingcone_metric,
double matchingcone_size,
string signalcone_metric,
double signalcone_size,
string isolcone_metric,
double isolcone_size,
bool useOnlyChargedHadrforleadPFCand,
double minPt_leadPFCand,
double minPt_PFCand,
double IsolPFGammaCands_maxEtSum){
700 double myIsolPFCandsEtSum=0.;
701 double myDiscriminator=0;
703 if (useOnlyChargedHadrforleadPFCand) myleadPFCand=
leadChargedHadrCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
704 else myleadPFCand=
leadCand(myVector,matchingcone_metric,matchingcone_size,minPt_leadPFCand);
705 if(!myleadPFCand)
return myDiscriminator;
708 std::vector<reco::CandidatePtr> isolPFGammaCands=
PFGammaCandsInAnnulus(leadPFCand_XYZVector,signalcone_metric,signalcone_size,isolcone_metric,isolcone_size,minPt_PFCand);
709 for(std::vector<reco::CandidatePtr>::const_iterator iPFCand=isolPFGammaCands.begin();iPFCand!=isolPFGammaCands.end();iPFCand++) myIsolPFCandsEtSum+=(**iPFCand).et();
710 if (myIsolPFCandsEtSum<=IsolPFGammaCands_maxEtSum) myDiscriminator=1;
711 return myDiscriminator;
std::vector< reco::CandidatePtr > PFGammaCandsInCone(const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
std::vector< reco::CandidatePtr > PFGammaCands_
std::vector< reco::CandidatePtr > PFCands_
std::vector< reco::CandidatePtr > PFChargedHadrCands_
reco::CandidatePtr leadGammaCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
std::vector< reco::CandidatePtr > PFChargedHadrCandsInCone(const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
std::vector< reco::CandidatePtr > PFChargedHadrCandsInAnnulus(const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
double discriminatorByIsolPFGammaCandsN(int IsolPFCands_maxN=0)
Angle< math::XYZVector > metricAngle_
double discriminatorByIsolPFChargedHadrCandsN(int IsolPFCands_maxN=0)
std::vector< reco::CandidatePtr > IsolPFChargedHadrCands_
ElementsInCone< math::XYZVector, Angle< math::XYZVector >, reco::Candidate > PFCandsinCone_Anglemetric_
const Point & position() const
position
const std::vector< reco::CandidatePtr > & isolationGammaCands() const
Gamma candidates in isolation region.
ElementsInCone< math::XYZVector, DeltaR< math::XYZVector >, reco::Candidate > PFCandsinCone_DRmetric_
double AreaMetric_recoElements_maxabsEta_
std::vector< reco::CandidatePtr > PFNeutrHadrCands_
double discriminatorByIsolPFCandsEtSum(double IsolPFCands_maxEtSum=0)
reco::CandidatePtr leadCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
double discriminatorByIsolPFGammaCandsEtSum(double IsolPFCands_maxEtSum=0)
double discriminatorByIsolPFCandsN(int IsolPFCands_maxN=0)
std::vector< reco::CandidatePtr > PFCandsInCone(const std::vector< reco::CandidatePtr > &PFCands, const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
std::vector< reco::CandidatePtr > PFNeutrHadrCandsInCone(const math::XYZVector &myVector, const std::string conemetric, const double conesize, const double minPt) const
PFTauElementsOperators(reco::PFTau &thePFTau)
void setAcceptanceLimit(double etaMaxTrackingAcceptance)
std::vector< reco::CandidatePtr > PFNeutrHadrCandsInAnnulus(const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
std::vector< reco::CandidatePtr > PFGammaCandsInAnnulus(const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
double discriminatorByIsolPFNeutrHadrCandsN(int IsolPFCands_maxN=0)
std::vector< reco::CandidatePtr > PFCandsInAnnulus(const std::vector< reco::CandidatePtr > &PFCands, const math::XYZVector &myVector, const std::string innercone_metric, const double innercone_size, const std::string outercone_metric, const double outercone_size, const double minPt) const
reco::TrackRefVector Tracks_
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
const std::vector< reco::CandidatePtr > & isolationChargedHadrCands() const
Charged candidates in isolation region.
const PFTauTagInfoRef & pfTauTagInfoRef() const
std::vector< reco::CandidatePtr > IsolPFNeutrHadrCands_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
DeltaR< math::XYZVector > metricDR_
ElementsInAnnulus< math::XYZVector, DeltaR< math::XYZVector >, Angle< math::XYZVector >, reco::Candidate > PFCandsinAnnulus_innerDRouterAnglemetrics_
std::pair< std::vector< reco::CandidatePtr >, std::vector< reco::CandidatePtr > > PFGammaCandsInOutEllipse(const std::vector< reco::CandidatePtr > &, const reco::Candidate &, double rPhi, double rEta, double maxPt) const
void computeInsideOutContents(const std::vector< reco::CandidatePtr > &theChargedCands, const std::vector< reco::CandidatePtr > &theGammaCands, const math::XYZVector &leadTrackVector, const TFormula &coneSizeFormula, double(*ptrToMetricFunction)(const math::XYZVector &, const math::XYZVector &), const double minChargedSize, const double maxChargedSize, const double minNeutralSize, const double maxNeutralSize, const double minChargedPt, const double minNeutralPt, const std::string &outlierCollectorConeMetric, const double outlierCollectorConeSize, std::vector< reco::CandidatePtr > &signalChargedObjects, std::vector< reco::CandidatePtr > &outlierChargedObjects, std::vector< reco::CandidatePtr > &signalGammaObjects, std::vector< reco::CandidatePtr > &outlierGammaObjects, bool useScanningAxis)
compute size of cone using the Inside-Out cone (Author Evan Friis, UC Davis)
void setAreaMetricrecoElementsmaxabsEta(double x)
std::vector< reco::CandidatePtr > IsolPFGammaCands_
ElementsInEllipse< reco::Candidate, reco::Candidate > PFCandidatesInEllipse_
const std::vector< reco::CandidatePtr > & isolationNeutrHadrCands() const
double discriminatorByIsolPFChargedHadrCandsEtSum(std::string matchingcone_metric, double matchingcone_size, std::string signalcone_metric, double signalcone_size, std::string isolcone_metric, double isolcone_size, bool useOnlyChargedHadrforleadPFCand, double minPt_leadPFCand, double minPt_PFCand, double IsolPFCands_maxEtSum=0)
const std::vector< reco::CandidatePtr > & isolationCands() const
Candidates in isolation region.
ElementsInAnnulus< math::XYZVector, DeltaR< math::XYZVector >, DeltaR< math::XYZVector >, reco::Candidate > PFCandsinAnnulus_innerDRouterDRmetrics_
double discriminatorByIsolPFNeutrHadrCandsEtSum(double IsolPFCands_maxEtSum=0)
reco::JetBaseRef PFJetRef_
ElementsInAnnulus< math::XYZVector, Angle< math::XYZVector >, Angle< math::XYZVector >, reco::Candidate > PFCandsinAnnulus_innerAngleouterAnglemetrics_
reco::CandidatePtr leadNeutrHadrCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const
std::vector< reco::CandidatePtr > IsolPFCands_
void copyCandRefsFilteredByPt(const std::vector< reco::CandidatePtr > &theInputCands, std::vector< reco::CandidatePtr > &theOutputCands, const double minPt)
append elements of theInputCands that pass Pt requirement to the end of theOutputCands ...
ElementsInAnnulus< math::XYZVector, Angle< math::XYZVector >, DeltaR< math::XYZVector >, reco::Candidate > PFCandsinAnnulus_innerAngleouterDRmetrics_
reco::CandidatePtr leadChargedHadrCand(const std::string matchingcone_metric, const double matchingcone_size, const double minPt) const