ATLAS Offline Software
InDetSVWithMuonTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Header include
8 #include "AthenaKernel/SlotSpecificObj.h" // for getNSlots
10 #include "GaudiKernel/ITHistSvc.h"
11 #include "TMath.h"
12 #include "TH1D.h"
13 #include "TH2D.h"
14 //
15 //-------------------------------------------------
16 // Other stuff
17 //
18 #include<iostream>
19 
20 namespace InDet {
21 //
22 //Constructor--------------------------------------------------------------
24  const std::string& name,
25  const IInterface* parent):
27  m_CutSctHits(4),
28  m_CutPixelHits(1),
29  m_CutSiHits(7),
30  m_CutBLayHits(0),
31  m_CutSharedHits(1),
32  m_CutPt(700.),
33  m_CutZVrt(25.),
34  m_CutA0(5.),
35  m_CutChi2(3.),
36  m_SecTrkChi2Cut(10.),
37  m_ConeForTag(0.4),
38  m_Sel2VrtChi2Cut(4.5),
39  m_Sel2VrtSigCut(3.0),
40  m_TrkSigCut(2.5),
41  m_A0TrkErrorCut(1.0),
42  m_ZTrkErrorCut(5.0),
43  m_FillHist(false),
44  m_existIBL(true),
45  m_RobustFit(5),
46  m_Rbeampipe (0.), //Correct values are filled
47  m_RlayerB (0.), // in initialize()
48  m_Rlayer1 (0.),
49  m_Rlayer2 (0.),
50  m_Rlayer3 (0.),
51  m_fitterSvc("Trk::TrkVKalVrtFitter/VertexFitterTool",this)
52  {
53  declareInterface<ISVWithMuonFinder>(this);
54 //
55 // Properties
56 //
57 //
58  declareProperty("CutSctHits", m_CutSctHits , "Remove track is it has less SCT hits" );
59  declareProperty("CutPixelHits", m_CutPixelHits, "Remove track is it has less Pixel hits");
60  declareProperty("CutSiHits", m_CutSiHits, "Remove track is it has less Pixel+SCT hits" );
61  declareProperty("CutBLayHits", m_CutBLayHits, "Remove track is it has less B-layer hits" );
62  declareProperty("CutSharedHits", m_CutSharedHits,"Reject final 2tr vertices if tracks have shared hits" );
63 
64  declareProperty("CutPt", m_CutPt, "Track Pt selection cut" );
65  declareProperty("CutA0", m_CutA0, "Track A0 selection cut" );
66  declareProperty("CutZVrt", m_CutZVrt, "Track Z impact selection cut");
67  declareProperty("ConeForTag", m_ConeForTag,"Cone around jet direction for track selection");
68  declareProperty("CutChi2", m_CutChi2, "Track Chi2 selection cut" );
69  declareProperty("TrkSigCut", m_TrkSigCut, "Track 3D impact significance w/r primary vertex" );
70  declareProperty("SecTrkChi2Cut", m_SecTrkChi2Cut,"Track - common secondary vertex association cut. Single Vertex Finder only");
71 
72  declareProperty("A0TrkErrorCut", m_A0TrkErrorCut, "Track A0 error cut" );
73  declareProperty("ZTrkErrorCut", m_ZTrkErrorCut, "Track Z impact error cut" );
74 
75  declareProperty("Sel2VrtChi2Cut", m_Sel2VrtChi2Cut, "Cut on Chi2 of 2-track vertex for initial selection" );
76  declareProperty("Sel2VrtSigCut", m_Sel2VrtSigCut, "Cut on significance of 3D distance between initial 2-track vertex and PV" );
77 
78  declareProperty("FillHist", m_FillHist, "Fill technical histograms" );
79  declareProperty("ExistIBL", m_existIBL, "Inform whether 3-layer or 4-layer detector is used " );
80 
81  declareProperty("RobustFit", m_RobustFit, "Use vertex fit with RobustFit functional(VKalVrt) for common secondary vertex fit" );
82 
83  declareProperty("VertexFitterTool", m_fitterSvc);
84 
85  }
86 
87 //Destructor---------------------------------------------------------------
89  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "InDetSVWithMuonTool destructor called" << endmsg;
90  }
91 
92 //Initialize---------------------------------------------------------------
94  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "InDetSVWithMuonTool initialize() called" << endmsg;
95 
96  if (m_fitterSvc.retrieve().isFailure()) {
97  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "Could not find Trk::TrkVKalVrtFitter" << endmsg;
98  return StatusCode::SUCCESS;
99  } else {
100  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "InDetSVWithMuonTool TrkVKalVrtFitter found" << endmsg;
101  }
102  m_fitSvc = dynamic_cast<Trk::TrkVKalVrtFitter*>(&(*m_fitterSvc));
103  if(!m_fitSvc){
104  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<" No implemented Trk::ITrkVKalVrtFitter interface" << endmsg;
105  return StatusCode::SUCCESS;
106  }
107 
108 //------------------------------------------
109 // Chose whether IBL is installed
110  if(m_existIBL){ // 4-layer pixel detector
111  if( m_Rbeampipe==0.) m_Rbeampipe=24.0;
112  if( m_RlayerB ==0.) m_RlayerB =34.0;
113  if( m_Rlayer1 ==0.) m_Rlayer1 =51.6;
114  if( m_Rlayer2 ==0.) m_Rlayer2 =90.0;
115  m_Rlayer3 =122.5;
116  } else { // 3-layer pixel detector
117  if( m_Rbeampipe==0.) m_Rbeampipe=29.4;
118  if( m_RlayerB ==0.) m_RlayerB =51.5;
119  if( m_Rlayer1 ==0.) m_Rlayer1 =90.0;
120  if( m_Rlayer2 ==0.) m_Rlayer2 =122.5;
121  }
122 
123 //
124 //
125  if(m_FillHist){
126  if (SG::getNSlots() > 1) {
127  ATH_MSG_FATAL("Filling histograms not supported in MT jobs.");
128  return StatusCode::FAILURE;
129  }
130 
131  ServiceHandle<ITHistSvc> histSvc ("THistSvc", name());
132  ATH_CHECK( histSvc.retrieve() );
133  m_h = std::make_unique<Hists>();
134  ATH_CHECK( m_h->book (*histSvc) );
135  }
136 
137 
138  return StatusCode::SUCCESS;
139 
140  }
141 
142 
144  {
145  m_hb_massPiPi = new TH1D("massPiPi"," massPiPi",160,200., 1000.);
146  m_hb_muonPt = new TH1D("muonPt", " Pt of input muon",100,0., 20000.);
147  m_hb_nvrt2 = new TH1D("nvrt2"," vertices2", 50,0., 50.);
148  m_hb_nseltrk = new TH1D("nseltrk"," Number of tracks cloase to muon", 50,0., 50.);
149  m_hb_totmass = new TH1D("totmass"," totmass", 250,0., 10000.);
150  m_hb_impact = new TH1D("impact", " impact", 100,0., 20.);
151  m_hb_impactR = new TH1D("impactR"," impactR", 100,-30., 70.);
152  m_hb_impactZ = new TH1D("impactZ"," impactZ", 100,-30., 70.);
153  m_hb_r2d = new TH1D("r2interact","Interaction radius 2tr", 150,0., 150.);
154  m_hb_r2dc = new TH1D("r2interactCommon","Interaction radius common", 150,0., 150.);
155  m_hb_signif3D = new TH1D("Signif3D","3D SV-PV significance for track+muon", 120,-5., 25.);
156  std::string histDir="/file1/stat/MuonSV/";
157 #define H_CHECK(X) if((X).isFailure()) return StatusCode::FAILURE
158  H_CHECK( histSvc.regHist(histDir+"muonPt", m_hb_muonPt) );
159  H_CHECK( histSvc.regHist(histDir+"massPiPi", m_hb_massPiPi) );
160  H_CHECK( histSvc.regHist(histDir+"nvrt2", m_hb_nvrt2) );
161  H_CHECK( histSvc.regHist(histDir+"nseltrk", m_hb_nseltrk) );
162  H_CHECK( histSvc.regHist(histDir+"totmass", m_hb_totmass) );
163  H_CHECK( histSvc.regHist(histDir+"impact", m_hb_impact) );
164  H_CHECK( histSvc.regHist(histDir+"impactR", m_hb_impactR) );
165  H_CHECK( histSvc.regHist(histDir+"impactZ", m_hb_impactZ) );
166  H_CHECK( histSvc.regHist(histDir+"Signif3D", m_hb_signif3D) );
167  H_CHECK( histSvc.regHist(histDir+"r2interact2tr", m_hb_r2d) );
168  H_CHECK( histSvc.regHist(histDir+"r2interactCommon", m_hb_r2dc) );
169 #undef H_CHECK
170  return StatusCode::SUCCESS;
171  }
172 
173 
175  {
176  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"InDetSVWithMuonTool finalize()" << endmsg;
177  return StatusCode::SUCCESS;
178  }
179 
180 
181 
182 
184  const xAOD::TrackParticle * Muon,
185  const std::vector<const xAOD::TrackParticle*> & InpTrk)
186  const {
187  std::vector<const xAOD::TrackParticle*> SelSecTrk;
188 
189  xAOD::Vertex* secVrt = MuonVrtSec( InpTrk, PrimVrt, Muon, SelSecTrk );
190 
191  return secVrt;
192  }
193 
194 
197  {
198  // We earlier checked that no more than one thread is being used.
199  Hists* h ATLAS_THREAD_SAFE = m_h.get();
200  return *h;
201  }
202 
203 
204 } // end InDet namespace
InDet::InDetSVWithMuonTool::Hists::m_hb_totmass
TH1D * m_hb_totmass
Definition: InDetSVWithMuonTool.h:97
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
InDet::InDetSVWithMuonTool::Hists::m_hb_signif3D
TH1D * m_hb_signif3D
Definition: InDetSVWithMuonTool.h:102
InDetSVWithMuonTool.h
InDet::InDetSVWithMuonTool::Hists::m_hb_impactZ
TH1D * m_hb_impactZ
Definition: InDetSVWithMuonTool.h:101
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
InDet
DUMMY Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::InDetSVWithMuonTool::m_SecTrkChi2Cut
double m_SecTrkChi2Cut
Definition: InDetSVWithMuonTool.h:118
InDet::InDetSVWithMuonTool::Hists::m_hb_muonPt
TH1D * m_hb_muonPt
Definition: InDetSVWithMuonTool.h:93
InDet::InDetSVWithMuonTool::m_fitSvc
Trk::TrkVKalVrtFitter * m_fitSvc
Definition: InDetSVWithMuonTool.h:139
InDet::InDetSVWithMuonTool::m_RlayerB
double m_RlayerB
Definition: InDetSVWithMuonTool.h:133
InDet::InDetSVWithMuonTool::getHists
Hists & getHists() const
Definition: InDetSVWithMuonTool.cxx:196
InDet::InDetSVWithMuonTool::m_CutPt
double m_CutPt
Definition: InDetSVWithMuonTool.h:114
TH1D
Definition: rootspy.cxx:342
InDet::InDetSVWithMuonTool::Hists::m_hb_impact
TH1D * m_hb_impact
Definition: InDetSVWithMuonTool.h:98
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
InDet::InDetSVWithMuonTool::Hists::m_hb_massPiPi
TH1D * m_hb_massPiPi
Definition: InDetSVWithMuonTool.h:94
InDet::InDetSVWithMuonTool::m_CutSctHits
long int m_CutSctHits
Definition: InDetSVWithMuonTool.h:109
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
InDet::InDetSVWithMuonTool::m_fitterSvc
ToolHandle< Trk::IVertexFitter > m_fitterSvc
Definition: InDetSVWithMuonTool.h:138
InDet::InDetSVWithMuonTool::Hists
Definition: InDetSVWithMuonTool.h:91
InDet::InDetSVWithMuonTool::m_CutZVrt
double m_CutZVrt
Definition: InDetSVWithMuonTool.h:115
InDet::InDetSVWithMuonTool::Hists::book
StatusCode book(ITHistSvc &histSvc)
Definition: InDetSVWithMuonTool.cxx:143
InDet::InDetSVWithMuonTool::m_CutSiHits
long int m_CutSiHits
Definition: InDetSVWithMuonTool.h:111
TrkVKalVrtFitter.h
InDet::InDetSVWithMuonTool::m_Rbeampipe
double m_Rbeampipe
Definition: InDetSVWithMuonTool.h:132
InDet::InDetSVWithMuonTool::m_existIBL
bool m_existIBL
Definition: InDetSVWithMuonTool.h:128
InDet::InDetSVWithMuonTool::m_CutSharedHits
long int m_CutSharedHits
Definition: InDetSVWithMuonTool.h:113
InDet::InDetSVWithMuonTool::m_Rlayer2
double m_Rlayer2
Definition: InDetSVWithMuonTool.h:135
InDet::InDetSVWithMuonTool::m_Sel2VrtSigCut
double m_Sel2VrtSigCut
Definition: InDetSVWithMuonTool.h:121
InDet::InDetSVWithMuonTool::m_Rlayer1
double m_Rlayer1
Definition: InDetSVWithMuonTool.h:134
H_CHECK
#define H_CHECK(X)
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
extractSporadic.h
list h
Definition: extractSporadic.py:97
InDet::InDetSVWithMuonTool::Hists::m_hb_nvrt2
TH1D * m_hb_nvrt2
Definition: InDetSVWithMuonTool.h:95
InDet::InDetSVWithMuonTool::m_Rlayer3
double m_Rlayer3
Definition: InDetSVWithMuonTool.h:136
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MuonSegmentReaderConfig.histSvc
histSvc
Definition: MuonSegmentReaderConfig.py:96
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::InDetSVWithMuonTool::m_FillHist
bool m_FillHist
Definition: InDetSVWithMuonTool.h:126
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
InDet::InDetSVWithMuonTool::~InDetSVWithMuonTool
virtual ~InDetSVWithMuonTool()
Definition: InDetSVWithMuonTool.cxx:88
InDet::InDetSVWithMuonTool::m_CutChi2
double m_CutChi2
Definition: InDetSVWithMuonTool.h:117
InDet::InDetSVWithMuonTool::m_RobustFit
long int m_RobustFit
Definition: InDetSVWithMuonTool.h:130
InDet::InDetSVWithMuonTool::m_Sel2VrtChi2Cut
double m_Sel2VrtChi2Cut
Definition: InDetSVWithMuonTool.h:120
InDet::InDetSVWithMuonTool::findSVwithMuon
const xAOD::Vertex * findSVwithMuon(const xAOD::Vertex &PrimVrt, const xAOD::TrackParticle *Muon, const std::vector< const xAOD::TrackParticle * > &InpTrk) const
Definition: InDetSVWithMuonTool.cxx:183
InDet::InDetSVWithMuonTool::Hists::m_hb_r2dc
TH1D * m_hb_r2dc
Definition: InDetSVWithMuonTool.h:104
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
InDet::InDetSVWithMuonTool::m_A0TrkErrorCut
double m_A0TrkErrorCut
Definition: InDetSVWithMuonTool.h:123
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDet::InDetSVWithMuonTool::Hists::m_hb_impactR
TH1D * m_hb_impactR
Definition: InDetSVWithMuonTool.h:99
SG::getNSlots
size_t getNSlots()
Return the number of event slots.
Definition: SlotSpecificObj.cxx:64
InDet::InDetSVWithMuonTool::InDetSVWithMuonTool
InDetSVWithMuonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: InDetSVWithMuonTool.cxx:23
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
InDet::InDetSVWithMuonTool::m_ZTrkErrorCut
double m_ZTrkErrorCut
Definition: InDetSVWithMuonTool.h:124
InDet::InDetSVWithMuonTool::MuonVrtSec
xAOD::Vertex * MuonVrtSec(const std::vector< const xAOD::TrackParticle * > &InpTrk, const xAOD::Vertex &PrimVrt, const xAOD::TrackParticle *Muon, std::vector< const xAOD::TrackParticle * > &ListSecondTracks) const
Definition: MuonVrtSec.cxx:19
InDet::InDetSVWithMuonTool::m_ConeForTag
double m_ConeForTag
Definition: InDetSVWithMuonTool.h:119
InDet::InDetSVWithMuonTool::m_TrkSigCut
double m_TrkSigCut
Definition: InDetSVWithMuonTool.h:122
SlotSpecificObj.h
Maintain a set of objects, one per slot.
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
AthAlgTool
Definition: AthAlgTool.h:26
checker_macros.h
Define macros for attributes used to control the static checker.
InDet::InDetSVWithMuonTool::initialize
StatusCode initialize()
Definition: InDetSVWithMuonTool.cxx:93
InDet::InDetSVWithMuonTool::m_CutBLayHits
long int m_CutBLayHits
Definition: InDetSVWithMuonTool.h:112
InDet::InDetSVWithMuonTool::m_CutPixelHits
long int m_CutPixelHits
Definition: InDetSVWithMuonTool.h:110
InDet::InDetSVWithMuonTool::finalize
StatusCode finalize()
Definition: InDetSVWithMuonTool.cxx:174
InDet::InDetSVWithMuonTool::m_CutA0
double m_CutA0
Definition: InDetSVWithMuonTool.h:116
InDet::InDetSVWithMuonTool::Hists::m_hb_nseltrk
TH1D * m_hb_nseltrk
Definition: InDetSVWithMuonTool.h:96
InDet::InDetSVWithMuonTool::Hists::m_hb_r2d
TH1D * m_hb_r2d
Definition: InDetSVWithMuonTool.h:103
ServiceHandle< ITHistSvc >
Trk::TrkVKalVrtFitter
Definition: TrkVKalVrtFitter.h:67
InDet::InDetSVWithMuonTool::m_h
std::unique_ptr< Hists > m_h
Definition: InDetSVWithMuonTool.h:106