ATLAS Offline Software
Loading...
Searching...
No Matches
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
22#include "T2TrackManager.h"
23// Specific to this algorithm
29//Conversion units
30#include "GaudiKernel/SystemOfUnits.h"
31
32using Gaudi::Units::GeV;
33using Gaudi::Units::mm;
34
35using std::string;
36using std::vector;
37using std::abs;
38
39using namespace PESA;
40
41
42namespace Beamspot
43{
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
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
67PESA::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
113 ATH_CHECK( m_beamSpotKey.initialize() ) ;
115
116 // Retrieve tools
117 ATH_CHECK(m_trackFilterTool.retrieve());
118 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
120
122
123 return StatusCode::SUCCESS;
124}
125
126
127void 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
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
473bool T2VertexBeamSpotTool::isGoodVertex( const T2Vertex& vertex ) const {
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
526void 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
556void 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
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
DataVector adapter that acts like it holds const pointers.
#define AmgSymMatrix(dim)
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current TrigVertexCollection
#define y
#define x
#define z
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool operator()(const Trk::Track *trk1, const Trk::Track *trk2)
bool operator()(const Trk::Track *trk1, const Trk::Track *trk2)
DataVector adapter that acts like it holds const pointers.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
Derived DataVector<T>.
Definition DataVector.h:795
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
A monitored timer.
double Z() const
Definition T2Vertex.h:69
double seedZ0() const
Z0 position of a seed track that was used for clustering.
const TrackVector & unusedTracks() const
Tracks that were not included into cluster, have to be called after return from a clustering method.
static TrackPerigee trackPerigeeFromString(const std::string &perigeeStr)
const TrackVector & clusterTracks() const
This is the same vector as returned from clustering method, have to be called after return from a clu...
const TrackVector & cluster(const TrackVector &tracks, const InDet::BeamSpotData *beamspot=nullptr)
Find one cluster in a set of tracks.
std::vector< TrackVector > split(const TrackVector &cluster, const EventContext &ctx) const
bool isGoodVertex(const T2Vertex &vertex) const
unsigned int reconstructVertices(TrackVector &tracks, TrigVertexCollection &myVertexCollection, DataVector< TrigVertexCollection > &mySplitVertexCollections, const EventContext &) const
void monitor_cluster(const T2TrackClusterer &clusterer) const
ToolHandle< T2BSTrackFilterTool > m_trackFilterTool
SG::WriteHandleKey< TrigVertexCollection > m_outputVertexCollectionKey
T2VertexBeamSpotTool(const std::string &type, const std::string &name, const IInterface *parent)
bool isGoodVertexBCID(const T2Vertex &vertex) const
void monitor_split_vertex(const std::string &prefix, const std::string &suffix, const T2SplitVertex &vertex) const
void reconstructSplitVertices(TrackVector &tracks, DataVector< TrigVertexCollection > &mySplitVertexCollections, T2TrackClusterer &trackClusterer, const InDet::BeamSpotData *indetBeamSpot, const EventContext &) const
ToolHandle< GenericMonitoringTool > m_monTool
void monitor_vertex(const std::string &prefix, const std::string &suffix, const T2Vertex &vertex, int bcid=-1) const
void updateBS(const TrackCollection &tracks, const EventContext &ctx) const
Update beam spot data with new track information.
T2TrackClusterer::TrackPerigee m_clusterTrackPerigee
ToolHandle< ITrigPrimaryVertexFitter > m_primaryVertexFitterTool
Primary Vertex Fitter Tool.
void monitor_cluster_tracks(T2TrackClusterer &clusterer, const Trk::Track &track) const
virtual StatusCode initialize() override final
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
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 ...
std::vector< const Trk::Track * > TrackVector
unsigned int m_vtxBCIDNTrkMin
Additional vertex selection criteria for BCID measurements.
encapsulates LVL2 vertex parameters (in the global reference frame), covariance matrix,...
Definition TrigVertex.h:28
const Perigee * perigeeParameters() const
return Perigee.
double chi2(TH1 *h0, TH1 *h1)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
Local tools.
Definition idx.h:9
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.