ATLAS Offline Software
SecVertexTruthMatchAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include "TMath.h"
10 #include "TH1.h"
11 #include "TEfficiency.h"
12 
13 const float GeV = 1000.;
14 
15 namespace CP {
16 
17  SecVertexTruthMatchAlg::SecVertexTruthMatchAlg( const std::string& name, ISvcLocator* svcLoc )
18  : EL::AnaAlgorithm( name, svcLoc ) {}
19 
21 
22  // Initializing Keys
23  ATH_CHECK(m_secVtxContainerKey.initialize());
24  ATH_CHECK(m_truthVtxContainerKey.initialize());
26 
27  // Retrieving the tool
28  ATH_CHECK(m_matchTool.retrieve());
29 
30  if(m_writeHistograms) {
31  std::vector<std::string> recoTypes{"All", "Matched", "Merged", "Fake", "Split", "Other"};
32  std::vector<std::string> truthTypes{"Inclusive", "Reconstructable", "Accepted", "Seeded", "Reconstructed", "ReconstructedSplit"};
33  // define SM origin categories if SM origin tracking is enabled
34  std::vector<std::string> smOriginTypes;
35  if(m_doSMOrigin) {
36  smOriginTypes = {"FakeOrigin", "Pileup", "KshortDecay", "StrangeMesonDecay", "LambdaDecay",
37  "StrangeBaryonDecay", "TauDecay", "GammaConversion", "OtherDecay",
38  "HadronicInteraction", "OtherSecondary", "BHadronDecay", "DHadronDecay",
39  "Fragmentation", "OtherOrigin", "Signal"};
40  }
41 
42  //determine histogram ranges depending if we are in normal or MuSA mode
43  //total bin counts stay the same for simplicity -- MuSA has less precision in general
44  float maxX = m_doMuSA ? 8000 : 500;
45  float maxY = m_doMuSA ? 10000 : 500;
46  float maxZ = m_doMuSA ? 10000 : 1500;
47  float maxLxy = m_doMuSA ? 8000 : 500;
48  float maxR = m_doMuSA ? 8000 : 600;
49  float mind0 = m_doMuSA ? 2000 : 100;
50  float maxd0 = m_doMuSA ? 2000 : 100;
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;
55 
56  float maxResR = m_doMuSA ? 2000 : 20;
57  float maxResZ = m_doMuSA ? 2000 : 20;
58 
59  ANA_CHECK (book(TH1F("RecoVertex/matchType", "Vertex Match Type", 65, -0.5, 64.5)));
60  if (m_doSMOrigin) {
61  ANA_CHECK (book(TH1F("RecoVertex/smOriginType", "Vertex SM Origin Type", 65537, -0.5, 65536.5)));
62  }
63 
64 
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)));
86 
87  // tracks
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)));
105 
106  // truth matching -- don't book for non-matched vertices
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)));
113  }
114  }
115 
116  // do reco vertices by SM origin if enabled -- NOTE these types are not exclusive (d decays will also be b decays in a cascade etc)
117  if (m_doSMOrigin) {
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)));
139 
140  // tracks
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)));
158 
159 
160  }
161  }
162 
163 
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)));
186  }
187  // now add the efficiencies
188  // Define two different bin arrays - one for standard mode, one for MuSA
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};
191 
192  // Determine which bins to use based on whether we're in MuSA mode
193  Double_t* bins = m_doMuSA ? muSA_bins : standard_bins;
194  size_t nbins = m_doMuSA ? sizeof(muSA_bins)/sizeof(muSA_bins[0])-1 : sizeof(standard_bins)/sizeof(standard_bins[0])-1;
195 
196  ANA_CHECK (book(TEfficiency("Acceptance", "Acceptance", nbins, bins)));
197  ANA_CHECK (book(TEfficiency("eff_seed", "Seed efficiency", nbins, bins)));
198  ANA_CHECK (book(TEfficiency("eff_core", "Core efficiency", nbins, bins)));
199  ANA_CHECK (book(TEfficiency("eff_total", "Total efficiency", nbins, bins)));
200 
201  }
202 
203 
204  return StatusCode::SUCCESS;
205  }
206 
208 
209  //Retrieve the vertices:
213 
214  std::vector<const xAOD::Vertex*> recoVerticesToMatch;
215  std::vector<const xAOD::TruthVertex*> truthVerticesToMatch;
216 
217  for(const auto recoVertex : *recoVertexContainer) {
218  xAOD::VxType::VertexType vtxType = static_cast<xAOD::VxType::VertexType>( recoVertex->vertexType() );
219 
220  if(vtxType != xAOD::VxType::SecVtx ){
221  ATH_MSG_DEBUG("Vertex not labeled as secondary");
222  continue;
223  }
224  recoVerticesToMatch.push_back(recoVertex);
225  }
226 
227  for(const auto truthVertex : *truthVertexContainer) {
228  if(truthVertex->nIncomingParticles() != 1) {
229  continue;
230  }
231  const xAOD::TruthParticle* truthPart = truthVertex->incomingParticle(0);
232  if(not truthPart) {
233  continue;
234  }
235  if(std::find(m_targetPDGIDs.begin(), m_targetPDGIDs.end(), std::abs(truthPart->pdgId())) == m_targetPDGIDs.end()) {
236  continue;
237  }
238  if(truthVertex->nOutgoingParticles() < 2) {
239  continue;
240  }
241  truthVerticesToMatch.push_back(truthVertex);
242  }
243 
244  //pass to the tool for decoration:
245  ATH_CHECK( m_matchTool->matchVertices( recoVerticesToMatch, truthVerticesToMatch, trackParticleContainer.cptr() ) );
246 
247  if(m_writeHistograms) {
248  static const xAOD::Vertex::Decorator<int> matchTypeDecor("vertexMatchType");
249  for(const auto& secVtx : recoVerticesToMatch) {
250  int matchTypeBitset = matchTypeDecor(*secVtx);
251  hist("RecoVertex/matchType")->Fill(matchTypeBitset);
252 
253  if(InDetSecVtxTruthMatchUtils::isMatched(matchTypeBitset)) {
254  fillRecoHistograms(secVtx, "Matched");
255  }
256  if(InDetSecVtxTruthMatchUtils::isMerged(matchTypeBitset)) {
257  fillRecoHistograms(secVtx, "Merged");
258  }
259  if(InDetSecVtxTruthMatchUtils::isFake(matchTypeBitset)) {
260  fillRecoHistograms(secVtx, "Fake");
261  }
262  if(InDetSecVtxTruthMatchUtils::isSplit(matchTypeBitset)) {
263  fillRecoHistograms(secVtx, "Split");
264  }
265  if(InDetSecVtxTruthMatchUtils::isOther(matchTypeBitset)) {
266  fillRecoHistograms(secVtx, "Other");
267  }
268  fillRecoHistograms(secVtx, "All");
269  }
270 
271  static const xAOD::Vertex::Decorator<int> truthTypeDecor("truthVertexMatchType");
272  for(const auto& truthVtx : truthVerticesToMatch) {
273  int truthTypeBitset = truthTypeDecor(*truthVtx);
274  if(InDetSecVtxTruthMatchUtils::isReconstructable(truthTypeBitset)) {
275  fillTruthHistograms(truthVtx, "Reconstructable");
276 
277  // fill efficiencies
278  efficiency("Acceptance")->Fill(InDetSecVtxTruthMatchUtils::isAccepted(truthTypeBitset), truthVtx->perp());
279  efficiency("eff_total")->Fill(InDetSecVtxTruthMatchUtils::isReconstructed(truthTypeBitset), truthVtx->perp());
280  }
281  if(InDetSecVtxTruthMatchUtils::isAccepted(truthTypeBitset)) {
282  fillTruthHistograms(truthVtx, "Accepted");
283  efficiency("eff_seed")->Fill(InDetSecVtxTruthMatchUtils::isSeeded(truthTypeBitset), truthVtx->perp());
284  }
285  if(InDetSecVtxTruthMatchUtils::isSeeded(truthTypeBitset)) {
286  fillTruthHistograms(truthVtx, "Seeded");
287  efficiency("eff_core")->Fill(InDetSecVtxTruthMatchUtils::isReconstructed(truthTypeBitset), truthVtx->perp());
288  }
289  if(InDetSecVtxTruthMatchUtils::isReconstructed(truthTypeBitset)) {
290  fillTruthHistograms(truthVtx, "Reconstructed");
291  }
293  fillTruthHistograms(truthVtx, "ReconstructedSplit");
294  }
295  fillTruthHistograms(truthVtx, "Inclusive");
296 
297  }
298  if (m_doSMOrigin) {
299  static const xAOD::Vertex::Decorator<int> originTypeDecor("vertexMatchOriginType");
300 
301  static const std::map<InDetSecVtxTruthMatchUtils::VertexMatchOriginType, std::string> originTypeMap = {
318  };
319 
320  for(const auto& secVtx : recoVerticesToMatch) {
321  int smOriginTypeBitset = originTypeDecor(*secVtx);
322  hist("RecoVertex/smOriginType")->Fill(smOriginTypeBitset);
323 
324  for(const auto& entry : originTypeMap) {
325  if(InDetSecVtxTruthMatchUtils::isOriginType(smOriginTypeBitset, entry.first)) {
326  fillOriginHistograms(secVtx, entry.second);
327  }
328  }
329  }
330  }
331 
332  }
333 
334  return StatusCode::SUCCESS;
335 
336  }
337  void SecVertexTruthMatchAlg::fillRecoHistograms(const xAOD::Vertex* secVtx, const std::string& matchType) {
338 
339  // set of accessors for tracks and weights
341  xAOD::Vertex::ConstAccessor<std::vector<float> > weightAcc("trackWeights");
342 
343  // set of decorators for truth matching info
344  const xAOD::Vertex::Decorator<std::vector<InDetSecVtxTruthMatchUtils::VertexTruthMatchInfo> > matchInfoDecor("truthVertexMatchingInfos");
345 
346  TVector3 reco_pos(secVtx->x(), secVtx->y(), secVtx->z());
347  float Lxy = reco_pos.Perp();
348 
349  size_t ntracks;
350  const xAOD::Vertex::TrackParticleLinks_t & trkParts = trkAcc( *secVtx );
351  ntracks = trkParts.size();
352 
353  TLorentzVector sumP4(0,0,0,0);
354  double H = 0.0;
355  double HT = 0.0;
356  int charge = 0;
357  double minOpAng = -1.0* 1.e10;
358  double maxOpAng = 1.0* 1.e10;
359  double minD0 = 1.0* 1.e10;
360  double maxD0 = 0.0;
361  double maxDR = 0.0;
362 
363  xAOD::TrackParticle::ConstAccessor< std::vector< float > > accCovMatrixDiag( "definingParametersCovMatrixDiag" );
364 
365  ATH_MSG_DEBUG("Loop over tracks");
366  for(size_t t = 0; t < ntracks; t++){
367  if(!trkParts[t].isValid()){
368  ATH_MSG_DEBUG("Track " << t << " is bad!");
369  continue;
370  }
371  const xAOD::TrackParticle & trk = **trkParts[t];
372 
373  double trk_d0 = std::abs(trk.definingParameters()[0]);
374  double trk_z0 = std::abs(trk.definingParameters()[1]);
375 
376  if(trk_d0 < minD0){ minD0 = trk_d0; }
377  if(trk_d0 > maxD0){ maxD0 = trk_d0; }
378 
379  TLorentzVector vv;
380  // TODO: use values computed w.r.t SV
381  vv.SetPtEtaPhiM(trk.pt(),trk.eta(), trk.phi0(), trk.m());
382  sumP4 += vv;
383  H += vv.Vect().Mag();
384  HT += vv.Pt();
385 
386  TLorentzVector v_minus_iv(0,0,0,0);
387  for(size_t j = 0; j < ntracks; j++){
388  if (j == t){ continue; }
389  if(!trkParts[j].isValid()){
390  ATH_MSG_DEBUG("Track " << j << " is bad!");
391  continue;
392  }
393 
394  const xAOD::TrackParticle & trk_2 = **trkParts[j];
395 
396  TLorentzVector tmp;
397  // TODO: use values computed w.r.t. SV
398  tmp.SetPtEtaPhiM(trk_2.pt(),trk_2.eta(), trk_2.phi0(), trk_2.m());
399  v_minus_iv += tmp;
400 
401  if( j > t ) {
402  double tm = vv * tmp / ( vv.Mag() * tmp.Mag() );
403  if( minOpAng < tm ) minOpAng = tm;
404  if( maxOpAng > tm ) maxOpAng = tm;
405  }
406  }
407  double DR = vv.DeltaR(v_minus_iv);
408  if( DR > maxDR ){ maxDR = DR;}
409 
410  charge += trk.charge();
411 
412  xAOD::TrackParticle::ConstAccessor<float> Trk_Chi2("chiSquared");
413  xAOD::TrackParticle::ConstAccessor<float> Trk_nDoF("numberDoF");
414 
415  if ( Trk_Chi2.isAvailable(trk) && Trk_Chi2(trk) && Trk_nDoF.isAvailable(trk) && Trk_nDoF(trk) ) {
416  hist("RecoVertex/" + matchType + "_Trk_Chi2")->Fill(Trk_Chi2(trk) / Trk_nDoF(trk));
417  hist("RecoVertex/" + matchType + "_Trk_nDoF")->Fill(Trk_nDoF(trk));
418  }
419  hist("RecoVertex/" + matchType + "_Trk_D0")->Fill(trk_d0);
420  hist("RecoVertex/" + matchType + "_Trk_Z0")->Fill(trk_z0);
421  hist("RecoVertex/" + matchType + "_Trk_theta")->Fill(trk.definingParameters()[3]);
422  hist("RecoVertex/" + matchType + "_Trk_qOverP")->Fill(trk.definingParameters()[4]);
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());
432  hist("RecoVertex/" + matchType + "_Trk_errD0")->Fill(trk.definingParametersCovMatrix()(0,0));
433  hist("RecoVertex/" + matchType + "_Trk_errZ0")->Fill(trk.definingParametersCovMatrix()(1,1));
434 
435  } // end loop over tracks
436 
437  const double dir = sumP4.Vect().Dot( reco_pos ) / sumP4.Vect().Mag() / reco_pos.Mag();
438 
439  xAOD::Vertex::ConstAccessor<float> Chi2("chiSquared");
440  xAOD::Vertex::ConstAccessor<float> nDoF("numberDoF");
441 
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);
462 
463  std::vector<InDetSecVtxTruthMatchUtils::VertexTruthMatchInfo> truthmatchinfo;
464  truthmatchinfo = matchInfoDecor(*secVtx);
465 
466  // This includes all matched vertices, including splits
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));
471 
472  ATH_MSG_DEBUG("Match Score and probability: " << matchScore_weight << " " << matchScore_pt/0.01);
473 
474  const ElementLink<xAOD::TruthVertexContainer>& truthVertexLink = std::get<0>(truthmatchinfo.at(0));
475  const xAOD::TruthVertex& truthVtx = **truthVertexLink ;
476 
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);
481  }
482  }
483  }
484 
485  void SecVertexTruthMatchAlg::fillTruthHistograms(const xAOD::TruthVertex* truthVtx, const std::string& truthType) {
486 
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());
493  hist("TruthVertex/" + truthType + "_Ntrk_out")->Fill(truthVtx->nOutgoingParticles());
494 
495  ATH_MSG_DEBUG("Plotting truth parent");
496  const xAOD::TruthParticle& truthPart = *truthVtx->incomingParticle(0);
497 
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());
504 
505  ATH_MSG_DEBUG("Plotting truth prod vtx");
506  if(truthPart.hasProdVtx()){
507  const xAOD::TruthVertex & vertex = *truthPart.prodVtx();
508 
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());
515  }
516  // m_truthInclusive_r->Fill(truthVtx.perp());
517 
518  // if(matchTypeDecor(truthVtx) >= RECONSTRUCTABLE){
519  // m_truthReconstructable_r->Fill(truthVtx.perp());
520  // }
521  // if(matchTypeDecor(truthVtx) >= ACCEPTED){
522  // m_truthAccepted_r->Fill(truthVtx.perp());
523  // }
524  // if(matchTypeDecor(truthVtx) >= SEEDED){
525  // m_truthSeeded_r->Fill(truthVtx.perp());
526  // }
527  // if(matchTypeDecor(truthVtx) >= RECONSTRUCTED){
528  // m_truthReconstructed_r->Fill(truthVtx.perp());
529  // }
530  // if(matchTypeDecor(truthVtx) >= RECONSTRUCTEDSPLIT){
531  // m_truthSplit_r->Fill(truthVtx.perp());
532  // }
533  //
534  }
535 
536  void SecVertexTruthMatchAlg::fillOriginHistograms(const xAOD::Vertex* secVtx, const std::string& originType) {
537 
538  // set of accessors for tracks and weights
540  xAOD::Vertex::ConstAccessor<std::vector<float> > weightAcc("trackWeights");
541 
542  TVector3 reco_pos(secVtx->x(), secVtx->y(), secVtx->z());
543  float Lxy = reco_pos.Perp();
544 
545  size_t ntracks;
546  const xAOD::Vertex::TrackParticleLinks_t & trkParts = trkAcc( *secVtx );
547  ntracks = trkParts.size();
548 
549  TLorentzVector sumP4(0,0,0,0);
550  double H = 0.0;
551  double HT = 0.0;
552  int charge = 0;
553  double minOpAng = -1.0* 1.e10;
554  double maxOpAng = 1.0* 1.e10;
555  double minD0 = 1.0* 1.e10;
556  double maxD0 = 0.0;
557  double maxDR = 0.0;
558 
559  xAOD::TrackParticle::ConstAccessor< std::vector< float > > accCovMatrixDiag( "definingParametersCovMatrixDiag" );
560 
561  // Loop over tracks to calculate derived quantities
562  for(size_t t = 0; t < ntracks; t++){
563  if(!trkParts[t].isValid()){
564  continue;
565  }
566  const xAOD::TrackParticle & trk = **trkParts[t];
567 
568  double trk_d0 = std::abs(trk.definingParameters()[0]);
569  double trk_z0 = std::abs(trk.definingParameters()[1]);
570 
571  if(trk_d0 < minD0){ minD0 = trk_d0; }
572  if(trk_d0 > maxD0){ maxD0 = trk_d0; }
573 
574  TLorentzVector vv;
575  vv.SetPtEtaPhiM(trk.pt(), trk.eta(), trk.phi0(), trk.m());
576  sumP4 += vv;
577  H += vv.Vect().Mag();
578  HT += vv.Pt();
579 
580  TLorentzVector v_minus_iv(0,0,0,0);
581  for(size_t j = 0; j < ntracks; j++){
582  if (j == t){ continue; }
583  if(!trkParts[j].isValid()){
584  continue;
585  }
586 
587  const xAOD::TrackParticle & trk_2 = **trkParts[j];
588 
589  TLorentzVector tmp;
590  tmp.SetPtEtaPhiM(trk_2.pt(), trk_2.eta(), trk_2.phi0(), trk_2.m());
591  v_minus_iv += tmp;
592 
593  if( j > t ) {
594  double tm = vv * tmp / ( vv.Mag() * tmp.Mag() );
595  if( minOpAng < tm ) minOpAng = tm;
596  if( maxOpAng > tm ) maxOpAng = tm;
597  }
598  }
599  double DR = vv.DeltaR(v_minus_iv);
600  if( DR > maxDR ){ maxDR = DR;}
601 
602  charge += trk.charge();
603 
604  // Fill track-level histograms
605  xAOD::TrackParticle::ConstAccessor<float> Trk_Chi2("chiSquared");
606  xAOD::TrackParticle::ConstAccessor<float> Trk_nDoF("numberDoF");
607 
608  if ( Trk_Chi2.isAvailable(trk) && Trk_Chi2(trk) && Trk_nDoF.isAvailable(trk) && Trk_nDoF(trk) ) {
609  hist("RecoVertex/" + originType + "_Trk_Chi2")->Fill(Trk_Chi2(trk) / Trk_nDoF(trk));
610  hist("RecoVertex/" + originType + "_Trk_nDoF")->Fill(Trk_nDoF(trk));
611  }
612  hist("RecoVertex/" + originType + "_Trk_D0")->Fill(trk_d0);
613  hist("RecoVertex/" + originType + "_Trk_Z0")->Fill(trk_z0);
614  hist("RecoVertex/" + originType + "_Trk_theta")->Fill(trk.definingParameters()[3]);
615  hist("RecoVertex/" + originType + "_Trk_qOverP")->Fill(trk.definingParameters()[4]);
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());
625  hist("RecoVertex/" + originType + "_Trk_errD0")->Fill(trk.definingParametersCovMatrix()(0,0));
626  hist("RecoVertex/" + originType + "_Trk_errZ0")->Fill(trk.definingParametersCovMatrix()(1,1));
627  }
628 
629  const double dir = sumP4.Vect().Dot( reco_pos ) / sumP4.Vect().Mag() / reco_pos.Mag();
630 
631  xAOD::Vertex::ConstAccessor<float> Chi2("chiSquared");
632  xAOD::Vertex::ConstAccessor<float> nDoF("numberDoF");
633 
634  // Fill vertex-level histograms
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);
655  }
656 
657 } // namespace CP
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:74
xAOD::Vertex_v1::x
float x() const
Returns the x position.
InDetSecVtxTruthMatchUtils::Pileup
@ Pileup
Definition: InDetSecVtxTruthMatchTool.h:48
InDetSecVtxTruthMatchUtils::OtherSecondary
@ OtherSecondary
Definition: InDetSecVtxTruthMatchTool.h:57
xAOD::TrackParticle_v1::m
virtual double m() const override final
The invariant mass of the particle..
Definition: TrackParticle_v1.cxx:84
GeV
const float GeV
Definition: SecVertexTruthMatchAlg.cxx:13
xAOD::TruthVertex_v1::phi
float phi() const
Vertex azimuthal angle.
Definition: TruthVertex_v1.cxx:177
SecVertexTruthMatchAlg.h
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
InDetSecVtxTruthMatchUtils::HadronicInteraction
@ HadronicInteraction
Definition: InDetSecVtxTruthMatchTool.h:56
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
AthHistogramming::book
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
Definition: AthHistogramming.h:303
InDetSecVtxTruthMatchUtils::isFake
bool isFake(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:87
xAOD::TrackParticle_v1::charge
float charge() const
Returns the charge.
Definition: TrackParticle_v1.cxx:151
InDetSecVtxTruthMatchUtils::isReconstructable
bool isReconstructable(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:96
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:78
AthHistogramming::efficiency
TEfficiency * efficiency(const std::string &effName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TEfficiency.
Definition: AthHistogramming.cxx:250
InDetSecVtxTruthMatchUtils::Signal
@ Signal
Definition: InDetSecVtxTruthMatchTool.h:62
InDetSecVtxTruthMatchUtils::isMerged
bool isMerged(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:79
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
InDetSecVtxTruthMatchUtils::isMatched
bool isMatched(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:75
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
InDetSecVtxTruthMatchUtils::isSplit
bool isSplit(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:83
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:872
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:49
xAOD::TruthVertex_v1::y
float y() const
Vertex y displacement.
IDTPM::truthType
int truthType(const U &p)
Definition: TrackParametersHelper.h:274
xAOD::VxType::VertexType
VertexType
Vertex types.
Definition: TrackingPrimitives.h:570
CP::SecVertexTruthMatchAlg::m_matchTool
ToolHandle< IInDetSecVtxTruthMatchTool > m_matchTool
Definition: SecVertexTruthMatchAlg.h:54
xAOD::TrackParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TrackParticle_v1.cxx:130
InDetSecVtxTruthMatchTool.h
H
#define H(x, y, z)
Definition: MD5.cxx:114
CP::SecVertexTruthMatchAlg::fillTruthHistograms
void fillTruthHistograms(const xAOD::TruthVertex *truthVtx, const std::string &truthType)
Definition: SecVertexTruthMatchAlg.cxx:485
CP::SecVertexTruthMatchAlg::m_writeHistograms
Gaudi::Property< bool > m_writeHistograms
Definition: SecVertexTruthMatchAlg.h:52
InDetSecVtxTruthMatchUtils::isOther
bool isOther(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:91
InDetSecVtxTruthMatchUtils::isReconstructed
bool isReconstructed(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:108
xAOD::TruthParticle_v1::e
virtual double e() const override final
The total energy of the particle.
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
CP::SecVertexTruthMatchAlg::initialize
virtual StatusCode initialize() override
Definition: SecVertexTruthMatchAlg.cxx:20
InDetSecVtxTruthMatchUtils::BHadronDecay
@ BHadronDecay
Definition: InDetSecVtxTruthMatchTool.h:58
InDetSecVtxTruthMatchUtils::isAccepted
bool isAccepted(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:100
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::VxType::SecVtx
@ SecVtx
Secondary vertex.
Definition: TrackingPrimitives.h:573
InDetSecVtxTruthMatchUtils::Fragmentation
@ Fragmentation
Definition: InDetSecVtxTruthMatchTool.h:60
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
CP::SecVertexTruthMatchAlg::m_secVtxContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_secVtxContainerKey
Definition: SecVertexTruthMatchAlg.h:41
CP::SecVertexTruthMatchAlg::m_targetPDGIDs
Gaudi::Property< std::vector< int > > m_targetPDGIDs
Definition: SecVertexTruthMatchAlg.h:50
InDetSecVtxTruthMatchUtils::LambdaDecay
@ LambdaDecay
Definition: InDetSecVtxTruthMatchTool.h:51
xAOD::TruthVertex_v1::perp
float perp() const
Vertex transverse distance from the beam line.
Definition: TruthVertex_v1.cxx:164
xAOD::TruthParticle_v1::hasProdVtx
bool hasProdVtx() const
Check for a production vertex on this particle.
Definition: TruthParticle_v1.cxx:69
InDetSecVtxTruthMatchUtils::StrangeMesonDecay
@ StrangeMesonDecay
Definition: InDetSecVtxTruthMatchTool.h:50
CP::SecVertexTruthMatchAlg::execute
virtual StatusCode execute() override
Definition: SecVertexTruthMatchAlg.cxx:207
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AsgComponentFactories.h:16
plotting.yearwise_luminosity_vs_mu.bins
bins
Definition: yearwise_luminosity_vs_mu.py:30
xAOD::Vertex_v1::TrackParticleLinks_t
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
Type for the associated track particles.
Definition: Vertex_v1.h:128
xAOD::Vertex_v1::z
float z() const
Returns the z position.
xAOD::TruthVertex_v1::incomingParticle
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
Definition: TruthVertex_v1.cxx:70
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
CP::GeV
const double GeV
Definition: EgammaCalibrationAndSmearingTool.cxx:42
beamspotman.dir
string dir
Definition: beamspotman.py:619
CP::SecVertexTruthMatchAlg::m_doMuSA
Gaudi::Property< bool > m_doMuSA
Definition: SecVertexTruthMatchAlg.h:55
CP::SecVertexTruthMatchAlg::m_doSMOrigin
Gaudi::Property< bool > m_doSMOrigin
Definition: SecVertexTruthMatchAlg.h:56
InDetSecVtxTruthMatchUtils::OtherDecay
@ OtherDecay
Definition: InDetSecVtxTruthMatchTool.h:55
xAOD::TruthParticle_v1::prodVtx
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Definition: TruthParticle_v1.cxx:75
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
xAOD::TrackParticle_v1::phi0
float phi0() const
Returns the parameter, which has range to .
Definition: TrackParticle_v1.cxx:159
xAOD::TrackParticle_v1::definingParametersCovMatrix
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
Definition: TrackParticle_v1.cxx:247
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
InDetSecVtxTruthMatchUtils::isOriginType
bool isOriginType(int matchInfo, VertexMatchOriginType type)
Definition: InDetSecVtxTruthMatchTool.h:117
InDetSecVtxTruthMatchUtils::KshortDecay
@ KshortDecay
Definition: InDetSecVtxTruthMatchTool.h:49
CP::SecVertexTruthMatchAlg::fillRecoHistograms
void fillRecoHistograms(const xAOD::Vertex *secVtx, const std::string &matchType)
Definition: SecVertexTruthMatchAlg.cxx:337
charge
double charge(const T &p)
Definition: AtlasPID.h:991
xAOD::TrackParticle_v1::e
virtual double e() const override final
The total energy of the particle.
Definition: TrackParticle_v1.cxx:110
xAOD::TruthParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TruthParticle_v1.cxx:169
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
xAOD::TrackParticle_v1::definingParameters
DefiningParameters_t definingParameters() const
Returns a SVector of the Perigee track parameters.
Definition: TrackParticle_v1.cxx:172
xAOD::TruthVertex_v1::x
float x() const
Vertex x displacement.
CP::SecVertexTruthMatchAlg::SecVertexTruthMatchAlg
SecVertexTruthMatchAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: SecVertexTruthMatchAlg.cxx:17
InDetSecVtxTruthMatchUtils::isReconstructedSplit
bool isReconstructedSplit(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:112
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
InDetSecVtxTruthMatchUtils::OtherOrigin
@ OtherOrigin
Definition: InDetSecVtxTruthMatchTool.h:61
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::TruthVertex_v1::eta
float eta() const
Vertex pseudorapidity.
Definition: TruthVertex_v1.cxx:171
xAOD::TruthParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
Definition: TruthParticle_v1.cxx:176
InDetSecVtxTruthMatchUtils::GammaConversion
@ GammaConversion
Definition: InDetSecVtxTruthMatchTool.h:54
xAOD::TruthVertex_v1::z
float z() const
Vertex longitudinal distance along the beam line form the origin.
xAOD::Vertex_v1::y
float y() const
Returns the y position.
xAOD::TruthParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TruthParticle_v1.cxx:161
AthHistogramming::hist
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.
Definition: AthHistogramming.cxx:198
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
InDetSecVtxTruthMatchUtils::StrangeBaryonDecay
@ StrangeBaryonDecay
Definition: InDetSecVtxTruthMatchTool.h:52
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
CP::SecVertexTruthMatchAlg::m_truthVtxContainerKey
SG::ReadHandleKey< xAOD::TruthVertexContainer > m_truthVtxContainerKey
Definition: SecVertexTruthMatchAlg.h:44
InDetSecVtxTruthMatchUtils::TauDecay
@ TauDecay
Definition: InDetSecVtxTruthMatchTool.h:53
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
InDetSecVtxTruthMatchUtils::FakeOrigin
@ FakeOrigin
Definition: InDetSecVtxTruthMatchTool.h:47
TruthParticle.h
InDetSecVtxTruthMatchUtils::isSeeded
bool isSeeded(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:104
PlotCalibFromCool.vv
vv
Definition: PlotCalibFromCool.py:716
CP::SecVertexTruthMatchAlg::fillOriginHistograms
void fillOriginHistograms(const xAOD::Vertex *secVtx, const std::string &originType)
Definition: SecVertexTruthMatchAlg.cxx:536
CP::SecVertexTruthMatchAlg::m_trackParticleContainerKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleContainerKey
Definition: SecVertexTruthMatchAlg.h:47
xAOD::TruthParticle_v1::m
virtual double m() const override final
The mass of the particle.
xAOD::TruthParticle_v1::charge
double charge() const
Physical charge.
InDetSecVtxTruthMatchUtils::DHadronDecay
@ DHadronDecay
Definition: InDetSecVtxTruthMatchTool.h:59