25#include "CLHEP/Random/RandFlat.h"
117 ( *m_msgStream) << MSG::INFO <<
" * MuonSelector::Init * m_muonSelectionTool.initialize() success :)" <<
endmsg;
118 if(
m_doDebug){ std::cout <<
" * MuonSelector::Init * m_muonSelectionTool.initialize() success :)" << std::endl;}
121 (*m_msgStream) << MSG::ERROR <<
" * MuonSelector::Init * FAILURE * Muon selction tool retrieving failed :( " <<
endmsg;
138 if(
m_doDebug){ std::cout <<
" * MuonSelector::passSelection * START * new muon " << pxMuon <<
" with pt: " << pxMuon->
pt() << std::endl; }
140 std::vector<bool> passes;
151 passes.push_back(pass);
152 if (
m_doDebug && !pass) std::cout <<
" * MuonSelector::passSelection * Muon Fails QualSelection"<<std::endl;
158 passes.push_back(pass);
159 if (
m_doDebug && !pass) std::cout<<
" * MuonSelector::passSelection * Muon Fails Iso Selection"<<std::endl;
166 passes.push_back(pass);
167 if (
m_doDebug && !pass) std::cout<<
" * MuonSelector::passSelection * Muon Fails pT Selection"<<std::endl;
173 passes.push_back(pass);
174 if (
m_doDebug && !pass) std::cout<<
" * MuonSelector::passSelection * Muon Fails IP Selection"<<std::endl;
180 if (
m_doDebug) std::cout <<
" * MuonSelector::passSelection * muon quality from muonsSelectionTool: " << my_quality << std::endl;
183 passes.push_back(pass);
184 if (
m_doDebug && pass) std::cout<<
" * MuonSelector::passSelection * Muon Passes official m_muonSelectionTool (medium) Selection :)" << std::endl;
185 if (
m_doDebug && !pass) std::cout<<
" * MuonSelector::passSelection * Muon Fails official m_muonSelectionTool (medium) Selection" << std::endl;
190 for (
int i=0; i < int(passes.size()); i++)
192 if(
m_doDebug) std::cout <<
" * MuonSelector::passSelection * BAD MUON * muon haven't passed the " << i+1 <<
"th selection " << std::endl;
199 if(
m_doDebug){ std::cout <<
" * MuonSelector::passSelection * completed. GOOD MUON " << std::endl; }
217 bool goodTrack =
false;
240 if(
m_doDebug) std::cout <<
" * MuonSelector * passQualCuts() * eBLhits: " << eBLhits
241 <<
" nBLhits: " << nBLhits
242 <<
" nhitsPIX: " << nhitsPIX
243 <<
" nPIXLayers: " << nContribPixLayers
244 <<
" nhitsSCT: " << nhitsSCT
245 <<
" Silicon holes: " << nPIXH + nSCTH
246 <<
" nhitsTRT: " << nhitsTRT
247 <<
" nTRTholes: " << nTRTH
250 if (((!eBLhits) || (nBLhits > 0))
251 && (nhitsPIX + nPIXDS > 1 )
252 && (nhitsSCT + nSCTDS >=6 )
253 && (nPIXH + nSCTH < 2 ) ) {
260 std::cout <<
" * MuonSelector * passQualCuts() * this muon satisfies the hits number QualCuts " << std::endl;
263 std::cout <<
" * MuonSelector * passQualCuts() * this muon did not pass the hits number QualCuts " << std::endl;
273 if(
m_doDebug) std::cout <<
" * MuonSelector::passPtCuts * START *" << std::endl;
274 using enum xAOD::Muon::TrackParticleType;
279 double pt = 0, ptID, ptMS,ptCB;
281 if ( !(pxMuonID || pxMuonMS || pxMuonCB)){
282 if(
m_doDebug) std::cout <<
" * MuonSelector::passPtCuts * NO inDetTrackParticle && muonSpectrometerTrackParticle && CombinedTrackParticle: " << std::endl;
288 ptID = pxMuonID ? pxMuonID->
pt() : 0.0 ;
289 ptMS = pxMuonMS ? pxMuonMS->
pt() : 0.0 ;
290 ptCB = pxMuonCB ? pxMuonCB->
pt() : 0.0 ;
291 double fMEta = std::abs(
m_pxMuon->eta() );
293 if(
m_doDebug) std::cout <<
" * MuonSelector::passPtCuts * pt of each segments of this muon pxMuon: " << pt << std::endl
294 <<
" ptID: " << ptID << std::endl
295 <<
" ptMS: " << ptMS << std::endl
296 <<
" ptCB: " << ptCB << std::endl
297 <<
" fMEta pxMuon->eta(): " << fMEta << std::endl;
306 if(
m_doDebug) std::cout <<
" * MuonSelector::passPtCuts * this muon is in eta range |eta|= " << fMEta <<
" < EtaCut(" <<
m_fEtaCut <<
") " << std::endl
307 <<
" and passed the PtCuts (" <<
m_combPtCut <<
") "<< std::endl;
311 if(
m_doDebug) std::cout <<
" * MuonSelector::passPtCuts * this muon did not pass the PtCuts (reco pt=" << pt <<
") or Eta cut " <<
m_fEtaCut << std::endl;
321 std::cout <<
" * MuonSelector::passIsolCuts * WARNING * No isolation variable stored on the muon" << std::endl;
322 std::cout <<
" * MuonSelector::passIsolCuts * this muon did not pass the IsoCuts " << std::endl;
330 if(
m_doDebug) std::cout <<
" * MuonSelector::passIsolCuts * muon pt: " << pt <<
" ptSum(ptcone40): "<< ptSum << std::endl;
332 if(
m_doDebug) std::cout <<
" * MuonSelector::passIsolCuts * this muon passed the IsoCuts ptcone40 / pt= "
333 << ptSum <<
" / " << pt <<
" = " << ptSum / pt
334 <<
" < IsoCut(" <<
m_IsoCut <<
") " << std::endl;
339 if(
m_doDebug) std::cout <<
" * MuonSelector::passIsolCuts * this muon did not pass the IsoCuts:" << std::endl;
349 using enum xAOD::Muon::TrackParticleType;
353 extz0 = IDTrk->z0()+IDTrk->vz();
355 std::cout <<
" * MuonSelector::passIPCuts *"
356 <<
" the IDTrack muon d0: " << extd0
357 <<
" the IDTrack muon z0: " << extz0 <<
" = " << IDTrk->z0() <<
" + " << IDTrk->vz() << std::endl;
360 if(
m_doDebug) std::cout <<
" * MuonSelector * passIPCuts() * no valid inDetTrackParticleLink(). Will use the combined muon IPs" << std::endl;
364 if(
m_doDebug) std::cout <<
" * MuonSelector * passIPCuts() * no valid CombinedTrackParticle. Giving up." << std::endl;
369 extz0 = CBTrk->
z0()+CBTrk->
vz();
371 std::cout <<
" * MuonSelector * passIPCuts() *"
372 <<
" the CBTrack muon d0: " << extd0
373 <<
" the CBTrack muon z0: " << extz0 <<
" = " << CBTrk->
z0() <<
" + " << CBTrk->
vz()<< std::endl;
382 if(
m_doDebug) std::cout <<
" * MuonSelector::passIPCuts ** fails because NO vertex collection "<< std::endl;
386 if ( vxContainer->
size()>1 ) {
388 std::cout <<
" * MuonSelector::passIPCuts ** vertex container is filled with " << vxContainer->
size() <<
" vertices" << std::endl;
391 for (
int ivtx=0; ivtx < (int) vxContainer->
size(); ivtx++) {
393 std::cout <<
" vertex " << ivtx+1 <<
" (x,y,z) = (" << thisVtx->
position().x()
404 bool goodmuonIP =
false;
405 float minDeltaZ = 99999.;
407 for (
int ivtx=0; ivtx < (int) vxContainer->
size(); ivtx++) {
411 if (std::abs(extz0 - thisVtx->
position().z()) < minDeltaZ) minDeltaZ = std::abs(extz0 - thisVtx->
position().z());
415 std::cout <<
" testing vtx: " << ivtx <<
" vtx.z= " << thisVtx->
position().z() <<
" trk.z= " << extz0 <<
" deltaZ= " << std::abs(extz0 - thisVtx->
position().z()) <<
" minDeltaZ= " << minDeltaZ << std::endl;
419 if(
m_doDebug) std::cout <<
" * MuonSelector::passIPCuts * this muon has passed the IPCuts for vertex " << ivtx+1
420 <<
" pVZcut= " << std::abs(extz0 - thisVtx->
position().z()) <<
" < " <<
m_diffZCut << std::endl
431 if(
m_doDebug) std::cout <<
" * MuonSelector::passIPCuts * this muon has passed the IPCuts. Zcut: "<<
m_pVZCut <<
" m_diffZCut " <<
m_diffZCut << std::endl;
436 if(
m_doDebug) std::cout <<
" * MuonSelector * passIPCuts() * this muon has not passed the IPCuts: " << std::endl;
444 std::cout <<
" * MuonSelector* -- STATS -- " << std::endl
451 std::cout <<
" passall : " <<
m_passall << std::endl
460 using enum xAOD::Muon::Quality;
461 std::for_each (newname.begin(), newname.end(), [](
char & c) {c = std::toupper(c);} );
468 std::cout <<
" ** MuonSelector::SetMuonQualityRequirement(" << newname <<
") = " <<
m_requestedMuonQuality << std::endl;
size_type size() const noexcept
Returns the number of elements in the collection.
std::string m_xSampleName
unsigned int m_testedmuons
const xAOD::Muon * m_pxMuon
virtual void BookHistograms()
unsigned char m_ucID_TRTCut
ToolHandle< CP::IMuonSelectionTool > m_muonSelectionTool
unsigned char m_ucID_PIXCut
unsigned int m_uNumInstances
unsigned char m_ucJMuon_Cut
unsigned char m_ucID_SCTCut
void SetMuonQualityRequirement(std::string newname)
xAOD::Muon::Quality m_requestedMuonQuality
bool passSelection(const xAOD::Muon *pxMuon)
static const T * getContainer(CONTAINERS eContainer)
virtual double pt() const
The transverse momentum ( ) of the particle.
float z0() const
Returns the parameter.
float vz() const
The z origin for the parameters.
float d0() const
Returns the parameter.
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
VxType::VertexType vertexType() const
The type of the vertex.
const Amg::Vector3D & position() const
Returns the 3-pos.
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
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.
Muon_v1 Muon
Reference the current persistent 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].
@ numberOfTRTHoles
number of TRT holes [unit8_t].
@ numberOfBLayerHits
these are the hits in the first pixel layer, i.e.
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
@ expectBLayerHit
Do we expect a b-layer hit for this track?
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].