25 #include "GaudiKernel/MsgStream.h"
30 #include <TLorentzVector.h>
93 return StatusCode::SUCCESS;
99 return StatusCode::SUCCESS;
108 std::vector<int> vLeptonPDGIDs;
109 std::vector<double> vLeptonPt;
110 std::vector<double> vLeptonEta;
111 std::vector< std::vector < int > > vLeptonParentPDGIDs;
115 const HepMC::GenEvent* genEvt = (*itr);
117 for(
const auto& pitr: genEvt->particles()) {
123 if( std::abs(pitr->pdg_id()) != 11 && std::abs(pitr->pdg_id()) != 13)
continue;
125 if( (pitr->momentum().perp() <
m_Ptmin) || std::abs(pitr->momentum().pseudoRapidity()) >
m_EtaRange)
continue;
129 bool massiveParent =
false;
132 auto vxp =
p->production_vertex();
134 if(vxp->particles_in().size()!=1)
break;
135 p = vxp->particles_in().at(0);
136 const int pdg = std::abs(
p->pdg_id());
137 if(!((pdg>=11 && pdg<=16) || pdg==22))
139 massiveParent = (
p->generated_mass()>20000);
143 if(!massiveParent)
continue;
145 vLeptonPDGIDs.push_back(pitr->pdg_id());
146 vLeptonPt.push_back(pitr->momentum().perp());
147 vLeptonEta.push_back(pitr->momentum().pseudoRapidity());
149 std::vector<int> parentPDG_tmp;
150 for (
auto thisParent: pitr->production_vertex()->particles_in()) parentPDG_tmp.push_back(thisParent->pdg_id());
151 vLeptonParentPDGIDs.push_back(parentPDG_tmp);
154 for(HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin();
155 pitr!=genEvt->particles_end(); ++pitr )
164 if( ((*pitr)->momentum().perp() >=
m_Ptmin) && std::abs((*pitr)->momentum().pseudoRapidity()) <=
m_EtaRange){
168 bool massiveParent =
false;
171 auto vxp =
p->production_vertex();
173 if(vxp->particles_in_size()!=1)
break;
174 p = *vxp->particles_in_const_begin();
177 massiveParent = (
p->generated_mass()>20000);
181 if(!massiveParent)
continue;
183 vLeptonPDGIDs.push_back((*pitr)->pdg_id());
184 vLeptonPt.push_back((*pitr)->momentum().perp());
185 vLeptonEta.push_back((*pitr)->momentum().pseudoRapidity());
186 HepMC::GenVertex::particle_iterator firstParent =
188 HepMC::GenVertex::particle_iterator endParent =
190 HepMC::GenVertex::particle_iterator thisParent = firstParent;
191 std::vector<int> parentPDG_tmp;
192 for(; thisParent != endParent; ++thisParent) parentPDG_tmp.push_back((*thisParent)->pdg_id());
194 vLeptonParentPDGIDs.push_back(parentPDG_tmp);
201 int nLeptons = vLeptonPDGIDs.size();
207 return StatusCode::SUCCESS;
219 for (
unsigned int i = 0 ;
i < vLeptonPDGIDs.size() ;
i++){
221 for (
unsigned int j =
i ; j < vLeptonPDGIDs.size() ; j++){
224 id1 = vLeptonPDGIDs[
i];
225 id2 = vLeptonPDGIDs[j];
227 if(std::abs(id1)==std::abs(
id2) && id1*
id2 < 0) nSFOS+=1;
228 else if(std::abs(id1)==std::abs(
id2) && id1*
id2 > 0) nSFSS+=1;
229 else if(std::abs(id1)!=std::abs(
id2) && id1*
id2 < 0) nOFOS+=1;
230 else if(std::abs(id1)!=std::abs(
id2) && id1*
id2 > 0) nOFSS+=1;
246 bool passSFOS =
false;
247 bool passSFSS =
false;
248 bool passOFOS =
false;
249 bool passOFSS =
false;
250 bool passPairSum =
false;
254 ATH_MSG_INFO(
"# Lep " << vLeptonPDGIDs.size() <<
", "<< nSFOS <<
" SFOS, "<<nSFSS<<
" SFSS, " << nOFOS <<
" OFOS, " << nOFSS <<
" OFSS pairs ," << nPairSum <<
"summed pairs" );
262 if(passSFOS && passSFSS && passOFOS && passOFSS && passPairSum){
264 for (
unsigned int i = 0;
i<vLeptonPDGIDs.size();
i++){
265 int pdg = vLeptonPDGIDs[
i];
266 double pt = vLeptonPt[
i];
267 double eta = vLeptonEta[
i];
269 for (
unsigned int j=0;j<vLeptonParentPDGIDs[
i].size();j++)
msg(
MSG::DEBUG) << vLeptonParentPDGIDs[
i][j];
272 return StatusCode::SUCCESS;
276 setFilterPassed(
false);
278 return StatusCode::SUCCESS;