ATLAS Offline Software
T2VertexBeamSpotTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 //============================================================
5 // T2VertexBeamSpot.cxx, (c) ATLAS Detector software
6 // Trigger/TrigAlgorithms/TrigT2BeamSpot/T2VertexBeamSpot
7 //
8 // Online beam spot measurement and monitoring using
9 // L2 recontructed primary vertices.
10 //
11 // Authors : David W. Miller, Rainer Bartoldus,
12 // Su Dong
13 //
14 //============================================================
15 
16 #include <algorithm>
17 #include <string>
18 #include <cmath>
19 
20 // This algorithm
21 #include "T2VertexBeamSpotTool.h"
22 #include "T2TrackManager.h"
23 // Specific to this algorithm
29 //Conversion units
30 #include "GaudiKernel/SystemOfUnits.h"
31 
32 using Gaudi::Units::GeV;
33 using Gaudi::Units::mm;
34 
35 using std::string;
36 using std::vector;
37 using std::abs;
38 
39 using namespace PESA;
40 
41 
42 namespace Beamspot
43 {
44  class TrackPTSort{
45  public:
46  inline bool operator () (const Trk::Track* trk1, const Trk::Track* trk2)
47  {
48  const Trk::TrackParameters* params1 = trk1->perigeeParameters();
49  float pT1 = std::abs(sin(params1->parameters()[Trk::theta])/params1->parameters()[Trk::qOverP]);
50  const Trk::TrackParameters* params2 = trk2->perigeeParameters();
51  float pT2 = std::abs(sin(params2->parameters()[Trk::theta])/params2->parameters()[Trk::qOverP]);
52  return pT1 > pT2;
53  }
54  };
55 
56  class TrackPhiSort{
57  public:
58  inline bool operator () (const Trk::Track* trk1, const Trk::Track* trk2)
59  {
60  float phi1 = trk1->perigeeParameters()->parameters()[Trk::phi];
61  float phi2 = trk2->perigeeParameters()->parameters()[Trk::phi];
62  return std::abs(phi1) > std::abs(phi2);
63  }
64  };
65 }
66 
67 PESA::T2VertexBeamSpotTool::T2VertexBeamSpotTool( const std::string& type, const std::string& name, const IInterface* parent )
68  : AthAlgTool( type, name, parent),
69  m_primaryVertexFitterTool("TrigInDetToolInterfaces/ITrigPrimaryVertexFitter", this){
70 
71 
72  //Declare properties in here
73  declareProperty( "PrimaryVertexFitter", m_primaryVertexFitterTool);
74 
75  //Declare variables:
76  declareProperty("TotalNTrackMin", m_totalNTrkMin = 2 );
77 
78  // Track clustering parameters
79  declareProperty("TrackSeedPt", m_trackSeedPt = 1.0*GeV );
80  declareProperty("TrackClusterDZ", m_trackClusDZ = 10.0*mm );
81  declareProperty("WeightClusterZ", m_weightSeed = true );
82  declareProperty("ReclusterSplit", m_reclusterSplit = true );
83  declareProperty("SplitWholeCluster", m_splitWholeCluster = false );
84  declareProperty("ClusterPerigee", m_clusterPerigee = "beamspot" );
85 
86  // Vertex Selection criteria
87  declareProperty("VertexMinNTrk", m_vtxNTrkMin = 2 );
88  declareProperty("VertexMaxNTrk", m_vtxNTrkMax = 100 );
89  declareProperty("VertexMinQual", m_vtxQualMin = 0.0 );
90  declareProperty("VertexMaxQual", m_vtxQualMax = 5. );
91  declareProperty("VertexMinChi2Prob", m_vtxChi2ProbMin = -10.0 );
92  declareProperty("VertexMinMass", m_vtxMassMin = -1.*GeV );
93  declareProperty("VertexMinSumPt", m_vtxSumPtMin = 0.*GeV );
94  declareProperty("VertexMaxX", m_vtxXposMax = 10.*mm );
95  declareProperty("VertexMaxXerr", m_vtxXerrMax = 1.*mm );
96  declareProperty("VertexMaxY", m_vtxYposMax = 10.*mm );
97  declareProperty("VertexMaxYerr", m_vtxYerrMax = 1.*mm );
98  declareProperty("VertexMaxZ", m_vtxZposMax = 200.*mm );
99  declareProperty("VertexMaxZerr", m_vtxZerrMax = 1.*mm );
100 
101  // Vertex selection for use in BCID measurements
102  declareProperty("VertexBCIDMinNTrk", m_vtxBCIDNTrkMin = 2 );
103 
104  declareProperty("nSplitVertices", m_nSplitVertices = 1);
105 
106  declareProperty("filterBS", m_filterBS = true);
107 }
108 
110  ATH_MSG_INFO( "Initialising BeamSpot tool" );
111 
112  //Initialize data Handles
115 
116  // Retrieve tools
117  ATH_CHECK(m_trackFilterTool.retrieve());
118  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
119  ATH_CHECK( m_primaryVertexFitterTool.retrieve() );
120 
122 
123  return StatusCode::SUCCESS;
124 }
125 
126 
127 void T2VertexBeamSpotTool::updateBS(const TrackCollection& tracks, const EventContext& ctx) const
128 {
129  // Monitor how long does it take to loop over all collections
130  auto tSelectingTracks = Monitored::Timer("TIME_SelectingTracks");
131 
132  // Select tracks
133  auto selectedTracks = m_trackFilterTool->filter(tracks);
134  if (m_filterBS) {
135  auto& eventID = ctx.eventID();
136  bool has_bs = m_trackFilterTool->updateBS(selectedTracks, eventID.lumi_block(),
137  eventID.bunch_crossing_id());
138  if (has_bs) {
139  selectedTracks = m_trackFilterTool->filterBS(selectedTracks);
140  }
141  }
142 
143  //Monitor total all/passed/highPt track numbers
144  tSelectingTracks.stop();
145  auto nTotalTracks = Monitored::Scalar<unsigned>("nTotalTracks", tracks.size());
146  auto nTotalPassedTracks = Monitored::Scalar<unsigned>("nTotalPassedTracks", selectedTracks.size());
147  auto nTotalHighPTTracks = Monitored::Scalar<unsigned>("nTotalHighPTTracks", numHighPTTrack(selectedTracks));
148 
149  //Monitor total number of tracks
150  auto monitor = Monitored::Group(m_monTool, tSelectingTracks, nTotalTracks,
151  nTotalPassedTracks, nTotalHighPTTracks);
152  ATH_MSG_DEBUG("Number of all Tracks: " << nTotalTracks << " Selected Tracks: " << nTotalPassedTracks <<
153  " highPt Tracks: " << nTotalHighPTTracks );
154 
155  // Check for seed tracks (= high-pT tracks)
156  if (nTotalHighPTTracks == 0) {
157  ATH_MSG_DEBUG("No seed tracks for vertexing");
158  return;
159  }
160 
161  // Check for the total number of available tracks
162  if (nTotalPassedTracks < m_totalNTrkMin) {
163  ATH_MSG_DEBUG( "Not enough total passed tracks to vertex");
164  return;
165  }
166 
168  myVertexCollection = std::make_unique<TrigVertexCollection>();
169  DataVector<TrigVertexCollection> mySplitVertexCollections;
170 
171  ATH_MSG_DEBUG( "Reconstruct vertices" );
172  reconstructVertices(selectedTracks, *myVertexCollection, mySplitVertexCollections, ctx);
173 }
174 
175 
176 unsigned T2VertexBeamSpotTool::numHighPTTrack( const TrackVector& tracks ) const
177 {
178  unsigned count = 0;
179  for (auto&& track: tracks) {
180  const Trk::TrackParameters* trackPars = track->perigeeParameters();
181  if (trackPars) {
182  float qOverP = trackPars->parameters()[Trk::qOverP];
183  float theta = trackPars->parameters()[Trk::theta];
184  double pt = std::abs(std::sin(theta)/qOverP)/Gaudi::Units::GeV;
185  if (pt > m_trackSeedPt) {
186  ++count;
187  }
188  }
189  }
190  return count;
191 }
192 
194  TrackVector& tracks,
195  TrigVertexCollection& myVertexCollection,
196  DataVector< TrigVertexCollection >& mySplitVertexCollections,
197  const EventContext& ctx) const
198 {
199  ATH_MSG_DEBUG( "Reconstructing vertices" );
200 
201  unsigned bcid = ctx.eventID().bunch_crossing_id();
202 
203  //Monitoring counters and timers
204  auto timerVertexRec = Monitored::Timer("TIME_VertexReconstruction");
205  auto nClusters = Monitored::Scalar<unsigned>("NClusters", 0);
206  auto nVtx = Monitored::Scalar<unsigned>("Nvtx", 0);
207  auto nPassVtx = Monitored::Scalar<unsigned>("NvtxPass", 0);
208  auto nPassBCIDVtx = Monitored::Scalar<unsigned>("NvtxPassBCID", 0);
209  auto BCID = Monitored::Scalar<unsigned>("BCID", bcid);
210 
211  // Sort tracks by track pT
212  {
213  auto timeToSortTracks = Monitored::Timer("TIME_toSortTracks");
214  std::sort(tracks.begin(), tracks.end(), Beamspot::TrackPTSort());
215  auto mon = Monitored::Group(m_monTool, timeToSortTracks );
216  }
217 
218  // Extract beam spot parameters
220  const InDet::BeamSpotData* indetBeamSpot(*beamSpotHandle);
221  const T2BeamSpot beamSpot(indetBeamSpot);
222  ATH_MSG_DEBUG( "Beamspot from BeamCondSvc: " << beamSpot);
223 
224  // Prepare a track clustering algorithm with the given parameters
225  // Should we leave this as a standalone class or merge with the tool?
228 
229  std::vector<double> clusterZ0; // Z0 for each cluster, for monitoring only
230 
231  // Create clusters from the track collection until all its tracks are used
232  while ( ! tracks.empty() ) {
233 
234  const Trk::TrackParameters* params = (*tracks.begin())->perigeeParameters();
235  float pT = std::abs(sin(params->parameters()[Trk::theta])/params->parameters()[Trk::qOverP]);
236  ATH_MSG_DEBUG( "Number of tracks remaining = " << tracks.size() );
237  ATH_MSG_DEBUG( "pT of first (seed) track (GeV) = " << pT/GeV );
238 
239 
240  // Cluster tracks in z around the first (highest-pT track) in the collection, which is taken
241  // as the seed.
242  {
243  auto timeToZCluster = Monitored::Timer("TIME_toZCluster");
244  trackClusterer.cluster(tracks, indetBeamSpot);
245  auto mon = Monitored::Group(m_monTool, timeToZCluster);
246  }
247 
248  // Sanity check:
249  if ( trackClusterer.clusterTracks().size() + trackClusterer.unusedTracks().size()
250  != tracks.size() ) {
251  ATH_MSG_DEBUG( "Track clustering check sum failed: "
252  << "cluster().size()=" << trackClusterer.clusterTracks().size()
253  << " + unusedTracks().size()=" << trackClusterer.unusedTracks().size()
254  << " != tracks.size()=" << tracks.size()
255  );
256  }
257 
258  // Continue with the remaining tracks - still pT-sorted
259  tracks = trackClusterer.unusedTracks();
260 
261  // This always uses at least one track (the seed), so we are sure to reduce the track
262  // selection and terminate the loop
263 
264  // Make sure we have enough tracks in the cluster
265  if ( trackClusterer.clusterTracks().size() < m_totalNTrkMin ) {
266  ATH_MSG_DEBUG( "Not enough tracks in cluster!" );
267  continue;
268  }
269 
270  // Event has a good cluster
271  nClusters++;
272 
273  // Monitor properties of of the cluster
274  monitor_cluster( trackClusterer );
275 
276  // Monitor properties of tracks inside the cluster
277  for (auto&& track: trackClusterer.clusterTracks()) {
278  monitor_cluster_tracks( trackClusterer, *track);
279  }
280 
281  ATH_MSG_DEBUG( "Number of tracks remaining after cluster #(" << nClusters << ") = " << tracks.size());
282  ATH_MSG_DEBUG( "Total number of tracks to fit = " << trackClusterer.clusterTracks().size() );
283  ATH_MSG_DEBUG( "Average Z position (from trk Z0) = " << trackClusterer.seedZ0() );
284  ATH_MSG_DEBUG( "Fitting tracks");
285 
286  // Fit a primary vertex to this cluster around its seed track
287  TrackCollection vertexTracks;
288  ConstDataVector<TrackCollection> cluster(trackClusterer.clusterTracks().begin(), trackClusterer.clusterTracks().end());
289  TrigVertex* primaryVertex = m_primaryVertexFitterTool->fit(cluster.asDataVector(), vertexTracks, trackClusterer.seedZ0());
290 
291  // Check to see if the fit succeeded / converged
292  if ( ! primaryVertex ) {
293  ATH_MSG_DEBUG( "Vertex fit failed");
294  continue;
295  }
296 
297  // Update vertex counter
298  nVtx++;
299 
300  const T2Vertex myVertex(*primaryVertex, vertexTracks, beamSpot, trackClusterer.seedZ0());
301 
302  // Monitor all vertices parameters
303  monitor_vertex( "Vertex", "", myVertex );
304  ATH_MSG_DEBUG( "Vertex fit: " << '\n' << myVertex);
305 
306  // Query for vertex selection
307  const bool passVertex = isGoodVertex( myVertex );
308 
309  if ( ! passVertex ) {
310  ATH_MSG_DEBUG( "Vertex failed selection" );
311  continue;
312  }
313 
314  // Add primary vertex to collection
315  myVertexCollection.push_back(primaryVertex); // passes ownership to vertex collection
316 
317  //Monitor parameters of the passed vertex
318  monitor_vertex( "Vertex", "Pass", myVertex );
319 
320  //Update good vertex counter
321  nPassVtx++;
322 
323  // Learn something more about the cluster that ended up in this vertex
324  auto deltaVtxZ = Monitored::Scalar<double>("ClusterDeltaVertexZ", trackClusterer.seedZ0() - myVertex.Z());
325  auto mon = Monitored::Group(m_monTool, deltaVtxZ);
326 
327  // monitor cluster-cluster delta Z0
328  for (double prevClusterZ0: clusterZ0) {
329  auto clusterClusterDeltaZ = Monitored::Scalar<double>("ClusterClusterDeltaZ0", trackClusterer.seedZ0() - prevClusterZ0);
330  auto mon = Monitored::Group(m_monTool, clusterClusterDeltaZ);
331  }
332  clusterZ0.push_back(trackClusterer.seedZ0());
333 
334  // If the vertex is good, splits are requested, and we have enough tracks to split, split them!
335  if ( passVertex && m_nSplitVertices > 1 ) {
336 
337  TrackVector mySplitTrackCollection;
338 
339  if ( m_splitWholeCluster ) {
340  ATH_MSG_DEBUG( "Splitting the entire cluster of tracks into two");
341  // Alternative 1: Split the entire cluster of track into two
342  mySplitTrackCollection = trackClusterer.clusterTracks();
343  } else {
344  ATH_MSG_DEBUG( "Splitting only tracks succesfully fitted to a vertex");
345  // Alternative 2: Split only the tracks that were successfully fit to a vertex
346  mySplitTrackCollection.assign(vertexTracks.begin(), vertexTracks.end());
347  }
348 
349  if (mySplitTrackCollection.size() >= m_nSplitVertices * m_totalNTrkMin) {
350  // Split, optinally re-cluster, and fit separate vertices
351  ATH_MSG_DEBUG( "Reconstruct split vertices");
352  reconstructSplitVertices( mySplitTrackCollection, mySplitVertexCollections, trackClusterer, indetBeamSpot, ctx );
353  }
354  // Alternative 3: Split all the tracks and iterate with the remaining tracks
355  // mySplitTrackCollection = tracks;
356  }
357 
358  ATH_MSG_DEBUG( "Number of tracks remaining = " << tracks.size() );
359 
360  // Now check if this vertex passed the higher multiplicity cut to be used for per-BCID measurements
361  const bool passVertexBCID = isGoodVertexBCID( myVertex );
362 
363  if ( passVertexBCID ) {
364  // Fill accepted per-BCID vertex histograms
365  monitor_vertex( "Vertex", "PassBCID", myVertex, bcid );
366 
367  // Update good per-BCID vertex counter
368  nPassBCIDVtx++;
369  }
370 
371  }//End looping over tracks
372 
373  //monitor number of (passed) vertices, clusters, etc
374  auto mon = Monitored::Group(m_monTool, nVtx, nPassVtx, nPassBCIDVtx, nClusters, timerVertexRec, BCID);
375  return static_cast<unsigned int>(nPassVtx);
376 }
377 
378 
380  TrackVector& myFullTrackCollection,
381  DataVector<TrigVertexCollection>& mySplitVertexCollections,
382  T2TrackClusterer& trackClusterer,
383  const InDet::BeamSpotData* indetBeamSpot,
384  const EventContext& ctx ) const
385 {
386  auto timerVertexRec = Monitored::Timer("TIME_SplitVertexReconstruction");
387 
388  // Sort the tracks in phi for splitting in the most independent, uniform variable
389  {
390  auto timeToSortTracks = Monitored::Timer("TIME_toSortSplitTracks");
391  std::sort(myFullTrackCollection.begin(), myFullTrackCollection.end(), Beamspot::TrackPhiSort());
392  auto mon = Monitored::Group(m_monTool, timeToSortTracks );
393  }
394 
395  // This returns m_nSplitVertices (ideally) or fewer (if clustering fails) track collections
396  T2TrackManager trackManager(m_nSplitVertices);
397  vector<TrackVector> splitTrackCollections = trackManager.split(myFullTrackCollection, ctx);
398 
399  // Add a new track collection for the split vertices corresponding to this primary vertex
400  // There can be anywhere between zero and m_nSplitVertices entries in the collection
401  TrigVertexCollection* splitVertices = new TrigVertexCollection();
402  mySplitVertexCollections.push_back(splitVertices); // passes ownership
403 
404  // Loop over the split track collections to perform clustering and vertex fitting
405  for (auto&& tracks: splitTrackCollections) {
406  TrigVertex* splitVertex = nullptr;
407  ATH_MSG_DEBUG( "split vertex # of tracks " << tracks.size());
408 
409  if ( m_reclusterSplit ) {
410  // Sort the tracks in pT for clustering around the highest-pT seed
411  {
412  std::sort(tracks.begin(), tracks.end(), Beamspot::TrackPTSort());
413  }
414 
415  // Cluster in z
416  {
417  auto timeToZClusterSplit = Monitored::Timer("TIME_toZClusterSplit");
418  trackClusterer.cluster(tracks, indetBeamSpot);
419  auto mon = Monitored::Group(m_monTool, timeToZClusterSplit );
420  }
421 
422  // Check for a good cluster
423  if ( trackClusterer.clusterTracks().size() < m_totalNTrkMin ) continue;
424 
425  // Fit a vertex to this split track cluster
426  {
427  auto timeToVertexFitSplit = Monitored::Timer("TIME_toVertexFitSplit");
428  TrackCollection vertexTracks;
429  ConstDataVector<TrackCollection> cluster(trackClusterer.clusterTracks().begin(), trackClusterer.clusterTracks().end());
430  splitVertex = m_primaryVertexFitterTool->fit(cluster.asDataVector(), vertexTracks, trackClusterer.seedZ0());
431  auto mon = Monitored::Group(m_monTool, timeToVertexFitSplit );
432  }
433 
434  }
435  else
436  {
437  // Alternatively: Fit a vertex to the unclustered split track
438  // collection, using the seed Z0 from the primary vertex
439  {
440  auto timeToVertexFitSplit = Monitored::Timer("TIME_toVertexFitSplit");
441  TrackCollection vertexTracks;
442  ConstDataVector<TrackCollection> cluster(tracks.begin(), tracks.end());
443  splitVertex = m_primaryVertexFitterTool->fit(cluster.asDataVector(), vertexTracks, trackClusterer.seedZ0() );
444  auto mon = Monitored::Group(m_monTool, timeToVertexFitSplit );
445  }
446  }
447 
448  if ( splitVertex ) {
449  ATH_MSG_DEBUG( "Reconstructed a split vertex");
450  // Add split vertex to collection
451  splitVertices->push_back( splitVertex ); // passes ownership to split vertex collection
452  } else {
453  ATH_MSG_DEBUG( "Could not reconstruct a split vertex");
454  }
455  }
456 
457  // Monitor split vertex distributions (if we found all of them)
458  if ( m_nSplitVertices > 1 && splitVertices->size() == m_nSplitVertices ) {
459  ATH_MSG_DEBUG( "Split vertexing is ON." << "Attempting to split N = " << m_nSplitVertices << " vertices. ");
460 
461  // Store information on the first two vertices
462  // There shouldn't be more, unless it's for systematic studies anyway
463  const T2SplitVertex splitVertex( *(*splitVertices)[0], *(*splitVertices)[1] );
464 
465  monitor_split_vertex("SplitVertex", "Pass", splitVertex);
466  }
467 
468  //Monitor timing
469  auto mon = Monitored::Group(m_monTool, timerVertexRec );
470 }
471 
472 
474  // Vertex quality cuts
475  return
476  (
477  vertex.NTrks() >= m_vtxNTrkMin && // FIXME: harmonize spelling
478  abs( vertex.X() ) <= m_vtxXposMax &&
479  abs( vertex.Y() ) <= m_vtxYposMax &&
480  abs( vertex.Z() ) <= m_vtxZposMax &&
481  abs( vertex.Xerr() ) <= m_vtxXerrMax && // FIXME: do we have negative errors?
482  abs( vertex.Yerr() ) <= m_vtxYerrMax &&
483  abs( vertex.Zerr() ) <= m_vtxZerrMax &&
484  vertex.Mass() >= m_vtxMassMin &&
485  vertex.SumPt() >= m_vtxSumPtMin &&
486  vertex.Qual() >= m_vtxQualMin &&
487  vertex.Qual() <= m_vtxQualMax &&
488  vertex.Chi2Prob() >= m_vtxChi2ProbMin &&
489  true
490  );
491 }
492 
493 
495  // Track quality cuts
496  return
497  (
498  vertex.NTrks() >= m_vtxBCIDNTrkMin && // FIXME: harmonize spelling
499  true
500  );
501 }
502 
503 
505  auto clusterZ = Monitored::Scalar<double>("ClusterZ", clusterer.seedZ0() );
506  auto clusterNtracks = Monitored::Scalar<int>("ClusterNTracks", clusterer.clusterTracks().size() );
507  auto clusterNUnusedTracks = Monitored::Scalar<int>("ClusterNTracksUnused", clusterer.unusedTracks().size() );
508 
509  auto mon = Monitored::Group(m_monTool, clusterZ, clusterNtracks, clusterNUnusedTracks );
510 }
511 
512 
514  const double deltaZ0 = track.perigeeParameters()->parameters()[Trk::z0] - clusterer.seedZ0();
515  const AmgSymMatrix(5)& perigeeCov = *track.perigeeParameters()->covariance();
516  const double z0Error = std::sqrt(perigeeCov(Trk::z0,Trk::z0));
517  const double z0Pull = ( z0Error > 0. ) ? deltaZ0 / z0Error : 0.;
518 
519  auto mon_deltaZ0 = Monitored::Scalar<double>("ClusterDeltaZ0", deltaZ0 );
520  auto mon_z0Pull = Monitored::Scalar<double>("ClusterZ0Pull", z0Pull );
521  auto mon = Monitored::Group(m_monTool, mon_deltaZ0, mon_z0Pull );
522 }
523 
524 
525 
526 void T2VertexBeamSpotTool::monitor_vertex(const std::string& prefix, const std::string& suffix, const T2Vertex &vertex, int bcid ) const {
527 
528  auto ntrk = Monitored::Scalar<int> ( prefix + "NTrks" + suffix, vertex.NTrks() );
529  auto sumpt = Monitored::Scalar<double>( prefix + "SumPt" + suffix, vertex.SumPt() );
530  auto sumpt2 = Monitored::Scalar<double>( prefix + "SumPt2" + suffix, vertex.SumPt2() );
531  auto mass = Monitored::Scalar<double>( prefix + "Mass" + suffix, vertex.Mass() );
532  auto qual = Monitored::Scalar<double>( prefix + "Qual" + suffix, vertex.Qual() );
533  auto chi2 = Monitored::Scalar<double>( prefix + "Chi2Prob" + suffix, vertex.Chi2Prob() );
534  auto x = Monitored::Scalar<double>( prefix + "X" + suffix, vertex.X() );
535  auto y = Monitored::Scalar<double>( prefix + "Y" + suffix, vertex.Y() );
536  auto z = Monitored::Scalar<double>( prefix + "Z" + suffix, vertex.Z() );
537  auto xzoom = Monitored::Scalar<double>( prefix + "XZoom" + suffix, vertex.XZoom() );
538  auto yzoom = Monitored::Scalar<double>( prefix + "YZoom" + suffix, vertex.YZoom() );
539  auto zzoom = Monitored::Scalar<double>( prefix + "ZZoom" + suffix, vertex.ZZoom() );
540  auto xerr = Monitored::Scalar<double>( prefix + "Xerr" + suffix, vertex.Xerr() );
541  auto yerr = Monitored::Scalar<double>( prefix + "Yerr" + suffix, vertex.Yerr() );
542  auto zerr = Monitored::Scalar<double>( prefix + "Zerr" + suffix, vertex.Zerr() );
543  auto xy = Monitored::Scalar<double>( prefix + "XY" + suffix, vertex.XY() );
544  auto pull = Monitored::Scalar<double>( prefix + "Pull" + suffix, vertex.Pull() );
545  auto ntrkInVtx = Monitored::Scalar<double>( prefix + "NTrksInVtx" + suffix, vertex.NTrksInVtx() );
546 
547  if (bcid >= 0) {
548  auto BCID = Monitored::Scalar<unsigned>("BCID", unsigned(bcid));
549  auto mon = Monitored::Group(m_monTool, ntrk, sumpt, sumpt2, mass, qual, chi2, x, y, z, xzoom, yzoom, zzoom, xerr, yerr, zerr, xy, pull, ntrkInVtx, BCID );
550  } else {
551  auto mon = Monitored::Group(m_monTool, ntrk, sumpt, sumpt2, mass, qual, chi2, x, y, z, xzoom, yzoom, zzoom, xerr, yerr, zerr, xy, pull, ntrkInVtx );
552  }
553 }
554 
555 
556 void T2VertexBeamSpotTool::monitor_split_vertex(const std::string& prefix, const std::string& suffix, const T2SplitVertex& vertex) const {
557 
558  auto ntrk1 = Monitored::Scalar<unsigned>( prefix + "1NTrks" + suffix, vertex.vertex1().NTrks());
559  auto x1 = Monitored::Scalar<double>( prefix + "1X" + suffix, vertex.vertex1().X());
560  auto y1 = Monitored::Scalar<double>( prefix + "1Y" + suffix, vertex.vertex1().Y());
561  auto z1 = Monitored::Scalar<double>( prefix + "1Z" + suffix, vertex.vertex1().Z());
562  auto x1err = Monitored::Scalar<double>( prefix + "1Xerr" + suffix, vertex.vertex1().Xerr());
563  auto y1err = Monitored::Scalar<double>( prefix + "1Yerr" + suffix, vertex.vertex1().Yerr());
564  auto z1err = Monitored::Scalar<double>( prefix + "1Zerr" + suffix, vertex.vertex1().Zerr());
565  auto ntrk2 = Monitored::Scalar<unsigned>( prefix + "2NTrks" + suffix, vertex.vertex2().NTrks());
566  auto x2 = Monitored::Scalar<double>( prefix + "2X" + suffix, vertex.vertex2().X());
567  auto y2 = Monitored::Scalar<double>( prefix + "2Y" + suffix, vertex.vertex2().Y());
568  auto z2 = Monitored::Scalar<double>( prefix + "2Z" + suffix, vertex.vertex2().Z());
569  auto x2err = Monitored::Scalar<double>( prefix + "2Xerr" + suffix, vertex.vertex2().Xerr());
570  auto y2err = Monitored::Scalar<double>( prefix + "2Yerr" + suffix, vertex.vertex2().Yerr());
571  auto z2err = Monitored::Scalar<double>( prefix + "2Zerr" + suffix, vertex.vertex2().Zerr());
572  auto dntrk = Monitored::Scalar<double>( prefix + "DNTrks" + suffix, vertex.DNTrks());
573  auto dx = Monitored::Scalar<double>( prefix + "DX" + suffix, vertex.DX());
574  auto dy = Monitored::Scalar<double>( prefix + "DY" + suffix, vertex.DY());
575  auto dz = Monitored::Scalar<double>( prefix + "DZ" + suffix, vertex.DZ());
576  auto dxerr = Monitored::Scalar<double>( prefix + "DXerr" + suffix, vertex.DXerr());
577  auto dyerr = Monitored::Scalar<double>( prefix + "DYerr" + suffix, vertex.DYerr());
578  auto dzerr = Monitored::Scalar<double>( prefix + "DZerr" + suffix, vertex.DZerr());
579  auto dxpull = Monitored::Scalar<double>( prefix + "DXpull" + suffix, vertex.DXpull());
580  auto dypull = Monitored::Scalar<double>( prefix + "DYpull" + suffix, vertex.DYpull());
581  auto dzpull = Monitored::Scalar<double>( prefix + "DZpull" + suffix, vertex.DZpull());
582 
583  auto mon = Monitored::Group(m_monTool, ntrk1, x1, y1, z1, x1err, y1err, z1err, ntrk2, x2, y2, z2, x2err, y2err, z2err,
584  dntrk, dx, dy, dz, dxerr, dyerr, dzerr, dxpull, dypull, dzpull);
585 }
586 
587 
588 
PESA::T2VertexBeamSpotTool::isGoodVertex
bool isGoodVertex(const T2Vertex &vertex) const
Definition: T2VertexBeamSpotTool.cxx:473
PESA::T2VertexBeamSpotTool::TrackVector
std::vector< const Trk::Track * > TrackVector
Definition: T2VertexBeamSpotTool.h:72
PESA::T2VertexBeamSpotTool::m_filterBS
bool m_filterBS
Definition: T2VertexBeamSpotTool.h:149
PESA::T2VertexBeamSpotTool::m_trackFilterTool
ToolHandle< T2BSTrackFilterTool > m_trackFilterTool
Definition: T2VertexBeamSpotTool.h:161
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
CalculateHighPtTerm.pT
pT
Definition: ICHEP2016/CalculateHighPtTerm.py:57
PESA::T2VertexBeamSpotTool::m_vtxMassMin
double m_vtxMassMin
Definition: T2VertexBeamSpotTool.h:135
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
TrackParameters.h
PESA::T2TrackClusterer::seedZ0
double seedZ0() const
Z0 position of a seed track that was used for clustering.
Definition: T2TrackClusterer.h:78
PESA::T2VertexBeamSpotTool::m_vtxQualMax
double m_vtxQualMax
Definition: T2VertexBeamSpotTool.h:133
PESA::T2VertexBeamSpotTool::m_vtxQualMin
double m_vtxQualMin
Definition: T2VertexBeamSpotTool.h:132
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
PESA::T2TrackClusterer::clusterTracks
const TrackVector & clusterTracks() const
This is the same vector as returned from clustering method, have to be called after return from a clu...
Definition: T2TrackClusterer.h:85
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
PESA::T2Vertex
Definition: T2Vertex.h:100
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
test_pyathena.pt
pt
Definition: test_pyathena.py:11
PESA::T2VertexBeamSpotTool::numHighPTTrack
unsigned numHighPTTrack(const TrackVector &tracks) const
Return count of high pT track in the track list, the total number of these high pT tracks is checked ...
Definition: T2VertexBeamSpotTool.cxx:176
Trk::z0
@ z0
Definition: ParamDefs.h:64
PESA::T2VertexBeamSpotTool::monitor_split_vertex
void monitor_split_vertex(const std::string &prefix, const std::string &suffix, const T2SplitVertex &vertex) const
Definition: T2VertexBeamSpotTool.cxx:556
PESA::T2VertexBeamSpotTool::m_vtxNTrkMin
unsigned int m_vtxNTrkMin
Definition: T2VertexBeamSpotTool.h:130
InDetAccessor::qOverP
@ qOverP
perigee
Definition: InDetAccessor.h:35
x
#define x
PESA::T2VertexBeamSpotTool::T2VertexBeamSpotTool
T2VertexBeamSpotTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: T2VertexBeamSpotTool.cxx:67
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
PESA::T2TrackClusterer::trackPerigeeFromString
static TrackPerigee trackPerigeeFromString(const std::string &perigeeStr)
Definition: T2TrackClusterer.cxx:28
Beamspot::TrackPTSort
Definition: T2VertexBeamSpotTool.cxx:44
PESA::T2VertexBeamSpotTool::isGoodVertexBCID
bool isGoodVertexBCID(const T2Vertex &vertex) const
Definition: T2VertexBeamSpotTool.cxx:494
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
PESA::T2VertexBeamSpotTool::m_reclusterSplit
bool m_reclusterSplit
Definition: T2VertexBeamSpotTool.h:121
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
ConstDataVector::asDataVector
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
PESA::T2VertexBeamSpotTool::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: T2VertexBeamSpotTool.h:152
PixelByteStreamErrors::BCID
@ BCID
Definition: PixelByteStreamErrors.h:13
PESA
Local tools.
Definition: T2BeamSpot.cxx:13
PESA::T2TrackClusterer::cluster
const TrackVector & cluster(const TrackVector &tracks, const InDet::BeamSpotData *beamspot=nullptr)
Find one cluster in a set of tracks.
Definition: T2TrackClusterer.cxx:50
PESA::T2BeamSpot
Definition: T2BeamSpot.h:32
PESA::T2VertexBeamSpotTool::m_vtxXposMax
double m_vtxXposMax
Definition: T2VertexBeamSpotTool.h:137
PESA::T2VertexBeamSpotTool::m_vtxYposMax
double m_vtxYposMax
Definition: T2VertexBeamSpotTool.h:139
PESA::T2VertexBeamSpotTool::monitor_cluster
void monitor_cluster(const T2TrackClusterer &clusterer) const
Definition: T2VertexBeamSpotTool.cxx:504
PESA::T2VertexBeamSpotTool::m_clusterTrackPerigee
T2TrackClusterer::TrackPerigee m_clusterTrackPerigee
Definition: T2VertexBeamSpotTool.h:124
Beamspot
Definition: T2VertexBeamSpotTool.cxx:43
PESA::T2VertexBeamSpotTool::m_vtxZerrMax
double m_vtxZerrMax
Definition: T2VertexBeamSpotTool.h:142
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition: TrackCollection.h:19
z
#define z
PESA::T2VertexBeamSpotTool::m_primaryVertexFitterTool
ToolHandle< ITrigPrimaryVertexFitter > m_primaryVertexFitterTool
Primary Vertex Fitter Tool.
Definition: T2VertexBeamSpotTool.h:159
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
PESA::T2VertexBeamSpotTool::m_vtxBCIDNTrkMin
unsigned int m_vtxBCIDNTrkMin
Additional vertex selection criteria for BCID measurements.
Definition: T2VertexBeamSpotTool.h:145
PESA::T2SimpleVertex::Z
double Z() const
Definition: T2Vertex.h:82
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
PESA::T2VertexBeamSpotTool::m_splitWholeCluster
bool m_splitWholeCluster
Definition: T2VertexBeamSpotTool.h:120
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:523
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
test_pyathena.parent
parent
Definition: test_pyathena.py:15
python.StandardJetMods.pull
pull
Definition: StandardJetMods.py:282
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
PESA::T2VertexBeamSpotTool::reconstructVertices
unsigned int reconstructVertices(TrackVector &tracks, TrigVertexCollection &myVertexCollection, DataVector< TrigVertexCollection > &mySplitVertexCollections, const EventContext &) const
Definition: T2VertexBeamSpotTool.cxx:193
TrigVertexCollection
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old TrigVertexCollection
Definition: TrigInDetEventTPCnv.cxx:236
PESA::T2TrackClusterer
Definition: T2TrackClusterer.h:42
Trk::ParametersBase
Definition: ParametersBase.h:55
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
PESA::T2VertexBeamSpotTool::m_trackSeedPt
double m_trackSeedPt
Definition: T2VertexBeamSpotTool.h:122
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Beamspot::TrackPhiSort
Definition: T2VertexBeamSpotTool.cxx:56
PESA::T2VertexBeamSpotTool::m_vtxNTrkMax
unsigned int m_vtxNTrkMax
Definition: T2VertexBeamSpotTool.h:131
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
PESA::T2SplitVertex
Definition: T2SplitVertex.h:52
PESA::T2VertexBeamSpotTool::m_vtxZposMax
double m_vtxZposMax
Definition: T2VertexBeamSpotTool.h:141
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::perigeeParameters
@ perigeeParameters
Definition: MeasurementType.h:19
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
PESA::T2TrackManager
Definition: T2TrackManager.h:34
PESA::T2VertexBeamSpotTool::m_vtxYerrMax
double m_vtxYerrMax
Definition: T2VertexBeamSpotTool.h:140
TrigVertexCollection
Definition: TrigVertexCollection.h:13
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
PESA::T2TrackManager::split
std::vector< TrackVector > split(const TrackVector &cluster, const EventContext &ctx) const
Definition: T2TrackManager.cxx:35
TrigVertex.h
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
T2VertexBeamSpotTool.h
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
PESA::T2VertexBeamSpotTool::m_vtxChi2ProbMin
double m_vtxChi2ProbMin
Definition: T2VertexBeamSpotTool.h:134
PESA::T2VertexBeamSpotTool::reconstructSplitVertices
void reconstructSplitVertices(TrackVector &tracks, DataVector< TrigVertexCollection > &mySplitVertexCollections, T2TrackClusterer &trackClusterer, const InDet::BeamSpotData *indetBeamSpot, const EventContext &) const
Definition: T2VertexBeamSpotTool.cxx:379
InDet::BeamSpotData
Definition: BeamSpotData.h:21
PESA::T2VertexBeamSpotTool::m_weightSeed
bool m_weightSeed
Definition: T2VertexBeamSpotTool.h:119
y
#define y
PESA::T2VertexBeamSpotTool::m_totalNTrkMin
unsigned m_totalNTrkMin
Definition: T2VertexBeamSpotTool.h:127
PESA::T2VertexBeamSpotTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: T2VertexBeamSpotTool.h:162
TrigVertex
Definition: TrigVertex.h:28
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
PESA::T2VertexBeamSpotTool::m_vtxXerrMax
double m_vtxXerrMax
Definition: T2VertexBeamSpotTool.h:138
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
PESA::T2TrackClusterer::unusedTracks
const TrackVector & unusedTracks() const
Tracks that were not included into cluster, have to be called after return from a clustering method.
Definition: T2TrackClusterer.h:89
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
PESA::T2VertexBeamSpotTool::initialize
virtual StatusCode initialize() override final
Definition: T2VertexBeamSpotTool.cxx:109
T2TrackManager.h
python.BuildSignatureFlags.beamSpot
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
Definition: BuildSignatureFlags.py:454
ITrigPrimaryVertexFitter.h
beamspotman.qual
qual
Definition: beamspotman.py:481
Trk::phi
@ phi
Definition: ParamDefs.h:75
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
AthAlgTool
Definition: AthAlgTool.h:26
PESA::T2VertexBeamSpotTool::m_trackClusDZ
double m_trackClusDZ
Definition: T2VertexBeamSpotTool.h:118
PESA::T2VertexBeamSpotTool::m_outputVertexCollectionKey
SG::WriteHandleKey< TrigVertexCollection > m_outputVertexCollectionKey
Definition: T2VertexBeamSpotTool.h:155
PESA::T2VertexBeamSpotTool::m_vtxSumPtMin
double m_vtxSumPtMin
Definition: T2VertexBeamSpotTool.h:136
PESA::T2VertexBeamSpotTool::m_clusterPerigee
std::string m_clusterPerigee
Definition: T2VertexBeamSpotTool.h:123
PESA::T2VertexBeamSpotTool::monitor_vertex
void monitor_vertex(const std::string &prefix, const std::string &suffix, const T2Vertex &vertex, int bcid=-1) const
Definition: T2VertexBeamSpotTool.cxx:526
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
PESA::T2VertexBeamSpotTool::m_nSplitVertices
unsigned m_nSplitVertices
Definition: T2VertexBeamSpotTool.h:147
PESA::T2VertexBeamSpotTool::monitor_cluster_tracks
void monitor_cluster_tracks(T2TrackClusterer &clusterer, const Trk::Track &track) const
Definition: T2VertexBeamSpotTool.cxx:513
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
TrigVertexCollection.h
PESA::T2VertexBeamSpotTool::updateBS
void updateBS(const TrackCollection &tracks, const EventContext &ctx) const
Update beam spot data with new track information.
Definition: T2VertexBeamSpotTool.cxx:127