6 #include "GaudiKernel/PhysicalConstants.h"
7 #include "GaudiKernel/SystemOfUnits.h"
15 return (
t1->pt() >
t2->pt());
55 ATH_MSG_INFO(
"*** 1st and 2nd jets in opposite eta region (Nj>=2) ***");
72 return StatusCode::FAILURE;
79 return StatusCode::FAILURE;
83 return StatusCode::SUCCESS;
93 std::vector<HepMC::ConstGenParticlePtr> MCTruthPhotonList;
94 std::vector<HepMC::ConstGenParticlePtr> MCTruthElectronList;
95 std::vector<CLHEP::HepLorentzVector> MCTruthTauList;
98 const HepMC::GenEvent* genEvt = (*itr);
100 for (
const auto& pitr: *genEvt) {
103 pitr->momentum().perp() >=
m_LGMinPt && std::abs(pitr->momentum().pseudoRapidity()) <=
m_LGMaxEta) {
104 MCTruthPhotonList.push_back(pitr);
105 ATH_MSG_INFO(
"photon pt(Gaudi::Units::GeV) = " << pitr->momentum().perp()/
Gaudi::Units::GeV <<
" eta = " << pitr->momentum().pseudoRapidity());
109 pitr->momentum().perp() >=
m_LGMinPt && std::abs(pitr->momentum().pseudoRapidity()) <=
m_LGMaxEta) {
110 MCTruthElectronList.push_back(pitr);
111 ATH_MSG_INFO(
"electron pt(Gaudi::Units::GeV) = " << pitr->momentum().perp()/
Gaudi::Units::GeV <<
" eta = " << pitr->momentum().pseudoRapidity());
117 for (
const auto&
beg: tau->end_vertex()->particles_out() ) {
118 if (
beg->production_vertex() != tau->end_vertex() )
continue;
119 if ( std::abs(
beg->pdg_id() ) == 12 ) leptonic = 1;
120 if ( std::abs(
beg->pdg_id() ) == 14 ) leptonic = 2;
121 if ( std::abs(
beg->pdg_id() ) == 15 ) leptonic = 11;
126 CLHEP::HepLorentzVector tauvis = CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(),
127 tau->momentum().py()-nutau.py(),
128 tau->momentum().pz()-nutau.pz(),
129 tau->momentum().e()-nutau.e());
130 if (tauvis.vect().perp() >=
m_LGMinPt && std::abs(tauvis.vect().pseudoRapidity()) <=
m_LGMaxEta) {
131 MCTruthTauList.push_back(tauvis);
138 for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) {
141 (*pitr)->momentum().perp() >=
m_LGMinPt && std::abs((*pitr)->momentum().pseudoRapidity()) <=
m_LGMaxEta) {
142 MCTruthPhotonList.push_back((*pitr));
143 ATH_MSG_INFO(
"photon pt(Gaudi::Units::GeV) = " << (*pitr)->momentum().perp()/
Gaudi::Units::GeV <<
" eta = " << (*pitr)->momentum().pseudoRapidity());
147 (*pitr)->momentum().perp() >=
m_LGMinPt && std::abs((*pitr)->momentum().pseudoRapidity()) <=
m_LGMaxEta) {
148 MCTruthElectronList.push_back((*pitr));
149 ATH_MSG_INFO(
"electron pt(Gaudi::Units::GeV) = " << (*pitr)->momentum().perp()/
Gaudi::Units::GeV <<
" eta = " << (*pitr)->momentum().pseudoRapidity());
154 HepMC::GenVertex::particles_out_const_iterator
begin = tau->end_vertex()->particles_out_const_begin();
155 HepMC::GenVertex::particles_out_const_iterator
end = tau->end_vertex()->particles_out_const_end();
158 if ( (*begin)->production_vertex() != tau->end_vertex() )
continue;
159 if ( std::abs( (*begin)->pdg_id() ) == 12 ) leptonic = 1;
160 if ( std::abs( (*begin)->pdg_id() ) == 14 ) leptonic = 2;
161 if ( std::abs( (*begin)->pdg_id() ) == 15 ) leptonic = 11;
166 CLHEP::HepLorentzVector tauvis = CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(),
167 tau->momentum().py()-nutau.py(),
168 tau->momentum().pz()-nutau.pz(),
169 tau->momentum().e()-nutau.e());
170 if (tauvis.vect().perp() >=
m_LGMinPt && std::abs(tauvis.vect().pseudoRapidity()) <=
m_LGMaxEta) {
171 MCTruthTauList.push_back(tauvis);
181 std::vector<const xAOD::Jet*> jetList;
184 jetList.push_back(*it_truth);
190 removePseudoJets(jetList, MCTruthPhotonList, MCTruthElectronList, MCTruthTauList);
202 if (jetList.size() >= 1) {
214 if (jetList.size() >= 2) {
226 if (jetList.size() >= 2) {
229 if (
j1->eta()*
j2->eta() < 0.) flagSign = 1;
237 if (jetList.size() >= 2) {
239 int okMassJJ =
m_MassJJ >= 0. ? 0 : 1;
240 for (
unsigned i=0;
i<jetList.size()-1;++
i) {
241 for (
unsigned j=
i+1;j<jetList.size();++j) {
242 double dEta = std::abs(jetList[
i]->
eta()-jetList[j]->
eta());
243 double Mjj = (jetList[
i]->p4()+jetList[j]->p4()).M();
246 if (okMassJJ == 0 && Mjj >
m_MassJJ) okMassJJ = 1;
247 if (okDeltaEtaJJ && okMassJJ) {
253 if (flagJJ == 1)
break;
266 setFilterPassed(flagNJets != 0 && flag1stJet != 0 && flag2ndJet != 0 && flagSign != 0 && flagJJ != 0);
267 return StatusCode::SUCCESS;
272 CLHEP::HepLorentzVector nu( 0, 0, 0, 0);
274 if ( ( std::abs(
part->pdg_id() ) == 12 ) || ( std::abs(
part->pdg_id() ) == 14 ) || ( std::abs(
part->pdg_id() ) == 16 ) ) {
275 nu.setPx(
part->momentum().px());
276 nu.setPy(
part->momentum().py());
277 nu.setPz(
part->momentum().pz());
278 nu.setE(
part->momentum().e());
282 if ( !
part->end_vertex() )
return nu;
291 for (
unsigned i=0;
i<
list.size();++
i) {
293 double dphi =
jet->phi()-
list[
i]->momentum().phi();
294 double deta =
jet->eta()-
list[
i]->momentum().pseudoRapidity();
295 if (dphi >
M_PI) { dphi -= 2.*
M_PI; }
296 if (dphi < -
M_PI) { dphi += 2.*
M_PI; }
297 double dr = std::sqrt(deta*deta+dphi*dphi);
298 double ratio_pt= std::abs((
jet->pt()-
list[
i]->momentum().perp())/
list[
i]->momentum().perp());
308 for (
unsigned i=0;
i<
list.size();++
i) {
310 double dphi =
jet->phi()-
list[
i].phi();
311 double deta =
jet->eta()-
list[
i].vect().pseudoRapidity();
312 if (dphi >
M_PI) { dphi -= 2.*
M_PI; }
313 if (dphi < -
M_PI) { dphi += 2.*
M_PI; }
314 double dr = std::sqrt(deta*deta+dphi*dphi);
315 double ratio_pt= std::abs((
jet->pt()-
list[
i].vect().perp())/
list[
i].vect().perp());
324 std::vector<HepMC::ConstGenParticlePtr> &MCTruthPhotonList,
325 std::vector<HepMC::ConstGenParticlePtr> &MCTruthElectronList,
326 std::vector<CLHEP::HepLorentzVector> &MCTruthTauList) {
327 std::vector<const xAOD::Jet*> orgJetList = jetList;
329 for (
unsigned i=0;
i<orgJetList.size();++
i) {