ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrigEgammaPrecisionPhotonHypoTool Class Reference

#include <TrigEgammaPrecisionPhotonHypoTool.h>

Inheritance diagram for TrigEgammaPrecisionPhotonHypoTool:
Collaboration diagram for TrigEgammaPrecisionPhotonHypoTool:

Public Member Functions

 TrigEgammaPrecisionPhotonHypoTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual StatusCode decide (std::vector< ITrigEgammaPrecisionPhotonHypoTool::PhotonInfo > &input) const override
 
virtual bool decide (const ITrigEgammaPrecisionPhotonHypoTool::PhotonInfo &i) const override
 

Private Member Functions

int findCutIndex (float eta) const
 

Private Attributes

HLT::Identifier m_decisionId
 
Gaudi::Property< std::vector< float > > m_etabin { this, "EtaBins", {} , "Bins of eta" }
 selection variable for PRECISION calo selection:eta bins More...
 
Gaudi::Property< std::vector< float > > m_eTthr { this, "ETthr", {}, "ET Threshold" }
 
Gaudi::Property< float > m_detacluster { this, "dETACLUSTERthr", 0. , "" }
 
Gaudi::Property< float > m_dphicluster { this, "dPHICLUSTERthr", 0. , "" }
 
Gaudi::Property< bool > m_doNoPid { this, "DoNoPid", false , "No Pid/Isolation applied" }
 
Gaudi::Property< std::string > m_pidName {this, "PidName", "", "Pid name"}
 
ToolHandle< GenericMonitoringToolm_monTool { this, "MonTool", "", "Monitoring tool" }
 
SG::ReadDecorHandleKey< xAOD::EventInfom_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" }
 

Detailed Description

Definition at line 19 of file TrigEgammaPrecisionPhotonHypoTool.h.

Constructor & Destructor Documentation

◆ TrigEgammaPrecisionPhotonHypoTool()

TrigEgammaPrecisionPhotonHypoTool::TrigEgammaPrecisionPhotonHypoTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 18 of file TrigEgammaPrecisionPhotonHypoTool.cxx.

21  : base_class( type, name, parent ),
23 }

Member Function Documentation

◆ decide() [1/2]

bool TrigEgammaPrecisionPhotonHypoTool::decide ( const ITrigEgammaPrecisionPhotonHypoTool::PhotonInfo i) const
overridevirtual

Definition at line 64 of file TrigEgammaPrecisionPhotonHypoTool.cxx.

65 {
66 
67  bool pass = false;
68 
69  auto mon_ET = Monitored::Scalar( "Et_em", -1.0 );
70  auto mon_dEta = Monitored::Scalar( "dEta", -1.0 );
71  auto mon_dPhi = Monitored::Scalar( "dPhi", -1.0 );
72  auto mon_etaBin = Monitored::Scalar( "EtaBin", -1.0 );
73  auto mon_Eta = Monitored::Scalar( "Eta", -99. );
74  auto mon_Phi = Monitored::Scalar( "Phi", -99. );
75  auto mon_mu = Monitored::Scalar("mu", -1.);
76 
77  auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 );
78  auto monitorIt = Monitored::Group( m_monTool, mon_ET, mon_dEta, mon_dPhi,
79  mon_etaBin, mon_Eta, mon_Phi, mon_mu,
80  PassedCuts );
81 
82  // when leaving scope it will ship data to monTool
83  PassedCuts = PassedCuts + 1; //got called (data in place)
84 
85  float ET(0), dEta(0), dPhi(0), eta(0), phi(0);
86 
87  auto roiDescriptor = input.roi;
88 
89  if ( fabs( roiDescriptor->eta() ) > 2.6 ) {
90  ATH_MSG_DEBUG( "REJECT The photon had eta coordinates beyond the EM fiducial volume : "
91  << roiDescriptor->eta() << "; stop the chain now" );
92  pass=false; // special case
93  return pass;
94  }
95 
96  ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId()
97  << ": Eta = " << roiDescriptor->eta()
98  << ", Phi = " << roiDescriptor->phi() );
99 
100  // fill local variables for RoI reference position
101  double etaRef = roiDescriptor->eta();
102  double phiRef = roiDescriptor->phi();
103  // correct phi the to right range ( probably not needed anymore )
104  if ( fabs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range
105 
106  auto pClus = input.photon->caloCluster();
107 
108  float absEta = fabs( pClus->eta() );
109  const int cutIndex = findCutIndex( absEta );
110 
111  dEta = pClus->eta() - etaRef;
112  // Deal with angle diferences greater than Pi
113  dPhi = fabs( pClus->phi() - phiRef );
114  dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only <
115  ET = pClus->et();
116  eta = pClus->eta();
117  phi = pClus->phi();
118  // apply cuts: DeltaEta( clus-ROI )
119  ATH_MSG_DEBUG( "Photon : eta=" << pClus->eta()
120  << " roi eta=" << etaRef << " DeltaEta=" << dEta
121  << " cut: <" << m_detacluster );
122 
123  if ( fabs( pClus->eta() - etaRef ) > m_detacluster ) {
124  ATH_MSG_DEBUG("REJECT Photon a cut failed");
125  return pass;
126  }
127  mon_Eta = eta;
128  mon_dEta = dEta;
129  PassedCuts = PassedCuts + 1; //Deta
130 
131  // DeltaPhi( clus-ROI )
132  ATH_MSG_DEBUG( ": phi=" << pClus->phi()
133  << " roi phi="<< phiRef << " DeltaPhi="<< dPhi
134  << " cut: <" << m_dphicluster );
135 
136  if( dPhi > m_dphicluster ) {
137  ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed");
138  return pass;
139  }
140  mon_Phi = phi;
141  mon_dPhi = dPhi;
142  PassedCuts = PassedCuts + 1; //DPhi
143 
144  // eta range
145  if ( cutIndex == -1 ) { // VD
146  ATH_MSG_DEBUG( "Photon : " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] );
147  return pass;
148  } else {
149  ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex );
150  }
151  mon_etaBin = m_etabin[cutIndex];
152  PassedCuts = PassedCuts + 1; // passed eta cut
153 
154  // ET_em
155  ATH_MSG_DEBUG( "Photon: ET_em=" << ET << " cut: >" << m_eTthr[cutIndex] );
156  if ( ET < m_eTthr[cutIndex] ) {
157  ATH_MSG_DEBUG("REJECT et cut failed");
158  return pass;
159  }
160  mon_ET = ET;
161  PassedCuts = PassedCuts + 1; // ET_em
162  if(m_doNoPid){
163  pass = true;
164  return pass;
165  }
166 
167  if(input.pidDecorator.count(m_pidName)){
168  pass = input.pidDecorator.at(m_pidName);
169  }
170 
171  // get average luminosity information to calculate LH
172  float avg_mu = 0;
174  if(eventInfoDecor.isPresent()) {
175  avg_mu = eventInfoDecor(0);
176  ATH_MSG_DEBUG("Average mu " << avg_mu);
177  }
178  mon_mu = avg_mu;
179 
180  float Rhad1(0), Rhad(0), Reta(0), Rphi(0), e277(0), weta2c(0), //emax2(0),
181  Eratio(0), DeltaE(0), f1(0), weta1c(0), wtot(0), fracm(0);
182 
183 
184  // variables based on HCAL
185  // transverse energy in 1st scintillator of hadronic calorimeter/ET
186  input.photon->showerShapeValue(Rhad1, xAOD::EgammaParameters::Rhad1);
187  // transverse energy in hadronic calorimeter/ET
188  input.photon->showerShapeValue(Rhad, xAOD::EgammaParameters::Rhad);
189 
190  // variables based on S2 of EM CAL
191  // E(7*7) in 2nd sampling
192  input.photon->showerShapeValue(e277, xAOD::EgammaParameters::e277);
193  // E(3*7)/E(7*7) in 2nd sampling
194  input.photon->showerShapeValue(Reta, xAOD::EgammaParameters::Reta);
195  // E(3*3)/E(3*7) in 2nd sampling
196  input.photon->showerShapeValue(Rphi, xAOD::EgammaParameters::Rphi);
197  // shower width in 2nd sampling
198  input.photon->showerShapeValue(weta2c, xAOD::EgammaParameters::weta2);
199 
200  // variables based on S1 of EM CAL
201  // fraction of energy reconstructed in the 1st sampling
202  input.photon->showerShapeValue(f1, xAOD::EgammaParameters::f1);
203  // shower width in 3 strips in 1st sampling
204  input.photon->showerShapeValue(weta1c, xAOD::EgammaParameters::weta1);
205  // E of 2nd max between max and min in strips [NOT USED]
206  // eg->showerShapeValue(emax2, xAOD::EgammaParameters::e2tsts1);
207  // (E of 1st max in strips-E of 2nd max)/(E of 1st max+E of 2nd max)
208  input.photon->showerShapeValue(Eratio, xAOD::EgammaParameters::Eratio);
209  // E(2nd max)-E(min) in strips
210  input.photon->showerShapeValue(DeltaE, xAOD::EgammaParameters::DeltaE);
211  // total shower width in 1st sampling
212  input.photon->showerShapeValue(wtot, xAOD::EgammaParameters::wtots1);
213  // E(+/-3)-E(+/-1)/E(+/-1)
214  input.photon->showerShapeValue(fracm, xAOD::EgammaParameters::fracs1);
215 
216  ATH_MSG_DEBUG( " Rhad = " << Rhad ) ;
217  ATH_MSG_DEBUG( " Rhad1 = " << Rhad1 ) ;
218  ATH_MSG_DEBUG( " e277 = " << e277 ) ;
219  ATH_MSG_DEBUG( " Reta = " << Reta ) ;
220  ATH_MSG_DEBUG( " Rphi = " << Rphi ) ;
221  ATH_MSG_DEBUG( " weta2c = " << weta2c ) ;
222  ATH_MSG_DEBUG( " f1 = " << f1 ) ;
223  ATH_MSG_DEBUG( " weta1c = " << weta1c ) ;
224  ATH_MSG_DEBUG( " Eratio = " << Eratio ) ;
225  ATH_MSG_DEBUG( " DeltaE = " << DeltaE ) ;
226  ATH_MSG_DEBUG( " wtot = " << wtot ) ;
227  ATH_MSG_DEBUG( " fracm = " << fracm ) ;
228 
229  if ( !pass ){
230  ATH_MSG_DEBUG("REJECT isEM failed");
231  return pass;
232  } else {
233  ATH_MSG_DEBUG("ACCEPT isEM passed");
234  }
235  // Monitor showershapes
236  ATH_MSG_DEBUG( "pass = " << pass );
237 
238  return pass;
239 
240 }

◆ decide() [2/2]

virtual StatusCode TrigEgammaPrecisionPhotonHypoTool::decide ( std::vector< ITrigEgammaPrecisionPhotonHypoTool::PhotonInfo > &  input) const
overridevirtual

◆ findCutIndex()

int TrigEgammaPrecisionPhotonHypoTool::findCutIndex ( float  eta) const
private

Definition at line 242 of file TrigEgammaPrecisionPhotonHypoTool.cxx.

242  {
243  const float absEta = std::abs(eta);
244 
245  auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } );
246  if ( binIterator == m_etabin.end() ) {
247  return -1;
248  }
249  return binIterator - m_etabin.begin();
250 }

◆ initialize()

StatusCode TrigEgammaPrecisionPhotonHypoTool::initialize ( )
overridevirtual

Definition at line 26 of file TrigEgammaPrecisionPhotonHypoTool.cxx.

27 {
28  ATH_MSG_DEBUG( "Initialization completed successfully" );
29  ATH_MSG_DEBUG( "EtaBins = " << m_etabin );
30  ATH_MSG_DEBUG( "ETthr = " << m_eTthr );
31  ATH_MSG_DEBUG( "dPHICLUSTERthr = " << m_dphicluster );
32  ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster );
33  ATH_MSG_DEBUG( "DoNoPid = " << m_doNoPid );
34 
35  if ( m_etabin.empty() ) {
36  ATH_MSG_ERROR( " There are no cuts set (EtaBins property is an empty list)" );
37  return StatusCode::FAILURE;
38  }
39 
40  // Now we try to retrieve the ElectronPhotonSelectorTools that we will use to apply the photon Identification. This is a *must*
41 
42 
43  // Retrieving Luminosity info
44  ATH_MSG_DEBUG( "Retrieving luminosityCondData..." );
45  ATH_CHECK( m_avgMuKey.initialize() );
46 
47  unsigned int nEtaBin = m_etabin.size();
48 
49 #define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \
50  { ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; }
51 
52  CHECK_SIZE( eTthr );
53 #undef CHECK_SIZE
54 
55  ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId );
56 
57  if ( not m_monTool.name().empty() )
58  CHECK( m_monTool.retrieve() );
59 
60  return StatusCode::SUCCESS;
61 }

Member Data Documentation

◆ m_avgMuKey

SG::ReadDecorHandleKey<xAOD::EventInfo> TrigEgammaPrecisionPhotonHypoTool::m_avgMuKey { this, "averageInteractionsPerCrossingKey", "EventInfo.averageInteractionsPerCrossing", "Decoration for Average Interaction Per Crossing" }
private

Definition at line 47 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_decisionId

HLT::Identifier TrigEgammaPrecisionPhotonHypoTool::m_decisionId
private

Definition at line 30 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_detacluster

Gaudi::Property< float > TrigEgammaPrecisionPhotonHypoTool::m_detacluster { this, "dETACLUSTERthr", 0. , "" }
private

Definition at line 35 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_doNoPid

Gaudi::Property< bool > TrigEgammaPrecisionPhotonHypoTool::m_doNoPid { this, "DoNoPid", false , "No Pid/Isolation applied" }
private

Definition at line 37 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_dphicluster

Gaudi::Property< float > TrigEgammaPrecisionPhotonHypoTool::m_dphicluster { this, "dPHICLUSTERthr", 0. , "" }
private

Definition at line 36 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_etabin

Gaudi::Property< std::vector<float> > TrigEgammaPrecisionPhotonHypoTool::m_etabin { this, "EtaBins", {} , "Bins of eta" }
private

selection variable for PRECISION calo selection:eta bins

Definition at line 33 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_eTthr

Gaudi::Property< std::vector<float> > TrigEgammaPrecisionPhotonHypoTool::m_eTthr { this, "ETthr", {}, "ET Threshold" }
private

Definition at line 34 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_monTool

ToolHandle< GenericMonitoringTool > TrigEgammaPrecisionPhotonHypoTool::m_monTool { this, "MonTool", "", "Monitoring tool" }
private

Definition at line 44 of file TrigEgammaPrecisionPhotonHypoTool.h.

◆ m_pidName

Gaudi::Property< std::string > TrigEgammaPrecisionPhotonHypoTool::m_pidName {this, "PidName", "", "Pid name"}
private

Definition at line 41 of file TrigEgammaPrecisionPhotonHypoTool.h.


The documentation for this class was generated from the following files:
TrigEgammaPrecisionPhotonHypoTool::m_detacluster
Gaudi::Property< float > m_detacluster
Definition: TrigEgammaPrecisionPhotonHypoTool.h:35
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
CHECK_SIZE
#define CHECK_SIZE(__n)
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
xAOD::EgammaParameters::Reta
@ Reta
e237/e277
Definition: EgammaEnums.h:154
TrigEgammaPrecisionPhotonHypoTool::m_doNoPid
Gaudi::Property< bool > m_doNoPid
Definition: TrigEgammaPrecisionPhotonHypoTool.h:37
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
TrigEgammaPrecisionPhotonHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigEgammaPrecisionPhotonHypoTool.h:44
TrigEgammaPrecisionPhotonHypoTool::m_eTthr
Gaudi::Property< std::vector< float > > m_eTthr
Definition: TrigEgammaPrecisionPhotonHypoTool.h:34
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::EgammaParameters::Rphi
@ Rphi
e233/e237
Definition: EgammaEnums.h:156
TrigEgammaPrecisionPhotonHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: TrigEgammaPrecisionPhotonHypoTool.h:30
TrigEgammaPrecisionPhotonHypoTool::m_etabin
Gaudi::Property< std::vector< float > > m_etabin
selection variable for PRECISION calo selection:eta bins
Definition: TrigEgammaPrecisionPhotonHypoTool.h:33
xAOD::EgammaParameters::wtots1
@ wtots1
shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips...
Definition: EgammaEnums.h:140
HLT::Identifier::fromToolName
static HLT::Identifier fromToolName(const std::string &tname)
Definition: HLTIdentifier.cxx:31
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
xAOD::EgammaParameters::f1
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
Definition: EgammaEnums.h:52
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
TrigEgammaPrecisionPhotonHypoTool::m_dphicluster
Gaudi::Property< float > m_dphicluster
Definition: TrigEgammaPrecisionPhotonHypoTool.h:36
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAOD::EgammaParameters::Rhad1
@ Rhad1
ethad1/et
Definition: EgammaEnums.h:162
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigEgammaPrecisionPhotonHypoTool::findCutIndex
int findCutIndex(float eta) const
Definition: TrigEgammaPrecisionPhotonHypoTool.cxx:242
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:232
xAOD::EgammaParameters::e277
@ e277
uncalibrated energy (sum of cells) of the middle sampling in a rectangle of size 7x7
Definition: EgammaEnums.h:80
TrigEgammaPrecisionPhotonHypoTool::m_avgMuKey
SG::ReadDecorHandleKey< xAOD::EventInfo > m_avgMuKey
Definition: TrigEgammaPrecisionPhotonHypoTool.h:47
xAOD::EgammaParameters::weta1
@ weta1
shower width using +/-3 strips around the one with the maximal energy deposit: w3 strips = sqrt{sum(E...
Definition: EgammaEnums.h:97
xAOD::EgammaParameters::Eratio
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
Definition: EgammaEnums.h:158
TrigEgammaPrecisionPhotonHypoTool::m_pidName
Gaudi::Property< std::string > m_pidName
Definition: TrigEgammaPrecisionPhotonHypoTool.h:41
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
xAOD::EgammaParameters::Rhad
@ Rhad
ethad/et
Definition: EgammaEnums.h:160
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
xAOD::EgammaParameters::DeltaE
@ DeltaE
e2tsts1-emins1
Definition: EgammaEnums.h:164
xAOD::EgammaParameters::fracs1
@ fracs1
shower shape in the shower core : [E(+/-3)-E(+/-1)]/E(+/-1), where E(+/-n) is the energy in ± n strip...
Definition: EgammaEnums.h:111
read_hist_ntuple.f1
f1
Definition: read_hist_ntuple.py:4
xAOD::EgammaParameters::weta2
@ weta2
the lateral width is calculated with a window of 3x5 cells using the energy weighted sum over all cel...
Definition: EgammaEnums.h:103