59 if (
msg().level() <= MSG::DEBUG) {
73 return StatusCode::FAILURE;
79 ATH_MSG_ERROR(
"initialize - CANNOT retrieve IEgammaCalibrationAndSmearingTool. Please set the property 'egCalibToolName' to be able to recalibrate fsr photon found as an electron ");
80 return StatusCode::FAILURE;
86 asg::AsgToolConfig config1 (
"CP::EgammaIsGoodOQSelectionTool/electronIsGoodOQSelectionTool");
93 asg::AsgToolConfig config2 (
"CP::EgammaIsGoodOQSelectionTool/photonIsGoodOQSelectionTool");
100 return StatusCode::SUCCESS;
108 if (photons == 0 ||electrons == 0) {
109 ATH_MSG_ERROR(
"getFsrPhoton: You MUST provide photon AND electron containers" );
120 if (cands->size() > 0) {
121 candidate = cands->at(0);
126 <<
", deltaR = " << candidate.
deltaR
127 <<
", Et = " << candidate.
Et
128 <<
", Eta = " << candidate.
eta
129 <<
", Phi = " << candidate.
phi
130 <<
", type = " <<candidate.
type);
136 std::vector<FsrCandidate>*
145 ATH_MSG_ERROR(
"getFsrCandidateList: No Photon container provided" );
150 photons_cont = photons;
154 if (0 == electrons) {
155 ATH_MSG_ERROR(
"getFsrCandidateList: No Electron container provided" );
160 electrons_cont = electrons;
194 std::vector< std::pair <const xAOD::IParticle*, double> > farFsrCandList;
195 farFsrCandList.clear();
196 farFsrCandList.reserve(photons_cont->
size());
200 parts.push_back(part);
202 ATH_MSG_DEBUG(
"In getFarFsrCandidateList function : photon size = " << photons_cont->
size());
204 for (
auto ph : *photons_cont) {
208 bool is_tight_photon = DFCommonPhotonsIsEMTight(*ph);
212 ATH_MSG_VERBOSE(
"Far Fsr ph bef : pt " << ph->pt() <<
" topoetcone20 = " << topoetcone20(*ph));
217 ATH_MSG_VERBOSE(
"Far Fsr ph aft: pt " << ph->pt() <<
" topoetcone20 = " << topoetcone20(*ph));
219 bool far_fsr_drcut_isOK =
false;
221 double dr =
deltaR(part->eta(), part->phi(), ph->eta(), ph->phi());
224 if (far_fsr_drcut_isOK && dr < 0.2) {
225 ATH_MSG_VERBOSE(
"Far Fsr candidate kinematics : author " << ph->author()
226 <<
" Et = " << ph->p4().Et()
228 <<
" isoIsOK = " << farPhIsoOK );
231 if(far_fsr_drcut_isOK) farFsrCandList.push_back(std::make_pair(ph, dr));
234 ATH_MSG_DEBUG(
"Far Fsr candidate kinematics : author " << ph->author()
235 <<
" Et = " << ph->p4().Et()
236 <<
" tight = " << is_tight_photon
237 <<
" farPhIsoOK = " << farPhIsoOK
238 <<
" far_fsr_drcut_isOK = " << far_fsr_drcut_isOK);
254 std::vector< std::pair <const xAOD::IParticle*, double> > nearFsrCandList;
256 nearFsrCandList.reserve(photons_cont->
size()+electrons_cont->
size());
257 ATH_MSG_DEBUG(
"In getNearFsrCandidateList function : photon size = " << photons_cont->
size()
258 <<
", electron size = " << electrons_cont->
size());
260 for (
auto photon : *photons_cont) {
268 if( ( oqIsOK && high_et_photon && (photon->p4().Et() >
m_etcut) && (photon_f1 >
m_f1cut) )
270 ( oqIsOK && !high_et_photon && (photon_f1 >
m_topo_f1cut)
273 double dr =
deltaR(muon->eta(), muon->phi(), photon->eta(), photon->phi());
277 || (high_et_photon && dr <
m_drcut) ) {
278 nearFsrCandList.push_back(std::make_pair(photon, dr));
279 ATH_MSG_DEBUG(
"Near Fsr candidates ( photon ) kinematics ; author "
281 <<
" Et = " << photon->p4().Et()
282 <<
" f1 = " << photon_f1
288 unsigned int nofPhFsr = nearFsrCandList.size();
291 for (
auto electron : *electrons_cont) {
293 if ( (nearFsrCandList.size() > 0) &&
isOverlap(electron, nearFsrCandList, nofPhFsr) )
continue;
312 float eCorr = electron->p4().Et()/(electron->caloCluster()->e()/cosh(electron->trackParticle()->eta()));
313 float clEt = eCorr*electron->caloCluster()->et();
315 ATH_MSG_VERBOSE(
"Near Fsr candidate ( electron ) Et = " << clEt <<
" eCorr " << eCorr <<
" OQ is ok: " << (
int) oqIsOK <<
", pt,eta,phi " << electron->pt()/1000 <<
", " << electron->eta() <<
", " << electron->phi());
319 if( elmutrackmatch && oqIsOK &&
323 double dr =
deltaR(muon->eta(), muon->phi(), electron->caloCluster()->eta(), electron->caloCluster()->phi());
326 nearFsrCandList.push_back(std::make_pair(electron, dr));
327 ATH_MSG_DEBUG(
"Near Fsr candidates ( electron ) kinematics : author "
328 << electron->author()
330 <<
" f1 = " << electron_f1
333 else ATH_MSG_VERBOSE(
"FAILED Near Fsr candidates ( electron ) kinematics : author "
334 << electron->author()
336 <<
" f1 = " << electron_f1
340 double dr =
deltaR(muon->eta(), muon->phi(), electron->caloCluster()->eta(), electron->caloCluster()->phi());
342 if (elmutrackmatch && dr <
m_drcut ) {
343 ATH_MSG_DEBUG(
"FAILED Near Fsr candidates ( electron ) kinematics : author "
344 << electron->author()
346 <<
" f1 = " << electron_f1
347 <<
" dr = " <<
deltaR(muon->eta(), muon->phi(), electron->caloCluster()->eta(), electron->caloCluster()->phi())
348 <<
" theta/phi el/mu " << electron_track->
theta() <<
"/" << muon->p4().Theta()
349 <<
"/" << electron_track->
phi() <<
"/" << muon->phi()
350 <<
" theta/phi mu trk " << muon_track->
theta() <<
"/" << muon_track->
phi()
362 const std::vector< std::pair <const xAOD::IParticle*, double> >& FsrCandList,
363 const std::string& option) {
368 for (
unsigned int i=0; i < FsrCandList.size(); i++ ) {
375 c.container =
"electron" ;
380 photon.Egamma_v1::operator=(*electron);
382 ATH_MSG_ERROR(
"FsrPhotonTool::sortFsrCandidates: Unable to applyCorrection to photon ");
386 c.eta = photon.caloCluster()->eta();
387 c.phi = photon.caloCluster()->phi();
389 ATH_MSG_DEBUG(
"FsrPhotonTool::sortFsrCandidates: el/ph et " << electron->pt() <<
"/"
390 << electron->caloCluster()->eta() <<
"/" << electron->caloCluster()->phi() <<
" "
391 << photon.pt() <<
"/"
392 << photon.caloCluster()->eta() <<
"/" << photon.caloCluster()->phi());
403 float eCorr = electron->p4().Et()/(electron->caloCluster()->e()/cosh(electron->trackParticle()->eta()));
404 float clEt = eCorr*electron->caloCluster()->et();
407 c.eta = electron->caloCluster()->eta();
408 c.phi = electron->caloCluster()->phi();
413 c.container =
"photon";
415 c.Et = photon->p4().Et();
416 c.eta = photon->eta();
417 c.phi = photon->phi();
420 ATH_MSG_WARNING(
"sortFsrCandidates: undefined particle - NOT electron nor photon. Should never get here!" );
426 c.particle = particle;
427 c.deltaR = FsrCandList.at(i).second;
428 if(c.deltaR < 0.05) c.Et -= 400./cosh(particle->eta());
432 ATH_MSG_DEBUG(
"sortFsrCandidates: save fsr candidate f1 = " << c.f1
433 <<
", deltaR = " << c.deltaR
435 <<
", Eta = " << c.eta
436 <<
", Phi = " << c.phi
437 <<
", type = " <<c.type);
450 const std::vector< std::pair <const xAOD::IParticle*, double> >& phfsr,
451 unsigned int nofPhFsr) {
452 for (
unsigned int indx=0; indx < nofPhFsr; indx++ ) {
457 ph_cl->
eta(), ph_cl->
phi());
459 << ph_cl->
et() <<
"/" << el_cl->
et());
466 double dphi= fabs(phi1 - phi2);
474 double deta = fabs(
meta - peta);
476 double dR = sqrt((dphi*dphi)+(deta*deta));
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
DataVector adapter that acts like it holds const pointers.
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ Ok
The correction was done successfully.
DataVector adapter that acts like it holds const pointers.
size_type size() const noexcept
Returns the number of elements in the collection.
Simple interface for searching the FSR candidate.
SG::Accessor< T, ALLOC > Accessor
StatusCode setProperty(const std::string &name, const T &value)
set the given property
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Class providing the definition of the 4-vector interface.
float theta() const
Returns the parameter, which has range 0 to .
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
const uint32_t BADCLUSELECTRON
const uint32_t BADCLUSPHOTON
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".