ATLAS Offline Software
Loading...
Searching...
No Matches
TPhotonIsEMSelector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
16#include "TPhotonIsEMSelector.h"
17#include <cmath>
18
20 asg::AsgMessaging(std::string(name)),
21 m_isEMMask(0),//All will pass if not defined
28 // selection for tight photons
62 m_cutNameClusterEtaRange_Photon("ClusterEtaRange_Photon"),
64 m_cutNameClusterBackEnergyFraction_Photon("ClusterBackEnergyFraction_Photon"),
66 m_cutNameClusterHadronicLeakage_Photon("ClusterHadronicLeakage_Photon"),
68 m_cutNameClusterMiddleEnergy_Photon("ClusterMiddleEnergy_Photon"),
70 m_cutNameClusterMiddleEratio37_Photon("ClusterMiddleEratio37_Photon"),
72 m_cutNameClusterMiddleEratio33_Photon("ClusterMiddleEratio33_Photon"),
74 m_cutNameClusterMiddleWidth_Photon("ClusterMiddleWidth_Photon"),
76 m_cutNameClusterStripsEratio_Photon("ClusterStripsEratio_Photon"),
78 m_cutNameClusterStripsDeltaE_Photon("ClusterStripsDeltaE_Photon"),
80 m_cutNameClusterStripsWtot_Photon("ClusterStripsWtot_Photon"),
82 m_cutNameClusterStripsFracm_Photon("ClusterStripsFracm_Photon"),
84 m_cutNameClusterStripsWeta1c_Photon("ClusterStripsWeta1c_Photon"),
86 m_cutNameClusterStripsDEmaxs1_Photon("ClusterStripsDEmaxs1_Photon"),
88 m_cutNameTrackMatchEoverP_Photon("TrackMatchEoverP_Photon"),
90 m_cutNameAmbiguityResolution_Photon("AmbiguityResolution_Photon"),
92 m_cutNameIsolation_Photon("Isolation_Photon"),
94 m_cutNameClusterIsolation_Photon("ClusterIsolation_Photon"),
96 m_cutNameTrackIsolation_Photon("TrackIsolation_Photon") {
115}
116
117// =================================================================
119
127
128 StatusCode sc(StatusCode::SUCCESS);
129
132 m_acceptInfo.addCut(m_cutNameClusterEtaRange_Photon, "Photon within eta range");
133 if (m_cutPositionClusterEtaRange_Photon < 0) sc = StatusCode::FAILURE;
134
135 int voidcutpos = m_acceptInfo.addCut("VOID1", "No Cut"); // bit 1 is not used
136 if (voidcutpos < 0) sc = StatusCode::FAILURE;
137
138 voidcutpos = m_acceptInfo.addCut("VOID2", "No Cut"); // bit 2 is not used
139 if (voidcutpos < 0) sc = StatusCode::FAILURE;
140
141 voidcutpos = m_acceptInfo.addCut("VOID3", "No Cut"); // bit 3 is not used
142 if (voidcutpos < 0) sc = StatusCode::FAILURE;
143
144 voidcutpos = m_acceptInfo.addCut("VOID4", "No Cut"); // bit 4 is not used
145 if (voidcutpos < 0) sc = StatusCode::FAILURE;
146
147 voidcutpos = m_acceptInfo.addCut("VOID5", "No Cut"); // bit 5 is not used
148 if (voidcutpos < 0) sc = StatusCode::FAILURE;
149
150 voidcutpos = m_acceptInfo.addCut("VOID6", "No Cut"); // bit 6 is not used
151 if (voidcutpos < 0) sc = StatusCode::FAILURE;
152
156 if (m_cutPositionClusterBackEnergyFraction_Photon < 0) sc = StatusCode::FAILURE;
157
158 voidcutpos = m_acceptInfo.addCut("VOID7", "No Cut"); // bit 8 is not used
159 if (voidcutpos < 0) sc = StatusCode::FAILURE;
160
161 voidcutpos = m_acceptInfo.addCut("VOID8", "No Cut"); // bit 9 is not used
162 if (voidcutpos < 0) sc = StatusCode::FAILURE;
163
166 m_acceptInfo.addCut(m_cutNameClusterHadronicLeakage_Photon, "Had leakage < Cut");
167 if (m_cutPositionClusterHadronicLeakage_Photon < 0) sc = StatusCode::FAILURE;
168
171 m_acceptInfo.addCut(m_cutNameClusterMiddleEnergy_Photon, "Energy in second sampling (E277) > Cut");
172 if (m_cutPositionClusterMiddleEnergy_Photon < 0) sc = StatusCode::FAILURE;
173
176 m_acceptInfo.addCut(m_cutNameClusterMiddleEratio37_Photon, "E237/E277 > Cut");
177 if (m_cutPositionClusterMiddleEratio37_Photon < 0) sc = StatusCode::FAILURE;
178
181 m_acceptInfo.addCut(m_cutNameClusterMiddleEratio33_Photon, "E233/E237 > Cut");
182 if (m_cutPositionClusterMiddleEratio33_Photon < 0) sc = StatusCode::FAILURE;
183
187 if (m_cutPositionClusterMiddleWidth_Photon < 0) sc = StatusCode::FAILURE;
188
192 if (m_cutPositionClusterStripsEratio_Photon < 0) sc = StatusCode::FAILURE;
193
194 voidcutpos = m_acceptInfo.addCut("VOID9", "No Cut"); // bit 16 is not used
195 if (voidcutpos < 0) sc = StatusCode::FAILURE;
196
200 "difference between 2nd maximum and 1st minimum in strips < Cut");
201 if (m_cutPositionClusterStripsDeltaE_Photon < 0) sc = StatusCode::FAILURE;
202
206 if (m_cutPositionClusterStripsWtot_Photon < 0) sc = StatusCode::FAILURE;
207
211 if (m_cutPositionClusterStripsFracm_Photon < 0) sc = StatusCode::FAILURE;
212
216 if (m_cutPositionClusterStripsWeta1c_Photon < 0) sc = StatusCode::FAILURE;
217
221 "difference between max and 2nd max in strips > Cut");
222 if (m_cutPositionClusterStripsDEmaxs1_Photon < 0) sc = StatusCode::FAILURE;
223
226 m_acceptInfo.addCut(m_cutNameTrackMatchEoverP_Photon, "E/p within allowed range (conversions only)");
227 if (m_cutPositionTrackMatchEoverP_Photon < 0) sc = StatusCode::FAILURE;
228
232 "Passes tighter ambiguity resolution vs electron");
233 if (m_cutPositionAmbiguityResolution_Photon < 0) sc = StatusCode::FAILURE;
234
235 voidcutpos = m_acceptInfo.addCut("VOID10", "No Cut"); // bit 24 is not used
236 if (voidcutpos < 0) sc = StatusCode::FAILURE;
237
238 voidcutpos = m_acceptInfo.addCut("VOID11", "No Cut"); // bit 25 is not used
239 if (voidcutpos < 0) sc = StatusCode::FAILURE;
240
241 voidcutpos = m_acceptInfo.addCut("VOID12", "No Cut"); // bit 26 is not used
242 if (voidcutpos < 0) sc = StatusCode::FAILURE;
243
244 voidcutpos = m_acceptInfo.addCut("VOID13", "No Cut"); // bit 27 is not used
245 if (voidcutpos < 0) sc = StatusCode::FAILURE;
246
247 voidcutpos = m_acceptInfo.addCut("VOID14", "No Cut"); // bit 28 is not used
248 if (voidcutpos < 0) sc = StatusCode::FAILURE;
249
252 m_acceptInfo.addCut(m_cutNameIsolation_Photon, "Track and calorimetric isolation");
253 if (m_cutPositionIsolation_Photon < 0) sc = StatusCode::FAILURE;
254
257 m_acceptInfo.addCut(m_cutNameClusterIsolation_Photon, "calorimetric isolation only");
258 if (m_cutPositionClusterIsolation_Photon < 0) sc = StatusCode::FAILURE;
259
262 m_acceptInfo.addCut(m_cutNameTrackIsolation_Photon, "track isolation only");
263 if (m_cutPositionTrackIsolation_Photon < 0) sc = StatusCode::FAILURE;
264
265 if (sc == StatusCode::FAILURE) {
266 ATH_MSG_ERROR("Exceeded the number of allowed cuts in TPhotonIsEMSelector");
267 }
268
269 return sc;
270}
271
273 asg::AcceptData acceptData(&m_acceptInfo);
274 for (int i = 0; i < 32; i++) {
275 const unsigned int mask = (0x1u << i) & m_isEMMask;
276 acceptData.setCutResult(i, (isEM & mask) == 0);
277 }
278
279 return acceptData;
280}
281
282
290 // eta position in second sampling
291 float eta2,
292 // transverse energy in calorimeter (using eta position in second sampling)
293 double et,
294 // transverse energy in 1st scintillator of hadronic calorimeter/ET
295 float Rhad1,
296 // transverse energy in hadronic calorimeter/ET
297 float Rhad,
298 // E(7*7) in 2nd sampling
299 float e277,
300 // E(3*7)/E(7*7) in 2nd sampling
301 float Reta,
302 // E(3*3)/E(3*7) in 2nd sampling
303 float Rphi,
304 // shower width in 2nd sampling
305 float weta2c,
306 // fraction of energy reconstructed in strips
307 float f1,
308 // (E of 1st max in strips-E of 2nd max)/(E of 1st max+E of 2nd max)
309 float Eratio,
310 // E(2nd max)-E(min) in strips
311 float DeltaE,
312 // shower width in 3 strips in 1st sampling
313 float weta1c,
314 // total shower width in strips
315 float wtot,
316 // E(+/-3)-E(+/-1)/E(+/-1)
317 float fracm,
318 // fraction of energy reconstructed in the 3rd sampling
319 float f3,
320 // E/p
321 double ep,
322 // is it a conversion
323 bool isConversion,
324 // pileup
325 float mu) {
326
327 // Do the actual selection
328
329 unsigned int isEM = calcIsEm(eta2,
330 et,
331 Rhad1,
332 Rhad,
333 e277,
334 Reta,
335 Rphi,
336 weta2c,
337 f1,
338 Eratio,
339 DeltaE,
340 weta1c,
341 wtot,
342 fracm,
343 f3,
344 ep,
345 isConversion,
346 mu);
347
348 return fillAccept(isEM);
349}
350
351
352//=============================================================================
353// calculate the isEM. (Used internally by accept)
354//=============================================================================
356 // eta position in second sampling
357 float eta2,
358 // transverse energy in calorimeter (using eta position in second sampling)
359 double et,
360 // transverse energy in 1st scintillator of hadronic calorimeter/ET
361 float Rhad1,
362 // transverse energy in hadronic calorimeter/ET
363 float Rhad,
364 // E(7*7) in 2nd sampling
365 float e277,
366 // E(3*7)/E(7*7) in 2nd sampling
367 float Reta,
368 // E(3*3)E(3*7) in 2nd sampling
369 float Rphi,
370 // shower width in 2nd sampling
371 float weta2c,
372 // fraction of energy reconstructed in strips
373 float f1,
374 // (E of 1st max in strips-E of 2nd max)/(E of 1st max+E of 2nd max)
375 float Eratio,
376 // E(2nd max)-E(min) in strips
377 float DeltaE,
378 // shower width in 3 strips in 1st sampling
379 float weta1c,
380 // total shower width in strips
381 float wtot,
382 // E(+/-3)-E(+/-1)/E(+/-1)
383 float fracm,
384 // fraction of energy reconstructed in the 3rd sampling
385 float f3,
386 // E/p
387 double ep,
388 // is it a conversion
389 bool isConversion,
390 // pileup
391 float mu) const {
392 unsigned int iflag = 0;
393
394 // apply calorimeter selection for photons
396 // force to test converted photon hypothesis
397 iflag = calocuts_photonsConverted(eta2,
398 et,
399 Rhad1,
400 Rhad,
401 e277,
402 Reta,
403 Rphi,
404 weta2c,
405 f1,
406 Eratio,
407 DeltaE,
408 weta1c,
409 wtot,
410 fracm,
411 f3,
412 ep,
413 iflag,
414 mu);
415
416 } else if (m_forceNonConvertedPhotonPID || !isConversion) {
417 iflag = calocuts_photonsNonConverted(eta2,
418 et,
419 Rhad1,
420 Rhad,
421 e277,
422 Reta,
423 Rphi,
424 weta2c,
425 f1,
426 Eratio,
427 DeltaE,
428 weta1c,
429 wtot,
430 fracm,
431 f3,
432 iflag,
433 mu);
434 } else {
435 iflag = calocuts_photonsConverted(eta2,
436 et,
437 Rhad1,
438 Rhad,
439 e277,
440 Reta,
441 Rphi,
442 weta2c,
443 f1,
444 Eratio,
445 DeltaE,
446 weta1c,
447 wtot,
448 fracm,
449 f3,
450 ep,
451 iflag,
452 mu);
453 }
454
455
456 return iflag;
457}
458
459
465 // eta position in second sampling
466 float eta2,
467 // transverse energy in calorimeter
468 double et,
469 // hadronic leakage ratios
470 float Rhad1,
471 float Rhad,
472 // E(7*7) in 2nd sampling
473 float e277,
474 // ratios
475 float Reta,
476 float Rphi,
477 // shower width in 2nd sampling
478 float weta2c,
479 // fraction of energy reconstructed in strips
480 float f1,
481 // (Emax1-Emax2)/(Emax1+Emax2)
482 float Eratio,
483 // difference of energy between max and min
484 float DeltaE,
485 // shower width in 3 strips in 1st sampling
486 float weta1c,
487 // total shower width in strips
488 float wtot,
489 // E(+/-3)-E(+/-1)/E(+/-1)
490 float fracm,
491 // fraction of energy reconstructed in the 3rd sampling
492 float f3,
493 unsigned int iflag,
494 // pileup
495 float mu) const {
496 //
497 // second sampling cuts
498 //
499 if ((m_e277_photonsNonConverted.empty())) {
500 ATH_MSG_WARNING("e277 needs to be set ");
501 }
502 if (!m_e277_photonsNonConverted.empty() && e277 >= m_e277_photonsNonConverted[0]) {
503 int ibine = 0;
504 // loop on ET range
505 for (unsigned int ibe = 1; ibe <= m_cutBinEnergy_photonsNonConverted.size();
506 ibe++) {
507 if (ibe < m_cutBinEnergy_photonsNonConverted.size()) {
508 if (et >= m_cutBinEnergy_photonsNonConverted[ibe - 1] &&
510 ibine = ibe;
511 }
512 } else if (ibe == m_cutBinEnergy_photonsNonConverted.size()) {
513 if (et >= m_cutBinEnergy_photonsNonConverted[ibe - 1]) {
514 ibine = ibe;
515 }
516 }
517 }
518
519 int ibinEta = -1;
520 // loop on eta range
521 for (unsigned int ibin = 0; ibin < m_cutBinEta_photonsNonConverted.size();
522 ibin++) {
523 if (ibin == 0) {
524 if (eta2 < m_cutBinEta_photonsNonConverted[0]) {
525 ibinEta = 0;
526 }
527 } else {
528 if (eta2 >= m_cutBinEta_photonsNonConverted[ibin - 1] &&
529 eta2 < m_cutBinEta_photonsNonConverted[ibin]) {
530 ibinEta = ibin;
531 }
532 }
533 }
534
535 //Negative ibinEta means we are ouside the range
536 //e.g abs(eta) > 2.47 or so
537 if (ibinEta < 0) {
538 iflag |= (0x1 << egammaPID::ClusterEtaRange_Photon);
539 return iflag;
540 }
541
542 int ibinMu = 0;
543 // loop on mu range
544 for (unsigned int ibin=1; ibin <= m_cutBinMu_photonsNonConverted.size();
545 ibin++) {
546 if ( ibin < m_cutBinMu_photonsNonConverted.size() ) {
547 if ( mu >= m_cutBinMu_photonsNonConverted[ibin-1] &&
548 mu < m_cutBinMu_photonsNonConverted[ibin] ) {
549 ibinMu = ibin;
550 }
551 }
552 else if ( ibin == m_cutBinMu_photonsNonConverted.size() ) {
553 if ( mu >= m_cutBinMu_photonsNonConverted[ibin-1] ) {
554 ibinMu = ibin;
555 }
556 }
557 }
558
559 // check the bin number
560 //const int ibin_combined = ibine * m_cutBinEta_photonsNonConverted.size() + ibinEta;
561 const int ibin_combined
562 = ibinMu * ( m_cutBinEta_photonsNonConverted.size() *
564 + ibine * m_cutBinEta_photonsNonConverted.size()
565 + ibinEta;
566
567 // hadronic leakage
569 if (eta2 < 0.8) {
570 if (Rhad1 > m_cutHadLeakage_photonsNonConverted[ibin_combined])
572 } else if (eta2 >= 0.8 && eta2 < 1.37) {
573 if (Rhad > m_cutHadLeakage_photonsNonConverted[ibin_combined])
575 } else {
576 if (Rhad1 > m_cutHadLeakage_photonsNonConverted[ibin_combined])
578 }
579 }
580
581 // F3
583 if (f3 > m_cutF3_photonsNonConverted[ibin_combined]) {
585 }
586 }
587
588 // E237/E277
590 if (Reta < m_Reta37_photonsNonConverted[ibin_combined]) {
592 }
593 }
594
595 // E233/E237
597 if (Rphi < m_Rphi33_photonsNonConverted[ibin_combined]) {
599 }
600 }
601
602 // width in 2n sampling
604 if (weta2c > m_weta2_photonsNonConverted[ibin_combined]) {
605 iflag |= (0x1 << egammaPID::ClusterMiddleWidth_Photon);
606 }
607 }
608 } else {
610 }
611
612 //
613 // first sampling cuts
614 //
616
617 int ibineStrips = 0;
618 // loop on ET range
619 for (unsigned int ibe = 1; ibe <= m_cutBinEnergyStrips_photonsNonConverted.size(); ibe++) {
623 ibineStrips = ibe;
624 }
625 } else if (ibe == m_cutBinEnergyStrips_photonsNonConverted.size()) {
627 ibineStrips = ibe;
628 }
629 }
630 }
631
632 int ibinEtaStrips = -1;
633 // loop on eta range
634 for (unsigned int ibin = 0; ibin < m_cutBinEtaStrips_photonsNonConverted.size(); ibin++) {
635 if (ibin == 0) {
637 ibinEtaStrips = 0;
638 }
639 } else {
640 if (eta2 >= m_cutBinEtaStrips_photonsNonConverted[ibin - 1] &&
642 ibinEtaStrips = ibin;
643 }
644 }
645 }
646
647 //Negative ibinEta means we are ouside the range
648 //e.g abs(eta) > 2.47 or so
649 if (ibinEtaStrips < 0) {
650 iflag |= (0x1 << egammaPID::ClusterEtaRange_Photon);
651 return iflag;
652 }
653
654 int ibinMuStrips = 0;
655 // loop on mu range
656 for (unsigned int ibmu=1;
657 ibmu <= m_cutBinMuStrips_photonsNonConverted.size(); ibmu++) {
658 if ( ibmu <m_cutBinMuStrips_photonsNonConverted.size() ) {
659 if ( mu >= m_cutBinMuStrips_photonsNonConverted[ibmu-1] &&
661 ibinMuStrips = ibmu;
662 }
663 }
664 else if ( ibmu == m_cutBinMuStrips_photonsNonConverted.size() ) {
665 if ( mu >= m_cutBinMuStrips_photonsNonConverted[ibmu-1] ) {
666 ibinMuStrips = ibmu;
667 }
668 }
669 }
670
671 //const int ibin_combinedStrips = ibineStrips * m_cutBinEtaStrips_photonsNonConverted.size() + ibinEtaStrips;
672 const int ibin_combinedStrips
673 = ibinMuStrips * m_cutBinEtaStrips_photonsNonConverted.size()
675 + ibineStrips * m_cutBinEtaStrips_photonsNonConverted.size()
676 + ibinEtaStrips;
677
679 if (f1 < m_f1_photonsNonConverted[0]) {
681 }
682 }
683
684 // Delta E
686 if (DeltaE > m_deltae_photonsNonConverted[ibin_combinedStrips]) {
688 }
689 }
690
691 // Eratio
693 if (Eratio <= m_DEmaxs1_photonsNonConverted[ibin_combinedStrips])
695 }
696
697 // total width in strips
699 if (wtot > m_wtot_photonsNonConverted[ibin_combinedStrips]) {
700 iflag |= (0x1 << egammaPID::ClusterStripsWtot_Photon);
701 }
702 }
703
704 // (E(+/-3)-E(+/-1))/E(+/-1)
706 if (fracm > m_fracm_photonsNonConverted[ibin_combinedStrips]) {
707 iflag |= (0x1 << egammaPID::ClusterStripsFracm_Photon);
708 }
709 }
710
711 // width in 3 strips
713 if (weta1c > m_w1_photonsNonConverted[ibin_combinedStrips]) {
715 }
716 }
717 }
718 return iflag;
719}
720
727 // eta position in second sampling
728 float eta2,
729 // transverse energy in calorimeter
730 double et,
731 // hadronic leakage ratios
732 float Rhad1,
733 float Rhad,
734 // E(7*7) in 2nd sampling
735 float e277,
736 // ratios
737 float Reta,
738 float Rphi,
739 // shower width in 2nd sampling
740 float weta2c,
741 // fraction of energy reconstructed in strips
742 float f1,
743 // (Emax1-Emax2)/(Emax1+Emax2)
744 float Eratio,
745 // difference of energy between max and min
746 float DeltaE,
747 // parametrization of E(2nd max)
748 // float deltaemax2,
749 // shower width in 3 strips in 1st sampling
750 float weta1c,
751 // total shower width in strips
752 float wtot,
753 // E(+/-3)-E(+/-1)/E(+/-1)
754 float fracm,
755 // fraction of energy reconstructed in the 3rd sampling
756 float f3,
757 // E/p
758 double ep,
759 unsigned int iflag,
760 // pileup
761 float mu) const {
762 int ibine = 0;
763 // loop on ET range
764 for (unsigned int ibe = 1; ibe <= m_cutBinEnergy_photonsConverted.size(); ibe++) {
765 if (ibe < m_cutBinEnergy_photonsConverted.size()) {
766 if (et >= m_cutBinEnergy_photonsConverted[ibe - 1] &&
768 ibine = ibe;
769 }
770 } else if (ibe == m_cutBinEnergy_photonsConverted.size()) {
771 if (et >= m_cutBinEnergy_photonsConverted[ibe - 1]) {
772 ibine = ibe;
773 }
774 }
775 }
776
777 int ibinEta = -1;
778 // loop on eta range
779 for (unsigned int ibin = 0; ibin < m_cutBinEta_photonsConverted.size(); ibin++) {
780 if (ibin == 0) {
781 if (eta2 < m_cutBinEta_photonsConverted[0]) {
782 ibinEta = 0;
783 }
784 } else {
785 if (eta2 >= m_cutBinEta_photonsConverted[ibin - 1] &&
786 eta2 < m_cutBinEta_photonsConverted[ibin]) {
787 ibinEta = ibin;
788 }
789 }
790 }
791 //Negative ibinEta means we are ouside the range
792 //e.g abs(eta) > 2.47 or so
793 if (ibinEta < 0) {
794 iflag |= (0x1 << egammaPID::ClusterEtaRange_Photon);
795 return iflag;
796 }
797
798 int ibinMu = 0;
799 // loop on mu range
800 for (unsigned int ibin=1; ibin <= m_cutBinMu_photonsConverted.size(); ibin++) {
801 if ( ibin < m_cutBinMu_photonsConverted.size() ) {
802 if ( mu >= m_cutBinMu_photonsConverted[ibin-1] &&
803 mu < m_cutBinMu_photonsConverted[ibin] ) {
804 ibinMu = ibin;
805 }
806 }
807 else if ( ibin == m_cutBinMu_photonsConverted.size() ) {
808 if ( mu >= m_cutBinMu_photonsConverted[ibin-1] ) {
809 ibinMu = ibin;
810 }
811 }
812 }
813
814 // check the bin number
815 //const int ibin_combined = ibine * m_cutBinEta_photonsConverted.size() + ibinEta;
816 const int ibin_combined
817 = ibinMu * ( m_cutBinEta_photonsConverted.size() *
819 + ibine * m_cutBinEta_photonsConverted.size()
820 + ibinEta;
821
822 //
823 // second sampling cuts
824 //
825 if ((m_e277_photonsConverted.empty())) {
826 ATH_MSG_WARNING("e277 needs to be set ");
827 }
828 if (!m_e277_photonsConverted.empty() && e277 >= m_e277_photonsConverted[0]) {
829
830 // hadronic leakage
832 if (eta2 < 0.8) {
833 if (Rhad1 > m_cutHadLeakage_photonsConverted[ibin_combined])
835 } else if (eta2 >= 0.8 && eta2 < 1.37) {
836 if (Rhad > m_cutHadLeakage_photonsConverted[ibin_combined])
838 } else {
839 if (Rhad1 > m_cutHadLeakage_photonsConverted[ibin_combined])
841 }
842 }
843
844 // F3
846 if (f3 > m_cutF3_photonsConverted[ibin_combined]) {
848 }
849 }
850
851 // E237/E277
853 if (Reta < m_Reta37_photonsConverted[ibin_combined]) {
855 }
856 }
857
858 // E233/E237
860 if (Rphi < m_Rphi33_photonsConverted[ibin_combined]) {
862 }
863 }
864
865 // width in 2n sampling
867 if (weta2c > m_weta2_photonsConverted[ibin_combined]) {
868 iflag |= (0x1 << egammaPID::ClusterMiddleWidth_Photon);
869 }
870 }
871 } else {
873 }
874
875 //
876 // first sampling cuts
877 //
879
880 int ibineStrips = 0;
881 // loop on ET range
882 for (unsigned int ibe = 1; ibe <= m_cutBinEnergyStrips_photonsConverted.size(); ibe++) {
883 if (ibe < m_cutBinEnergyStrips_photonsConverted.size()) {
886 ibineStrips = ibe;
887 }
888 } else if (ibe == m_cutBinEnergyStrips_photonsConverted.size()) {
890 ibineStrips = ibe;
891 }
892 }
893 }
894
895 int ibinEtaStrips = -1;
896 // loop on eta range
897 for (unsigned int ibin = 0; ibin < m_cutBinEtaStrips_photonsConverted.size(); ibin++) {
898 if (ibin == 0) {
900 ibinEtaStrips = 0;
901 }
902 } else {
903 if (eta2 >= m_cutBinEtaStrips_photonsConverted[ibin - 1] &&
905 ibinEtaStrips = ibin;
906 }
907 }
908 }
909
910 int ibinMuStrips = 0;
911 // loop on mu range
912 for (unsigned int ibmu=1;
913 ibmu <= m_cutBinMuStrips_photonsConverted.size(); ibmu++) {
914 if ( ibmu <m_cutBinMuStrips_photonsConverted.size() ) {
915 if ( mu >= m_cutBinMuStrips_photonsConverted[ibmu-1] &&
917 ibinMuStrips = ibmu;
918 }
919 }
920 else if ( ibmu == m_cutBinMuStrips_photonsConverted.size() ) {
921 if ( mu >= m_cutBinMuStrips_photonsConverted[ibmu-1] ) {
922 ibinMuStrips = ibmu;
923 }
924 }
925 }
926
927 // check the bin number
928 if (ibinEtaStrips == -1) {
929 iflag |= (0x1 << egammaPID::ClusterEtaRange_Photon);
930 return iflag;
931 }
932
933 //const int ibin_combinedStrips = ibineStrips * m_cutBinEtaStrips_photonsConverted.size() + ibinEtaStrips;
934 const int ibin_combinedStrips
935 = ibinMuStrips * m_cutBinEtaStrips_photonsNonConverted.size()
937 + ibineStrips * m_cutBinEtaStrips_photonsNonConverted.size()
938 + ibinEtaStrips;
939
941 if (f1 < m_f1_photonsConverted[0]) {
943 }
944 }
945
946 // Delta E
948 if (DeltaE > m_deltae_photonsConverted[ibin_combinedStrips]) {
950 }
951 }
952
953 // Eratio
955 if (Eratio <= m_DEmaxs1_photonsConverted[ibin_combinedStrips])
957 }
958
959 // total width in strips
961 if (wtot > m_wtot_photonsConverted[ibin_combinedStrips]) {
962 iflag |= (0x1 << egammaPID::ClusterStripsWtot_Photon);
963 }
964 }
965
966 // (E(+/-3)-E(+/-1))/E(+/-1)
968 if (fracm > m_fracm_photonsConverted[ibin_combinedStrips]) {
969 iflag |= (0x1 << egammaPID::ClusterStripsFracm_Photon);
970 }
971 }
972
973 // width in 3 strips
975 if (weta1c > m_w1_photonsConverted[ibin_combinedStrips]) {
977 }
978 }
979 }
980
981 // cut on E/p
982 //
985 if (ep < m_cutminEp_photonsConverted[ibin_combined] ||
986 ep > m_cutmaxEp_photonsConverted[ibin_combined])
987 iflag |= (0x1 << egammaPID::TrackMatchEoverP_Photon);
988 }
989
990 return iflag;
991}
992
1012template<typename T>
1013bool Root::TPhotonIsEMSelector::checkVar(const std::vector <T> &vec, int choice) const {
1014 // check vector size
1015
1016
1017 const unsigned int etaNB_photonsConv = m_cutBinEta_photonsConverted.size();
1018 const unsigned int etNB_photonsConv = m_cutBinEnergy_photonsConverted.size();
1019 const unsigned int muNB_photonsConv = m_cutBinMu_photonsConverted.size();
1020 const unsigned int etaStripsNB_photonsConv = m_cutBinEtaStrips_photonsConverted.size();
1021 const unsigned int etStripsNB_photonsConv = m_cutBinEnergyStrips_photonsConverted.size();
1022 const unsigned int muStripsNB_photonsConv = m_cutBinMuStrips_photonsConverted.size();
1023 const unsigned int etaNB_photonsNonConv = m_cutBinEta_photonsNonConverted.size();
1024 const unsigned int etNB_photonsNonConv = m_cutBinEnergy_photonsNonConverted.size();
1025 const unsigned int muNB_photonsNonConv = m_cutBinMu_photonsNonConverted.size();
1026 const unsigned int etaStripsNB_photonsNonConv = m_cutBinEtaStrips_photonsNonConverted.size();
1027 const unsigned int etStripsNB_photonsNonConv = m_cutBinEnergyStrips_photonsNonConverted.size();
1028 const unsigned int muStripsNB_photonsNonConv = m_cutBinMuStrips_photonsNonConverted.size();
1029
1030 unsigned int combinedStripsNB_photonsConv = etaStripsNB_photonsConv;
1031 unsigned int combinedStripsNB_photonsNonConv = etaStripsNB_photonsNonConv;
1032 unsigned int combinedNB_photonsNonConv = etaNB_photonsNonConv;
1033 unsigned int combinedNB_photonsConv = etaNB_photonsConv;
1034
1035 // pt-dependent cuts
1036 if (etStripsNB_photonsNonConv > 0)
1037 combinedStripsNB_photonsNonConv = etaStripsNB_photonsNonConv * (etStripsNB_photonsNonConv + 1);
1038
1039 if (etNB_photonsConv > 0)
1040 combinedNB_photonsConv = etaNB_photonsConv * (etNB_photonsConv + 1);
1041
1042 if (etStripsNB_photonsConv > 0)
1043 combinedStripsNB_photonsConv = etaStripsNB_photonsConv * (etStripsNB_photonsConv + 1);
1044
1045 if (etNB_photonsNonConv > 0)
1046 combinedNB_photonsNonConv = etaNB_photonsNonConv * (etNB_photonsNonConv + 1);
1047
1048 // mu-dependent cuts
1049 if (muStripsNB_photonsNonConv > 0)
1050 combinedStripsNB_photonsNonConv *= (muStripsNB_photonsNonConv + 1);
1051
1052 if (muNB_photonsConv > 0)
1053 combinedNB_photonsConv *= (muNB_photonsConv + 1);
1054
1055 if (muStripsNB_photonsConv > 0)
1056 combinedStripsNB_photonsConv *= (muStripsNB_photonsConv + 1);
1057
1058 if (muNB_photonsNonConv > 0)
1059 combinedNB_photonsNonConv *= (muNB_photonsNonConv + 1);
1060
1061 // if size of vector is 0 it means cut is not defined
1062 if (vec.empty()) return false;
1063 // check if size is 1
1064 if (choice == 0) {
1065 if (vec.size() != 1) {
1066 ATH_MSG_ERROR("vector size is "
1067 << vec.size() << " but needs 1");
1068 return false;
1069 }
1070 }
1071
1072 // check if size is etaNB_photonsConv
1073 if (choice == 11) {
1074
1075 if (vec.size() != etaNB_photonsConv) {
1076 ATH_MSG_ERROR("vector size is "
1077 << vec.size() << " but needs etaNB_photonsConv "
1078 << etaNB_photonsConv);
1079 return false;
1080
1081 }
1082 }
1083
1084 // check if size is etNB_photonsConv
1085 if (choice == 12) {
1086 if (vec.size() != etNB_photonsConv) {
1087 ATH_MSG_ERROR("vector size is "
1088 << vec.size() << " but needs etNB_photonsConv="
1089 << etNB_photonsConv);
1090 return false;
1091 }
1092 }
1093
1094 // check if size is combinedNB_photonsConv
1095 if (choice == 13) {
1096 if (vec.size() != combinedNB_photonsConv) {
1097 ATH_MSG_ERROR("vector size is "
1098 << vec.size() << " but needs combinedNB_photonsConv="
1099 << combinedNB_photonsConv);
1100 return false;
1101 }
1102 }
1103
1104 // check if size is etaStripsNB_photonsConv
1105 if (choice == 14) {
1106 if (vec.size() != etaStripsNB_photonsConv) {
1107 ATH_MSG_ERROR("vector size is "
1108 << vec.size() << " but needs etaStripsNB_photonsConv="
1109 << etaStripsNB_photonsConv);
1110 return false;
1111 }
1112 }
1113
1114 // check if size is etStripsNB_photonsConv
1115 if (choice == 15) {
1116 if (vec.size() != etStripsNB_photonsConv) {
1117 ATH_MSG_ERROR("vector size is "
1118 << vec.size() << " but needs etStripsNB_photonsConv="
1119 << etStripsNB_photonsConv);
1120 return false;
1121 }
1122 }
1123
1124 // check if size is combinedStripsNB_photonsConv
1125 if (choice == 16) {
1126 if (vec.size() != combinedStripsNB_photonsConv) {
1127 ATH_MSG_ERROR("vector size is "
1128 << vec.size() << " but needs combinedStripsNB_photonsConv="
1129 << combinedStripsNB_photonsConv);
1130 return false;
1131 }
1132 }
1133
1134 // check if size is etaNB_photonsNonConv
1135 if (choice == 21) {
1136 if (vec.size() != etaNB_photonsNonConv) {
1137 ATH_MSG_ERROR("vector size is "
1138 << vec.size() << " but needs etaNB_photonsNonConv "
1139 << etaNB_photonsNonConv);
1140 return false;
1141 }
1142 }
1143
1144 // check if size is etNB_photonsNonConv
1145 if (choice == 22) {
1146 if (vec.size() != etNB_photonsNonConv) {
1147 ATH_MSG_ERROR("vector size is "
1148 << vec.size() << " but needs etNB_photonsNonConv="
1149 << etNB_photonsNonConv);
1150 return false;
1151 }
1152 }
1153
1154 // check if size is combinedNB_photonsNonConv
1155 if (choice == 23) {
1156 if (vec.size() != combinedNB_photonsNonConv) {
1157 ATH_MSG_ERROR("vector size is "
1158 << vec.size() << " but needs combinedNB_photonsNonConv="
1159 << combinedNB_photonsNonConv);
1160 return false;
1161 }
1162 }
1163
1164 // check if size is etaStripsNB_photonsNonConv
1165 if (choice == 24) {
1166 if (vec.size() != etaStripsNB_photonsNonConv) {
1167 ATH_MSG_ERROR("vector size is "
1168 << vec.size() << " but needs etaStripsNB_photonsNonConv="
1169 << etaStripsNB_photonsNonConv);
1170 return false;
1171 }
1172 }
1173
1174 // check if size is etStripsNB_photonsNonConv
1175 if (choice == 25) {
1176 if (vec.size() != etStripsNB_photonsNonConv) {
1177 ATH_MSG_ERROR("vector size is "
1178 << vec.size() << " but needs etStripsNB_photonsNonConv="
1179 << etStripsNB_photonsNonConv);
1180 return false;
1181 }
1182 }
1183
1184 // check if size is combinedStripsNB_photonsNonConv
1185 if (choice == 26) {
1186 if (vec.size() != combinedStripsNB_photonsNonConv) {
1187 ATH_MSG_ERROR("vector size is "
1188 << vec.size() << " but needs combinedStripsNB_photonsNonConv="
1189 << combinedStripsNB_photonsNonConv);
1190 return false;
1191 }
1192 }
1193
1194 return true;
1195
1196
1197}
1198
1199template bool Root::TPhotonIsEMSelector::checkVar<float>(const std::vector<float> &vec, int choice) const;
1200
1201template bool Root::TPhotonIsEMSelector::checkVar<int>(const std::vector<int> &vec, int choice) const;
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
std::vector< size_t > vec
static Double_t sc
std::vector< float > m_cutBinEnergy_photonsNonConverted
range of ET bins for photon-ID
std::vector< float > m_cutHadLeakage_photonsConverted
Cut on hadronic leakage for photons.
int m_cutPositionTrackIsolation_Photon
tracker isolation for photon selection
const std::string m_cutNameClusterIsolation_Photon
calorimetric isolation for photon selection
std::vector< float > m_e277_photonsConverted
Cut in E277 for photons.
asg::AcceptData fillAccept(unsigned int isEM) const
std::vector< float > m_DEmaxs1_photonsConverted
cut on (Emax1-Emax2)/(Emax1-Emax2) for photons
int m_cutPositionClusterBackEnergyFraction_Photon
energy fraction in the third layer
const std::string m_cutNameClusterStripsDeltaE_Photon
energy of 2nd maximum in 1st sampling ~e2tsts1/(1000+const_lumi*et)
std::vector< float > m_w1_photonsNonConverted
Cut on width in 3 strips for photons.
bool m_forceNonConvertedPhotonPID
boolean to force to test non converted photon hypothesis
std::vector< float > m_deltae_photonsNonConverted
Cut on Demax2 for photons.
const std::string m_cutNameClusterMiddleEratio33_Photon
energy ratio in 2nd sampling for photons
bool m_forceConvertedPhotonPID
boolean to force to test converted photon hypothesis
int m_cutPositionClusterStripsFracm_Photon
shower shape in shower core 1st sampling
std::vector< float > m_cutBinEta_photonsNonConverted
range of eta bins for photon-ID
int m_cutPositionClusterHadronicLeakage_Photon
cluster leakage into the hadronic calorimeter
std::vector< float > m_cutBinEtaStrips_photonsNonConverted
binning in eta in strips for photons
std::vector< float > m_cutminEp_photonsConverted
cut min on E/p for e-ID
int m_cutPositionClusterStripsEratio_Photon
fraction of energy found in 1st sampling
std::vector< float > m_f1_photonsNonConverted
Cut on fraction of energy rec.
StatusCode initialize()
Initialize this class.
int m_cutPositionClusterIsolation_Photon
calorimetric isolation for photon selection
std::vector< float > m_cutHadLeakage_photonsNonConverted
Cut on hadronic leakage for photons.
unsigned int m_isEMMask
which subset of cuts to apply
~TPhotonIsEMSelector()
Standard destructor.
asg::AcceptInfo m_acceptInfo
Accept info.
int m_cutPositionClusterEtaRange_Photon
cluster eta range
TPhotonIsEMSelector(const char *name="TPhotonIsEMSelector")
Standard constructor.
std::vector< float > m_Reta37_photonsConverted
ratio E237/E277
std::vector< float > m_Reta37_photonsNonConverted
ratio E237/E277
std::vector< float > m_fracm_photonsConverted
Cut on fraction of energy outside core for photons.
std::vector< float > m_cutBinEnergy_photonsConverted
range of ET bins for photon-ID
std::vector< float > m_f1_photonsConverted
Cut on fraction of energy rec.
std::vector< float > m_cutBinEnergyStrips_photonsNonConverted
std::vector< float > m_wtot_photonsNonConverted
Cut on total width in strips for photons.
std::vector< float > m_wtot_photonsConverted
Cut on total width in strips for photons.
int m_cutPositionClusterStripsWeta1c_Photon
shower width weighted by distance from the maximum one
std::vector< float > m_cutBinMuStrips_photonsNonConverted
binning in pielup in strips for photons
int m_cutPositionAmbiguityResolution_Photon
ambiguity resolution for photon (vs electron)
const std::string m_cutNameClusterEtaRange_Photon
cluster eta range
std::vector< float > m_DEmaxs1_photonsNonConverted
cut on (Emax1-Emax2)/(Emax1-Emax2) for photons
std::vector< float > m_cutBinMu_photonsNonConverted
range of mu bins for photon-ID
std::vector< float > m_w1_photonsConverted
Cut on width in 3 strips for photons.
std::vector< float > m_fracm_photonsNonConverted
Cut on fraction of energy outside core for photons.
const std::string m_cutNameClusterStripsWtot_Photon
shower width in 1st sampling
int m_cutPositionClusterMiddleEnergy_Photon
energy in 2nd sampling (e277)
int m_cutPositionClusterStripsDeltaE_Photon
energy of 2nd maximum in 1st sampling ~e2tsts1/(1000+const_lumi*et)
std::vector< float > m_cutBinMu_photonsConverted
range of mu bins for photon-ID
std::vector< float > m_deltae_photonsConverted
Cut on Demax2 for photons.
std::vector< float > m_Rphi33_photonsNonConverted
ratio E233/E237
const std::string m_cutNameClusterMiddleWidth_Photon
width in the second sampling
const std::string m_cutNameClusterStripsDEmaxs1_Photon
difference between max and 2nd max in strips
std::vector< float > m_cutBinEta_photonsConverted
range of eta bins for photon-ID
std::vector< float > m_cutBinMuStrips_photonsConverted
binning in pileup in strips for photons
std::vector< float > m_weta2_photonsNonConverted
Cut on width in 2nd sampling for photons.
std::vector< float > m_cutF3_photonsNonConverted
cut values for cut on f3 or f3core
int m_cutPositionClusterMiddleWidth_Photon
width in the second sampling
std::vector< float > m_cutmaxEp_photonsConverted
cut max on E/p for e-ID
const std::string m_cutNameClusterMiddleEnergy_Photon
energy in 2nd sampling (e277)
std::vector< float > m_cutBinEnergyStrips_photonsConverted
std::vector< float > m_weta2_photonsConverted
Cut on width in 2nd sampling for photons.
asg::AcceptData accept() const
Return dummy accept with only info.
const std::string m_cutNameClusterHadronicLeakage_Photon
cluster leakage into the hadronic calorimeter
int m_cutPositionTrackMatchEoverP_Photon
energy-momentum match for photon selection
int m_cutPositionClusterStripsWtot_Photon
shower width in 1st sampling
const std::string m_cutNameTrackIsolation_Photon
tracker isolation for photon selection
const std::string m_cutNameTrackMatchEoverP_Photon
energy-momentum match for photon selection
int m_cutPositionClusterMiddleEratio37_Photon
energy ratio in 2nd sampling
std::vector< float > m_e277_photonsNonConverted
Cut in E277 for photons.
const std::string m_cutNameClusterMiddleEratio37_Photon
energy ratio in 2nd sampling
int m_cutPositionClusterStripsDEmaxs1_Photon
difference between max and 2nd max in strips
const std::string m_cutNameClusterStripsEratio_Photon
fraction of energy found in 1st sampling
unsigned int calcIsEm(float eta2, double et, float Rhad1, float Rhad, float e277, float Reta, float Rphi, float weta2c, float f1, float Eratio, float DeltaE, float weta1c, float wtot, float fracm, float f3, double ep, bool isConversion, float mu) const
const std::string m_cutNameIsolation_Photon
isolation
unsigned int calocuts_photonsConverted(float eta2, double et, float Rhad1, float Rhad, float e277, float Reta, float Rphi, float weta2c, float f1, float Eratio, float DeltaE, float weta1c, float wtot, float fracm, float f3, double ep, unsigned int iflag, float mu) const
Apply calorimeter cuts for selection of converted photons.
std::vector< float > m_Rphi33_photonsConverted
ratio E233/E237
unsigned int calocuts_photonsNonConverted(float eta2, double et, float Rhad1, float Rhad, float e277, float Reta, float Rphi, float weta2c, float f1, float Eratio, float DeltaE, float weta1c, float wtot, float fracm, float f3, unsigned int iflag, float mu) const
Apply calorimeter cuts for selection of non converted photons.
const std::string m_cutNameClusterStripsFracm_Photon
shower shape in shower core 1st sampling
bool checkVar(const std::vector< T > &vec, int choice) const
Method that check vector size.
int m_cutPositionClusterMiddleEratio33_Photon
energy ratio in 2nd sampling for photons
const std::string m_cutNameClusterBackEnergyFraction_Photon
energy fraction in the third layer
std::vector< float > m_cutBinEtaStrips_photonsConverted
binning in eta in strips for photons
const std::string m_cutNameAmbiguityResolution_Photon
ambiguity resolution for photon (vs electron)
const std::string m_cutNameClusterStripsWeta1c_Photon
shower width weighted by distance from the maximum one
std::vector< float > m_cutF3_photonsConverted
cut values for cut on f3 or f3core
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition AcceptData.h:134
AsgMessaging(const std::string &name)
Constructor with a name.
STL class.
@ ClusterMiddleEratio33_Photon
energy ratio in 2nd sampling for photons
@ ClusterEtaRange_Photon
cluster eta range
@ ClusterHadronicLeakage_Photon
cluster leakage into the hadronic calorimeter
@ ClusterMiddleEnergy_Photon
energy in 2nd sampling (e277)
@ ClusterMiddleWidth_Photon
width in the second sampling
@ ClusterStripsFracm_Photon
shower shape in shower core 1st sampling
@ ClusterStripsWtot_Photon
shower width in 1st sampling
@ ClusterMiddleEratio37_Photon
energy ratio in 2nd sampling
@ ClusterStripsDeltaE_Photon
difference between 2nd maximum and 1st minimum in strips (e2tsts1-emins1)
@ ClusterStripsEratio_Photon
fraction of energy found in 1st sampling
@ ClusterStripsDEmaxs1_Photon
difference between max and 2nd max in strips
@ ClusterStripsWeta1c_Photon
shower width weighted by distance from the maximum one
@ ClusterBackEnergyFraction_Photon
energy fraction in the third layer
@ TrackMatchEoverP_Photon
energy-momentum match for photon selection
STL namespace.
Extra patterns decribing particle interation process.