12#include "TLorentzVector.h"
22#include "GaudiKernel/IInterface.h"
48 ISvcLocator* pSvcLocator):
57 m_selTool(
"InDet::InDetTrackSelectionTool/TrackSelectionTool"),
182 return StatusCode::FAILURE;
191 return StatusCode::FAILURE;
199 return StatusCode::FAILURE;
210 return StatusCode::FAILURE;
233 ATH_MSG_INFO(
" -- IDPerfMonZmumu::initialize() -- init m_beamSpotKey ");
260 m_4mu.setDebugMode(
true);
271 return StatusCode::FAILURE;
279 return StatusCode::FAILURE;
287 return StatusCode::FAILURE;
294 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::Initialize ** Completed **");
295 return StatusCode::SUCCESS;
303 m_h_cutflow =
new TH1F(
"h_cutflow",
"cut flow histogram",11, -0.5, 9.5);
425 bool isTreeNone =
false;
426 if (
m_IDTreeName.find(
"none") != std::string::npos) isTreeNone =
true;
600 if (
m_combTreeName.find(
"none") != std::string::npos) isTreeNone =
true;
656 if (
m_MSTreeName.find(
"none") != std::string::npos) isTreeNone =
true;
658 ATH_MSG_INFO(
"initialize() ** defining IDPerfMon MSTree ");
821 ATH_MSG_INFO(
"initialize() Going to register the mu+mu- trees");
823 if (tHistSvc.retrieve().isFailure()){
824 ATH_MSG_ERROR(
"initialize() Could not find Hist Service -> Switching ValidationMode Off !");
830 ATH_MSG_INFO(
"initialize() commonTree succesfully registered!");
833 ATH_MSG_ERROR(
"initialize() Could not register the validation commonTree -> Switching ValidationMode Off !");
841 ATH_MSG_INFO(
"initialize() IDTree succesfully registered!");
844 ATH_MSG_ERROR(
"initialize() Could not register the validation IDTree -> Switching ValidationMode Off !");
857 ATH_MSG_INFO(
"initialize() CBTree succesfully registered!");
860 ATH_MSG_ERROR(
"initialize() Could not register the validation CBTree -> Switching ValidationMode Off !");
874 ATH_MSG_INFO(
"initialize() MSTree succesfully registered!");
877 ATH_MSG_ERROR(
"initialize() Could not register the validation MSTree -> Switching ValidationMode Off !");
887 ATH_MSG_INFO(
"initialize() Refit1 Tree succesfully registered!");
890 ATH_MSG_ERROR(
"initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
898 ATH_MSG_INFO(
"initialize() Refit2 Tree succesfully registered!");
901 ATH_MSG_ERROR(
"initialize() Could not register the validation Tree -> Switching ValidationMode Off !");
910 ATH_MSG_INFO(
"initialize() truthTree Tree succesfully registered!");
913 ATH_MSG_ERROR(
"initialize() Could not register the validation truth Tree -> Switching ValidationMode Off !");
921 ATH_MSG_INFO(
"initialize() FourMu Tree succesfully registered!");
924 ATH_MSG_ERROR(
"initialize() Could not register the validation FourMu Tree -> Switching ValidationMode Off !");
930 return StatusCode::SUCCESS;
953 m_event_mu = eventInfo->actualInteractionsPerCrossing();
954 m_beamposX = beamSpotHandleRec->beamPos().x();
955 m_beamposY = beamSpotHandleRec->beamPos().y();
957 if (eventInfo->mcEventWeights().size()>0) {
966 ATH_MSG_DEBUG(
" IDPerfMonZmumu::execute evtStore->retrieve (eventInfo) failed .. trying another strategy.. ");
972 m_event_mu = eventInfo2->actualInteractionsPerCrossing();
973 if (eventInfo->mcEventWeights().size()>0) {
982 ATH_MSG_ERROR(
"** IDPerfMonZmumu::execute ** Could not retrieve event info.");
988 ATH_MSG_DEBUG(
" ** IDPerfMonZmumu::execute ** calling FourLeptonAnalysis()...");
990 if (fourLeptAnaStatus.isSuccess())
ATH_MSG_INFO (
" ** IDPerfMonZmumu::execute ** RunFourLeptonAnalysis() SUCCESS -> found a new event");
996 ATH_MSG_DEBUG(
" ** IDPerfMonZmumu::execute ** calling dimuon analysis m_xZmm.Reco()...");
1001 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV "
1003 <<
" ** SUCCESS **");
1009 <<
" Failed dimuon reconstruction. m_xZmm.Reco() returned FALSE ");
1010 return StatusCode::SUCCESS;
1019 if (isTriggerPassed == StatusCode::SUCCESS) {
1023 ATH_MSG_DEBUG(
"Trigger Failed -> reject event --> leave event");
1024 return StatusCode::SUCCESS;
1036 StatusCode success_pos = StatusCode::FAILURE;
1037 StatusCode success_neg = StatusCode::FAILURE;
1039 if (muon_pos && muon_neg) {
1041 using enum xAOD::Muon::TrackParticleType;
1043 ATH_MSG_INFO(
"** IDPerfMonZmumu::execute ** Retrieving InnerDetectorTrackParticles of the accepted muons");
1044 ppos_comb = muon_pos->
trackParticle(InnerDetectorTrackParticle);
1045 pneg_comb = muon_neg->
trackParticle(InnerDetectorTrackParticle);
1047 if (!ppos_comb || !pneg_comb) {
1048 ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** InnerDetectorTrackParticles are requested but they are not present. Exiting event.");
1049 return StatusCode::SUCCESS;
1054 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Retrieving CombinedTrackParticles of the accepted muons");
1058 if (!ppos_comb || !pneg_comb){
1059 ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** CombinedTrackParticles are requested but they are not present. Exiting event.");
1060 return StatusCode::SUCCESS;
1066 if (ppos_comb && pneg_comb) {
1075 const EventContext& ctx = Gaudi::Hive::currentContext();
1077 for (
const auto V : *vertices) {
1087 if (!ppos_comb_v || !pneg_comb_v){
1088 ATH_MSG_WARNING(
"Some or all of the requested particles have no vertex. Exiting event");
1089 return StatusCode::SUCCESS;
1093 ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** Could not find CombinedMuon pos/neg in event"
1097 return StatusCode::SUCCESS;
1104 if (
m_xZmm.AcceptEvent() ) {
1108 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ** some preliminaries are due though...");
1112 if ( !
m_selTool->accept(muon_pos->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)) ) {
1113 ATH_MSG_DEBUG(
"Exiting because the ID segment of muon_pos do not pass the TrackSelection");
1114 return StatusCode::SUCCESS;
1116 if ( !
m_selTool->accept(muon_neg->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)) ) {
1117 ATH_MSG_DEBUG(
"Exiting because the ID segment of muon_neg do not pass the TrackSelection");
1118 return StatusCode::SUCCESS;
1120 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Good news ** pos and neg muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle) pass the trackSelection :)");
1123 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track selection is not in use ");
1135 muon_pos->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle),
1136 muon_pos->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)->
charge(),
1139 muon_neg->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle),
1140 muon_neg->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)->
charge(),
1143 if (success_pos && success_neg) {
1153 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1158 <<
" pt: " << muon_pos->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)->
pt()
1166 <<
" pt: " << muon_neg->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)->
pt()
1198 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** not filling IDTracks in combTree due to problems with muon_xxx->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle)");
1206 muon_pos->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle),
1211 muon_neg->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle),
1216 if (success_pos && success_neg) {
1222 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1271 muon_pos->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle),
1276 muon_neg->
trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle),
1279 if (success_pos && success_neg) {
1284 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1312 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Going to build TrackCollections: muonTrks, muonTrksRefit1 and muonTrksRefit2");
1317 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Going to refit and store the track parameters ");
1325 StatusCode fitStatus;
1327 const EventContext& ctx = Gaudi::Hive::currentContext();
1328 if( ppos_comb->
track() ) {
1333 if (fitStatus.isFailure()) {
1334 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit1 Failed for ppos_comb->track(). Skipping Event");
1335 return StatusCode::SUCCESS;
1338 muonTrksRefit1->
push_back(refit1MuonTrk1);
1339 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit1 Success of ppos_comb->track()."
1346 if (fitStatus.isFailure()) {
1347 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit2 Failed for ppos_comb->track(). Skipping Event");
1348 return StatusCode::SUCCESS;
1351 muonTrksRefit2->
push_back(refit2MuonTrk1);
1352 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit2 Success of ppos_comb->track()."
1358 if( pneg_comb->
track() ) {
1363 if (fitStatus.isFailure()) {
1364 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit1 Failed. Skipping Event");
1365 return StatusCode::SUCCESS;
1368 muonTrksRefit1->
push_back(refit1MuonTrk2);
1369 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit1 Success of pneg_comb->track()."
1376 if (fitStatus.isFailure()) {
1378 return StatusCode::SUCCESS;
1381 muonTrksRefit2->
push_back(refit2MuonTrk2);
1382 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** Track Refit2 Success of pneg_comb->track()."
1387 if (muonTrksRefit1->
size() != 2)
ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** WARNING ** size of muonTrksRefit1: " << muonTrksRefit1->
size());
1388 if (muonTrksRefit2->
size() != 2)
ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** WARNING ** size of muonTrksRefit2: " << muonTrksRefit2->
size());
1396 if (
sc.isSuccess()) {
1403 if (muonTrksRefit1->
size() > 1) {
1405 if (
sc.isSuccess()) {
1412 if (muonTrksRefit2->
size() > 1) {
1414 if (
sc.isSuccess()) {
1423 if (muonTrksRefit1->
size()<2) {
1424 ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** Refit1 muon tracks are missing!");
1427 ATH_MSG_DEBUG(
"** IDPerfMonZmumu::execute ** going to fill refit1tree ");
1432 if (success_pos && success_neg) {
1438 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1478 if (muonTrksRefit2->
size()<2) {
1479 ATH_MSG_WARNING(
"** IDPerfMonZmumu::execute ** Refit2 muon tracks are missing!");
1487 if (success_pos && success_neg) {
1493 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1536 if ( !
m_xZmm.AcceptEvent() ) {
1540 return StatusCode::SUCCESS;
1547 bool truthStatusIsGood =
true;
1549 truthStatusIsGood =
false;
1553 truthStatusIsGood =
false;
1556 if (truthStatusIsGood) {
1561 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1603 bool dofill =
false;
1615 <<
" Invariant mass = " <<
m_xZmm.GetInvMass() <<
" GeV ");
1639 for (
auto muon : *muons) {
1640 const xAOD::TrackParticle* tp = muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
1642 ATH_MSG_DEBUG(
" - tpb = "<< tp <<
" -> is null? " << (!tp));
1650 const Trk::Perigee* tPerigee = t->perigeeParameters() ;
1663 StatusCode scid =
evtStore()->record(IDTracks,
"IDTracks");
1664 if (scid.isSuccess()) {
1675 return StatusCode::SUCCESS;
1686 return StatusCode::FAILURE;
1690 return StatusCode::FAILURE;
1707 double sigma_pt = 0;
1709 double sigma_qOverP = 1.;
1712 px = trackp->
p4().Px();
1713 py = trackp->
p4().Py();
1714 pt = trackp->
p4().Pt();
1715 pz = trackp->
p4().Pz();
1716 phi= trackp->
p4().Phi();
1717 eta= trackp->
p4().Eta();
1720 qoverp = trackp->
qOverP();
1729 double sigma_pt_term1 = (sin(trackp->
theta()) / pow(qoverp,2)) * sigma_qOverP;
1730 double sigma_pt_term2 = (1./qoverp) * cos(trackp->
theta()) * sigma_theta;
1731 double sigma_pt_term3 = (cos(trackp->
theta()) / pow(qoverp,2)) * sigma_theta * sigma_qOverP;
1735 if (vertex ==
nullptr) {
1737 return StatusCode::FAILURE;
1740 ATH_MSG_WARNING(
"in FillRecParametersTP. WARNING: m_trackToVertexIPEstimator is NULL");
1741 return StatusCode::FAILURE;
1745 std::unique_ptr<Trk::ImpactParametersAndSigma> iPandSigma(
nullptr);
1747 const EventContext &ctx = Gaudi::Hive::currentContext();
1752 ATH_MSG_DEBUG(
"return from the trackToVertexIPEstimator->estimate()");
1755 ATH_MSG_WARNING (
"FillRecParametersTP::trackToVertexIPEstimator failed !");
1756 return StatusCode::FAILURE;
1759 ATH_MSG_DEBUG(
"FillRecParametersTP::trackToVertexIPEstimator success !");
1760 PVd0 = iPandSigma->IPd0;
1761 PVd0res = iPandSigma->PVsigmad0;
1762 d0res = iPandSigma->sigmad0;
1763 PVz0 = iPandSigma->IPz0;
1764 PVz0res = iPandSigma->PVsigmaz0;
1765 z0res = iPandSigma->sigmaz0;
1789 ATH_MSG_DEBUG(
"(Filled charge == 1 ) (reco)-> px : "<< px <<
" py: "<<py <<
" pt: "<<pt <<
" pz: "<<pz
1790 <<
" d0: "<<
m_positive_d0 <<
" d0res : "<< d0res <<
" PVd0res : "<< PVd0res <<
" z0: "<<
m_positive_z0 <<
" z0res : " << z0res <<
" PVz0res : "<< PVz0res );
1792 }
else if (
charge == -1) {
1812 ATH_MSG_DEBUG(
"(Filled charge == -1 ) (reco)-> px : "<< px <<
" py: "<< py <<
" pt: " << pt <<
" pz: "<<pz
1813 <<
" d0: "<<
m_negative_d0 <<
" d0res : "<< d0res <<
" PVd0res : "<< PVd0res <<
" z0: "<<
m_negative_z0 <<
" z0res : " << z0res <<
" PVz0res : "<< PVz0res );
1816 return StatusCode::SUCCESS;
1824 ATH_MSG_DEBUG(
"* FillRecParameters * Empty Track: track. Skipping.");
1825 return StatusCode::FAILURE;
1829 ATH_MSG_DEBUG(
"* FillRecParameters * Empty Track: trackp_for_unbias. Skipping.");
1830 return StatusCode::FAILURE;
1833 const Trk::Perigee* trkPerigee = track->perigeeParameters();
1846 double d0_err = 999.;
1847 double z0_err = 999.;
1855 if (trkPerigee !=
nullptr){
1856 double qOverP = trkPerigee->parameters()[
Trk::qOverP];
1860 pt = std::abs(trkPerigee->
pT());
1864 d0 = trkPerigee->parameters()[
Trk::d0];
1865 z0 = trkPerigee->parameters()[
Trk::z0];
1883 pt = std::abs(atBL->
pT());
1887 d0 = atBL->parameters()[
Trk::d0];
1888 z0 = atBL->parameters()[
Trk::z0];
1895 ATH_MSG_WARNING(
"FillRecParameters::Failed extrapolation to the BeamLine");
1899 TLorentzVector vtrack = TLorentzVector (trkPerigee->
momentum().x(),
1903 float trkd0 = trkPerigee->parameters()[
Trk::d0];
1904 float trkz0 = trkPerigee->parameters()[
Trk::z0];
1905 float bsX = position.x();
1906 float bsY = position.y();
1907 float bsZ = position.z();
1908 float btiltX = beamSpotHandleRec->beamTilt(0);
1909 float btiltY = beamSpotHandleRec->beamTilt(1);
1911 float beamX = bsX + std::tan(btiltX) * (trkz0-bsZ);
1912 float beamY = bsY + std::tan(btiltY) * (trkz0-bsZ);
1913 float beamD0 = ( -std::sin(vtrack.Phi())*beamX + std::cos(vtrack.Phi())*beamY );
1914 float d0bscorr = trkd0 - beamD0;
1915 float z0bscorr = trkz0 - bsZ;
1918 std::unique_ptr<Trk::ImpactParametersAndSigma> iPandSigma(
nullptr);
1921 if( iPandSigma==0 ){
1922 ATH_MSG_WARNING (
"FillRecParameters::trackToVertexIPEstimator failed !");
1923 return StatusCode::FAILURE;
1926 ATH_MSG_DEBUG(
"FillRecParameters::trackToVertexIPEstimator success !");
1927 PVd0 = iPandSigma->IPd0;
1928 PVd0res = iPandSigma->PVsigmad0;
1930 PVz0 = iPandSigma->IPz0;
1931 PVz0res = iPandSigma->PVsigmaz0;
1935 ATH_MSG_INFO(
" FillRecParameters::trackToVertexIPEstimator vertex does exist ");
1964 ATH_MSG_DEBUG(
"(Filled charge == 1 ) (reco)-> px : "<< px <<
" py: "<<py <<
" pz: "<<pz <<
" d0: "<<d0<<
" z0: "<< z0);
1985 ATH_MSG_DEBUG(
"(Filled charge == -1 ) (reco)-> px : "<< px <<
" py: "<<py <<
" pz: "<<pz <<
" d0: "<<d0<<
" z0: "<<z0 );
1988 return StatusCode::SUCCESS;
1994 ATH_MSG_DEBUG(
"* FillRecParametersSimple * Empty Track: track. Skipping.");
1995 return StatusCode::FAILURE;
1998 const Trk::Perigee* trkPerigee = track->perigeeParameters();
1999 if (not trkPerigee) {
2000 ATH_MSG_ERROR(
"trkPerigee pointer is null in IDPerfMonZmumu::FillRecParametersSimple");
2001 return StatusCode::FAILURE;
2012 double d0_err = 999.;
2013 double z0_err = 999.;
2016 double qOverP = trkPerigee->parameters()[
Trk::qOverP];
2020 pt = std::abs(trkPerigee->
pT());
2024 d0 = trkPerigee->parameters()[
Trk::d0];
2025 z0 = trkPerigee->parameters()[
Trk::z0];
2032 Amg::Vector3D position (eventInfo->beamPosX(), eventInfo->beamPosY(), eventInfo->beamPosZ());
2033 TLorentzVector vtrack = TLorentzVector (trkPerigee->
momentum().x(),
2038 const EventContext& ctx = Gaudi::Hive::currentContext();
2041 float trkd0 = trkPerigee->parameters()[
Trk::d0];
2042 float trkz0 = trkPerigee->parameters()[
Trk::z0];
2043 float bsX = beamSpotHandleRec->beamPos().x();
2044 float bsY = beamSpotHandleRec->beamPos().y();
2045 float bsZ = beamSpotHandleRec->beamPos().z();
2046 float btiltX = beamSpotHandleRec->beamTilt(0);
2047 float btiltY = beamSpotHandleRec->beamTilt(1);
2049 float beamX = bsX + std::tan(btiltX) * (trkz0-bsZ);
2050 float beamY = bsY + std::tan(btiltY) * (trkz0-bsZ);
2051 float beamD0 = ( -std::sin(vtrack.Phi())*beamX + std::cos(vtrack.Phi())*beamY );
2052 float d0bscorr = trkd0 - beamD0;
2053 float z0bscorr = trkz0 - bsZ - vertex->z();
2058 <<
"( " << beamSpotHandleRec->beamPos().x()
2059 <<
", " << beamSpotHandleRec->beamPos().y()
2060 <<
", " << beamSpotHandleRec->beamPos().z()
2061 <<
") tkd0: " << trkd0
2062 <<
" d0bscorr: " << d0bscorr);
2094 ATH_MSG_DEBUG(
"* FillRecParametersSimple * completed * charge " <<
charge <<
" pt: " << pt <<
" d0: " << d0 <<
" z0: " << z0);
2096 return StatusCode::SUCCESS;
2103 if (!trackParticle ){
2104 ATH_MSG_WARNING(
"-- FillTruthParameters -- Empty Trackparticle. Skipping.");
2105 return StatusCode::FAILURE;
2111 ATH_MSG_DEBUG(
" -- FillTruthParameters -- Failure while retrieving the truth particle. Returning FAILURE.");
2112 return StatusCode::FAILURE;
2115 if ( particle->pdgId() == 13)
charge = -1.;
2116 if ( particle->pdgId() == -13)
charge = 1.;
2117 if ( particle->isNeutral() ) {
2118 ATH_MSG_DEBUG(
" -- FillTruthParameters -- reco muon associated to a truth neutral!! Returning FAILURE.");
2119 return StatusCode::FAILURE;
2122 ATH_MSG_DEBUG(
" -- FillTruthParameters -- reco muon associated to a non true muon!! Returning FAILURE.");
2123 return StatusCode::FAILURE;
2126 const Amg::Vector3D momentum(particle->px(), particle->py(), particle->pz());
2128 ptruthVertex=particle->prodVtx();
2130 ATH_MSG_DEBUG(
"A production vertex pointer was retrieved, but it is NULL");
2131 return StatusCode::FAILURE;
2135 if (particle->parent(0) !=
nullptr) {
2139 ATH_MSG_DEBUG(
" -- FillTruthParameters -- truth particle is good. pdg: " << particle->pdgId()
2140 <<
" type: " << particle->type()
2141 <<
" nparents " << particle->nParents()
2142 <<
" parent->pdg: " << particle->parent(0)->pdgId()
2143 <<
" truthType: " << truthTypeAcc(*particle)
2144 <<
" truthOrigin: " << truthOriginAcc(*particle)
2149 ATH_MSG_DEBUG(
" -- FillTruthParameters -- truth particle is good. pdg: " << particle->pdgId()
2150 <<
" type: " << particle->type()
2151 <<
" nparents " << particle->nParents()
2152 <<
" parent->pdg: " << particle->parent(0)->pdgId()
2153 <<
" truthType & truthOrigin: " <<
" NOT AVAILABLE "
2158 const auto xPos=ptruthVertex->
x();
2159 const auto yPos=ptruthVertex->
y();
2160 const auto z_truth=ptruthVertex->
z();
2168 const EventContext& ctx = Gaudi::Hive::currentContext();
2189 ATH_MSG_DEBUG(
"reco IPs (pos): > d0 : "<<d0recoPos <<
" z0: " << z0recoPos <<
" trackp z0 : " << trackParticle->
z0() <<
" trackp d0 : " << trackParticle->
d0());
2190 ATH_MSG_DEBUG(
"reco IPs (neg): > d0 : "<<d0recoNeg <<
" z0: " << z0recoNeg <<
" trackp z0 : " << trackParticle->
z0() <<
" trackp d0 : " << trackParticle->
d0() );
2192 double qOverP_truth = 0.;
2197 px = tP->momentum().x();
2198 py = tP->momentum().y();
2200 pz = tP->momentum().z();
2203 d0 = tP->parameters()[
Trk::d0];
2204 z0 = tP->parameters()[
Trk::z0];
2206 ATH_MSG_DEBUG(
"cand perig HEP particle (truth) px : "<< tP->momentum().x());
2207 ATH_MSG_DEBUG(
"cand perig HEP particle (truth) py : "<< tP->momentum().y());
2208 ATH_MSG_DEBUG(
"cand perig HEP particle (truth) pz : "<< tP->momentum().z());
2231 bool parentfound =
false;
2232 if (particle->nParents()>0) {
2233 if (particle->parent(0) !=
nullptr) {
2248 }
else if (
charge == -1) {
2263 bool parentfound =
false;
2264 if (particle->nParents()>0) {
2265 if (particle->parent(0) !=
nullptr) {
2280 return StatusCode::SUCCESS;
2291 if( ! acc.isAvailable( p ) ) {
2295 const Link_t& link = acc( p );
2297 if( ! link.isValid() ) {
2308 return StatusCode::SUCCESS;
2319 return StatusCode::FAILURE;
2325 float thisEventTriggerPrescale = 999999.9;
2326 float thisHLTTriggerPrescale = 999999.9;
2327 bool thisHLTIsPassed =
false;
2328 std::string thisHLTTriggerName;
2329 std::string thisEventTriggerName;
2332 const std::vector<std::string> myHLTtriglist =
m_triggerDecision->getChainGroup(
"HLT_mu.*, HLT_2mu.*")->getListOfTriggers();
2333 for (
int i=0; i < (int) myHLTtriglist.size(); i++) {
2335 ATH_MSG_DEBUG(
"HLT trigger = " << i <<
" out of " << myHLTtriglist.size() <<
" --> " << myHLTtriglist.at(i) <<
" isPassed? " <<
m_triggerDecision->isPassed(myHLTtriglist.at(i)) <<
" prescale: " <<
m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale() );
2338 thisHLTIsPassed =
true;
2339 float thisprescale =
m_triggerDecision->getChainGroup(myHLTtriglist.at(i))->getPrescale();
2340 if (thisprescale < thisHLTTriggerPrescale) {
2341 thisHLTTriggerPrescale = thisprescale;
2342 thisHLTTriggerName = myHLTtriglist.at(i);
2346 if (thisHLTTriggerPrescale < 1) thisHLTTriggerPrescale = 1;
2347 ATH_MSG_DEBUG(
"Event HLT trigger prescale = " << thisHLTTriggerPrescale);
2350 if (thisHLTIsPassed) {
2355 return StatusCode::FAILURE;
2359 thisEventTriggerPrescale = thisHLTTriggerPrescale;
2360 thisEventTriggerName = thisHLTTriggerName;
2361 ATH_MSG_DEBUG(
"CheckTriggerStatusAndPrescale -- Event trigger prescale = " << thisEventTriggerPrescale);
2362 ATH_MSG_DEBUG(
"CheckTriggerStatusAndPrescale -- Event trigger name = " << thisEventTriggerName);
2368 return StatusCode::SUCCESS;
2382 for (
int ivtx=0; ivtx< (int) vxContainer->
size();ivtx++) {
2383 myVtx = (*vxContainer)[ivtx];
2555 StatusCode thisStatus = StatusCode::SUCCESS;
2576 if( electronTruth) {
2577 ATH_MSG_DEBUG (
"retrieving electron Truth container with key: \"egammaTruthParticles\" SUCCESS ");
2579 if( electronTruth->hasStore() ) {
2581 auto tr_itr = electronTruth->
begin();
2582 auto tr_end = electronTruth->
end();
2583 int electronCount = 0;
2584 for(
int i = 0; tr_itr != tr_end; ++tr_itr, ++i ) {
2585 ATH_MSG_DEBUG(
"Truth : Investigating truth electron #" << i <<
" pdgID= " << ( *tr_itr )->pdgId());
2586 if (fabs(( *tr_itr )->pdgId()) == 11) {
2587 if (( *tr_itr )->pt() > 10000 && fabs(( *tr_itr )->eta()) < 2.47) {
2588 ATH_MSG_INFO(
" central electron found --> pt: " << ( *tr_itr )->charge()*( *tr_itr )->pt() <<
" eta " <<( *tr_itr )->eta() );
2593 ATH_MSG_INFO(
"#central electrons: " << electronCount );
2596 ATH_MSG_WARNING (
"electronTruth container has no Store !!! FAILURE");
2600 ATH_MSG_WARNING (
"retrieve electron Truth container with key: \"egammaTruthParticles\" FAILURE");
2604 if (
m_doDebug) std::cout <<
" ** RunFourLeptonAnalysis ** calling m_4mu.Reco() .... " << std::endl;
2605 bool statusOf4LeptReco =
m_4mu.Reco();
2608 if(statusOf4LeptReco) {
2609 thisStatus = StatusCode::SUCCESS;
2610 ATH_MSG_INFO (
"4-lepton reconstruction SUCCESS. # accepted events " <<
m_4mu.getAcceptedEvents() <<
" Invariant mass = " <<
m_4mu.GetInvMass() <<
" GeV ");
2611 if (
m_doDebug) std::cout <<
" ** RunFourLeptonAnalysis ** 4-lepton reconstruction SUCCESS. # accepted events " <<
m_4mu.getAcceptedEvents() <<
" Invariant mass = " <<
m_4mu.GetInvMass() <<
" GeV " << std::endl;
2614 thisStatus = StatusCode::FAILURE;
2615 ATH_MSG_DEBUG (
"4-lepton reconstruction FAILURE. m_4mu.Reco() returned FALSE --> event failed selection");
2616 if (
m_doDebug) std::cout <<
" ** RunFourLeptonAnalysis ** 4-lepton reconstruction FAILURE. m_4mu.Reco() returned FALSE --> event failed selection" << std::endl;
2619 if(statusOf4LeptReco) {
2620 if (
m_4mu.EventPassed() ) {
2727 std::string metName =
"MET_Reference_AntiKt4LCTopo";
2728 std::string metRefFinalName =
"FinalClus";
2735 ATH_MSG_WARNING (
"No Collection with name " << metName <<
" found in StoreGate");
2739 StatusCode
sc =
evtStore()->retrieve(final_met, metName);
2740 if (
sc.isFailure()) {
2741 ATH_MSG_DEBUG (
"Could not retrieve Collection " << metName <<
" from StoreGate");
2746 if (final_met)
met = (*final_met)[metRefFinalName];
2753 ATH_MSG_INFO (
" -- IDPerfMonZmumu::execute -- Accepted event " <<
m_4mu.getAcceptedEvents() <<
" with m_4mu.GetInvMass= " <<
m_4mu_minv);
2758 <<
" Invariant mass = " <<
m_4mu_minv <<
" GeV ");
2759 if (muon1_pos !=
nullptr)
ATH_MSG_DEBUG(
"mu1+ --> pxyz " << muon1_pos->
p4().Px()
2760 <<
", " << muon1_pos->
p4().Py()
2761 <<
", " << muon1_pos->
p4().Pz()
2762 <<
" pt: " << muon1_pos->
pt()
2763 <<
" d0: " << muon1_pos->
d0()
2764 <<
" z0: " << muon1_pos->
z0()
2767 if (muon1_neg !=
nullptr)
ATH_MSG_DEBUG(
"mu1- --> pxyz " << muon1_neg->
p4().Px()
2768 <<
", " << muon1_neg->
p4().Py()
2769 <<
", " << muon1_neg->
p4().Pz()
2770 <<
" pt: " << muon1_neg->
pt()
2771 <<
" d0: " << muon1_neg->
d0()
2772 <<
" z0: " << muon1_neg->
z0()
2775 if (elec1_pos !=
nullptr)
ATH_MSG_DEBUG(
"el1+ --> pxyz " << elec1_pos->
p4().Px()
2776 <<
", " << elec1_pos->
p4().Py()
2777 <<
", " << elec1_pos->
p4().Pz()
2778 <<
" pt: " << elec1_pos->
pt()
2779 <<
" d0: " << elec1_pos->
d0()
2780 <<
" z0: " << elec1_pos->
z0()
2801 int nBLhits, nhitsPIX, nhitsSCT, nhitsTRT, nContribPixLayers;
2802 int nPIXholes, nSCTholes;
2803 if (IDTrkMuPos && IDTrkMuNeg) {
2821 <<
" nBLhits: " << nBLhits
2822 <<
" nhitsPIX: " << nhitsPIX
2823 <<
" nPIXLayers: " << nContribPixLayers
2824 <<
" nhitsSCT: " << nhitsSCT
2825 <<
" Silicon holes: " << nPIXholes + nSCTholes
2826 <<
" nhitsTRT: " << nhitsTRT);
2842 <<
" nBLhits: " << nBLhits
2843 <<
" nhitsPIX: " << nhitsPIX
2844 <<
" nPIXLayers: " << nContribPixLayers
2845 <<
" nhitsSCT: " << nhitsSCT
2846 <<
" Silicon holes: " << nPIXholes + nSCTholes
2847 <<
" nhitsTRT: " << nhitsTRT);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
double charge(const T &p)
Helper class to provide constant type-safe access to aux data.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
double m_el_negative1_z0_err
ToolHandle< Trig::TrigDecisionTool > m_triggerDecision
std::vector< float > m_Refit1_qoverp
StatusCode CheckTriggerStatusAndPrescale()
virtual StatusCode finalize()
StatusCode FillTruthParameters(const xAOD::TrackParticle *track)
StatusCode RunFourLeptonAnalysis()
bool m_useCustomMuonSelector
std::vector< float > m_Refit1_sigma_qoverp
double m_el_positive1_d0_err
double m_el_positive2_z0_err
double m_positive_d0_PVerr
std::string m_truthTreeFolder
double m_negative_2_z0_err
double m_positive_sigma_qoverp
double m_negative_sigma_qoverp
const xAOD::Vertex * GetDiMuonVertex(const xAOD::TrackParticle *, const xAOD::TrackParticle *)
double m_positive_2_d0_err
double m_positive_d0_manualBS
void ResetCommonNtupleVectors()
std::vector< float > m_Refit2_sigma_d0
std::vector< float > m_CBTrack_sigma_z0
TH1F * m_h_cutflow
link vector to map HepMC onto xAOD truth
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
tool to extrapolate tracks to BL
std::vector< float > m_Refit1_sigma_d0
std::vector< float > m_CBTrack_d0
std::string m_refit1TreeFolder
std::string m_ValidationTreeDescription
< validation tree description - second argument in TTree
std::vector< float > m_Refit2_qoverp
std::string m_outputTracksName
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackContainerName
IDTtacks.
std::vector< float > m_Refit1_eta
ToolHandle< Trig::IMatchingTool > m_triggerMatching
std::vector< float > m_CBTrack_sigma_d0
unsigned int m_lumi_block
std::vector< float > m_IDTrack_d0
std::string m_MSTreeFolder
std::string m_trackParticleName
Track(Particle)TruthCollection input name.
std::string m_combTreeFolder
ToolHandle< IegammaTrkRefitterTool > m_TrackRefitter1
The track refitter.
double m_negative_2_d0_err
double m_positive_z0_PVerr
std::vector< float > m_Truth_phi
std::vector< float > m_Truth_pt
ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator
Needed for IP resolution studies.
std::vector< float > m_Refit2_d0
std::string m_MuonQualityName
double m_el_positive1_z0_err
double m_negative_z0_manualBS
ToolHandle< Trk::IExtrapolator > m_extrapolator
bool m_validationMode
< boolean to switch to validation mode
std::vector< float > m_Refit1_phi
std::vector< float > m_Refit2_eta
bool m_useTrackSelectionTool
std::string m_FourMuTreeFolder
Root Validation Tree.
std::vector< float > m_IDTrack_pt
std::vector< float > m_CBTrack_sigma_pt
std::vector< float > m_Truth_z0
double m_negative_z0_PVerr
ToolHandle< IegammaTrkRefitterTool > m_TrackRefitter2
The track refitter.
std::vector< float > m_IDTrack_sigma_d0
std::vector< float > m_Refit2_pt
double m_positive_sigma_pt
std::string m_truthTreeName
std::string m_refit1TreeName
double m_el_negative2_z0_err
std::vector< float > m_CBTrack_z0
std::string m_FourMuTreeName
std::vector< float > m_CBTrack_pt
std::vector< float > m_Refit1_sigma_pt
std::string m_triggerName
std::string m_refit2TreeName
virtual StatusCode initialize()
virtual StatusCode execute()
std::vector< float > m_Refit1_d0
std::vector< float > m_Truth_eta
ToolHandle< CP::ITrackVertexAssociationTool > m_Trk2VtxAssociationTool
std::string m_defaultTreeName
double m_negative_d0_PVerr
double m_positive_2_z0_err
std::vector< float > m_CBTrack_sigma_qoverp
std::vector< int > m_nSCThits
std::vector< int > m_nTRThits
std::vector< float > m_IDTrack_qoverp
std::vector< float > m_Refit2_z0
std::string m_truthLinkVecName
TrackParticle input name.
double m_positive_z0_manualBS
std::vector< float > m_Truth_d0
std::vector< int > m_nBLhits
std::vector< float > m_Refit1_pt
double m_LeadingMuonPtCut
std::string m_defaultTreeFolder
std::string m_IDTreeFolder
double m_el_positive2_d0_err
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
used for truth parameters
std::vector< float > m_IDTrack_phi
std::vector< float > m_Refit2_sigma_pt
std::string m_sTriggerChainName
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
std::string m_commonTreeFolder
std::vector< float > m_IDTrack_sigma_z0
double m_negative_sigma_pt
StatusCode FillRecParametersSimple(const Trk::Track *track, float charge, const xAOD::Vertex *vertex)
std::string m_combTreeName
void ExtractIDHitsInformation(const xAOD::Muon *muon_pos, const xAOD::Muon *muon_neg)
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
ToolHandle< CP::IMuonSelectionTool > m_muonSelector
used to pass a custom muon selector
std::vector< float > m_Refit2_sigma_qoverp
std::string m_commonTreeName
std::vector< float > m_Refit1_z0
std::vector< float > m_Truth_qoverp
std::vector< float > m_IDTrack_z0
StatusCode FillRecParameters(const Trk::Track *track, const xAOD::TrackParticle *trackp_for_unbias, double charge, const xAOD::Vertex *vertex, const EventContext &ctx)
std::vector< float > m_Refit2_phi
double m_el_negative2_d0_err
std::vector< int > m_nPIXhits
std::vector< float > m_IDTrack_sigma_pt
StatusCode FillRecParametersTP(const xAOD::TrackParticle *trackp, const xAOD::TrackParticle *trackp_for_unbias, double charge, const xAOD::Vertex *vertex=nullptr)
double m_negative_d0_manualBS
std::vector< float > m_CBTrack_eta
void RegisterHistograms()
std::string m_refit2TreeFolder
std::vector< int > m_Truth_parent
std::vector< float > m_IDTrack_sigma_qoverp
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
ToolHandle< InDet::IInDetTrackSelectionTool > m_selTool
The track selection Tool.
std::vector< float > m_Refit1_sigma_z0
std::vector< float > m_CBTrack_qoverp
double m_el_negative1_d0_err
std::vector< float > m_Refit2_sigma_z0
std::vector< float > m_IDTrack_eta
std::vector< float > m_CBTrack_phi
void Clear4MuNtupleVariables()
IDPerfMonZmumu(const std::string &name, ISvcLocator *pSvcLocator)
needed for IP resolution studies
static const T * getContainer(CONTAINERS eContainer)
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
double eta() const
Access method for pseudorapidity - from momentum.
const Amg::Vector3D & momentum() const
Access method for the momentum.
double pT() const
Access method for transverse momentum.
Class describing the Line to which the Perigee refers to.
const Perigee * perigeeParameters() const
return Perigee.
Class providing the definition of the 4-vector interface.
const TrackParticle * trackParticle(TrackParticleType type) const
Returns a pointer (which can be NULL) to the TrackParticle used in identification of this muon.
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float d0() const
Returns the parameter.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
float qOverP() const
Returns the parameter.
std::vector< float > definingParametersCovMatrixVec() const
Returns the length 6 vector containing the elements of defining parameters covariance matrix.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
float charge() const
Returns the charge.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.
VxType::VertexType vertexType() const
The type of the vertex.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 3, 1 > Vector3D
@ OWN_ELEMENTS
this data object owns its elements
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
MissingET_v1 MissingET
Version control by type defintion.
TruthVertex_v1 TruthVertex
Typedef to implementation.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
MissingETContainer_v1 MissingETContainer
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector [unit8_t].
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfBLayerHits
these are the hits in the first pixel layer, i.e.
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.