ATLAS Offline Software
AANT_Tools.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Header include
9 
12 
13 #include <iostream>
14 #include <vector>
15 
16 
17 #include "TH1D.h"
18 #include "TNtuple.h"
19 #include "TTree.h"
20 #include "TROOT.h"
21 //-------------------------------------------------
22 
23 using namespace std;
24 
25 namespace VKalVrtAthena {
26 
27  //____________________________________________________________________________________________________
28  StatusCode VrtSecInclusive::setupNtupleVariables() {
29 
30  m_ntupleVars->addNewVar<unsigned int> ( "RunNumber" );
31  m_ntupleVars->addNewVar<unsigned int> ( "Event" );
32  m_ntupleVars->addNewVar<unsigned int> ( "Time" );
33  m_ntupleVars->addNewVar<unsigned int> ( "LumiBlock" );
34  m_ntupleVars->addNewVar<unsigned int> ( "BCID" );
35  m_ntupleVars->addNewVar<unsigned int> ( "LVL1ID" );
36 
37  m_ntupleVars->addNewVar<unsigned int> ( "NumAllTrks" );
38  m_ntupleVars->addNewVar<unsigned int> ( "NumSelTrks" );
39  m_ntupleVars->addNewVar<unsigned int> ( "SizeIncomp" );
40 
41  m_ntupleVars->addNewVar<unsigned int> ( "NumPV" );
42  m_ntupleVars->addNewVar<unsigned int> ( "NTrksPV" );
43  m_ntupleVars->addNewVar<unsigned int> ( "PVType" );
44  m_ntupleVars->addNewVar<double> ( "PVX" );
45  m_ntupleVars->addNewVar<double> ( "PVY" );
46  m_ntupleVars->addNewVar<double> ( "PVZ" );
47 
48  m_ntupleVars->addNewVar< vector<int> > ( "NdofTrksPV" );
49  m_ntupleVars->addNewVar< vector<double> > ( "PVZpile" );
50 
51  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_id" );
52  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_pT" );
53  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_2dIPPV" );
54  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_ZIPPV" );
55  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_2dIP" );
56  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_ZIP" );
57  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_phi" );
58  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_eta" );
59  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_chi2" );
60  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_eta" );
61  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_BLayHits" );
62  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixHits" );
63  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_SCTHits" );
64  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_TRTHits" );
65  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixBar1" );
66  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixBar2" );
67  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_barcode" ); // FIXME barcode-based
68  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_matchPr" );
69  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_2dIPErr" );
70  m_ntupleVars->addNewVar< vector<double> > ( "RecoTrk_ZIPErr" );
71  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_PixShare" );
72  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_SCTShare" );
73  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_TrkAuth" );
74  m_ntupleVars->addNewVar< vector<int> > ( "RecoTrk_TrkLowPt" );
75 
76  m_ntupleVars->addNewVar< vector<int> > ( "SelTrk_barcode" ); // FIXME barcode-based
77 
78  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_id" );
79  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_pT" );
80  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_p" );
81  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_phi" );
82  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_eta" );
83  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_2dIP" );
84  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_ZIP" );
85  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_delp" );
86  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_del2dIP" );
87  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_delzIP" );
88  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_eta" );
89  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_BLayHits" );
90  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_PixHits" );
91  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_SCTHits" );
92  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_TRTHits" );
93  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_barcode" ); // FIXME barcode-based
94  m_ntupleVars->addNewVar< vector<double> > ( "SVTrk_matchPr" );
95  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_TrkAuth" );
96  m_ntupleVars->addNewVar< vector<int> > ( "SVTrk_TrkLowPt" );
97 
98  m_ntupleVars->addNewVar< unsigned int > ( "All2TrkVrtNum" );
99  m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtMass" );
100  m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtPt" );
101  m_ntupleVars->addNewVar< vector<int> > ( "All2TrkVrtCharge" );
102  m_ntupleVars->addNewVar< vector<int> > ( "All2TrkSumBLHits" );
103  m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtX" );
104  m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtY" );
105  m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtZ" );
106  m_ntupleVars->addNewVar< vector<double> > ( "All2TrkVrtChiSq" );
107 
108  m_ntupleVars->addNewVar< unsigned int > ( "AfFakVrtNum" );
109  m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtMass" );
110  m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtPt" );
111  m_ntupleVars->addNewVar< vector<int> > ( "AfFakVrtCharge" );
112  m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtX" );
113  m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtY" );
114  m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtZ" );
115  m_ntupleVars->addNewVar< vector<double> > ( "AfFakVrtChiSq" );
116 
117  m_ntupleVars->addNewVar< unsigned int > ( "NumInitSecVrt" );
118  m_ntupleVars->addNewVar< unsigned int > ( "NumRearrSecVrt" );
119  m_ntupleVars->addNewVar< unsigned int > ( "NumSecVrt" );
120  m_ntupleVars->addNewVar< vector<double> > ( "SecVtxX" );
121  m_ntupleVars->addNewVar< vector<double> > ( "SecVtxY" );
122  m_ntupleVars->addNewVar< vector<double> > ( "SecVtxZ" );
123  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_NumTrks" );
124  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Mass" );
125  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Mass_electron" );
126  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Chi2" );
127  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_pT" );
128  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_pZ" );
129  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_Charge" );
130  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_SumBLayHits" );
131  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_AllTrksBLayHits" );
132  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_MinOpAng" );
133 
134  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPt" );
135  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPhi" );
136  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkEta" );
137  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_TrkBLay" );
138  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_TrkPixExclBLay" );
139  m_ntupleVars->addNewVar< vector<int> > ( "SecVtx_TrkSCT" );
140  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trk2dIP" );
141  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkZIP" );
142  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelP" );
143  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trkdel2dIP" );
144  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelZIP" );
145  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPtWrtSV" );
146  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkPhiWrtSV" );
147  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkEtaWrtSV" );
148  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trk2dIPWrtSV" );
149  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkZIPWrtSV" );
150  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelPWrtSV" );
151  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_Trkdel2dIPWrtSV" );
152  m_ntupleVars->addNewVar< vector<double> > ( "SecVtx_TrkdelZIPWrtSV" );
153 
154  m_ntupleVars->addNewVar<double> ( "Truth_SV1X" );
155  m_ntupleVars->addNewVar<double> ( "Truth_SV1Y" );
156  m_ntupleVars->addNewVar<double> ( "Truth_SV1Z" );
157  m_ntupleVars->addNewVar<double> ( "Truth_PiEta" );
158  m_ntupleVars->addNewVar<double> ( "Truth_PiPhi" );
159  m_ntupleVars->addNewVar<double> ( "Truth_PiPt" );
160  m_ntupleVars->addNewVar<int> ( "Truth_PiInt" );
161  m_ntupleVars->addNewVar<int> ( "Truth_nSVHiPt" );
162  m_ntupleVars->addNewVar<int> ( "Truth_nSVLoPt" );
163  m_ntupleVars->addNewVar<int> ( "Truth_nSVGe1HiPt" );
164 
165  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllVtxType" );
166  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVX" );
167  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVY" );
168  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVZ" );
169  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk1Pt" );
170  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk2Pt" );
171  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk3Pt" );
172  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk4Pt" );
173  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVTrk5Pt" );
174  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVNumTrks" );
175  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVNumReTrks" );
176  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVCharge" );
177  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVSumTrksPt" );
178  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVSumTrksPz" );
179  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVHasLifetime" );
180  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVStrangeBaryon" );
181  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVIncomingPid" );
182  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllSVNumIncident" );
183  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVPtIncident" );
184  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVPzIncident" );
185  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllSVMinOpAng" );
186 
187  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrk2dIP" );
188  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkZIP" );
189  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkPt" );
190  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkEta" );
191  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkPhi" );
192  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkR" );
193  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllTrkZ" );
194  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllTrkBC" );
195 
196  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllRefitSt" );
197  m_ntupleVars->addNewVar< vector<int> > ( "Truth_AllRefitNTrk" );
198  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitChi2" );
199  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitSVX" );
200  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitSVY" );
201  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitSVZ" );
202  m_ntupleVars->addNewVar< vector<double> > ( "Truth_AllRefitMass" );
203 
204  return StatusCode::SUCCESS;
205  }
206 
207 
208  //____________________________________________________________________________________________________
209  StatusCode VrtSecInclusive::deleteNtupleVariables() {
210 
211  m_ntupleVars->deleteNtupleVariables();
212 
213  return StatusCode::SUCCESS;
214  }
215 
216 
217  //____________________________________________________________________________________________________
218  StatusCode VrtSecInclusive::setupNtuple() {
219 
220  m_ntupleVars->branchNtuple( m_tree_Vert );
221 
222  return StatusCode::SUCCESS;
223  }
224 
225 
226  //____________________________________________________________________________________________________
227  StatusCode VrtSecInclusive::clearNtupleVariables() {
228 
229  m_ntupleVars->clear();
230 
231  return StatusCode::SUCCESS;
232  }
233 
234 
235  //____________________________________________________________________________________________________
236  StatusCode VrtSecInclusive::addEventInfo() {
237  // add event level variables
238  //
239  ATH_MSG_DEBUG( " > addEventInfo: in addEventInfo");
240 
241  // this code has been taken from AnalysisExamples/VFitZmmOnAOD
242  //
243  //get EventInfo for run and event number
244 
245  const xAOD::EventInfo* eventInfo;
246  ATH_CHECK( evtStore()->retrieve(eventInfo) );
247 
248  //
249  //m_ntupleVars->m_runNumber = eventInfo->runNumber();
250  m_ntupleVars->get<unsigned int>( "RunNumber" ) = eventInfo->runNumber();
251  m_ntupleVars->get<unsigned int>( "Event") = eventInfo->eventNumber();
252  m_ntupleVars->get<unsigned int>( "Time" ) = eventInfo->timeStamp() ;
253  m_ntupleVars->get<unsigned int>( "LumiBlock" ) = eventInfo->lumiBlock() ;
254  m_ntupleVars->get<unsigned int>( "BCID" ) = eventInfo->bcid();
255 
256  ATH_MSG_DEBUG( " > addEventInfo: event "<< m_ntupleVars->get<unsigned int>( "Event" ) );
257 
258  return StatusCode::SUCCESS;
259  }
260 
261 
262  //____________________________________________________________________________________________________
263  StatusCode VrtSecInclusive::fillAANT_SelectedBaseTracks() {
264 
265  for ( const xAOD::TrackParticle* trk : *m_selectedTracks ) {
266 
267  if( m_jp.FillNtuple ) {
268  uint8_t tmpT;
269  if( !(trk->summaryValue(tmpT,xAOD::numberOfPixelHits)) ) tmpT=0;
270  m_ntupleVars->get< vector<int> >( "SVTrk_PixHits" ).emplace_back( (int) tmpT);
271 
272  if( !(trk->summaryValue(tmpT,xAOD::numberOfSCTHits)) ) tmpT=0;
273  m_ntupleVars->get< vector<int> >( "SVTrk_SCTHits" ).emplace_back( (int) tmpT);
274 
275  if( !(trk->summaryValue(tmpT,xAOD::numberOfTRTHits)) ) tmpT=0;
276  m_ntupleVars->get< vector<int> >( "SVTrk_TRTHits" ).emplace_back( (int) tmpT);
277 
278  if( !(trk->summaryValue(tmpT,xAOD::numberOfInnermostPixelLayerHits)) ) tmpT=0;
279  m_ntupleVars->get< vector<int> >( "SVTrk_BLayHits" ).emplace_back( (int) tmpT);
280  }
281 
282 
283  //
284  // get perigee params
285  //
286  const auto& perigee = trk->perigeeParameters();
287 
288  if( m_jp.FillNtuple ) {
289 
290  double phi = perigee.parameters()[Trk::phi];
291  double theta = perigee.parameters()[Trk::theta];
292  double d0 = perigee.parameters()[Trk::d0];
293  double qOverP = perigee.parameters()[Trk::qOverP];
294  double errqOverP = (*(perigee.covariance()))(Trk::qOverP,Trk::qOverP);
295  double errd0 = (*(perigee.covariance()))(Trk::d0,Trk::d0);
296  double ptrk = (1./qOverP);
297  double pT = ptrk*sin(theta);
298  double trketa = -1.*log( tan(theta/2) );
299 
300  // here we have to look at the original recotrack id to establish cross-link
301  // between "SVTrk" vars and "RecoTrk" vars:
302  static const SG::ConstAccessor<unsigned long> trk_idAcc("trk_id");
303  m_ntupleVars->get< vector<int> >( "SVTrk_id" ) .emplace_back( trk_idAcc(*trk) );
304 
305  m_ntupleVars->get< vector<double> >( "SVTrk_pT" ) .emplace_back(pT);
306  m_ntupleVars->get< vector<double> >( "SVTrk_p" ) .emplace_back(ptrk);
307  m_ntupleVars->get< vector<double> >( "SVTrk_phi" ) .emplace_back(phi);
308  m_ntupleVars->get< vector<double> >( "SVTrk_eta" ) .emplace_back(trketa);
309  m_ntupleVars->get< vector<double> >( "SVTrk_2dIP" ) .emplace_back(d0);
310  m_ntupleVars->get< vector<double> >( "SVTrk_ZIP" ) .emplace_back(perigee.parameters()[Trk::z0]);
311 
312  double matchProb = -1;
313  int barcode = HepMC::UNDEFINED_ID; // FIXME barcode-based
314  if(m_jp.doTruth)
315  {
316  const xAOD::TruthParticle* aTemp_truth = getTrkGenParticle( trk );
317  if( aTemp_truth )
318  {
319  barcode = HepMC::barcode(aTemp_truth); // FIXME barcode-based
320  static const SG::ConstAccessor<float> truthMatchProbabilityAcc( "truthMatchProbability" );
321  matchProb= truthMatchProbabilityAcc( *trk );
322  }
323  }
324 
325  m_ntupleVars->get< vector<int> >( "SVTrk_barcode" ) .emplace_back( barcode ); // FIXME barcode-based
326  m_ntupleVars->get< vector<double> >( "SVTrk_matchPr" ) .emplace_back( matchProb );
327 
328  ATH_MSG_DEBUG(" > fillAANT_SelectedBaseTracks: Sel Trk d0/pT/eta/match bc/pr "
329  << d0 << ","
330  << pT << ","
331  << trketa << ","
332  << barcode << "," // FIXME barcode-based
333  << matchProb );
334 
335  double errp = ptrk*ptrk*errqOverP;
336 
337  m_ntupleVars->get< vector<double> >( "SVTrk_delp" ) .emplace_back( errp );
338  m_ntupleVars->get< vector<double> >( "SVTrk_del2dIP" ) .emplace_back( errd0 );
339  m_ntupleVars->get< vector<double> >( "SVTrk_delzIP" ) .emplace_back( (*(perigee.covariance()))(Trk::z0,Trk::z0) );
340 
341  }
342 
343 
344  } // end of selected tracks
345 
346  return StatusCode::SUCCESS;
347  }
348 
349 
350  //____________________________________________________________________________________________________
351  StatusCode VrtSecInclusive::fillAANT_SecondaryVertices( xAOD::VertexContainer *vertices ) {
352 
353  // Loop over vertices
354  for( xAOD::Vertex *vertex : *vertices ) {
355 
356  // Track Loop
357  for(size_t itrk=0; itrk<vertex->nTrackParticles(); itrk++) {
358 
359  // Here trk is not const - will augment SV perigee variables in the loop.
360  const xAOD::TrackParticle* trk = vertex->trackParticle( itrk );
361 
362  //
363  // add variables for each track into ntuple
364  // Add all vertices to same ntuple, and extract later in root macro
365  //
366  m_ntupleVars->get< vector<double> >( "SecVtx_TrkPt" ) .emplace_back( trk->pt() );
367  m_ntupleVars->get< vector<double> >( "SecVtx_TrkPhi" ) .emplace_back( trk->phi() );
368  m_ntupleVars->get< vector<double> >( "SecVtx_TrkEta" ) .emplace_back( trk->eta() );
369  m_ntupleVars->get< vector<double> >( "SecVtx_Trk2dIP" ) .emplace_back( trk->d0() );
370  m_ntupleVars->get< vector<double> >( "SecVtx_TrkZIP" ) .emplace_back( trk->z0() );
371  m_ntupleVars->get< vector<double> >( "SecVtx_Trkdel2dIP" ) .emplace_back( trk->definingParametersCovMatrix()(Trk::d0, Trk::d0) );
372  m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelZIP" ) .emplace_back( trk->definingParametersCovMatrix()(Trk::z0, Trk::z0) );
373 
374  track_summary trk_summary;
375  fillTrackSummary( trk_summary, trk );
376 
377  m_ntupleVars->get< vector<int> >( "SecVtx_TrkBLay" ) .emplace_back( trk_summary.numIBLHits );
378  m_ntupleVars->get< vector<int> >( "SecVtx_TrkPixExclBLay" ) .emplace_back( trk_summary.numPixelHits - trk_summary.numIBLHits );
379  m_ntupleVars->get< vector<int> >( "SecVtx_TrkSCT" ) .emplace_back( trk_summary.numSctHits );
380 
381  static const SG::ConstAccessor<float> pt_wrtSVAcc("pt_wrtSV");
382  static const SG::ConstAccessor<float> eta_wrtSVAcc("eta_wrtSV");
383  static const SG::ConstAccessor<float> phi_wrtSVAcc("phi_wrtSV");
384  static const SG::ConstAccessor<float> d0_wrtSVAcc("d0_wrtSV");
385  static const SG::ConstAccessor<float> z0_wrtSVAcc("z0_wrtSV");
386  static const SG::ConstAccessor<float> errP_wrtSVAcc("errP_wrtSV");
387  static const SG::ConstAccessor<float> errd0_wrtSVAcc("errd0_wrtSV");
388  static const SG::ConstAccessor<float> errz0_wrtSVAcc("errz0_wrtSV");
389  ATH_MSG_VERBOSE(" >> fillAANT_SecondaryVertices : filling track vars wrt. SV");
390  if( pt_wrtSVAcc.isAvailable(*trk) &&
391  eta_wrtSVAcc.isAvailable(*trk) &&
392  phi_wrtSVAcc.isAvailable(*trk) &&
393  d0_wrtSVAcc.isAvailable(*trk) &&
394  z0_wrtSVAcc.isAvailable(*trk) &&
395  errP_wrtSVAcc.isAvailable(*trk) &&
396  errd0_wrtSVAcc.isAvailable(*trk) &&
397  errz0_wrtSVAcc.isAvailable(*trk) ) {
398 
399  m_ntupleVars->get< vector<double> >( "SecVtx_TrkPtWrtSV" ) .emplace_back( pt_wrtSVAcc(*trk) );
400  m_ntupleVars->get< vector<double> >( "SecVtx_TrkEtaWrtSV" ) .emplace_back( eta_wrtSVAcc(*trk) );
401  m_ntupleVars->get< vector<double> >( "SecVtx_TrkPhiWrtSV" ) .emplace_back( phi_wrtSVAcc(*trk) );
402  m_ntupleVars->get< vector<double> >( "SecVtx_Trk2dIPWrtSV" ) .emplace_back( d0_wrtSVAcc(*trk) );
403  m_ntupleVars->get< vector<double> >( "SecVtx_TrkZIPWrtSV" ) .emplace_back( z0_wrtSVAcc(*trk) );
404  m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelPWrtSV" ) .emplace_back( errP_wrtSVAcc(*trk) );
405  m_ntupleVars->get< vector<double> >( "SecVtx_Trkdel2dIPWrtSV" ) .emplace_back( errd0_wrtSVAcc(*trk) );
406  m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelZIPWrtSV" ) .emplace_back( errz0_wrtSVAcc(*trk) );
407 
408  } else {
409 
410  ATH_MSG_VERBOSE(" >> fillAANT_SecondaryVertices : filling track vars wrt. SV (invalid values)");
411 
412  m_ntupleVars->get< vector<double> >( "SecVtx_TrkPtWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
413  m_ntupleVars->get< vector<double> >( "SecVtx_TrkEtaWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
414  m_ntupleVars->get< vector<double> >( "SecVtx_TrkPhiWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
415  m_ntupleVars->get< vector<double> >( "SecVtx_Trk2dIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
416  m_ntupleVars->get< vector<double> >( "SecVtx_TrkZIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
417  m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
418  m_ntupleVars->get< vector<double> >( "SecVtx_Trkdel2dIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
419  m_ntupleVars->get< vector<double> >( "SecVtx_TrkdelZIPWrtSV" ) .emplace_back( AlgConsts::invalidFloat );
420 
421  }
422 
423  } // loop over tracks in vertex
424 
425  ATH_MSG_DEBUG(" >> fillAANT_SecondaryVertices : Track loop end. ");
426 
427  ATH_MSG_VERBOSE(" >> fillAANT_SecondaryVertices : filling vertex vars");
428 
429  static const SG::ConstAccessor<float> massAcc("mass");
430  static const SG::ConstAccessor<float> mass_eAcc("mass_e");
431  static const SG::ConstAccessor<float> pTAcc("pT");
432  static const SG::ConstAccessor<float> pzAcc("pz");
433  static const SG::ConstAccessor<float> vtx_chargeAcc("vtx_charge");
434  static const SG::ConstAccessor<float> sumBLayHitsAcc("sumBLayHits");
435  static const SG::ConstAccessor<float> allTrksBLayHitsAcc("allTrksBLayHits");
436  static const SG::ConstAccessor<float> minOpAngAcc("minOpAng");
437 
438  m_ntupleVars->get< vector<int> >( "SecVtx_NumTrks" ) .emplace_back( vertex->nTrackParticles() );
439  m_ntupleVars->get< vector<double> >( "SecVtx_Chi2" ) .emplace_back( vertex->chiSquared() );
440  m_ntupleVars->get< vector<double> >( "SecVtxX" ) .emplace_back( vertex->x() );
441  m_ntupleVars->get< vector<double> >( "SecVtxY" ) .emplace_back( vertex->y() );
442  m_ntupleVars->get< vector<double> >( "SecVtxZ" ) .emplace_back( vertex->z() );
443  m_ntupleVars->get< vector<double> >( "SecVtx_Mass" ) .emplace_back( massAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
444  m_ntupleVars->get< vector<double> >( "SecVtx_Mass_electron" ) .emplace_back( mass_eAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
445  m_ntupleVars->get< vector<double> >( "SecVtx_pT" ) .emplace_back( pTAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
446  m_ntupleVars->get< vector<double> >( "SecVtx_pZ" ) .emplace_back( pzAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
447  m_ntupleVars->get< vector<int> >( "SecVtx_Charge" ) .emplace_back( vtx_chargeAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
448  m_ntupleVars->get< vector<int> >( "SecVtx_SumBLayHits" ) .emplace_back( sumBLayHitsAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
449  m_ntupleVars->get< vector<int> >( "SecVtx_AllTrksBLayHits" ) .emplace_back( allTrksBLayHitsAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
450  m_ntupleVars->get< vector<double> >( "SecVtx_MinOpAng" ) .emplace_back( minOpAngAcc.withDefault(*vertex, AlgConsts::invalidFloat) );
451 
452 
453  } // loop over vertices
454 
455  return StatusCode::SUCCESS;
456  }
457 
458 } // end of namespace VKalVrtAthena
459 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
VKalVrtAthena::VrtSecInclusive::track_summary_properties::numIBLHits
uint8_t numIBLHits
Definition: VrtSecInclusive.h:493
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:75
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
Trk::z0
@ z0
Definition: ParamDefs.h:64
VKalVrtAthena::VrtSecInclusive::track_summary_properties
Definition: VrtSecInclusive.h:492
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::numberOfTRTHits
@ numberOfTRTHits
number of TRT hits [unit8_t].
Definition: TrackingPrimitives.h:275
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDetAccessor::qOverP
@ qOverP
perigee
Definition: InDetAccessor.h:35
NtupleVars.h
xAOD::TrackParticle_v1::d0
float d0() const
Returns the parameter.
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
VrtSecInclusive.h
VKalVrtAthena
Definition: AANT_Tools.cxx:25
Trk::theta
@ theta
Definition: ParamDefs.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:55
xAOD::TrackParticle_v1::definingParametersCovMatrix
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
Definition: TrackParticle_v1.cxx:246
VKalVrtAthena::VrtSecInclusive::track_summary_properties::numSctHits
uint8_t numSctHits
Definition: VrtSecInclusive.h:510
Trk::d0
@ d0
Definition: ParamDefs.h:63
MagicNumbers.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
VKalVrtAthena::AlgConsts::invalidFloat
constexpr double invalidFloat
Definition: Reconstruction/VKalVrt/VrtSecInclusive/VrtSecInclusive/Constants.h:23
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Trk::phi
@ phi
Definition: ParamDefs.h:75
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
IntersectionPos.h
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
xAOD::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
Definition: TrackingPrimitives.h:237
VKalVrtAthena::VrtSecInclusive::track_summary_properties::numPixelHits
uint8_t numPixelHits
Definition: VrtSecInclusive.h:500
SG::ConstAccessor::withDefault
const_reference_type withDefault(const ELT &e, const T &deflt) const
Fetch the variable for one element, as a const reference, with a default.