ATLAS Offline Software
Loading...
Searching...
No Matches
TElectronIsEMSelector.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: TElectronIsEMSelector.cxx
8PACKAGE: PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools
9
10*********************************************************************/
11
13#include <cmath>
14
15namespace{
16 const int SummaryTypeNotSet = -1;
17}
18
20 asg::AsgMessaging(std::string(name)),
21 m_isEMMask(0), //All will pass if not specified
22 m_useTRTOutliers(true),
23 m_useTRTXenonHits(false),
88 m_cutNameClusterEtaRange_Electron("ClusterEtaRange_Electron"),
90 m_cutNameConversionMatch_Electron("ConversionMatch_Electron"),
92 m_cutNameClusterHadronicLeakage_Electron("ClusterHadronicLeakage_Electron"),
94 m_cutNameClusterMiddleEnergy_Electron("ClusterMiddleEnergy_Electron"),
96 m_cutNameClusterMiddleEratio37_Electron("ClusterMiddleEratio37_Electron"),
98 m_cutNameClusterMiddleEratio33_Electron("ClusterMiddleEratio33_Electron"),
100 m_cutNameClusterMiddleWidth_Electron("ClusterMiddleWidth_Electron"),
102 m_cutNameClusterBackEnergyFraction_Electron("ClusterBackEnergyFraction_Electron"),
104 m_cutNameClusterStripsEratio_Electron("ClusterStripsEratio_Electron"),
106 m_cutNameClusterStripsDeltaEmax2_Electron("ClusterStripsDeltaEmax2_Electron"),
108 m_cutNameClusterStripsDeltaE_Electron("ClusterStripsDeltaE_Electron"),
110 m_cutNameClusterStripsWtot_Electron("ClusterStripsWtot_Electron"),
112 m_cutNameClusterStripsFracm_Electron("ClusterStripsFracm_Electron"),
114 m_cutNameClusterStripsWeta1c_Electron("ClusterStripsWeta1c_Electron"),
116 m_cutNameClusterStripsDEmaxs1_Electron("ClusterStripsDEmaxs1_Electron"),
118 m_cutNameTrackBlayer_Electron("TrackBlayer_Electron"),
120 m_cutNameTrackPixel_Electron("TrackPixel_Electron"),
122 m_cutNameTrackSi_Electron("TrackSi_Electron"),
124 m_cutNameTrackA0_Electron("TrackA0_Electron"),
126 m_cutNameTrackMatchEta_Electron("TrackMatchEta_Electron"),
128 m_cutNameTrackMatchPhi_Electron("TrackMatchPhi_Electron"),
130 m_cutNameTrackMatchEoverP_Electron("TrackMatchEoverP_Electron"),
132 m_cutNameTrackTRTeProbabilityHT_Electron("TrackTRTeProbabilityHT_Electron"),
134 m_cutNameTrackTRThits_Electron("TrackTRThits_Electron"),
136 m_cutNameTrackTRTratio_Electron("TrackTRTratio_Electron"),
138 m_cutNameTrackTRTratio90_Electron("TrackTRTratio90_Electron"),
140 m_cutNameTrackA0Tight_Electron("TrackA0Tight_Electron"),
143 m_cutNameTrackMatchEtaTight_Electron("TrackMatchEtaTight_Electron"),
145 m_cutNameIsolation_Electron("Isolation_Electron"),
147 m_cutNameClusterIsolation_Electron("ClusterIsolation_Electron"),
149 m_cutNameTrackIsolation_Electron("TrackIsolation_Electron")
150{
178}
179
181= default;
182
184{
185
186 StatusCode sc(StatusCode::SUCCESS);
187
188 // --------------------------------------------------------------------------
189 // Register the cuts and check that the registration worked:
190 // NOTE: THE ORDER IS IMPORTANT!!! Cut0 corresponds to bit 0, Cut1 to bit 1,...
193 m_acceptInfo.addCut(m_cutNameClusterEtaRange_Electron, "Electron within eta range");
194 if (m_cutPositionClusterEtaRange_Electron < 0) sc = StatusCode::FAILURE;
195
198 m_acceptInfo.addCut(m_cutNameConversionMatch_Electron, "Electron matches a photon with AR > LOOSE");
199 if (m_cutPositionConversionMatch_Electron < 0) sc = StatusCode::FAILURE;
200
203 m_acceptInfo.addCut(m_cutNameClusterHadronicLeakage_Electron, "Had leakage < Cut");
204 if (m_cutPositionClusterHadronicLeakage_Electron < 0) sc = StatusCode::FAILURE;
205
209 if (m_cutPositionClusterMiddleEnergy_Electron < 0) sc = StatusCode::FAILURE;
210
214 if (m_cutPositionClusterMiddleEratio37_Electron < 0) sc = StatusCode::FAILURE;
215
218 m_acceptInfo.addCut(m_cutNameClusterMiddleEratio33_Electron, "E233/E237 > Cut");
219 if (m_cutPositionClusterMiddleEratio33_Electron < 0) sc = StatusCode::FAILURE;
220
224 if (m_cutPositionClusterMiddleWidth_Electron < 0) sc = StatusCode::FAILURE;
225
229 if (m_cutPositionClusterBackEnergyFraction_Electron < 0) sc = StatusCode::FAILURE;
230
234 if (m_cutPositionClusterStripsEratio_Electron < 0) sc = StatusCode::FAILURE;
235
238 m_acceptInfo.addCut(m_cutNameClusterStripsDeltaEmax2_Electron, "emax2/(1000.+0.009*et) < Cut, where emax2 is the energy of the second max");
239 if (m_cutPositionClusterStripsDeltaEmax2_Electron < 0) sc = StatusCode::FAILURE;
240
243 m_acceptInfo.addCut(m_cutNameClusterStripsDeltaE_Electron, "difference between 2nd maximium and first minimum < Cut");
244 if (m_cutPositionClusterStripsDeltaE_Electron < 0) sc = StatusCode::FAILURE;
245
248 m_acceptInfo.addCut(m_cutNameClusterStripsWtot_Electron, "Total shower width in first sampling < Cut");
249 if (m_cutPositionClusterStripsWtot_Electron < 0) sc = StatusCode::FAILURE;
250
253 m_acceptInfo.addCut(m_cutNameClusterStripsFracm_Electron, "Fracm (aka Fside) < Cut");
254 if (m_cutPositionClusterStripsFracm_Electron < 0) sc = StatusCode::FAILURE;
255
258 m_acceptInfo.addCut(m_cutNameClusterStripsWeta1c_Electron, "Shower width in 3 strips in first sampling < Cut");
259 if (m_cutPositionClusterStripsWeta1c_Electron < 0) sc = StatusCode::FAILURE;
260
261 int voidcutpos = m_acceptInfo.addCut("VOID1", "No Cut"); // bit 14 is not used
262 if (voidcutpos < 0) sc = StatusCode::FAILURE;
263
266 m_acceptInfo.addCut(m_cutNameClusterStripsDEmaxs1_Electron, "Difference between first and second max > Cut");
267 if (m_cutPositionClusterStripsDEmaxs1_Electron < 0) sc = StatusCode::FAILURE;
268
271 m_acceptInfo.addCut(m_cutNameTrackBlayer_Electron, "nBL > 0, maybe including outliers and using expectHitInBLayer");
272 if (m_cutPositionTrackBlayer_Electron < 0) sc = StatusCode::FAILURE;
273
276 m_acceptInfo.addCut(m_cutNameTrackPixel_Electron, "nPi > Cut, maybe including outliers");
277 if (m_cutPositionTrackPixel_Electron < 0) sc = StatusCode::FAILURE;
278
281 m_acceptInfo.addCut(m_cutNameTrackSi_Electron, "nSi > Cut, maybe including outliers");
282 if (m_cutPositionTrackSi_Electron < 0) sc = StatusCode::FAILURE;
283
286 m_acceptInfo.addCut(m_cutNameTrackA0_Electron, "A0 (aka d0) wrt beam spot < Cut");
287 if (m_cutPositionTrackA0_Electron < 0) sc = StatusCode::FAILURE;
288
291 m_acceptInfo.addCut(m_cutNameTrackMatchEta_Electron, "Track match deta in 1st sampling < Cut");
292 if (m_cutPositionTrackMatchEta_Electron < 0) sc = StatusCode::FAILURE;
293
296 m_acceptInfo.addCut(m_cutNameTrackMatchPhi_Electron, "Track match dphi in 2nd sampling < Cut");
297 if (m_cutPositionTrackMatchPhi_Electron < 0) sc = StatusCode::FAILURE;
298
302 if (m_cutPositionTrackMatchEoverP_Electron < 0) sc = StatusCode::FAILURE;
303
304 // voidcutpos = m_acceptInfo.addCut("VOID2", "No Cut"); // bit 23 is not used
305 //if (voidcutpos < 0) sc = StatusCode::FAILURE;
306
309 m_acceptInfo.addCut(m_cutNameTrackTRTeProbabilityHT_Electron, "eProbabilityHT TRT hits > Cut");
310 if (m_cutPositionTrackTRTeProbabilityHT_Electron < 0) sc = StatusCode::FAILURE;
311
314 m_acceptInfo.addCut(m_cutNameTrackTRThits_Electron, "number of TRT hits > Cut");
315 if (m_cutPositionTrackTRThits_Electron < 0) sc = StatusCode::FAILURE;
316
319 m_acceptInfo.addCut(m_cutNameTrackTRTratio_Electron, "ration of high to all TRT hits > Cut");
320 if (m_cutPositionTrackTRTratio_Electron < 0) sc = StatusCode::FAILURE;
321
324 m_acceptInfo.addCut(m_cutNameTrackTRTratio90_Electron, "ration of high to all TRT hits > Cut, 90% cut, (only for old tight menu)");
325 if (m_cutPositionTrackTRTratio90_Electron < 0) sc = StatusCode::FAILURE;
326
329 m_acceptInfo.addCut(m_cutNameTrackA0Tight_Electron, "tight cut on d0 for old tight menu (not used otherwis)");
330 if (m_cutPositionTrackA0Tight_Electron < 0) sc = StatusCode::FAILURE;
331
335 m_acceptInfo.addCut(m_cutNameTrackMatchEtaTight_Electron, "tight cut on deta only for old tight menu");
336 if (m_cutPositionTrackMatchEtaTight_Electron < 0) sc = StatusCode::FAILURE;
337
340 m_acceptInfo.addCut(m_cutNameIsolation_Electron, "Track and calorimetric isolation");
341 if (m_cutPositionIsolation_Electron < 0) sc = StatusCode::FAILURE;
342
345 m_acceptInfo.addCut(m_cutNameClusterIsolation_Electron, "calorimetric isolation only");
346 if (m_cutPositionClusterIsolation_Electron < 0) sc = StatusCode::FAILURE;
347
350 m_acceptInfo.addCut(m_cutNameTrackIsolation_Electron, "track isolation only");
351 if (m_cutPositionTrackIsolation_Electron < 0) sc = StatusCode::FAILURE;
352
353 if (sc == StatusCode::FAILURE) {
354 ATH_MSG_ERROR("Exceeded the number of allowed cuts in TElectronIsEMSelector");
355 }
356
357 return sc;
358}
359
361{
362 asg::AcceptData acceptData(&m_acceptInfo);
363 for (int i = 0; i < 32; i++) {
364 const unsigned int mask = (0x1u << i) & m_isEMMask;
365 acceptData.setCutResult(i, (isEM & mask) == 0);
366 }
367 return acceptData;
368}
369
370//=============================================================================
371// Calculate the actual accept of each cut individually.
372//=============================================================================
374 // eta position in second sampling
375 float eta2,
376 // transverse energy in calorimeter (using eta position in second sampling)
377 double et,
379 // E(3*3) in 2nd sampling e233
380 float Reta,
381 // E(3*7) in 2nd sampling e237
382 float Rphi,
383 // transverse energy in 1st scintillator of hadronic calorimeter
384 float Rhad1,
385 // transverse energy in hadronic calorimeter
386 float Rhad,
387 // E(7*7) in 2nd sampling
388 float e277,
389 // shower width in 3 strips in 1st sampling
390 float weta1c,
391 // shower width in 2nd sampling
392 float weta2c,
393 // fraction of energy reconstructed in the 1st sampling
394 float f1,
395 // E of 2nd max between max and min in strips
396 float emax2,
397 // E of 1st max in strips
398 float Eratio,
399 // E(min) in strips
400 float DeltaE,
401 // total shower width in 1st sampling
402 float wtot,
403 // E(+/-3)-E(+/-1)/E(+/-1)
404 float fracm,
405 // fraction of energy reconstructed in the 3rd sampling
406 float f3,
408 // is effective number of BL hits+outliers at least 1?
409 bool passBLayerRequirement,
410 // number of pixel hits + dead sensors
411 int nPixHitsPlusDeadSensors,
412 // number of silicon hits + dead sensors
413 int nSiHitsPlusDeadSensors,
414 // TRT hits
415 int nTRThigh,
416 int nTRThighOutliers,
417 int nTRT,
418 int nTRTOutliers,
419 int nTRTXenonHits,
420 float TRT_PID,
421 // transverse impact parameter
422 float trackd0,
423 // Delta eta,phi matching
424 float deltaeta,
425 float deltaphi,
426 // E/p
427 double ep) const
428{
429
430 // -----------------------------------------------------------
431 // Do the actual selection
432
433 unsigned int isEM = calcIsEm(eta2,
434 et,
435 Reta, // e233,
436 Rphi, //e237,
437 Rhad1,
438 Rhad, //ethad,
439 e277,
440 weta1c,
441 weta2c,
442 f1,
443 emax2,
444 Eratio, //emax,
445 DeltaE, //emin,
446 wtot,
447 fracm,
448 f3,
449 passBLayerRequirement,
450 nPixHitsPlusDeadSensors,
451 nSiHitsPlusDeadSensors,
452 nTRThigh,
453 nTRThighOutliers,
454 nTRT,
455 nTRTOutliers,
456 nTRTXenonHits,
457 TRT_PID,
458 trackd0,
459 deltaeta,
460 deltaphi,
461 ep);
462
463 return fillAccept(isEM);
464
465}
466
467// return the isem
468unsigned int
470 // eta position in second sampling
471 float eta2,
472 // transverse energy in calorimeter (using eta position in second sampling)
473 double et,
475 // E(3*3) in 2nd sampling e233
476 float Reta,
477 // E(3*7) in 2nd sampling e237
478 float Rphi,
479 // transverse energy in 1st scintillator of hadronic calorimeter
480 float Rhad1,
481 // transverse energy in hadronic calorimeter
482 float Rhad,
483 // E(7*7) in 2nd sampling
484 float e277,
485 // shower width in 3 strips in 1st sampling
486 float weta1c,
487 // shower width in 2nd sampling
488 float weta2c,
489 // fraction of energy reconstructed in the 1st sampling
490 float f1,
491 // E of 2nd max between max and min in strips
492 float emax2,
493 // E of 1st max in strips
494 float Eratio, // replaced emax,
495 // E(min) in strips
496 float DeltaE, // emin,
497 // total shower width in 1st sampling
498 float wtot,
499 // E(+/-3)-E(+/-1)/E(+/-1)
500 float fracm,
501 // fraction of energy reconstructed in the 3rd sampling
502 float f3,
504 // is effective number of BL hits+outliers at least 1?
505 bool passBLayerRequirement,
506 // number of pixel hits + dead sensors
507 int nPixHitsPlusDeadSensors,
508 // number of silicon hits + dead sensors
509 int nSiHitsPlusDeadSensors,
510 // TRT hits
511 int nTRThigh,
512 int nTRThighOutliers,
513 int nTRT,
514 int nTRTOutliers,
515 int nTRTXenonHits,
516 float TRT_PID,
517 // transverse impact parameter
518 float trackd0,
519 // Delta eta,phi matching
520 float deltaeta,
521 float deltaphi,
522 // E/p
523 double ep) const
524{
525 unsigned int iflag = calocuts_electrons(eta2,
526 et,
527 Reta, // e233,
528 Rphi, // e237,
529 Rhad1, // ethad1,
530 Rhad, // ethad,
531 e277,
532 weta1c,
533 weta2c,
534 f1,
535 emax2,
536 Eratio, // emax,
537 DeltaE, // emin,
538 wtot,
539 fracm,
540 f3,
541 0);
542
543 iflag = TrackCut(eta2,
544 et,
545 passBLayerRequirement,
546 nPixHitsPlusDeadSensors,
547 nSiHitsPlusDeadSensors,
548 nTRThigh,
549 nTRThighOutliers,
550 nTRT,
551 nTRTOutliers,
552 nTRTXenonHits,
553 TRT_PID,
554 trackd0,
555 deltaeta,
556 deltaphi,
557 ep,
558 iflag);
559
560 return iflag;
561}
562
563unsigned int
565 // eta position in second sampling
566 float eta2,
567 // transverse energy in calorimeter (using eta position in second sampling)
568 double et,
569 // E(3*3) in 2nd sampling 233
570 float Reta,
571 // E(3*7) in 2nd sampling
572 float Rphi,
573 // transverse energy in 1st scintillator of hadronic calorimeter
574 float Rhad1,
575 // transverse energy in hadronic calorimeter
576 float Rhad,
577 // E(7*7) in 2nd sampling
578 float e277,
579 // shower width in 3 strips in 1st sampling
580 float weta1c,
581 // shower width in 2nd sampling
582 float weta2c,
583 // fraction of energy reconstructed in the 1st sampling
584 float f1,
585 // E of 2nd max between max and min in strips
586 float emax2,
587 // E of 1st max in strips (emax)
588 float Eratio,
589 // E(min) in strips (emin)
590 float DeltaE,
591 // total shower width in 1st sampling
592 float wtot,
593 // E(+/-3)-E(+/-1)/E(+/-1)
594 float fracm,
595 // fraction of energy reconstructed in the 3rd sampling
596 float f3,
597 // the starting isEM (should be 0 if new)
598 unsigned int iflag,
599 // trigETthr : threshold in ET to apply the cuts at trigger level
600 double trigEtTh) const
601{
602 // modifiy et when dealing with trigger
603 // to be sure that it will take the correct bin (VD)
604 if(trigEtTh > 0) et = trigEtTh*1.01;
605 std::vector<int> bins =FindEtEtaBin(et,eta2);
606 int ibin_et= bins.at(0);
607 int ibin_eta= bins.at(1);
608 int ibin_combined= bins.at(2);
609
610 // check eta range
611 if (eta2 > 2.47) {
612 iflag |= (0x1 << egammaPID::ClusterEtaRange_Electron);
613 }
614
615 //Negative energy. For legacy fill the Middle Energy less than 0 , should be equivalent
616 if (e277 < 0) {
617 iflag |= ( 0x1 << egammaPID::ClusterMiddleEnergy_Electron) ;
618 }
619
620 // check if index is defined
621 if (ibin_eta>=0 && ibin_et>=0 && ibin_combined>=0) {
622
623 // hadronic leakage
624 if (CheckVar(m_cutHadLeakage, 4)) {
625 if (eta2 < 0.8) {
626 if (Rhad1 > m_cutHadLeakage[ibin_combined])
628 } else if (eta2 >= 0.8 && eta2 < 1.37) {
629 if (Rhad > m_cutHadLeakage[ibin_combined])
631 } else {
632 if (Rhad1 > m_cutHadLeakage[ibin_combined])
634 }
635 }
636
637 // cut on f3
638 if (CheckVar(m_cutF3, 4)) {
639 if (f3 > m_cutF3[ibin_combined]) {
641 }
642 }
643
644 // cuts on 2nd sampling
645 if (CheckVar(m_cutReta37, 4)) {
646 if (Reta <= m_cutReta37[ibin_combined])
648 }
649 // -------------------------------
650 if (CheckVar(m_cutRphi33, 4)) {
651 if (Rphi <= m_cutRphi33[ibin_combined])
653 }
654 // -------------------------------
655 // check Weta2c
656 if (CheckVar(m_cutWeta2c, 4)) {
657 if (weta2c > m_cutWeta2c[ibin_combined])
659 }
660 // cuts on 1st sampling
661 // we remove also crack
662 if (f1 > m_cutF1[0] && eta2 < 2.37 && (eta2 < 1.37 || eta2 > 1.52)) {
663
664 // check Rmax2
665 if (CheckVar(m_cutDeltaEmax2, 4)) {
666 // parametrizatiion of emax2
667 double deltaemax2 = emax2 / (1000. + 0.009 * et);
668 if (emax2 > 0. && deltaemax2 >= m_cutDeltaEmax2[ibin_combined])
670 }
671
672 // check Delta E
673 if (CheckVar(m_cutDeltaE, 4)) {
674 if (emax2 > 0. && DeltaE >= m_cutDeltaE[ibin_combined])
676 }
677
678 // check DEmaxs1
679 if (CheckVar(m_cutDEmaxs1, 4)) {
680 if (Eratio <= m_cutDEmaxs1[ibin_combined])
682 }
683
684 // check Wtot
685 if (CheckVar(m_cutWtot, 4)) {
686 if (wtot >= m_cutWtot[ibin_combined])
688 }
689
690 // check Fside
691 if (CheckVar(m_cutFracm, 4)) {
692 if (fracm >= m_cutFracm[ibin_combined])
694 }
695
696 // check Weta1c
697 if (CheckVar(m_cutWeta1c, 4)) {
698 if (weta1c >= m_cutWeta1c[ibin_combined])
700 }
701 }
702 }
703
704 return iflag;
705}
706
707unsigned int
709 // eta of the cluster in the 2nd sampling
710 float eta2,
711 // transverse energy in calorimeter (using eta position in second sampling)
712 double et,
713 // is effective number of BL hits+outliers at least 1?
714 bool passBLayerRequirement,
715 // number of pixel hits + dead sensors
716 int nPixHitsPlusDeadSensors,
717 // number of silicon hits + dead sensors
718 int nSiHitsPlusDeadSensors,
719
720 // TRT hits
721 int nTRThigh,
722 int nTRThighOutliers,
723 int nTRT,
724 int nTRTOutliers,
725 int nTRTXenonHits,
726 float TRT_PID,
727 // transverse impact parameter
728 float trackd0,
729 // Delta eta,phi matching
730 float deltaeta,
731 float deltaphi,
732 // E/p
733 double ep,
734 unsigned int iflag) const
735{
736 // check the bin number
737 std::vector<int> bins =FindEtEtaBin(et,eta2);
738 int ibin_eta= bins.at(1);
739 int ibin_combined= bins.at(2);
740
741 if (ibin_eta >= 0 && ibin_combined >= 0) {
742 // Track quality cuts
743 // cuts on number of b-layer hits
744 if (CheckVar(m_cutBL, 1) && m_cutBL[ibin_eta] == 1 &&
745 !passBLayerRequirement) {
746 iflag |= (0x1 << egammaPID::TrackBlayer_Electron);
747 }
748 // cuts on number of pixel hits
749 if (CheckVar(m_cutPi, 1)) {
750 if (nPixHitsPlusDeadSensors < m_cutPi[ibin_eta])
751 iflag |= (0x1 << egammaPID::TrackPixel_Electron);
752 }
753 // cuts on number of precision hits
754 if (CheckVar(m_cutSi, 1)) {
755 if (nSiHitsPlusDeadSensors < m_cutSi[ibin_eta])
756 iflag |= (0x1 << egammaPID::TrackSi_Electron);
757 }
758 // cuts on transverse impact parameter
759 if (CheckVar(m_cutA0, 1)) {
760 if (trackd0 > m_cutA0[ibin_eta])
761 iflag |= (0x1 << egammaPID::TrackA0_Electron);
762 }
763 // cuts on transverse impact parameter for tight selection
764 if (CheckVar(m_cutA0Tight, 1)) {
765 if (trackd0 > m_cutA0Tight[ibin_eta])
766 iflag |= (0x1 << egammaPID::TrackA0Tight_Electron);
767 }
768
769 // matching (eta,phi) and energy-momentum
770 // cut on Delta Eta and Delta Phi
771 deltaeta = std::abs(deltaeta);
772
773 if (CheckVar(m_cutDeltaEta, 4)) {
774 if (deltaeta > m_cutDeltaEta[ibin_combined])
775 iflag |= (0x1 << egammaPID::TrackMatchEta_Electron);
776 }
777 if (CheckVar(m_cutminDeltaPhi, 4)) {
778 if (deltaphi < m_cutminDeltaPhi[ibin_combined])
779 iflag |= (0x1 << egammaPID::TrackMatchPhi_Electron);
780 }
781 if (CheckVar(m_cutmaxDeltaPhi, 4)) {
782 if (deltaphi > m_cutmaxDeltaPhi[ibin_combined])
783 iflag |= (0x1 << egammaPID::TrackMatchPhi_Electron);
784 }
785 // cut on Delta Eta for Tight selection
787 if (deltaeta > m_cutDeltaEtaTight[ibin_combined])
789 }
790
791 // cut on E/p
792 if (CheckVar(m_cutminEp, 4) && CheckVar(m_cutmaxEp, 4)) {
793 if (ep < m_cutminEp[ibin_combined] || ep > m_cutmaxEp[ibin_combined])
794 iflag |= (0x1 << egammaPID::TrackMatchEoverP_Electron);
795 }
796 }
797
798 // use of Transition Radiation Tracker
799 double rTRT = 0;
800 int nTRTTotal = 0;
801 if (m_useTRTOutliers) {
804 if (m_useTRTXenonHits && (nTRTXenonHits != SummaryTypeNotSet))
805 nTRTTotal = nTRTXenonHits;
806 else
807 nTRTTotal = nTRT + nTRTOutliers;
808
809 rTRT = (nTRTTotal) > 0
810 ? ((double)(nTRThigh + nTRThighOutliers) / (nTRTTotal))
811 : 0.;
812
813 } else {
814 rTRT = (nTRT) > 0 ? ((double)(nTRThigh) / (nTRT)) : 0.;
815 nTRTTotal = nTRT;
816 }
817
818 double DeltaNum = -100;
819 // coefficients to aproximate Number of TRT hits:
820 // zone 0: eta<0.1 parabolic
821 const double a0 = 33.14 ; const double b0 = -129.1 ; const double c0 = 1455.;
822 // zone 1: eta<0.625 cubic
823 const double a1 = 29.42 ; const double b1 = 27.93 ; const double c1 = -89.96; const double d1 = 91.51;
824 // zone 2: eta<1.07 parabolic
825 const double a2 = 196.3; const double b2 = -403.; const double c2 = 230.2;
826 // zone 3: eta <1.304 linear
827 const double a3 = -10.59; const double b3 = 37.29;
828 // zone 4: eta <1.752 cubic
829 const double a4 = -640.9; const double b4 = 1323.; const double c4 = -851.8; const double d4 = 180.8;
830 // zone 5: eta <2.0 linear
831 const double a5 = 159.8; const double b5 = -70.9;
832
833 int ibin_eta_TRT = -1;
834 //We have an array
835 //[0.1; 0.625; 1.07; 1.304; 1.752; 2.0]
836 //Above 2.0 we do not have a TRT ,
837 //so valid values will be 0 -5 in the above case
838 if (!m_cutBinEta_TRT.empty()&& eta2<m_cutBinEta_TRT.back()) {
839 const int numBins = (m_cutBinEta_TRT.size()-1);
840 int ibinEta = 0;
841 while (ibinEta < numBins && eta2 > m_cutBinEta_TRT[ibinEta]) {
842 ++ibinEta;
843 }
844 ibin_eta_TRT = ibinEta;
845 }
846
847 if (ibin_eta_TRT >= 0) {
848 switch (ibin_eta_TRT) {
849 case 0: {
850 DeltaNum = nTRTTotal - (a0 + b0 * eta2 + c0 * eta2 * eta2);
851 } break;
852 case 1: {
853 DeltaNum = nTRTTotal - (a1 + b1 * eta2 + c1 * eta2 * eta2 +
854 d1 * eta2 * eta2 * eta2);
855 } break;
856 case 2: {
857 DeltaNum = nTRTTotal - (a2 + b2 * eta2 + c2 * eta2 * eta2);
858 } break;
859 case 3: {
860 DeltaNum = nTRTTotal - (a3 + b3 * eta2);
861 } break;
862 case 4: {
863 DeltaNum = nTRTTotal - (a4 + b4 * eta2 + c4 * eta2 * eta2 +
864 d4 * eta2 * eta2 * eta2);
865 } break;
866 case 5: {
867 DeltaNum = nTRTTotal - (a5 + b5 * eta2);
868 }
869 }
870
871 if (CheckVar(m_cutNumTRT, 2)) {
872 if (DeltaNum < m_cutNumTRT[ibin_eta_TRT]) {
873 iflag |= (0x1 << egammaPID::TrackTRThits_Electron);
874 }
875 }
876
877 int ibin_et_TRT = -1;
878 // loop on ET range
879 if (!m_cutBinET_TRT.empty()) {
880 const int numBins = m_cutBinET_TRT.size();
881 int ibinET = 0;
882 while (ibinET < numBins && et > m_cutBinET_TRT[ibinET]) {
883 ++ibinET;
884 }
885 ibin_et_TRT = ibinET;
886 }
887
888 int ibin_combined_TRT =ibin_eta_TRT;
889 if(ibin_et_TRT>0){
890 ibin_combined_TRT =ibin_et_TRT*m_cutBinEta_TRT.size()+ibin_eta_TRT;
891 }
892
894 ATH_MSG_WARNING("We apply both: TRT ratio and eProbabilityHT cuts, are "
895 "you sure you want that, if yes good luck");
896 }
897
899
900 if (TRT_PID < m_cutEProbabilityHT[ibin_combined_TRT] && nTRTTotal > 0) {
902 }
903 }
904
905 if (CheckVar(m_cutTRTRatio,5)) {
906
907 if (rTRT < m_cutTRTRatio[ibin_combined_TRT] && nTRTTotal > 0) {
908 iflag |= (0x1 << egammaPID::TrackTRTratio_Electron);
909 }
910 }
911
912 if (CheckVar(m_cutTRTRatio90, 5)) { // not really used
913 if (rTRT < m_cutTRTRatio90[ibin_combined_TRT]) {
914 iflag |= (0x1 << egammaPID::TrackTRTratio90_Electron);
915 }
916 }
917 } // eta TRT
918
919 return iflag;
920}
921
922std::vector<int> Root::TElectronIsEMSelector::FindEtEtaBin(double et, double eta2) const{
923
924 // Try to figure out in which bin we belong
925
926 //Example
927 //For Et we have an array of values
928 //5000; 10000; 15000; 20000; 30000; 40000; 50000; 60000; 70000; 80000
929 //with 10 entries
930 //And we have 11 cut entries
931 //so ibin_et can be 0-10
932 int ibin_et = -1;
933 // loop on ET range
934 if (!m_cutBinET.empty()) {
935 const int numBins = m_cutBinET.size();
936 int ibinET = 0;
937 while (ibinET < numBins && et > m_cutBinET[ibinET]) {
938 ++ibinET;
939 }
940 ibin_et = ibinET;
941 }
942 //For eta we have an array of values
943 // 0.1; 0.6 ;0.8; 1.15; 1.37; 1.52; 1.81; 2.01; 2.37; 2.47
944 //with 10 entries
945 //And we have 10 cut entries
946 //As above 2.47 will be cut by
947 //egammaPID::ClusterEtaRange_Electron
948 //so valid ibin_eta can be 0-9 (we need to have eta2<2.47)
949 int ibin_eta = -1;
950 if (!m_cutBinEta.empty() && eta2<m_cutBinEta.back()) {
951 const int numBins = (m_cutBinEta.size()-1);
952 int ibinEta = 0;
953 while (ibinEta < numBins && eta2 > m_cutBinEta[ibinEta]) {
954 ++ibinEta;
955 }
956 ibin_eta = ibinEta;
957 }
958
959 const int ibin_combined = ibin_et * m_cutBinEta.size() + ibin_eta;
960 // check the bin number
961 std::vector<int> bins{ ibin_et, ibin_eta, ibin_combined };
962 return bins;
963}
964
965// ==============================================================
966
967template<typename T>
968bool Root::TElectronIsEMSelector::CheckVar(const std::vector<T>& vec, int choice) const
969{
970 // check vector size
971 // 0 : size should be 1
972 // 1 : vs etaNB
973 // 2 : vs etaTRTNB
974 // 3 : vs etNB
975 // 4 : vs combinedNB
976 // 5 : vs combinedTRTNB
977
978 // if size of vector is 0 it means cut is not defined
979 if (vec.empty()) {
980 return false;
981 }
982
983 const unsigned int etaNB = m_cutBinEta.size();
984 const unsigned int etaTRTNB = m_cutBinEta_TRT.size();
985 const unsigned int etNB = m_cutBinET.size();
986 const unsigned int etTRTNB = m_cutBinET_TRT.size();
987 unsigned int combinedNB = 0;
988 unsigned int combinedTRTNB = 0;
989
990 if (etNB>1) {
991 combinedNB = etaNB * (etNB+1);
992 }
993 else {
994 combinedNB = etaNB;
995 }
996
997 if (etTRTNB>1) {
998 combinedTRTNB = etaTRTNB * (etTRTNB+1);
999 }
1000 else {
1001 combinedTRTNB = etaTRTNB;
1002 }
1003
1004 // check if size is 1 (give choice 0)
1005 if (choice==0) {
1006 if ( vec.size() != 1) {
1007 ATH_MSG_ERROR("choice 0 vector size is "
1008 << vec.size() << " but needs 1");
1009 return false;
1010 }
1011 }
1012
1013 // check if size is etaNB
1014 if (choice==1) {
1015 if ( vec.size() != etaNB ) {
1016 ATH_MSG_ERROR("choice 1 vector size is "
1017 << vec.size() << " but needs "
1018 << etaNB);
1019 return false;
1020 }
1021 }
1022 // check if size is etaTRTNB
1023 if (choice==2) {
1024 if ( vec.size() != etaTRTNB ) {
1025 ATH_MSG_ERROR("choice 2 vector size is "
1026 << vec.size() << " but needs "
1027 << etaTRTNB);
1028 return false;
1029 }
1030 }
1031
1032 // check if size is etNB
1033 if (choice==3) {
1034 if ( vec.size() != etNB ) {
1035 ATH_MSG_ERROR("choice 3 vector size is "
1036 << vec.size() << " but needs "
1037 << etNB);
1038 return false;
1039 }
1040 }
1041
1042 // check if size is combinedNB
1043 if (choice==4) {
1044 if ( vec.size() != combinedNB ) {
1045 ATH_MSG_ERROR("choice 4 vector size is "
1046 << vec.size() << " but needs "
1047 << combinedNB);
1048 return false;
1049 }
1050 }
1051
1052 // check if size is etaTRTNB
1053 if (choice==5) {
1054 if ( vec.size() != combinedTRTNB ) {
1055 ATH_MSG_ERROR("choice 5 vector size is "
1056 << vec.size() << " but needs "
1057 << combinedTRTNB);
1058 return false;
1059 }
1060 }
1061 return true;
1062}
1063
1064template bool Root::TElectronIsEMSelector::CheckVar<float> (const std::vector<float>& vec, int choice) const;
1065template bool Root::TElectronIsEMSelector::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
static const std::vector< std::string > bins
std::vector< float > m_cutBinEta
range of eta bins for e-ID
bool CheckVar(const std::vector< T > &vec, int choice) const
int m_cutPositionTrackMatchPhi_Electron
phi difference between cluster and extrapolated track in the 2nd sampling
const std::string m_cutNameTrackTRTratio90_Electron
ratio of high to all TRT hits for non-isolated electrons (not for new ++ menus)
const std::string m_cutNameTrackPixel_Electron
number of Pixel hits
const std::string m_cutNameTrackMatchEoverP_Electron
energy-momentum match
std::vector< float > m_cutEProbabilityHT
cut on on eProbabilityHT new TRT PID tool
int m_cutPositionClusterStripsDEmaxs1_Electron
difference between max and 2nd max in strips
int m_cutPositionTrackMatchEta_Electron
eta difference between cluster and extrapolated track in the 1st sampling
std::vector< float > m_cutminEp
cut min on E/p for e-ID
std::vector< float > m_cutHadLeakage
cut on hadronic energy for e-ID
const std::string m_cutNameClusterEtaRange_Electron
cluster eta range
int m_cutPositionClusterStripsDeltaEmax2_Electron
energy of 2nd maximum in 1st sampling ~e2tsts1/(1000+const_lumi*et)
std::vector< float > m_cutNumTRT
cut on Number of TRT hits for e-ID
int m_cutPositionClusterStripsFracm_Electron
shower shape in shower core 1st sampling
int m_cutPositionClusterStripsEratio_Electron
fraction of energy found in 1st sampling (NB: not used in fact for electrons)
const std::string m_cutNameTrackMatchEta_Electron
eta difference between cluster and extrapolated track in the 1st sampling
std::vector< float > m_cutDeltaEtaTight
cut max on delta eta for Tight e-ID
const std::string m_cutNameTrackTRThits_Electron
number of TRT hits
std::vector< float > m_cutTRTRatio90
cut on Ratio of TR hits to Number of TRT hits for 10% loss due to TRT
std::vector< float > m_cutDeltaEta
cut max on delta eta for e-ID
std::vector< float > m_cutA0Tight
cut min on transverse impact parameter for Tight e-ID
std::vector< float > m_cutRphi33
cut on ratio e233/e277 for e-ID
unsigned int TrackCut(float eta2, double et, bool passBLayerRequirement, int nPixHitsPlusDeadSensors, int nSiHitsPlusDeadSensors, int nTRThigh, int nTRThighOutliers, int nTRT, int nTRTOutliers, int nTRTXenonHits, float TRT_PID, float trackd0, float deltaeta, float deltaphi, double ep, unsigned int iflag) const
std::vector< float > m_cutA0
cut min on transverse impact parameter for e-ID
const std::string m_cutNameClusterIsolation_Electron
calorimetric isolation
const std::string m_cutNameClusterHadronicLeakage_Electron
cluster leakage into the hadronic calorimeter
const std::string m_cutNameTrackIsolation_Electron
tracker isolation
int m_cutPositionClusterStripsDeltaE_Electron
difference between 2nd maximum and 1st minimum in strips (e2tsts1-emins1)
std::vector< float > m_cutBinET_TRT
Et binning for cuts on TRT for e-ID.
const std::string m_cutNameTrackA0_Electron
distance of closet approach
unsigned int m_isEMMask
which subset of cuts to apply
int m_cutPositionTrackTRThits_Electron
number of TRT hits
bool m_useTRTOutliers
use of TRT outliers
int m_cutPositionClusterMiddleEnergy_Electron
Et<0 cut.
TElectronIsEMSelector(const char *name="TElectronIsEMSelector")
Standard constructor.
int m_cutPositionClusterStripsWtot_Electron
shower width in 1st sampling
const std::string m_cutNameClusterMiddleEratio33_Electron
energy ratio in 2nd sampling (e.g E233/E237)
const std::string m_cutNameClusterMiddleEnergy_Electron
energy in 2nd sampling (e.g E277>0)
std::vector< float > m_cutFracm
cut on Fside in 1st sampling for e-ID
const std::string m_cutNameTrackSi_Electron
number of Pixel and SCT hits
int m_cutPositionConversionMatch_Electron
matching to photon (not necessarily conversion–the name is historical)
std::vector< float > m_cutBinET
range of ET bins for e-ID
const std::string m_cutNameClusterStripsFracm_Electron
shower shape in shower core 1st sampling
int m_cutPositionTrackA0Tight_Electron
distance of closet approach for tight selection (not to be used in new ++ menus)
const std::string m_cutNameTrackA0Tight_Electron
distance of closet approach for tight selection (not to be used in new ++ menus)
std::vector< float > m_cutDeltaEmax2
cut on Delta Emax2 in 1st sampling for e-ID
int m_cutPositionClusterBackEnergyFraction_Electron
energy fraction in the third layer
std::vector< float > m_cutmaxEp
cut max on E/p for e-ID
int m_cutPositionTrackMatchEoverP_Electron
energy-momentum match
std::vector< float > m_cutWeta2c
cut on shower width in 2nd sampling for e-ID
unsigned int calcIsEm(float eta2, double et, float Reta, float Rphi, float Rhad1, float Rhad, float e277, float weta1c, float weta2c, float f1, float emax2, float Eratio, float DeltaE, float wtot, float fracm, float f3, bool passBLayerRequirement, int nPixHitsPlusDeadSensors, int nSiHitsPlusDeadSensors, int nTRThigh, int nTRThighOutliers, int nTRT, int nTRTOutliers, int nTRTXenonHits, float TRT_PID, float trackd0, float deltaeta, float deltaphi, double ep) const
std::vector< float > m_cutTRTRatio
cut on Ratio of TR hits to Number of TRT hits for e-ID
const std::string m_cutNameClusterMiddleWidth_Electron
width in the second sampling (e.g Weta2)
const std::string m_cutNameClusterStripsWeta1c_Electron
shower width weighted by distance from the maximum one
asg::AcceptData fillAccept(unsigned int isEM) const
int m_cutPositionClusterMiddleEratio33_Electron
energy ratio in 2nd sampling (e.g E233/E237)
bool m_useTRTXenonHits
use of TRT Xenon Hits
asg::AcceptInfo m_acceptInfo
Accept info.
int m_cutPositionClusterMiddleEratio37_Electron
energy ratio in 2nd sampling (e.g E237/E277)
const std::string m_cutNameTrackMatchEtaTight_Electron
eta difference between cluster and extrapolated track in the 1st sampling for tight selection (not to...
int m_cutPositionTrackIsolation_Electron
tracker isolation
std::vector< float > m_cutWeta1c
cut on width in 1st sampling for e-ID
int m_cutPositionTrackTRTratio_Electron
ratio of high to all TRT hits for isolated electrons
const std::string m_cutNameClusterStripsDeltaE_Electron
difference between 2nd maximum and 1st minimum in strips (e2tsts1-emins1)
const std::string m_cutNameClusterStripsWtot_Electron
shower width in 1st sampling
std::vector< float > m_cutF1
cut on fraction of energy deposited in 1st sampling for e-ID
std::vector< float > m_cutReta37
cut on ratio e237/e277 for e-ID
const std::string m_cutNameTrackTRTratio_Electron
ratio of high to all TRT hits for isolated electrons
const std::string m_cutNameConversionMatch_Electron
matching to photon (not necessarily conversion–the name is historical)
unsigned int calocuts_electrons(float eta2, double et, float Reta, float Rphi, float Rhad1, float Rhad, float e277, float weta1c, float weta2c, float f1, float emax2, float Eratio, float DeltaE, float wtot, float fracm, float f3, unsigned int iflag, double trigEtTh=0) const
std::vector< int > m_cutSi
cut min on precision hits for e-ID
std::vector< float > m_cutmaxDeltaPhi
cut max on delta phi for e-ID
int m_cutPositionTrackTRTratio90_Electron
ratio of high to all TRT hits for non-isolated electrons (not for new ++ menus)
std::vector< int > FindEtEtaBin(double et, double eta2) const
std::vector< float > m_cutWtot
cut on total width in 1st sampling for e-ID
~TElectronIsEMSelector()
Standard destructor.
const std::string m_cutNameClusterBackEnergyFraction_Electron
energy fraction in the third layer
int m_cutPositionClusterIsolation_Electron
calorimetric isolation
asg::AcceptData accept() const
Return dummy accept with only info.
const std::string m_cutNameIsolation_Electron
isolation
int m_cutPositionTrackPixel_Electron
number of Pixel hits
int m_cutPositionClusterMiddleWidth_Electron
width in the second sampling (e.g Weta2)
std::vector< float > m_cutminDeltaPhi
cut min on delta phi for e-ID (this should be negative)
std::vector< float > m_cutDeltaE
cut on Emax2 - Emin in 1st sampling for e-ID
int m_cutPositionClusterStripsWeta1c_Electron
shower width weighted by distance from the maximum one
std::vector< int > m_cutBL
cut min on b-layer hits for e-ID
std::vector< int > m_cutPi
cut min on pixel hits for e-ID
int m_cutPositionTrackBlayer_Electron
B layer hit.
const std::string m_cutNameTrackMatchPhi_Electron
phi difference between cluster and extrapolated track in the 2nd sampling
int m_cutPositionTrackMatchEtaTight_Electron
eta difference between cluster and extrapolated track in the 1st sampling for tight selection (not to...
int m_cutPositionTrackTRTeProbabilityHT_Electron
Cut on the TRT eProbabilityHT_Electron.
int m_cutPositionTrackA0_Electron
distance of closet approach
const std::string m_cutNameTrackTRTeProbabilityHT_Electron
Cut on the TRT eProbabilityHT_Electron.
const std::string m_cutNameClusterMiddleEratio37_Electron
energy ratio in 2nd sampling (e.g E237/E277)
int m_cutPositionTrackSi_Electron
number of Pixel and SCT hits
const std::string m_cutNameTrackBlayer_Electron
B layer hit.
std::vector< float > m_cutDEmaxs1
cut on (Emax1-Emax2)/(Emax1-Emax2) for e-ID
StatusCode initialize()
Initialize this class.
const std::string m_cutNameClusterStripsDEmaxs1_Electron
difference between max and 2nd max in strips
std::vector< float > m_cutBinEta_TRT
Eta binning for cuts on TRT for e-ID.
const std::string m_cutNameClusterStripsEratio_Electron
fraction of energy found in 1st sampling (NB: not used in fact for electrons)
int m_cutPositionClusterHadronicLeakage_Electron
cluster leakage into the hadronic calorimeter
const std::string m_cutNameClusterStripsDeltaEmax2_Electron
energy of 2nd maximum in 1st sampling ~e2tsts1/(1000+const_lumi*et)
int m_cutPositionClusterEtaRange_Electron
cluster eta range
std::vector< float > m_cutF3
cut values for cut on f3
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.
double a0
Definition globals.cxx:27
@ TrackBlayer_Electron
B layer hit.
@ TrackMatchPhi_Electron
phi difference between cluster and extrapolated track in the 2nd sampling
@ ClusterMiddleWidth_Electron
width in the second sampling (e.g Weta2)
@ ClusterStripsWeta1c_Electron
shower width weighted by distance from the maximum one
@ TrackA0_Electron
distance of closet approach
@ ClusterStripsFracm_Electron
shower shape in shower core 1st sampling
@ TrackMatchEta_Electron
eta difference between cluster and extrapolated track in the 1st sampling
@ TrackTRTeProbabilityHT_Electron
Cut on the TRT eProbabilityHT_Electron.
@ TrackSi_Electron
number of Pixel and SCT hits
@ ClusterStripsDeltaE_Electron
difference between 2nd maximum and 1st minimum in strips (e2tsts1-emins1)
@ TrackTRTratio_Electron
ratio of high to all TRT hits for isolated electrons
@ TrackTRTratio90_Electron
ratio of high to all TRT hits for non-isolated electrons (not for new ++ menus)
@ ClusterMiddleEratio37_Electron
energy ratio in 2nd sampling (e.g E237/E277)
@ ClusterBackEnergyFraction_Electron
energy fraction in the third layer
@ TrackPixel_Electron
number of Pixel hits
@ ClusterStripsDeltaEmax2_Electron
energy of 2nd maximum in 1st sampling ~e2tsts1/(1000+const_lumi*et)
@ TrackMatchEtaTight_Electron
eta difference between cluster and extrapolated track in the 1st sampling for tight selection (!
@ ClusterStripsDEmaxs1_Electron
difference between max and 2nd max in strips
@ TrackMatchEoverP_Electron
energy-momentum match
@ TrackA0Tight_Electron
distance of closet approach for tight selection (!
@ ClusterStripsWtot_Electron
shower width in 1st sampling
@ ClusterMiddleEratio33_Electron
energy ratio in 2nd sampling (e.g E233/E237)
@ ClusterMiddleEnergy_Electron
energy in 2nd sampling (e.g E277>0)
@ ClusterHadronicLeakage_Electron
cluster leakage into the hadronic calorimeter
@ ClusterEtaRange_Electron
cluster eta range
@ TrackTRThits_Electron
number of TRT hits
STL namespace.
Extra patterns decribing particle interation process.