21 #include "CLHEP/Random/RandFlat.h"
23 #include "GaudiKernel/IToolSvc.h"
57 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::Init -- START -- " <<
endmsg;
58 ISvcLocator* serviceLocator = Gaudi::svcLocator();
60 StatusCode sc = serviceLocator->service(
"ToolSvc", toolSvc,
true);
62 if (
sc.isFailure() || toolSvc ==
nullptr ) {
63 (*m_msgStream) << MSG::ERROR <<
" * ElectronSelector::Init * Unable to retrieve ToolSvc " <<
endmsg;
71 (*m_msgStream) << MSG::INFO <<
"ElectronSelector::Init -- Setting up electron LH tool." <<
endmsg;
74 const std::string elecWorkingPoint =
"LooseLHElectron";
76 if((
m_LHTool2015->setProperty(
"WorkingPoint",elecWorkingPoint.c_str())).isFailure()) {
77 (*m_msgStream) << MSG::WARNING <<
"Failure loading ConfigFile for electron likelihood tool with working point: " << elecWorkingPoint.c_str() <<
endmsg;
80 (*m_msgStream) << MSG::INFO <<
"Loading ConfigFile for electron likelihood tool with working point: " << elecWorkingPoint <<
". SUCCESS " <<
endmsg;
84 std::string confDir =
"ElectronPhotonSelectorTools/offline/mc20_20210514/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth.conf";
85 if ( (
m_LHTool2015->setProperty(
"ConfigFile", confDir)).isSuccess()) {
86 (*m_msgStream) << MSG::INFO <<
"Electron likelihood config ("<< confDir.c_str() <<
") setting SUCCESS!" <<
endmsg;
89 (*m_msgStream) << MSG::WARNING <<
"Electron likelihood config ("<< confDir.c_str() <<
") setting FAILURE" <<
endmsg;
93 (*m_msgStream) << MSG::INFO <<
"Electron likelihood tool initialize() SUCCESS!" <<
endmsg;
96 (*m_msgStream) << MSG::WARNING <<
"Electron likelihood tool initialize() FAILURE!" <<
endmsg;
99 (*m_msgStream) <<
MSG::DEBUG <<
" --ElectronSelector::Init -- COMPLETED -- " <<
endmsg;
106 (*m_msgStream) <<
MSG::DEBUG <<
" --ElectronSelector::PrepareElectronList -- START -- " <<
endmsg;
110 electron_iterator iter = pxElecContainer->
begin();
111 electron_iterator iterEnd = pxElecContainer->
end();
114 int electroncount = 0;
115 for(; iter != iterEnd ; ++iter) {
117 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::PrepareElectronList -- candiate electron " << electroncount
122 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::PrepareElectronList -- candiate electron " << electroncount
127 bool progressingwell =
true;
129 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::PrepareElectronList -- finished recording electrons. "
131 <<
" out of tested electron candidates:" << electroncount <<
endmsg;
136 if (!progressingwell) {
137 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::PrepareElectronList -- FAILED -- this event has not even a good e+e- pair " <<
endmsg;
141 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::PrepareElectronList -- COMPLETED -- electroncount -- m_pxElTrackList.size() / all = "
151 bool electronisgood =
true;
155 electronisgood =
false;
156 (*m_msgStream) <<
MSG::DEBUG <<
" -- electron fails workingpoint selection -- " <<
endmsg;
162 if (!theTrackParticle) {
163 electronisgood =
false;
164 (*m_msgStream) <<
MSG::DEBUG <<
" -- electron fails trackparticle -- " <<
endmsg;
168 electronisgood =
false;
173 electronisgood =
false;
174 (*m_msgStream) <<
MSG::DEBUG <<
" -- electron fails pt cut -- pt= " << theTrackParticle->
pt()
175 <<
" < " <<
m_ptCut <<
" (cut value) "
181 electronisgood =
false;
182 (*m_msgStream) <<
MSG::DEBUG <<
" -- electron candidate has no CaloCluster " <<
endmsg;
186 electronisgood =
false;
187 (*m_msgStream) <<
MSG::DEBUG <<
" -- electron fails cluster Et cut -- Et= " << (cluster->
e() *
cos(theTrackParticle->
theta()))*
m_CGeV
188 <<
" < " <<
m_ptCut <<
" (cut value) "
192 if (electronisgood && (std::abs(cluster->
eta())>
m_etaCut || std::abs(theTrackParticle->
eta())>
m_etaCut) ) {
193 electronisgood =
false;
194 (*m_msgStream) <<
MSG::DEBUG <<
" -- electron fails eta cut -- cluster_eta= " << cluster->
eta() <<
endmsg;
197 if (electronisgood) {
201 (*m_msgStream) <<
MSG::DEBUG <<
" * RecordElectron * good electron found -> store this electron with pt " << theTrackParticle->
pt()
206 return electronisgood;
230 bool goodlist =
true;
233 double ptMinus1 = 0.;
234 double ptMinus2 = 0.;
238 int elecnegcount = 0;
239 int elecposcount = 0;
278 if (elecposcount == 0 || elecnegcount == 0) {
280 if (
m_doDebug) std::cout <<
" -- ElectronSelector::OrderElectronList -- No opposite charge electrons --> DISCARD ALL ELECTRONS -- " << std::endl;
287 if (
m_doDebug && elecposcount + elecnegcount >= 2 ){
288 std::cout <<
" -- ElectronSelector::OrderElectronList -- electron summary list taking " << elecposcount + elecnegcount
289 <<
" electrons from the input list of " <<
m_pxElTrackList.size() <<
" electrons: " << std::endl;
290 if (
m_elecneg1 >= 0) std::cout <<
" leading e-: " <<
m_elecneg1 <<
" Pt = " << ptMinus1 << std::endl;
291 if (
m_elecneg2 >= 0) std::cout <<
" second e-: " <<
m_elecneg2 <<
" Pt = " << ptMinus2 << std::endl;
292 if (
m_elecpos1 >= 0) std::cout <<
" leading e+: " <<
m_elecpos1 <<
" Pt = " << ptPlus1 << std::endl;
293 if (
m_elecpos2 >= 0) std::cout <<
" second e+: " <<
m_elecpos2 <<
" Pt = " << ptPlus2 << std::endl;
296 if (elecposcount + elecnegcount >= 2){
304 (*m_msgStream) <<
MSG::DEBUG <<
" -- ElectronSelector::OrderElectronList -- COMPLETED -- status: "<< goodlist << std::endl;
311 if (
m_doDebug) std::cout <<
" -- ElectronSelector::RetrieveVertices -- START -- list size: "
314 bool goodvertices =
false;
315 int nverticesfound = 1;
352 if (nverticesfound >= 1) goodvertices =
true;
354 if (
m_doDebug) std::cout <<
" -- ElectronSelector::RetrieveVertices -- COMPLETED -- status: " << goodvertices << std::endl;