22#include "CLHEP/Random/RandFlat.h"
28#include "CLHEP/Units/SystemOfUnits.h"
29#include "CLHEP/Units/PhysicalConstants.h"
113 if (
m_doDebug) { std::cout <<
" * ZmumuEvent * ZmumuEvent::Reco() starting " << std::endl; }
133 for(
auto muon : *pxMuonContainer ){
136 idtrk = muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
137 metrk = muon->trackParticle(xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle);
138 if (idtrk && metrk) {
141 InnerDetectorPtAcc(*muon) = idtrk->
pt();
142 MuonSpectrometerPtAcc(*muon) = metrk->
pt();
148 if (pxMuonContainer !=
nullptr) {
149 if (
m_doDebug) {std::cout <<
" * ZmumuEvent * track list has "<< pxMuonContainer->
size() <<
" muon in xAOD::MuonContainer " <<
m_container <<std::endl; }
153 int attemptedMuonCount = 0;
154 int acceptedMuonCount = 0;
156 while ( xMuonItr != xMuonItrE ){
158 attemptedMuonCount++;
160 if(
m_doDebug){std::cout <<
" * ZmumuEvent * Reco() ** attempt on xMuonItr number "<< attemptedMuonCount <<
" (pointer: "<< *xMuonItr <<
")" << std::endl; }
162 if (
m_xMuonID.passSelection( pxCMuon) ) {
166 if (
m_doDebug) {std::cout <<
" This muon is accepeted !! this is muon number " << acceptedMuonCount <<
" & full pass" <<
m_numberOfFullPassMuons << std::endl; }
171 if (
m_doDebug) {std::cout <<
" * ZmumuEvent * accepted " << acceptedMuonCount <<
" muons from the input list of "<< pxMuonContainer->
size() <<std::endl; }
177 std::cout <<
" * ZmumuEvent * Can't retrieve combined muon collection (container: " <<
m_container <<
") " << std::endl;
220 if(
m_doDebug) {std::cout <<
" * ZmumuEvent * Event selection ** START ** for type: " << eType <<
" m_NumberOfFullPassMuons: " <<
m_numberOfFullPassMuons << std::endl;}
230 bool allMuonsGood =
true;
233 allMuonsGood =
false;
248 double leadingMuonPt, secondMuonPt;
282 if (secondMuonPt > leadingMuonPt) {
283 double tempPt = leadingMuonPt;
284 leadingMuonPt = secondMuonPt;
285 secondMuonPt = tempPt;
291 if(
m_doDebug){ std::cout <<
" * ZmumuEvent * Failing 1st muon pt cut * Reco Pt: " << leadingMuonPt <<
" < " <<
m_LeadingMuonPtCut*CLHEP::GeV << std::endl;}
297 if(
m_doDebug){ std::cout <<
" * ZmumuEvent * Failing 2nd muon pt cut * Reco Pt: " << secondMuonPt <<
" < " <<
m_SecondMuonPtCut*CLHEP::GeV << std::endl;}
339 std::cout <<
" * ZmumuEvent * z0_muon1= " << z0_muon1 <<
" z0_muon2= " << z0_muon2 <<
" delta= " << z0_muon1-z0_muon2 << std::endl;
341 if ( std::abs(z0_muon1 - z0_muon2) >
m_Z0GapCut) {
345 std::cout <<
" * ZmumuEvent * z0_muon1= " << z0_muon1 <<
" z0_muon2= " << z0_muon2 <<
" delta= " << z0_muon1-z0_muon2 <<
" > " <<
m_Z0GapCut <<
" (cut)" << std::endl;
353 std::cout <<
" * ZmumuEvent * Good muon pair: pt= " << leadingMuonPt/1000
354 <<
" & " << secondMuonPt/1000
355 <<
" GeV dimuon invariant mass = " <<
m_fInvariantMass[eType] <<
" GeV " << std::endl;
369 for (
unsigned int u = 0; u <
NUM_MUONS; ++u ) {
375 for (
unsigned int v = 0; v <
NUM_TYPES; ++v ) {
392 if(
m_doDebug) { std::cout <<
" * ZmumuEvent * RecordMuon * bad pxMuon --> EXIT "<< std::endl;}
402 if(
m_doDebug){ std::cout <<
" * ZmumuEvent * RecordMuon * bad pxMSmuon --> EXIT "<< std::endl;}
568 if ( pxTrackContainer )
572 while ( xTrkItr != xTrkItrE )
575 if ( !pxTrack )
continue;
577 if(!pxTrkTrack)
continue;
579 if ( !pxPerigee )
continue;
580 const float fTrkPhi = pxPerigee->parameters()[
Trk::phi];
581 const float fTrkEta = pxPerigee->
eta();
585 float fDR = sqrt( fDPhi*fDPhi + fDEta*fDEta );
637 double muPlusPt = 0.;
638 double muMinusPt = 0.;
657 if (muPlusId>=0 && muMinusId>=0) {
663 <<
" mu+: " << muPlusId <<
" mu-: " << muMinusId << std::endl;}
673 std::cout <<
" ** ZmumuEvent ** -- STATS -- " << std::endl
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
double charge(const T &p)
Helper class to provide type-safe access to aux data.
DataModel_detail::const_iterator< DataVector > const_iterator
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.
static float EvaluateAngle(const T *pxP1, const T *pxP2)
static float EvalDiMuInvMass(const T *pxP1, const T *pxP2)
static float EvalCharge(const T *pxP1, const T *pxP2)
static float EvalPhi(const T *pxP1, const T *pxP2)
static float EvalPtDiff(const T *pxP1, const T *pxP2)
static float EvalPt(const T *pxP1, const T *pxP2)
static float EvalEta(const T *pxP1, const T *pxP2)
std::string m_xSampleName
static const T * getContainer(CONTAINERS eContainer)
Helper class to provide type-safe access to aux data.
double eta() const
Access method for pseudorapidity - from momentum.
const Perigee * perigeeParameters() const
return Perigee.
double m_LeadingMuonPtCut
float getPtImbalance(ZTYPE eType)
unsigned int m_testedMuonCount
unsigned int m_eventselectioncount_masswindow
int getZCharge(ZTYPE eType)
unsigned int m_acceptedEventCount
float m_fZEtaDir[NUM_TYPES]
const xAOD::TrackParticle * m_pxMSTrack[NUM_MUONS]
unsigned int m_eventsWithEnoughMuonsCount
void ReconstructKinematics()
unsigned int m_eventselectioncount_toofewmuons
unsigned int m_eventselectioncount_goodlumiblock
unsigned int m_eventselectioncount_ptofsecondmuon
float m_fZPhiDir[NUM_TYPES]
bool EventSelection(ZTYPE eType)
unsigned int m_eventsWithoutEnoughMuonsCount
unsigned int m_uTrackMatch
unsigned int m_eventselectioncount_notallmuonsfilled
unsigned int m_eventselectioncount_openingangle
const xAOD::TrackParticle * m_pxIDTrack[NUM_MUONS]
const xAOD::Muon * m_pxRecMuon[NUM_MUONS]
unsigned int getNumberOfTaggedMuons()
unsigned int getPosMuon(ZTYPE eType)
float m_fInvariantMass[NUM_TYPES]
float m_fMuonDispersion[NUM_TYPES]
unsigned int m_numberOfFullPassMuons
unsigned int m_acceptedMuonCount
bool m_passedSelectionCuts
unsigned int m_eventselectioncount_morethantwomuons
void SetSecondMuonPtCut(double newvalue)
const std::string getRegion() const
void SetLeadingMuonPtCut(double newvalue)
void SetMuonPtCut(double newvalue)
const xAOD::TrackParticle * m_pxMETrack[NUM_MUONS]
unsigned int m_eventselectioncount_dimuoncharge
unsigned int m_eventselectioncount_ptofleadingmuon
virtual bool Reco(int theLumiBlock=0)
PerfMonServices::CONTAINERS m_container
bool RecordMuon(const xAOD::Muon *pxMuon)
unsigned int getNegMuon(ZTYPE eType)
double m_DiMuonPairInvMass
virtual void BookHistograms()
const TrackParticle * trackParticle(TrackParticleType type) const
Returns a pointer (which can be NULL) to the TrackParticle used in identification of this muon.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".