11#include "TEfficiency.h"
13const float GeV = 1000.;
31 std::vector<std::string> recoTypes{
"All",
"Matched",
"Merged",
"Fake",
"Split",
"Other"};
32 std::vector<std::string> truthTypes{
"Inclusive",
"Reconstructable",
"Accepted",
"Seeded",
"Reconstructed",
"ReconstructedSplit"};
34 std::vector<std::string> smOriginTypes;
36 smOriginTypes = {
"FakeOrigin",
"Pileup",
"KshortDecay",
"StrangeMesonDecay",
"LambdaDecay",
37 "StrangeBaryonDecay",
"TauDecay",
"GammaConversion",
"OtherDecay",
38 "HadronicInteraction",
"OtherSecondary",
"BHadronDecay",
"DHadronDecay",
39 "Fragmentation",
"OtherOrigin",
"Signal"};
46 float maxZ =
m_doMuSA ? 10000 : 1500;
47 float maxLxy =
m_doMuSA ? 8000 : 500;
51 float maxTrackd0 =
m_doMuSA ? 3000 : 300;
52 float maxTrackz0 =
m_doMuSA ? 5000 : 500;
53 float maxErrd0 =
m_doMuSA ? 300 : 30;
54 float maxErrz0 =
m_doMuSA ? 500 : 50;
56 float maxResR =
m_doMuSA ? 2000 : 20;
57 float maxResZ =
m_doMuSA ? 2000 : 20;
59 ANA_CHECK (
book(TH1F(
"RecoVertex/matchType",
"Vertex Match Type", 65, -0.5, 64.5)));
61 ANA_CHECK (
book(TH1F(
"RecoVertex/smOriginType",
"Vertex SM Origin Type", 65537, -0.5, 65536.5)));
65 for(
const auto& recoType : recoTypes) {
66 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_x").c_str(),
"Reco vertex x [mm]", 1000, -maxX, maxX)));
67 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_y").c_str(),
"Reco vertex y [mm]", 1000, -maxY, maxY)));
68 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_z").c_str(),
"Reco vertex z [mm]", 1000, -maxZ, maxZ)));
69 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Lxy").c_str(),
"Reco vertex L_{xy} [mm]", 500, 0, maxLxy)));
70 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_pT").c_str(),
"Reco vertex p_{T} [GeV]", 100, 0, 100)));
71 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_eta").c_str(),
"Reco vertex #eta", 100, -5, 5)));
72 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_phi").c_str(),
"Reco vertex #phi", 100, -TMath::Pi(), TMath::Pi())));
73 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_mass").c_str(),
"Reco vertex mass [GeV]", 500, 0, 100)));
74 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_mu").c_str(),
"Reco vertex Red. Mass [GeV]", 500, 0, 100)));
75 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_chi2").c_str(),
"Reco vertex recoChi2", 100, 0, 10)));
76 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_dir").c_str(),
"Reco vertex recoDirection", 100, -1, 1)));
77 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_charge").c_str(),
"Reco vertex recoCharge", 20, -10, 10)));
78 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_H").c_str(),
"Reco vertex H [GeV]", 100, 0, 100)));
79 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_HT").c_str(),
"Reco vertex Mass [GeV]", 100, 0, 100)));
80 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_minOpAng").c_str(),
"Reco vertex minOpAng", 100, -1, 1)));
81 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_maxOpAng").c_str(),
"Reco vertex maxOpAng", 100, -1, 1)));
82 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_maxdR").c_str(),
"Reco vertex maxDR", 100, 0, 10)));
83 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_mind0").c_str(),
"Reco vertex min d0 [mm]", 100, 0, mind0)));
84 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_maxd0").c_str(),
"Reco vertex max d0 [mm]", 100, 0, maxd0)));
85 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_ntrk").c_str(),
"Reco vertex n tracks", 30, 0, 30)));
88 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_qOverP").c_str(),
"Reco track qOverP ", 100, 0, .01)));
89 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_theta").c_str(),
"Reco track theta ", 64, 0, 3.2)));
90 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_E").c_str(),
"Reco track E ", 100, 0, 100)));
91 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_M").c_str(),
"Reco track M ", 100, 0, 10)));
92 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Pt").c_str(),
"Reco track Pt ", 100, 0, 100)));
93 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Px").c_str(),
"Reco track Px ", 100, 0, 100)));
94 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Py").c_str(),
"Reco track Py ", 100, 0, 100)));
95 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Pz").c_str(),
"Reco track Pz ", 100, 0, 100)));
96 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Eta").c_str(),
"Reco track Eta ", 100, -5, 5)));
97 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Phi").c_str(),
"Reco track Phi ", 63, -3.2, 3.2)));
98 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_D0").c_str(),
"Reco track D0 ", 300, -maxTrackd0, maxTrackd0)));
99 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Z0").c_str(),
"Reco track Z0 ", 500, -maxTrackz0, maxTrackz0)));
100 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_errD0").c_str(),
"Reco track errD0 ", 300, 0, maxErrd0)));
101 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_errZ0").c_str(),
"Reco track errZ0 ", 500, 0, maxErrz0)));
102 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_Chi2").c_str(),
"Reco track Chi2 ", 100, 0, 10)));
103 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_nDoF").c_str(),
"Reco track nDoF ", 100, 0, 100)));
104 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_Trk_charge").c_str(),
"Reco track charge ", 3, -1.5, 1.5)));
107 if ( recoType !=
"All" and recoType !=
"Fake" ) {
108 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_positionRes_R").c_str(),
"Position resolution for vertices matched to truth decays", 400, -maxResR, maxResR)));
109 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_positionRes_Z").c_str(),
"Position resolution for vertices matched to truth decays", 400, -maxResZ, maxResZ)));
110 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_matchScore_weight").c_str(),
"Vertex Match Score (weight)", 101, 0, 1.01)));
111 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_matchScore_pt").c_str(),
"Vertex Match Score (pT)", 101, 0, 1.01)));
112 ANA_CHECK (
book(TH1F((
"RecoVertex/" + recoType +
"_matchedTruthID").c_str(),
"Vertex Truth Match ID", 100, 0, 100)));
118 for(
const auto& smOriginType : smOriginTypes) {
119 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_x").c_str(),
"Reco vertex x [mm]", 1000, -maxX, maxX)));
120 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_y").c_str(),
"Reco vertex y [mm]", 1000, -maxY, maxY)));
121 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_z").c_str(),
"Reco vertex z [mm]", 1000, -maxZ, maxZ)));
122 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Lxy").c_str(),
"Reco vertex L_{xy} [mm]", 500, 0, maxLxy)));
123 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_pT").c_str(),
"Reco vertex p_{T} [GeV]", 100, 0, 100)));
124 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_eta").c_str(),
"Reco vertex #eta", 100, -5, 5)));
125 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_phi").c_str(),
"Reco vertex #phi", 100, -TMath::Pi(), TMath::Pi())));
126 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_mass").c_str(),
"Reco vertex mass [GeV]", 500, 0, 100)));
127 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_mu").c_str(),
"Reco vertex Red. Mass [GeV]", 500, 0, 100)));
128 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_chi2").c_str(),
"Reco vertex recoChi2", 100, 0, 10)));
129 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_dir").c_str(),
"Reco vertex recoDirection", 100, -1, 1)));
130 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_charge").c_str(),
"Reco vertex recoCharge", 20, -10, 10)));
131 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_H").c_str(),
"Reco vertex H [GeV]", 100, 0, 100)));
132 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_HT").c_str(),
"Reco vertex Mass [GeV]", 100, 0, 100)));
133 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_minOpAng").c_str(),
"Reco vertex minOpAng", 100, -1, 1)));
134 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_maxOpAng").c_str(),
"Reco vertex maxOpAng", 100, -1, 1)));
135 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_maxdR").c_str(),
"Reco vertex maxDR", 100, 0, 10)));
136 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_mind0").c_str(),
"Reco vertex min d0 [mm]", 100, 0, mind0)));
137 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_maxd0").c_str(),
"Reco vertex max d0 [mm]", 100, 0, maxd0)));
138 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_ntrk").c_str(),
"Reco vertex n tracks", 30, 0, 30)));
141 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_qOverP").c_str(),
"Reco track qOverP ", 100, 0, .01)));
142 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_theta").c_str(),
"Reco track theta ", 64, 0, 3.2)));
143 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_E").c_str(),
"Reco track E ", 100, 0, 100)));
144 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_M").c_str(),
"Reco track M ", 100, 0, 10)));
145 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Pt").c_str(),
"Reco track Pt ", 100, 0, 100)));
146 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Px").c_str(),
"Reco track Px ", 100, 0, 100)));
147 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Py").c_str(),
"Reco track Py ", 100, 0, 100)));
148 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Pz").c_str(),
"Reco track Pz ", 100, 0, 100)));
149 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Eta").c_str(),
"Reco track Eta ", 100, -5, 5)));
150 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Phi").c_str(),
"Reco track Phi ", 63, -3.2, 3.2)));
151 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_D0").c_str(),
"Reco track D0 ", 300, -maxTrackd0, maxTrackd0)));
152 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Z0").c_str(),
"Reco track Z0 ", 500, -maxTrackz0, maxTrackz0)));
153 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_errD0").c_str(),
"Reco track errD0 ", 300, 0, maxErrd0)));
154 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_errZ0").c_str(),
"Reco track errZ0 ", 500, 0, maxErrz0)));
155 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_Chi2").c_str(),
"Reco track Chi2 ", 100, 0, 10)));
156 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_nDoF").c_str(),
"Reco track nDoF ", 100, 0, 100)));
157 ANA_CHECK (
book(TH1F((
"RecoVertex/" + smOriginType +
"_Trk_charge").c_str(),
"Reco track charge ", 3, -1.5, 1.5)));
164 for(
const auto& truthType : truthTypes) {
165 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_x").c_str(),
"Truth vertex x [mm]", 1000, -maxX, maxX)));
166 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_y").c_str(),
"Truth vertex y [mm]", 500, -maxY, maxY)));
167 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_z").c_str(),
"Truth vertex z [mm]", 500, -maxZ, maxZ)));
168 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_R").c_str(),
"Truth vertex r [mm]", 6000, 0, maxR)));
169 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_distFromPV").c_str(),
"Truth vertex distFromPV [mm]", 600, 0, maxR)));
170 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Eta").c_str(),
"Truth vertex Eta", 100, -5, 5)));
171 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Phi").c_str(),
"Truth vertex Phi", 64, -3.2, 3.2)));
172 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Ntrk_out").c_str(),
"Truth vertex n outgoing tracks", 100, 0, 100)));
173 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Parent_E").c_str(),
"Reco track E", 100, 0, 100)));
174 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Parent_M").c_str(),
"Reco track M", 500, 0, 500)));
175 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Parent_Pt").c_str(),
"Reco track Pt", 100, 0, 100)));
176 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Parent_Eta").c_str(),
"Reco track Eta", 100, -5, 5)));
177 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Parent_Phi").c_str(),
"Reco track Phi", 63, -3.2, 3.2)));
178 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_Parent_charge").c_str(),
"Reco track charge", 3, -1, 1)));
179 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProdX").c_str(),
"truthParentProd vertex x [mm]", 500, -500, 500)));
180 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProdY").c_str(),
"truthParentProd vertex y [mm]", 500, -500, 500)));
181 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProdZ").c_str(),
"truthParentProd vertex z [mm]", 500, -500, 500)));
182 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProdR").c_str(),
"truthParentProd vertex r [mm]", 6000, 0, 600)));
183 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProddistFromPV").c_str(),
"truthParentProd vertex distFromPV [mm]", 500, 0, 500)));
184 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProdEta").c_str(),
"truthParentProd vertex Eta", 100, -5, 5)));
185 ANA_CHECK (
book(TH1F((
"TruthVertex/" + truthType +
"_ParentProdPhi").c_str(),
"truthParentProd vertex Phi", 64, -3.2, 3.2)));
189 Double_t standard_bins[] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 100, 125, 150, 200, 300, 500};
190 Double_t muSA_bins[] = {0.0, 1, 5, 10, 20, 50, 100, 200, 300, 500, 750, 1000, 1500, 2000, 2500, 3000, 4000, 5000, 6000, 7000, 8000};
194 size_t nbins =
m_doMuSA ?
sizeof(muSA_bins)/
sizeof(muSA_bins[0])-1 :
sizeof(standard_bins)/
sizeof(standard_bins[0])-1;
204 return StatusCode::SUCCESS;
214 std::vector<const xAOD::Vertex*> recoVerticesToMatch;
215 std::vector<const xAOD::TruthVertex*> truthVerticesToMatch;
217 for(
const auto recoVertex : *recoVertexContainer) {
224 recoVerticesToMatch.push_back(recoVertex);
227 for(
const auto truthVertex : *truthVertexContainer) {
228 if(truthVertex->nIncomingParticles() != 1) {
238 if(truthVertex->nOutgoingParticles() < 2) {
241 truthVerticesToMatch.push_back(truthVertex);
245 ATH_CHECK(
m_matchTool->matchVertices( recoVerticesToMatch, truthVerticesToMatch, trackParticleContainer.
cptr() ) );
249 for(
const auto& secVtx : recoVerticesToMatch) {
250 int matchTypeBitset = matchTypeDecor(*secVtx);
251 hist(
"RecoVertex/matchType")->Fill(matchTypeBitset);
272 for(
const auto& truthVtx : truthVerticesToMatch) {
273 int truthTypeBitset = truthTypeDecor(*truthVtx);
301 static const std::map<InDetSecVtxTruthMatchUtils::VertexMatchOriginType, std::string> originTypeMap = {
320 for(
const auto& secVtx : recoVerticesToMatch) {
321 int smOriginTypeBitset = originTypeDecor(*secVtx);
322 hist(
"RecoVertex/smOriginType")->Fill(smOriginTypeBitset);
324 for(
const auto& entry : originTypeMap) {
334 return StatusCode::SUCCESS;
346 TVector3 reco_pos(secVtx->
x(), secVtx->
y(), secVtx->
z());
347 float Lxy = reco_pos.Perp();
351 ntracks = trkParts.size();
353 TLorentzVector sumP4(0,0,0,0);
357 double minOpAng = -1.0* 1.e10;
358 double maxOpAng = 1.0* 1.e10;
359 double minD0 = 1.0* 1.e10;
366 for(
size_t t = 0; t < ntracks; t++){
376 if(trk_d0 < minD0){ minD0 = trk_d0; }
377 if(trk_d0 > maxD0){ maxD0 = trk_d0; }
381 vv.SetPtEtaPhiM(trk.
pt(),trk.
eta(), trk.
phi0(), trk.
m());
383 H += vv.Vect().Mag();
386 TLorentzVector v_minus_iv(0,0,0,0);
387 for(
size_t j = 0; j < ntracks; j++){
388 if (j == t){
continue; }
398 tmp.SetPtEtaPhiM(trk_2.
pt(),trk_2.
eta(), trk_2.
phi0(), trk_2.
m());
402 double tm = vv * tmp / ( vv.Mag() * tmp.Mag() );
403 if( minOpAng < tm ) minOpAng = tm;
404 if( maxOpAng > tm ) maxOpAng = tm;
407 double DR = vv.DeltaR(v_minus_iv);
408 if( DR > maxDR ){ maxDR = DR;}
416 hist(
"RecoVertex/" + matchType +
"_Trk_Chi2")->Fill(Trk_Chi2(trk) / Trk_nDoF(trk));
417 hist(
"RecoVertex/" + matchType +
"_Trk_nDoF")->Fill(Trk_nDoF(trk));
419 hist(
"RecoVertex/" + matchType +
"_Trk_D0")->Fill(trk_d0);
420 hist(
"RecoVertex/" + matchType +
"_Trk_Z0")->Fill(trk_z0);
423 hist(
"RecoVertex/" + matchType +
"_Trk_Eta")->Fill(trk.
eta());
424 hist(
"RecoVertex/" + matchType +
"_Trk_Phi")->Fill(trk.
phi0());
425 hist(
"RecoVertex/" + matchType +
"_Trk_E")->Fill(trk.
e() /
GeV);
426 hist(
"RecoVertex/" + matchType +
"_Trk_M")->Fill(trk.
m() /
GeV);
427 hist(
"RecoVertex/" + matchType +
"_Trk_Pt")->Fill(trk.
pt() /
GeV);
428 hist(
"RecoVertex/" + matchType +
"_Trk_Px")->Fill(trk.
p4().Px() /
GeV);
429 hist(
"RecoVertex/" + matchType +
"_Trk_Py")->Fill(trk.
p4().Py() /
GeV);
430 hist(
"RecoVertex/" + matchType +
"_Trk_Pz")->Fill(trk.
p4().Pz() /
GeV);
431 hist(
"RecoVertex/" + matchType +
"_Trk_charge")->Fill(trk.
charge());
437 const double dir = sumP4.Vect().Dot( reco_pos ) / sumP4.Vect().Mag() / reco_pos.Mag();
442 hist(
"RecoVertex/" + matchType +
"_x")->Fill(secVtx->
x());
443 hist(
"RecoVertex/" + matchType +
"_y")->Fill(secVtx->
y());
444 hist(
"RecoVertex/" + matchType +
"_z")->Fill(secVtx->
z());
445 hist(
"RecoVertex/" + matchType +
"_Lxy")->Fill(Lxy);
446 hist(
"RecoVertex/" + matchType +
"_ntrk")->Fill(ntracks);
447 hist(
"RecoVertex/" + matchType +
"_pT")->Fill(sumP4.Pt() /
GeV);
448 hist(
"RecoVertex/" + matchType +
"_eta")->Fill(sumP4.Eta());
449 hist(
"RecoVertex/" + matchType +
"_phi")->Fill(sumP4.Phi());
450 hist(
"RecoVertex/" + matchType +
"_mass")->Fill(sumP4.M() /
GeV);
451 hist(
"RecoVertex/" + matchType +
"_mu")->Fill(sumP4.M()/maxDR /
GeV);
452 hist(
"RecoVertex/" + matchType +
"_chi2")->Fill(Chi2(*secVtx)/nDoF(*secVtx));
453 hist(
"RecoVertex/" + matchType +
"_dir")->Fill(dir);
454 hist(
"RecoVertex/" + matchType +
"_charge")->Fill(
charge);
455 hist(
"RecoVertex/" + matchType +
"_H")->Fill(
H /
GeV);
456 hist(
"RecoVertex/" + matchType +
"_HT")->Fill(HT /
GeV);
457 hist(
"RecoVertex/" + matchType +
"_minOpAng")->Fill(minOpAng);
458 hist(
"RecoVertex/" + matchType +
"_maxOpAng")->Fill(maxOpAng);
459 hist(
"RecoVertex/" + matchType +
"_mind0")->Fill(minD0);
460 hist(
"RecoVertex/" + matchType +
"_maxd0")->Fill(maxD0);
461 hist(
"RecoVertex/" + matchType +
"_maxdR")->Fill(maxDR);
463 std::vector<InDetSecVtxTruthMatchUtils::VertexTruthMatchInfo> truthmatchinfo;
464 truthmatchinfo = matchInfoDecor(*secVtx);
467 if (matchType !=
"All" and matchType !=
"Fake") {
468 if(not truthmatchinfo.empty()){
469 float matchScore_weight = std::get<1>(truthmatchinfo.at(0));
470 float matchScore_pt = std::get<2>(truthmatchinfo.at(0));
472 ATH_MSG_DEBUG(
"Match Score and probability: " << matchScore_weight <<
" " << matchScore_pt/0.01);
477 hist(
"RecoVertex/" + matchType +
"_positionRes_R")->Fill(Lxy - truthVtx.
perp());
478 hist(
"RecoVertex/" + matchType +
"_positionRes_Z")->Fill(secVtx->
z() - truthVtx.
z());
479 hist(
"RecoVertex/" + matchType +
"_matchScore_weight")->Fill(matchScore_weight);
480 hist(
"RecoVertex/" + matchType +
"_matchScore_pt")->Fill(matchScore_pt);
487 hist(
"TruthVertex/" + truthType +
"_x")->Fill(truthVtx->
x());
488 hist(
"TruthVertex/" + truthType +
"_y")->Fill(truthVtx->
y());
489 hist(
"TruthVertex/" + truthType +
"_z")->Fill(truthVtx->
z());
490 hist(
"TruthVertex/" + truthType +
"_R")->Fill(truthVtx->
perp());
491 hist(
"TruthVertex/" + truthType +
"_Eta")->Fill(truthVtx->
eta());
492 hist(
"TruthVertex/" + truthType +
"_Phi")->Fill(truthVtx->
phi());
498 hist(
"TruthVertex/" + truthType +
"_Parent_E")->Fill(truthPart.
e() /
GeV);
499 hist(
"TruthVertex/" + truthType +
"_Parent_M")->Fill(truthPart.
m() /
GeV);
500 hist(
"TruthVertex/" + truthType +
"_Parent_Pt")->Fill(truthPart.
pt() /
GeV);
501 hist(
"TruthVertex/" + truthType +
"_Parent_Phi")->Fill(truthPart.
phi());
502 hist(
"TruthVertex/" + truthType +
"_Parent_Eta")->Fill(truthPart.
eta());
503 hist(
"TruthVertex/" + truthType +
"_Parent_charge")->Fill(truthPart.
charge());
509 hist(
"TruthVertex/" + truthType +
"_ParentProdX")->Fill(vertex.x());
510 hist(
"TruthVertex/" + truthType +
"_ParentProdY")->Fill(vertex.y());
511 hist(
"TruthVertex/" + truthType +
"_ParentProdZ")->Fill(vertex.z());
512 hist(
"TruthVertex/" + truthType +
"_ParentProdR")->Fill(vertex.perp());
513 hist(
"TruthVertex/" + truthType +
"_ParentProdEta")->Fill(vertex.eta());
514 hist(
"TruthVertex/" + truthType +
"_ParentProdPhi")->Fill(vertex.phi());
542 TVector3 reco_pos(secVtx->
x(), secVtx->
y(), secVtx->
z());
543 float Lxy = reco_pos.Perp();
547 ntracks = trkParts.size();
549 TLorentzVector sumP4(0,0,0,0);
553 double minOpAng = -1.0* 1.e10;
554 double maxOpAng = 1.0* 1.e10;
555 double minD0 = 1.0* 1.e10;
562 for(
size_t t = 0; t < ntracks; t++){
571 if(trk_d0 < minD0){ minD0 = trk_d0; }
572 if(trk_d0 > maxD0){ maxD0 = trk_d0; }
575 vv.SetPtEtaPhiM(trk.
pt(), trk.
eta(), trk.
phi0(), trk.
m());
577 H += vv.Vect().Mag();
580 TLorentzVector v_minus_iv(0,0,0,0);
581 for(
size_t j = 0; j < ntracks; j++){
582 if (j == t){
continue; }
590 tmp.SetPtEtaPhiM(trk_2.
pt(), trk_2.
eta(), trk_2.
phi0(), trk_2.
m());
594 double tm = vv * tmp / ( vv.Mag() * tmp.Mag() );
595 if( minOpAng < tm ) minOpAng = tm;
596 if( maxOpAng > tm ) maxOpAng = tm;
599 double DR = vv.DeltaR(v_minus_iv);
600 if( DR > maxDR ){ maxDR = DR;}
609 hist(
"RecoVertex/" + originType +
"_Trk_Chi2")->Fill(Trk_Chi2(trk) / Trk_nDoF(trk));
610 hist(
"RecoVertex/" + originType +
"_Trk_nDoF")->Fill(Trk_nDoF(trk));
612 hist(
"RecoVertex/" + originType +
"_Trk_D0")->Fill(trk_d0);
613 hist(
"RecoVertex/" + originType +
"_Trk_Z0")->Fill(trk_z0);
616 hist(
"RecoVertex/" + originType +
"_Trk_Eta")->Fill(trk.
eta());
617 hist(
"RecoVertex/" + originType +
"_Trk_Phi")->Fill(trk.
phi0());
618 hist(
"RecoVertex/" + originType +
"_Trk_E")->Fill(trk.
e() /
GeV);
619 hist(
"RecoVertex/" + originType +
"_Trk_M")->Fill(trk.
m() /
GeV);
620 hist(
"RecoVertex/" + originType +
"_Trk_Pt")->Fill(trk.
pt() /
GeV);
621 hist(
"RecoVertex/" + originType +
"_Trk_Px")->Fill(trk.
p4().Px() /
GeV);
622 hist(
"RecoVertex/" + originType +
"_Trk_Py")->Fill(trk.
p4().Py() /
GeV);
623 hist(
"RecoVertex/" + originType +
"_Trk_Pz")->Fill(trk.
p4().Pz() /
GeV);
624 hist(
"RecoVertex/" + originType +
"_Trk_charge")->Fill(trk.
charge());
629 const double dir = sumP4.Vect().Dot( reco_pos ) / sumP4.Vect().Mag() / reco_pos.Mag();
635 hist(
"RecoVertex/" + originType +
"_x")->Fill(secVtx->
x());
636 hist(
"RecoVertex/" + originType +
"_y")->Fill(secVtx->
y());
637 hist(
"RecoVertex/" + originType +
"_z")->Fill(secVtx->
z());
638 hist(
"RecoVertex/" + originType +
"_Lxy")->Fill(Lxy);
639 hist(
"RecoVertex/" + originType +
"_ntrk")->Fill(ntracks);
640 hist(
"RecoVertex/" + originType +
"_pT")->Fill(sumP4.Pt() /
GeV);
641 hist(
"RecoVertex/" + originType +
"_eta")->Fill(sumP4.Eta());
642 hist(
"RecoVertex/" + originType +
"_phi")->Fill(sumP4.Phi());
643 hist(
"RecoVertex/" + originType +
"_mass")->Fill(sumP4.M() /
GeV);
644 hist(
"RecoVertex/" + originType +
"_mu")->Fill(sumP4.M()/maxDR /
GeV);
645 hist(
"RecoVertex/" + originType +
"_chi2")->Fill(Chi2(*secVtx)/nDoF(*secVtx));
646 hist(
"RecoVertex/" + originType +
"_dir")->Fill(dir);
647 hist(
"RecoVertex/" + originType +
"_charge")->Fill(
charge);
648 hist(
"RecoVertex/" + originType +
"_H")->Fill(
H /
GeV);
649 hist(
"RecoVertex/" + originType +
"_HT")->Fill(HT /
GeV);
650 hist(
"RecoVertex/" + originType +
"_minOpAng")->Fill(minOpAng);
651 hist(
"RecoVertex/" + originType +
"_maxOpAng")->Fill(maxOpAng);
652 hist(
"RecoVertex/" + originType +
"_mind0")->Fill(minD0);
653 hist(
"RecoVertex/" + originType +
"_maxd0")->Fill(maxD0);
654 hist(
"RecoVertex/" + originType +
"_maxdR")->Fill(maxDR);
#define ATH_CHECK
Evaluate an expression and check for errors.
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
static const std::vector< std::string > bins
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.
TEfficiency * efficiency(const std::string &effName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TEfficiency.
void fillOriginHistograms(const xAOD::Vertex *secVtx, const std::string &originType)
Gaudi::Property< bool > m_doMuSA
Gaudi::Property< bool > m_writeHistograms
Gaudi::Property< std::vector< int > > m_targetPDGIDs
Gaudi::Property< bool > m_doSMOrigin
virtual StatusCode initialize() override
void fillRecoHistograms(const xAOD::Vertex *secVtx, const std::string &matchType)
virtual StatusCode execute() override
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_secVtxContainerKey
ToolHandle< IInDetSecVtxTruthMatchTool > m_matchTool
SecVertexTruthMatchAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
void fillTruthHistograms(const xAOD::TruthVertex *truthVtx, const std::string &truthType)
SG::ReadHandleKey< xAOD::TruthVertexContainer > m_truthVtxContainerKey
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
ElementLink implementation for ROOT usage.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
SG::Decorator< T, ALLOC > Decorator
class to provide type-safe access to aux data.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Helper class to provide type-safe access to aux data.
const_pointer_type cptr()
Dereference the pointer.
DefiningParameters_t definingParameters() const
Returns a SVector of the Perigee track parameters.
virtual double m() const override final
The invariant mass of the particle..
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
float phi0() const
Returns the parameter, which has range to .
virtual double e() const override final
The total energy of the particle.
virtual double m() const override final
The mass of the particle.
int pdgId() const
PDG ID code.
bool hasProdVtx() const
Check for a production vertex on this particle.
virtual double e() const override final
The total energy of the particle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
double charge() const
Physical charge.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float eta() const
Vertex pseudorapidity.
float y() const
Vertex y displacement.
float phi() const
Vertex azimuthal angle.
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
float perp() const
Vertex transverse distance from the beam line.
size_t nOutgoingParticles() const
Get the number of outgoing particles.
float x() const
Vertex x displacement.
float z() const
Returns the z position.
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
Type for the associated track particles.
float y() const
Returns the y position.
float x() const
Returns the x position.
Select isolated Photons, Electrons and Muons.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
bool isSeeded(int matchInfo)
bool isSplit(int matchInfo)
bool isFake(int matchInfo)
bool isReconstructedSplit(int matchInfo)
bool isOriginType(int matchInfo, VertexMatchOriginType type)
bool isReconstructable(int matchInfo)
bool isReconstructed(int matchInfo)
bool isMatched(int matchInfo)
bool isAccepted(int matchInfo)
bool isMerged(int matchInfo)
bool isOther(int matchInfo)
@ SecVtx
Secondary vertex.
TruthVertex_v1 TruthVertex
Typedef to implementation.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
static const SG::AuxElement::Accessor< std::vector< float > > accCovMatrixDiag("definingParametersCovMatrixDiag")