58 RETURN_CHECK(
"initialize", config.setProperty(
"IsoDecSuffix",
"CloseByCorr"));
59 if (
msg().level() <= MSG::DEBUG) {
60 RETURN_CHECK(
"initialize", config.setProperty(
"OutputLevel", 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;
189 static const SG::AuxElement::Accessor<char> DFCommonPhotonsIsEMTight (
"DFCommonPhotonsIsEMTight");
190 static const SG::AuxElement::Accessor<char> DFCommonPhotonsCleaning (
"DFCommonPhotonsCleaning");
191 static const SG::AuxElement::Accessor<float> topoetcone20 (
"topoetcone20");
195 std::vector< std::pair <const xAOD::IParticle*, double> > farFsrCandList;
196 farFsrCandList.clear();
197 farFsrCandList.reserve(photons_cont->
size());
201 parts.push_back(part);
203 ATH_MSG_DEBUG(
"In getFarFsrCandidateList function : photon size = " << photons_cont->
size());
205 for (
auto ph : *photons_cont) {
210 bool is_tight_photon = DFCommonPhotonsIsEMTight(*ph);
214 ATH_MSG_VERBOSE(
"Far Fsr ph bef : pt " << ph->pt() <<
" topoetcone20 = " << topoetcone20(*ph));
219 ATH_MSG_VERBOSE(
"Far Fsr ph aft: pt " << ph->pt() <<
" topoetcone20 = " << topoetcone20(*ph));
221 bool far_fsr_drcut_isOK =
false;
223 double dr =
deltaR(part->eta(), part->phi(), ph->eta(), ph->phi());
226 if (far_fsr_drcut_isOK && dr < 0.2) {
227 ATH_MSG_VERBOSE(
"Far Fsr candidate kinematics : author " << ph->author()
228 <<
" Et = " << ph->p4().Et()
230 <<
" isoIsOK = " << farPhIsoOK );
233 if(far_fsr_drcut_isOK) farFsrCandList.push_back(std::make_pair(ph, dr));
236 ATH_MSG_DEBUG(
"Far Fsr candidate kinematics : author " << ph->author()
237 <<
" Et = " << ph->p4().Et()
238 <<
" tight = " << is_tight_photon
239 <<
" farPhIsoOK = " << farPhIsoOK
240 <<
" far_fsr_drcut_isOK = " << far_fsr_drcut_isOK);
253 static const SG::AuxElement::Accessor<char> DFCommonPhotonsCleaning (
"DFCommonPhotonsCleaning");
259 std::vector< std::pair <const xAOD::IParticle*, double> > nearFsrCandList;
261 nearFsrCandList.reserve(photons_cont->
size()+electrons_cont->
size());
262 ATH_MSG_DEBUG(
"In getNearFsrCandidateList function : photon size = " << photons_cont->
size()
263 <<
", electron size = " << electrons_cont->
size());
265 for (
auto photon : *photons_cont) {
273 if( ( oqIsOK && high_et_photon && (photon->p4().Et() >
m_etcut) && (photon_f1 >
m_f1cut) )
275 ( oqIsOK && !high_et_photon && (photon_f1 >
m_topo_f1cut)
278 double dr =
deltaR(muon->eta(), muon->phi(), photon->eta(), photon->phi());
282 || (high_et_photon && dr <
m_drcut) ) {
283 nearFsrCandList.push_back(std::make_pair(photon, dr));
284 ATH_MSG_DEBUG(
"Near Fsr candidates ( photon ) kinematics ; author "
286 <<
" Et = " << photon->p4().Et()
287 <<
" f1 = " << photon_f1
293 unsigned int nofPhFsr = nearFsrCandList.size();
296 for (
auto electron : *electrons_cont) {
298 if ( (nearFsrCandList.size() > 0) &&
isOverlap(electron, nearFsrCandList, nofPhFsr) )
continue;
305 const xAOD::TrackParticle* muon_track = muon->trackParticle(xAOD::Muon::TrackParticleType::Primary);
317 float eCorr = electron->p4().Et()/(electron->caloCluster()->e()/cosh(electron->trackParticle()->eta()));
318 float clEt = eCorr*electron->caloCluster()->et();
320 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());
324 if( elmutrackmatch && oqIsOK &&
328 double dr =
deltaR(muon->eta(), muon->phi(), electron->caloCluster()->eta(), electron->caloCluster()->phi());
331 nearFsrCandList.push_back(std::make_pair(electron, dr));
332 ATH_MSG_DEBUG(
"Near Fsr candidates ( electron ) kinematics : author "
333 << electron->author()
335 <<
" f1 = " << electron_f1
338 else ATH_MSG_VERBOSE(
"FAILED Near Fsr candidates ( electron ) kinematics : author "
339 << electron->author()
341 <<
" f1 = " << electron_f1
345 double dr =
deltaR(muon->eta(), muon->phi(), electron->caloCluster()->eta(), electron->caloCluster()->phi());
347 if (elmutrackmatch && dr <
m_drcut ) {
348 ATH_MSG_DEBUG(
"FAILED Near Fsr candidates ( electron ) kinematics : author "
349 << electron->author()
351 <<
" f1 = " << electron_f1
352 <<
" dr = " <<
deltaR(muon->eta(), muon->phi(), electron->caloCluster()->eta(), electron->caloCluster()->phi())
353 <<
" theta/phi el/mu " << electron_track->
theta() <<
"/" << muon->p4().Theta()
354 <<
"/" << electron_track->
phi() <<
"/" << muon->phi()
355 <<
" theta/phi mu trk " << muon_track->
theta() <<
"/" << muon_track->
phi()
367 const std::vector< std::pair <const xAOD::IParticle*, double> >& FsrCandList,
368 const std::string& option) {
373 for (
unsigned int i=0; i < FsrCandList.size(); i++ ) {
380 c.container =
"electron" ;
385 photon.Egamma_v1::operator=(*electron);
387 ATH_MSG_ERROR(
"FsrPhotonTool::sortFsrCandidates: Unable to applyCorrection to photon ");
391 c.eta = photon.caloCluster()->eta();
392 c.phi = photon.caloCluster()->phi();
394 ATH_MSG_DEBUG(
"FsrPhotonTool::sortFsrCandidates: el/ph et " << electron->pt() <<
"/"
395 << electron->caloCluster()->eta() <<
"/" << electron->caloCluster()->phi() <<
" "
396 << photon.pt() <<
"/"
397 << photon.caloCluster()->eta() <<
"/" << photon.caloCluster()->phi());
408 float eCorr = electron->p4().Et()/(electron->caloCluster()->e()/cosh(electron->trackParticle()->eta()));
409 float clEt = eCorr*electron->caloCluster()->et();
412 c.eta = electron->caloCluster()->eta();
413 c.phi = electron->caloCluster()->phi();
418 c.container =
"photon";
420 c.Et = photon->p4().Et();
421 c.eta = photon->eta();
422 c.phi = photon->phi();
425 ATH_MSG_WARNING(
"sortFsrCandidates: undefined particle - NOT electron nor photon. Should never get here!" );
431 c.particle = particle;
432 c.deltaR = FsrCandList.at(i).second;
433 if(c.deltaR < 0.05) c.Et -= 400./cosh(particle->eta());
437 ATH_MSG_DEBUG(
"sortFsrCandidates: save fsr candidate f1 = " << c.f1
438 <<
", deltaR = " << c.deltaR
440 <<
", Eta = " << c.eta
441 <<
", Phi = " << c.phi
442 <<
", type = " <<c.type);
455 const std::vector< std::pair <const xAOD::IParticle*, double> >& phfsr,
456 unsigned int nofPhFsr) {
457 for (
unsigned int indx=0; indx < nofPhFsr; indx++ ) {
463 ph_cl->
eta(), ph_cl->
phi());
465 << ph_cl->
et() <<
"/" << el_cl->
et());
472 double dphi= fabs(phi1 - phi2);
480 double deta = fabs(
meta - peta);
482 double dR = sqrt((dphi*dphi)+(deta*deta));
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(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.
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".