ATLAS Offline Software
Loading...
Searching...
No Matches
TrigTrackSelector Class Reference

MC truth. More...

#include <TrigTrackSelector.h>

Inheritance diagram for TrigTrackSelector:
Collaboration diagram for TrigTrackSelector:

Public Types

typedef std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t

Public Member Functions

 TrigTrackSelector (TrackFilter *selector)
 use a radius of 47 mm corresponding to the Run 1 pixel inner radius For the IBL it should be 32 mm, but this was kept as 47 mm for consistency of the definition.
 TrigTrackSelector (TrackFilter *selector, double radius)
 TrigTrackSelector (TrackFilter *selector, int selectPdgId, int selectParentPdgId)
 TrigTrackSelector (TrackFilter *selector, double radius, int selectPdgId, int selectParentPdgId)
template<typename T>
 TrigTrackSelector (T &tm, TrackFilter *selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0)
template<typename T>
 TrigTrackSelector (T tbegin, T tend, TrackFilter *selector, double radius=default_radius(), int selectPdgId=0, int selectParentPdgId=0)
 ~TrigTrackSelector ()
void setBeamline (double x, double y, double z=0)
double getBeamX () const
double getBeamY () const
double getBeamZ () const
void correctTracks (bool b=true)
virtual void clear () override
void selectTracks (const TruthParticleContainer *truthtracks)
 neater code to make use of vector function also for a single ancestor pdgid, instead of the full code duplication, but less efficienct as it then needs to create a single element vector for each particle, to avoid the code duplication.
void selectTracks (const xAOD::TruthParticleContainer *truthtracks)
void truthBeamline (const xAOD::TruthParticleContainer *truthtracks, double &x0, double &y0)
 extract all the tracks from a xAOD::TruthParticle collection and histogram the x and y production coordinates to determine the event "beamline" position
bool selectTrack (HepMC::ConstGenParticlePtr track)
bool selectTrack (const TruthParticle &track)
bool selectTrack (const TruthParticle *track)
bool selectTrack (const xAOD::TruthParticle *track, double x0=0, double y0=0)
TIDA::Track * makeTrack (HepMC::ConstGenParticlePtr track)
TIDA::Track * makeTrack (const TruthParticle *track, unsigned long tid=0)
bool selectTrack (const Trk::Track *track)
void selectTracks (const TrackCollection *trigtracks)
bool selectTrack (const xAOD::TrackParticle *track, void *=0)
 legacy run 2 selector access
void selectTracks (const xAOD::TrackParticleContainer *tracks, void *=0)
void selectTracks (xAOD::TrackParticleContainer::const_iterator trackitr, xAOD::TrackParticleContainer::const_iterator trackend, void *=0)
 MT selector access.
void selectTracks (const TrackParticleLinks_t &tracks)
void correctToBeamline (double &z0, double &dz0, double &d0, double &dd0, double theta, double phi)
virtual bool addTrack (TIDA::Track *t, bool(*f)(const TIDA::Track *)=0)
virtual void addTracks (std::vector< TIDA::Track * > &t, bool(*f)(const TIDA::Track *)=0)
const std::vector< TIDA::Track * > & tracks () const
std::vector< TIDA::Track * > tracks (TrackFilter *selector) const
unsigned size () const
void delete_track (TIDA::Track *t)

Static Public Member Functions

static double default_radius ()

Protected Member Functions

const xAOD::TruthParticle * fromAncestor (const int pdg_id, const xAOD::TruthParticle *p) const
 recursive functions to identify whether a particle comes from some particle of a specific PDG ID, or some numb er of specified PDG IDs.
const xAOD::TruthParticle * fromAncestor (const std::vector< int > &ids, const xAOD::TruthParticle *p) const
 recursive function to identify whether a particle comes from some other number of ancestor particles, with the pdgids passed in as a vector.
virtual void cleanup (TIDA::Track *)

Protected Attributes

std::vector< TIDA::Track * > m_tracks
TrackFilter * m_selector

Private Attributes

unsigned long m_id
double m_xBeam
double m_yBeam
double m_zBeam
bool m_correctTrkTracks
double m_radius
int m_selectPdgId
int m_selectParentPdgId

Static Private Attributes

static const double s_default_radius = 47
 NB: This was 47 for Run 2, but with the addition of the IBL it should be 32 It was kept at 47 for all Run 2 and migration to MT, but for Run 3 we really want it changed to be 32.

Detailed Description

MC truth.

FrameWork includes #include "GaudiKernel/ServiceHandle.h" absolutely pathetic!! write my own class TrigInDetAnalysis classes

Definition at line 48 of file TrigTrackSelector.h.

Member Typedef Documentation

◆ TrackParticleLinks_t

Constructor & Destructor Documentation

◆ TrigTrackSelector() [1/6]

TrigTrackSelector::TrigTrackSelector ( TrackFilter * selector)
inline

use a radius of 47 mm corresponding to the Run 1 pixel inner radius For the IBL it should be 32 mm, but this was kept as 47 mm for consistency of the definition.

this should be changed to 32 mm for Run 3

Definition at line 60 of file TrigTrackSelector.h.

60: TrigTrackSelector( selector, default_radius(), 0, 0 ) { }
TrigTrackSelector(TrackFilter *selector)
use a radius of 47 mm corresponding to the Run 1 pixel inner radius For the IBL it should be 32 mm,...
static double default_radius()

◆ TrigTrackSelector() [2/6]

TrigTrackSelector::TrigTrackSelector ( TrackFilter * selector,
double radius )
inline

Definition at line 62 of file TrigTrackSelector.h.

62: TrigTrackSelector( selector, radius, 0, 0 ) { }

◆ TrigTrackSelector() [3/6]

TrigTrackSelector::TrigTrackSelector ( TrackFilter * selector,
int selectPdgId,
int selectParentPdgId )
inline

Definition at line 64 of file TrigTrackSelector.h.

64: TrigTrackSelector( selector, default_radius(), selectPdgId, selectParentPdgId ) { }

◆ TrigTrackSelector() [4/6]

TrigTrackSelector::TrigTrackSelector ( TrackFilter * selector,
double radius,
int selectPdgId,
int selectParentPdgId )

◆ TrigTrackSelector() [5/6]

template<typename T>
TrigTrackSelector::TrigTrackSelector ( T & tm,
TrackFilter * selector,
double radius = default_radius(),
int selectPdgId = 0,
int selectParentPdgId = 0 )
inline

Definition at line 69 of file TrigTrackSelector.h.

69 :
70 TrigTrackSelector( tm.begin(), tm.end(), selector, radius, selectPdgId, selectParentPdgId ) {
71 }

◆ TrigTrackSelector() [6/6]

template<typename T>
TrigTrackSelector::TrigTrackSelector ( T tbegin,
T tend,
TrackFilter * selector,
double radius = default_radius(),
int selectPdgId = 0,
int selectParentPdgId = 0 )
inline

Definition at line 74 of file TrigTrackSelector.h.

74 :
75 TrigTrackSelector( selector, radius, selectPdgId, selectParentPdgId ) {
76 selectTracks( tbegin, tend );
77 }
void selectTracks(const TruthParticleContainer *truthtracks)
neater code to make use of vector function also for a single ancestor pdgid, instead of the full code...

◆ ~TrigTrackSelector()

TrigTrackSelector::~TrigTrackSelector ( )
inline

Definition at line 80 of file TrigTrackSelector.h.

80{ clear(); }
virtual void clear() override

Member Function Documentation

◆ addTrack()

virtual bool TrackSelector::addTrack ( TIDA::Track * t,
bool(* f )(const TIDA::Track *) = 0 )
inlinevirtualinherited

Definition at line 34 of file TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h.

34 {
35 //std::cout << "addtrack() before f: t " << *t << " " << size() << "\t f " << f << std::endl;
36 if ( f==0 ) {
37 if ( m_selector && m_selector->select(t) ) { m_tracks.push_back(t); return true; }
38 else { cleanup(t); }
39 }
40 else {
41 if ( f(t) ) { m_tracks.push_back(t); return true; }
42 else { cleanup(t); }
43 }
44 return false;
45 }

◆ addTracks()

virtual void TrackSelector::addTracks ( std::vector< TIDA::Track * > & t,
bool(* f )(const TIDA::Track *) = 0 )
inlinevirtualinherited

Definition at line 47 of file TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h.

47 {
48 for ( size_t i=0 ; i<t.size() ; i++ ) addTrack( t[i], f );
49 }
virtual bool addTrack(TIDA::Track *t, bool(*f)(const TIDA::Track *)=0)

◆ cleanup()

virtual void TrackSelector::cleanup ( TIDA::Track * )
inlineprotectedvirtualinherited

◆ clear()

virtual void TrigTrackSelector::clear ( )
inlineoverridevirtual

Reimplemented from TrackSelector.

Definition at line 91 of file TrigTrackSelector.h.

91{ for ( size_t i=m_tracks.size() ; i-- ; ) delete m_tracks[i]; m_tracks.clear(); }

◆ correctToBeamline()

void TrigTrackSelector::correctToBeamline ( double & z0,
double & dz0,
double & d0,
double & dd0,
double theta,
double phi )

make sure that users have set the beamline parameters

error estimates

Definition at line 1007 of file TrigTrackSelector.cxx.

1009 {
1010
1012
1013 // if ( m_first ) {
1014 // if ( m_xBeam==0 && m_yBeam==0 ) {
1015 // std::cerr << "TrigTrackSelector::correctToBeamline() WARNING -- Beamline set to (0,0) -- WARNING" << std::endl;
1016 // }
1017 // else {
1018 // std::cout << "TrigTrackSelector::correctToBeamline() Beamline set to " << m_xBeam << " " << m_yBeam << std::endl;
1019 // }
1020 // m_first = false;
1021 // }
1022
1023
1024 // double theta = 2*std::atan( exp( (-1)*eta ) );
1025 double z0t = z0 + ((std::cos(phi)*m_xBeam + std::sin(phi)*m_yBeam)/std::tan(theta));
1026 double a0t = d0 + std::sin(phi)*m_xBeam - std::cos(phi)*m_yBeam;
1027
1029 double dz0t = dz0 + ((std::cos(phi)*m_xBeam + std::sin(phi)*m_yBeam)/std::tan(theta));
1030 double da0t = dd0 + std::sin(phi)*m_xBeam - std::cos(phi)*m_yBeam;
1031
1032 z0 = z0t;
1033 d0 = a0t;
1034
1035 dz0 = dz0t;
1036 dd0 = da0t;
1037}
Scalar phi() const
phi method
Scalar theta() const
theta method

◆ correctTracks()

void TrigTrackSelector::correctTracks ( bool b = true)
inline

Definition at line 89 of file TrigTrackSelector.h.

◆ default_radius()

double TrigTrackSelector::default_radius ( )
inlinestatic

Definition at line 162 of file TrigTrackSelector.h.

162{ return s_default_radius; }
static const double s_default_radius
NB: This was 47 for Run 2, but with the addition of the IBL it should be 32 It was kept at 47 for all...

◆ delete_track()

void TrackSelector::delete_track ( TIDA::Track * t)
inlineinherited

Definition at line 68 of file TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h.

68 {
69 m_tracks.erase( std::remove( m_tracks.begin(), m_tracks.end(), t ), m_tracks.end() );
70 }
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.

◆ fromAncestor() [1/2]

const xAOD::TruthParticle * TrigTrackSelector::fromAncestor ( const int pdg_id,
const xAOD::TruthParticle * p ) const
protected

recursive functions to identify whether a particle comes from some particle of a specific PDG ID, or some numb er of specified PDG IDs.

recursive function to identify whether a particle comes from some other ancestor particle at any point in its history - checks its parents and then function calls itself to check their parents etc., until it either finds the pdgid it is looking for, or it has no more ancestors if it finds an appropriate ancestor it returns the pointer to it, otherwise it returns a nullptr

finds an appropriate ancestor and returns the pointer to it, otherwise it just returns a nullptr

Definition at line 39 of file TrigTrackSelector.cxx.

39 {
40 if ( p==nullptr ) return nullptr;
41 if ( MC::isElectron(p) || MC::isMuon(p) ) return nullptr; //don't want light leptons from eg tau decays - they are found directly
42 if ( p->absPdgId()==pdg_id ) {
43 return p; // recursive stopping conditions
44 }
45 auto vertex = p->prodVtx();
46 if ( vertex == nullptr ) {
47 return nullptr; // has no production vertex !!!
48 }
49 if ( vertex->nIncomingParticles() < 1 ) {
50 return nullptr; // recursive stopping conditions
51 }
52 for( unsigned ip = 0; ip < vertex->nIncomingParticles(); ip++ ) {
53 auto* in = vertex->incomingParticle(ip);
54 auto parent = fromAncestor( pdg_id, in);
55 if ( parent!=nullptr ) {
56 if (parent->absPdgId()==pdg_id) return parent;
57 }
58 }
59
60 return nullptr;
61}
const xAOD::TruthParticle * fromAncestor(const int pdg_id, const xAOD::TruthParticle *p) const
recursive functions to identify whether a particle comes from some particle of a specific PDG ID,...
bool isElectron(const T &p)
bool isMuon(const T &p)

◆ fromAncestor() [2/2]

const xAOD::TruthParticle * TrigTrackSelector::fromAncestor ( const std::vector< int > & ids,
const xAOD::TruthParticle * p ) const
protected

recursive function to identify whether a particle comes from some other number of ancestor particles, with the pdgids passed in as a vector.

Any such ancestors at point in it's history will do - checks it's parents and then calls the function calls itself to check the parent's parents etc, until it either finds one of the pdgids it is looking for, or it has no more ancestors if it finds an appropriate ancestor it returns the pointer to it, otherwise it returns a nullptr

Definition at line 73 of file TrigTrackSelector.cxx.

73 {
74 if ( p==nullptr ) return nullptr;
75 if (MC::isElectron(p) || MC::isMuon(p)) return nullptr; //don't want light leptons from eg tau decays - they are found directly
76 for ( size_t i=ids.size() ; i-- ; ) {
77 if ( p->absPdgId()==ids[i] ) return p; // recursive stopping conditions
78 }
79
80 auto vertex = p->prodVtx();
81 if ( vertex == nullptr ) return nullptr; // has no production vertex !!!
82
83 if ( vertex->nIncomingParticles()<1 ) return nullptr; // recursive stopping conditions
84
85 for( unsigned ip = 0; ip < vertex->nIncomingParticles(); ip++ ) {
86 auto* in = vertex->incomingParticle(ip);
87 auto parent = fromAncestor( ids, in);
88 if ( parent!=nullptr ) {
89 for ( size_t i=ids.size() ; i-- ; ) {
90 if ( parent->absPdgId()==ids[i] ) return parent;
91 }
92 }
93 }
94
95 return nullptr;
96}

◆ getBeamX()

double TrigTrackSelector::getBeamX ( ) const
inline

Definition at line 85 of file TrigTrackSelector.h.

85{ return m_xBeam; }

◆ getBeamY()

double TrigTrackSelector::getBeamY ( ) const
inline

Definition at line 86 of file TrigTrackSelector.h.

86{ return m_yBeam; }

◆ getBeamZ()

double TrigTrackSelector::getBeamZ ( ) const
inline

Definition at line 87 of file TrigTrackSelector.h.

87{ return m_zBeam; }

◆ makeTrack() [1/2]

TIDA::Track * TrigTrackSelector::makeTrack ( const TruthParticle * track,
unsigned long tid = 0 )

check for final state

the is our new "final state" requirement the inner and outer radii are in some sense arbitrary - these correspond to an envelope around the pixel detector, so the track must pass through the entire pixel detector NB: In order to ensure you don't miss any tracks they really need to be the same ie if a track brems in your "volume" then you will miss that track, and also the resulting track, even if it is a high et track

keep anything over 10 GeV with the old requirement

avoid default (unset) TruthParticle charge

only use charged tracks

what a faff - refuse to mess about with the classes to swim tracks etc - why can't they just encode this sort of information in the class!! It's not as if it doesn't actually have members for anything else useless!! Classes should be designed for ease of use !!!!

is there a sign issue here ?

correct back to the beamline

how about storing uniqueID/status/pidg info?

this isn't good!! but it will do for testing

probably won't work either

get the production vertex for the z0 and d0 but should we store the z0 of the production vertex? or swim the track to the perigee point with respect to 0,0 and use the parameters there?

what to do with these???

Definition at line 445 of file TrigTrackSelector.cxx.

445 {
446
447 if ( track==0 ) return 0;
448 if ( !MC::isStable(track)) return 0;
449
450
451 double phi = track->phi();
452 double eta = track->eta();
453
457 double xp[3] = { 0, 0, 0 };
458
459 if ( track->genParticle()->production_vertex() ) {
460 xp[0] = track->genParticle()->production_vertex()->position().x();
461 xp[1] = track->genParticle()->production_vertex()->position().y();
462 xp[2] = track->genParticle()->production_vertex()->position().z();
463 }
464
465 // CHANGED BY JK - z0 with respect to (0,0)
466 // double z0 = xp[2];
467 double theta = 2*std::atan( exp( (-1)*eta ) );
468 double z0 = xp[2] - (xp[0]*std::cos(phi) + xp[1]*std::sin(phi))/std::tan(theta);
469
470 double xd[3] = { 0, 0, 0 };
471
472 if ( track->genParticle()->end_vertex() ) {
473 xd[0] = track->genParticle()->end_vertex()->position().x();
474 xd[1] = track->genParticle()->end_vertex()->position().y();
475 xd[2] = track->genParticle()->end_vertex()->position().z();
476 }
477
478 double rp = std::sqrt( xp[0]*xp[0] + xp[1]*xp[1] );
479 double rd = std::sqrt( xd[0]*xd[0] + xd[1]*xd[1] );
480
481
482 bool final_state = false;
483
495 const double inner_radius = m_radius;
496 const double outer_radius = m_radius;
497 if ( ( track->genParticle()->production_vertex() && rp<=inner_radius ) &&
498 ( track->genParticle()->end_vertex()==0 || rd>outer_radius ) ) final_state = true;
499
500
501 if ( !final_state ) return 0;
502
513
514 double q = track->charge();
515
516 static const particleType ptype;
517
519 if ( q==-999 ) q = ptype.charge( track->pdgId() );
520
522 if ( q==0 ) return 0;
523
524 double pT = q*track->pt();
525
526
527 double d0 = 0;
528
533
535
536
537 // CHANGED BY JK - d0 with respect to (0,0)
538 // d0 = q*rp*std::sin(phi);
539 d0 = xp[1]*std::cos(phi) - xp[0]*std::sin(phi);
540
541
543
544 double dz0 = 0;
545 double dd0 = 0;
546
547 correctToBeamline( z0, dz0, d0, dd0, theta, phi );
548
549
550
552
554 int author = track->pdgId();
555 int uniqueID = HepMC::uniqueID(track);
556
557
558 unsigned long id = (unsigned long)track;
559 if ( tid!=0 ) id = tid;
560
564
565
567
568 // std::cout << "\t\t\tSUTT Truth track"
569 // << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta()
570 // << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi()
571 // << "\tz0=" << z0
572 // << "\tpT=" << pT // << "\t( " << 1/qoverp << ")"
573 // << "\td0=" << d0
574 // << "\tauthor=" << author
575 // << std::endl;
576
577
578
579 TIDA::Track* t = new TIDA::Track(eta, phi, z0, d0, pT, 0, 0,
580 0, 0, 0, 0, 0,
581 0, 0, 0, 0,
582 0, 0, 0, 0,
583 author, false, uniqueID, -1,
584 false,
585 id ) ;
586
587 return t;
588
589}
Scalar eta() const
pseudorapidity method
ReadCards * rp
void correctToBeamline(double &z0, double &dz0, double &d0, double &dd0, double theta, double phi)
double charge(int id) const
int uniqueID(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.

◆ makeTrack() [2/2]

TIDA::Track * TrigTrackSelector::makeTrack ( HepMC::ConstGenParticlePtr track)

Definition at line 437 of file TrigTrackSelector.cxx.

437 {
438//AV Using memory to get some value is not a good idea. This is not a repruducible/portable way, but I leave it as is.
439 unsigned long id = (unsigned long)(track.get());
440 TruthParticle t = TruthParticle(track);
441 return makeTrack( &t, id );
442}
TIDA::Track * makeTrack(HepMC::ConstGenParticlePtr track)
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ selectTrack() [1/6]

bool TrigTrackSelector::selectTrack ( const Trk::Track * track)

a covariance!

check this <<–

now some ridiculous code to get the author of the TrackParticle (offline) tracks

Definition at line 594 of file TrigTrackSelector.cxx.

594 {
595
596 // do the track extraction stuff here....
597
598 static const int hpmap[20] = { 0, 1, 2, 7, 8, 9, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
599 // std::cout << __FILE__<< " " <<__LINE__<<std::endl;
600
601 if ( track ) {
602
603 // const Trk::Perigee* startPerigee = track->perigeeParameters();
604
605#ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
606 const Trk::MeasuredPerigee* startPerigee = dynamic_cast<const Trk::MeasuredPerigee*>(track->perigeeParameters());
607 // const Trk::MeasuredPerigee* measPer = startPerigee; // just out of laziness
608#else
609 const Trk::Perigee* startPerigee = track->perigeeParameters();
610 const Trk::Perigee* measPer = startPerigee; // just out of laziness
611#endif
612
613
614 // CLHEP::HepVector perigeeParams = measPer->parameters();
615 // double pT = measPer->pT();
616 // double eta = measPer->eta();
617 // double phi = perigeeParams[Trk::phi0];
618 // double z0 = perigeeParams[Trk::z0];
619 // double d0 = perigeeParams[Trk::d0];
620 // // AAARCH!!!!! the TrackParticle pT is NOT SIGNED!!!! ( I ask you! )
621 // if ( perigeeParams[Trk::qOverP]<0 ) pT *= -1;
622 // std::cout <<pT1<<" pt1vspT "<<pT<<std::endl;
623
624 if (startPerigee){
625
626 double theta = startPerigee->parameters()[Trk::theta];
627 double p = 1/startPerigee->parameters()[Trk::qOverP];
628 double qOverPt = startPerigee->parameters()[Trk::qOverP]/std::sin(theta);
629 double charge = startPerigee->charge();
630 double eta = startPerigee->eta();
631 double phi = startPerigee->parameters()[Trk::phi0];
632 double z0 = startPerigee->parameters()[Trk::z0];
633 double d0 = startPerigee->parameters()[Trk::d0];
634 // double pT = (1./qOverPt)*(charge);
635 double pT = (1./qOverPt); // always use signed PT
636
637 if ( charge<0 && pT>0 ) pT *= -1;
638 if ( charge<0 && p>0 ) p *= -1;
639
640
641
642#ifdef TRKPARAMETERS_MEASUREDPERIGEE_H
643 const Trk::ErrorMatrix err = startPerigee->localErrorMatrix();
644 double dtheta = err.error(Trk::theta);
645 double dqovp = err.error(Trk::qOverP);
646 double covthetaOvP = err.covValue(Trk::qOverP,Trk::theta);
647
648 double dphi = err.error(Trk::phi0);
649 double dz0 = err.error(Trk::z0);
650 double dd0 = err.error(Trk::d0);
651#else
652 double dtheta = std::sqrt((*measPer->covariance())(Trk::theta,Trk::theta));
653 double dqovp = std::sqrt((*measPer->covariance())(Trk::qOverP,Trk::qOverP));
654 double covthetaOvP = (*measPer->covariance())(Trk::qOverP,Trk::theta);
655
656 double dphi = std::sqrt((*measPer->covariance())(Trk::phi0,Trk::phi0));
657 double dz0 = std::sqrt((*measPer->covariance())(Trk::z0,Trk::z0));
658 double dd0 = std::sqrt((*measPer->covariance())(Trk::d0,Trk::d0));
659#endif
660
661 double deta = 0.5*dtheta/(std::cos(0.5*theta)*std::cos(0.5*theta)*std::tan(0.5*theta));
662
663
664 if ( m_correctTrkTracks ) correctToBeamline( z0, dz0, d0, dd0, theta, phi );
665
666 double dpT = 0;
667
668
669 double sintheta = std::sin(theta);
670 double costheta = std::cos(theta);
671 double dpT2 = (p*p*sintheta)*(p*p*sintheta)*dqovp*dqovp + (p*costheta)*(p*costheta)*dtheta*dtheta - 2*(p*p*sintheta)*(p*costheta)*covthetaOvP;
672
673 if ( dpT2>0 ) dpT = std::sqrt( dpT2 );
674
675 // Check number of hits
676 // NB: a spacepoint is two offline "hits", so a pixel spacepoint is really
677 // 2 "hits" and an offline SCT "hit" is really a 1D cluster, so two intersetcting
678 // stereo clusters making a spacepoint are two "hits"
679 // const Trk::TrackSummary *summary = dynamic_cast<const Trk::TrackSummary*>(track->trackSummary());
680 //ToolHandle< Trk::ITrackSummaryTool > m_trackSumTool;
681 //m_trackSumTool = ToolHandle<Trk::ITrackSummaryTool>("Trk::TrackSummaryTool/InDetTrackSummaryTool");
682 //const Trk::TrackSummary* summary = NULL;
683 //summary = m_trackSumTool->createSummary(*track);
684
685 const Trk::TrackSummary * summary = track->trackSummary();
686 int nBlayerHits = 0;
687 int nPixelHits = 0;
688 int nSctHits = 0;
689 int nStrawHits = 0;
690 int nTrHits = 0;
691 int nSiHits = 0;
692 bool expectBL = false; // Not stored for Trk::Track
693 unsigned bitmap = 0;
694
695 if(summary==0){
696 std::cerr << "Could not create TrackSummary - Track will likely fail hits requirements" << std::endl;
697 }
698 else{
699 nBlayerHits = 2*summary->get(Trk::numberOfBLayerHits);
701 nSctHits = summary->get(Trk::numberOfSCTHits);
702 nStrawHits = summary->get(Trk::numberOfTRTHits);
704 nSiHits = nPixelHits + nSctHits;
705
706 for ( int ih=0 ; ih<20 ; ih++ ) {
707 if ( summary->isHit(Trk::DetectorType(ih)) ) bitmap |= ( 1<<hpmap[ih] );
708 }
709 }
710
711 unsigned long id = (unsigned long)track;
712 double chi2 = 0;
713 double dof = 0;
714 //const Trk::FitQuality *quality = dynamic_cast<const Trk::FitQuality*>(track->fitQuality());
715 const Trk::FitQuality *quality = (track->fitQuality());
716 if(quality==0) std::cerr << "Could not create FitQuality - Track will likely fail hits requirements" << std::endl;
717 else{
718 chi2 = quality->chiSquared();
719 dof = quality->numberDoF();
720 }
721
722 int trackAuthor = -1;
723
726
727 // std::cout << "fetching author info :" << track->info().trackFitter() << ":"
728 // << track->info().dumpInfo() << ": bm 0x" << std::hex << bitmap << std::dec << std::endl;
729
730 int fitter = track->info().trackFitter();
731 // std::string dumpinfo = track->info().dumpInfo();
732
733 if ( fitter>0 && fitter<Trk::TrackInfo::NumberOfTrackFitters ) {
734 if ((track->info().dumpInfo()).find("TRTStandalone") != std::string::npos) trackAuthor = 2;
735 else if ((track->info().dumpInfo()).find("TRTSeededTrackFinder") != std::string::npos) trackAuthor = 1;
736 else trackAuthor = 0;
737 }
738
739 #if 0
740 std::cout << "\t\t\tSUTT TP track"
741 << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta()
742 << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi()
743 << "\tz0=" << z0
744 << "\tpT=" << pT // << "\t( " << 1/qoverp << ")"
745 << "\td0=" << d0
746 << "\tNsi=" << nSiHits
747 << "\tNtrt=" << nTrHits
748 << "\tNstr=" << nStrawHits
749 << "\tauthor=" << trackAuthor
750 << std::endl;
751 #endif
752 // Create and save Track
753 TIDA::Track* t = new TIDA::Track(eta, phi, z0, d0, pT, chi2, dof,
754 deta, dphi, dz0, dd0, dpT,
755 nBlayerHits, nPixelHits, nSctHits, nSiHits,
756 nStrawHits, nTrHits, bitmap, 0,
757 trackAuthor, false, -1, -1,
758 expectBL, id) ;
759
760 if ( !addTrack( t ) ){
761 delete t;
762 return false;
763 }
764 return true;
765
766 //std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl;
767 }
768 }
769
770 return false;
771}
double charge(const T &p)
Definition AtlasPID.h:999
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition FitQuality.h:60
double chiSquared() const
returns the of the overall track fit
Definition FitQuality.h:56
double eta() const
Access method for pseudorapidity - from momentum.
double charge() const
Returns the charge.
double chi2(TH1 *h0, TH1 *h1)
float nSiHits(const U &p)
float nPixelHits(const U &p)
const ShapeFitter * fitter
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Perigee MeasuredPerigee
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
DetectorType
enumerates the various detector types currently accessible from the isHit() method.
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfBLayerHits
these are the hits in the 0th pixel layer?
@ numberOfTRTHighThresholdHits
total number of TRT hits which pass the high threshold

◆ selectTrack() [2/6]

bool TrigTrackSelector::selectTrack ( const TruthParticle & track)

Definition at line 271 of file TrigTrackSelector.cxx.

271 {
272
273 return selectTrack( &track );
274
275}
bool selectTrack(HepMC::ConstGenParticlePtr track)

◆ selectTrack() [3/6]

bool TrigTrackSelector::selectTrack ( const TruthParticle * track)

Definition at line 279 of file TrigTrackSelector.cxx.

279 {
280 TIDA::Track* t = makeTrack( track, m_id );
281 if ( t == 0 ) return false;
282 if ( !addTrack(t) ) {
283 delete t;
284 return false;
285 }
286 return true;
287}

◆ selectTrack() [4/6]

bool TrigTrackSelector::selectTrack ( const xAOD::TrackParticle * track,
void * = 0 )

legacy run 2 selector access

lazy just to avoid a find-replace of measPer to track

Grrrrr remove interaction mean z position!!!

protect against spurious qOverP = 0 BUT !!! this should NEVER happen !!! so shouldn't really have this failing silently, but not allowed to put in std::cerr output leave the original code in as this is mostly for a test

a covariance not an error

don't correct xaod tracks to the beamline

??? <<– check this

holes

cheat !! pack the holes into the hits so that eg int pixelholes() { return npix/1000; } int pixelhits() { return npix%1000; }

get the total number of holes as well

fit quality

Definition at line 790 of file TrigTrackSelector.cxx.

790 {
791 // do the track extraction stuff here....
792
793 // static int hpmap[20] = { 0, 1, 2, 7, 8, 9, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
794
795 if ( track ) {
796
798 const xAOD::TrackParticle* measPer = track;
799
800 // CLHEP::HepVector perigeeParams = measPer->parameters();
801
802 double pT = measPer->pt();
803 double eta = measPer->eta();
804 double phi = measPer->phi0();
805 double z0 = measPer->z0() + measPer->vz();
806 double d0 = measPer->d0();
807
808 double theta = measPer->theta();
809
814 // if ( measPer->qOverP()==0 ) return false;
815 if ( measPer->qOverP()==0 ) throw std::runtime_error( "probable corrupted track - this should never happen" );
816 double p = 1/measPer->qOverP();
817
818 // AAARCH!!!!! the TrackParticle pT is NOT SIGNED!!!! ( I ask you! )
819 if ( measPer->qOverP()<0 && pT>0 ) pT *= -1;
820
821 double dtheta = std::sqrt(measPer->definingParametersCovMatrix()(Trk::theta,Trk::theta));
822 double dqovp = std::sqrt(measPer->definingParametersCovMatrix()(Trk::qOverP,Trk::qOverP));
823 double covthetaOvP = measPer->definingParametersCovMatrix()(Trk::qOverP,Trk::theta);
824
825 double deta = 0.5*dtheta/(std::cos(0.5*theta)*std::cos(0.5*theta)*std::tan(0.5*theta)); // ???? CHECK THIS <<--
826
827 double dphi = std::sqrt(measPer->definingParametersCovMatrix()(Trk::phi0,Trk::phi0));
828 double dz0 = std::sqrt(measPer->definingParametersCovMatrix()(Trk::z0,Trk::z0));
829 double dd0 = std::sqrt(measPer->definingParametersCovMatrix()(Trk::d0,Trk::d0));
830
831 double dpT = 0;
832
833
835 // if ( m_xBeam!=0 || m_yBeam!=0 ) correctToBeamline( z0, dz0, d0, dd0, theta, phi );
836
837
838 double sintheta = std::sin(theta);
839 double costheta = std::cos(theta);
840 double dpt2 = (p*p*sintheta)*(p*p*sintheta)*dqovp*dqovp + (p*costheta)*(p*costheta)*dtheta*dtheta - 2*(p*p*sintheta)*(p*costheta)*covthetaOvP;
841
842 if ( dpt2>0 ) dpT = std::sqrt( dpt2 );
843
844 // Check number of hits
845 // NB: a spacepoint is two offline "hits", so a pixel spacepoint is really
846 // 2 "hits" and an offline SCT "hit" is really a 1D cluster, so two intersetcting
847 // stereo clusters making a spacepoint are two "hits"
848
849 uint8_t sum_nBlayerHits = 0;
850 track->summaryValue( sum_nBlayerHits, xAOD::numberOfInnermostPixelLayerHits);
851 int nBlayerHits = 2*sum_nBlayerHits;
852
853 uint8_t sum_nPixelHits = 0;
854 track->summaryValue( sum_nPixelHits, xAOD::numberOfPixelHits);
855 int nPixelHits = 2*sum_nPixelHits;
856
857 uint8_t sum_nSctHits = 0;
858 track->summaryValue( sum_nSctHits, xAOD::numberOfSCTHits);
859 int nSctHits = sum_nSctHits;
860
861 uint8_t sum_nStrawHits = 0;
862 track->summaryValue( sum_nStrawHits, xAOD::numberOfTRTHits);
863 int nStrawHits = sum_nStrawHits;
864
865 uint8_t sum_nTrtHits = 0;
866 track->summaryValue( sum_nTrtHits, xAOD::numberOfTRTHighThresholdHits);
867 int nTrtHits = sum_nTrtHits;
868
869
870 uint8_t sum_expectBL = 0;
871 track->summaryValue( sum_expectBL, xAOD::expectInnermostPixelLayerHit);
872 bool expectBL = ( sum_expectBL ? true : false );
873
875
876 uint8_t sum_sctholes = 0;
877 track->summaryValue( sum_sctholes, xAOD::numberOfSCTHoles);
878
879 uint8_t sum_pixholes = 0;
880 track->summaryValue( sum_pixholes, xAOD::numberOfPixelHoles);
881
885
886 nSctHits += 1000*sum_sctholes;
887 nPixelHits += 1000*sum_pixholes;
888
890 int nSiHits = nPixelHits + nSctHits;
891
893
894 double chi2 = track->chiSquared();
895 double dof = track->numberDoF();
896
897 unsigned long id = (unsigned long)track;
898
899 unsigned bitmap = track->hitPattern();
900
901
902
903 double xbeam = track->vx();
904 double ybeam = track->vy();
905 double zbeam = track->vz();
906
907 if ( xbeam!=getBeamX() || ybeam!=getBeamY() || zbeam!=getBeamZ() ) setBeamline( xbeam, ybeam, zbeam );
908
909 int trackAuthor = 0;
910
911 int fitter = track->trackFitter();
912 std::bitset<xAOD::NumberOfTrackRecoInfo> patternrec = track->patternRecoInfo();
913
914 //int icount = 0;<- never used if section below is commented
915 for ( unsigned ipr=patternrec.size() ; ipr-- ; ) {
916 if ( patternrec[ipr] ) {
917 //icount++; <- never used if section below is commented
918 trackAuthor |= (ipr >> 16);
919 // static bool first = true;
920 // if ( first && icount>1 ) {
921 // std::cerr << "more than one pattern rec strategy " << ipr << "\t(suppressing further output)" << std::endl;
922 // first = false;
923 // }
924 }
925 }
926
927 trackAuthor |= fitter;
928
929 // if ( fitter>0 && fitter<Trk::TrackInfo::NumberOfTrackFitters ) {
930 // if ( dumpinfo.find("TRTStandalone")!=std::string::npos) trackAuthor = 2;
931 // else if ( dumpinfo.find("TRTSeededTrackFinder")!=std::string::npos) trackAuthor = 1;
932 // else trackAuthor = 0;
933 // }
934
935#if 0
936 std::cout << "\t\t\tSUTT TP track"
937 << "\teta=" << eta // << " +- " << (*trackitr)->params()->deta()
938 << "\tphi=" << phi // << " +- " << (*trackitr)->params()->dphi()
939 << "\tz0=" << z0
940 << "\tpT=" << pT // << "\t( " << 1/qoverp << ")"
941 << "\td0=" << d0
942 << "\tNsi=" << nSiHits
943 // << "\tNtrt=" << nTrtHits
944 // << "\tNstr=" << nStrawHits
945 << "\tfitter=" << fitter
946 << "\tauthor=" << trackAuthor
947 << "\tVTX x " << track->vx() << "\ty " << track->vy() << "\tz " << track->vz()
948 << std::endl;
949#endif
950
951 // Create and save Track
952
953 TIDA::Track* t = new TIDA::Track( eta, phi, z0, d0, pT, chi2, dof,
954 deta, dphi, dz0, dd0, dpT,
955 nBlayerHits, nPixelHits, nSctHits, nSiHits,
956 nStrawHits, nTrtHits, bitmap, 0,
957 trackAuthor, false, -1, -1,
958 expectBL, id) ;
959
960 // std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl;
961
962 if ( !addTrack( t ) ){
963 delete t;
964 return false;
965 }
966 return true;
967
968 }
969 return false;
970
971
972}
void setBeamline(double x, double y, double z=0)
double getBeamY() const
double getBeamX() const
double getBeamZ() const
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float vz() const
The z origin for the parameters.
float d0() const
Returns the parameter.
float qOverP() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float phi0() const
Returns the parameter, which has range to .
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
@ numberOfSCTHoles
number of SCT holes [unit8_t].

◆ selectTrack() [5/6]

bool TrigTrackSelector::selectTrack ( const xAOD::TruthParticle * track,
double x0 = 0,
double y0 = 0 )

lazy just to avoid a find-replace of measPer to track

avoid default (unset) TruthParticle charge

only use charged tracks

need to calculate the origin, and the beamline, and the d0 and z0 with respect to the beamline leave this in until we have checked whether everything is implemented correctly

need to calculate d0 and z0 correctly.

these are the d0 and z at the point of closest approach to x0, y0, the event "beamline", which is the best that we can do for the moment

the is our new "final state" requirement the inner and outer radii are in some sense arbitrary - these correspond to an envelope around the pixel detector, so the track must pass through the entire pixel detector NB: In order to ensure you don't miss any tracks they really need to be the same ie if a track brems in your "volume" then you will miss that track, and also the resulting track, even if it is a high et track

was hardcoded as 47 - now is set from the constructor

get the total number of holes as well

useful debug info - leave in

Definition at line 293 of file TrigTrackSelector.cxx.

293 {
294 if ( track ) {
295
296 if (!MC::isStable(track) ) return false;
297
299 const xAOD::TruthParticle* measPer = track;
300
301 double pT = measPer->pt();
302 double eta = measPer->eta();
303 double phi = measPer->phi();
304
305 // AAARCH!!!!! the TrackParticle pT is NOT SIGNED!!!! ( I ask you! )
306 if ( measPer->charge()<0 && pT>0 ) pT *= -1;
307 double q = track->charge();
308
309 static const particleType ptype;
310
312 if ( q==-999 ) q = ptype.charge( track->pdgId() );
313
315 if ( q==0 ) return 0;
316
320 // double xbeam = getBeamX(); // track->vx();
321 // double ybeam = getBeamY(); // track->vy();
322 // double zbeam = getBeamZ(); // track->vz();
323
324 if ( !track->hasProdVtx() ) return false;
325
327
328 double xp[3] = { measPer->prodVtx()->x(), measPer->prodVtx()->y(), measPer->prodVtx()->z() };
329 double xb[3] = { xp[0]-x0, xp[1]-y0, measPer->prodVtx()->z() };
330 double xd[3] = { 0, 0, 0 };
331
332 if ( track->hasDecayVtx() ) {
333 xd[0] = track->decayVtx()->x();
334 xd[1] = track->decayVtx()->y();
335 xd[2] = track->decayVtx()->z();
336 }
337
338 double rp = std::sqrt( xp[0]*xp[0] + xp[1]*xp[1] );
339 double rd = std::sqrt( xd[0]*xd[0] + xd[1]*xd[1] );
340
343 double theta = 2*std::atan( std::exp( -eta ) );
344 double z0 = xb[2] - (xb[0]*std::cos(phi) + xb[1]*std::sin(phi))/std::tan(theta);
345 double d0 = xb[1]*std::cos(phi) - xb[0]*std::sin(phi);
346
347 bool final_state = false;
348
360 const double inner_radius = m_radius;
361 const double outer_radius = m_radius;
362
363 if ( ( track->hasProdVtx() && rp<=inner_radius ) &&
364 ( !track->hasDecayVtx() || rd>outer_radius ) ) final_state = true;
365
366 if ( !final_state ) return false;
367
368 double deta = 0;
369 double dphi = 0;
370 double dz0 = 0;
371 double dd0 = 0;
372
373 double dpT = 0;
374
375 int nBlayerHits = 0;
376 int nPixelHits = 0;
377 int nSctHits = 0;
378 int nStrawHits = 0;
379 int nTrtHits = 0;
380
381 double chi2 = 0;
382 double dof = 0;
383
384 bool expectBL = false;
385
386 nSctHits += 0;
387 nPixelHits += 0;
388
390 int nSiHits = 0;
391
392 unsigned long id = (unsigned long)track;
393
394 unsigned bitmap = 0;
395
396 int trackAuthor = track->pdgId();
397 int uniqueID = HepMC::uniqueID(track);
398
399#if 0
400 std::cout << "\t\t\tSUTT TP track"
401 << "\teta=" << eta
402 << "\tphi=" << phi
403 << "\tz0=" << z0
404 << "\tpT=" << pT
405 << "\td0=" << d0
406 << "\tauthor=" << trackAuthor
407 << "\tVTX x " << xp[0]<< "\ty " << xp[1] << "\tz " << xp[2]
408 << std::endl;
409#endif
410
411 // Create and save Track
412
413 TIDA::Track* t = new TIDA::Track( eta, phi, z0, d0, pT, chi2, dof,
414 deta, dphi, dz0, dd0, dpT,
415 nBlayerHits, nPixelHits, nSctHits, nSiHits,
416 nStrawHits, nTrtHits, bitmap, 0,
417 trackAuthor, false, uniqueID, -1,
418 expectBL, id) ;
419
421 // std::cout << "SUTT TP track " << *t << "\t0x" << std::hex << bitmap << std::dec << std::endl;
422
423 // addTrack applies additional cuts using the Filter
424 if ( !addTrack( t ) ){
425 delete t;
426 return false;
427 }
428 }
429 return false;
430
431}
virtual double pt() const override final
The transverse momentum ( ) of the particle.
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
double charge() const
Physical charge.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.

◆ selectTrack() [6/6]

bool TrigTrackSelector::selectTrack ( HepMC::ConstGenParticlePtr track)

not a "final state" particle

set this so can use it as the identifier - don't forget to reset!!

Definition at line 253 of file TrigTrackSelector.cxx.

253 {
254
256 if ( !MC::isStable(track) ) return false;
257
259//AV Using memory to get some value is not a good idea. This is not a repruducible/portable way, but I leave it as is.
260 m_id = (unsigned long)(track.get());
261 bool sel;
262 sel = selectTrack( TruthParticle(track) );
263 m_id = 0;
264
265 return sel;
266
267}

◆ selectTracks() [1/6]

void TrigTrackSelector::selectTracks ( const TrackCollection * trigtracks)

Definition at line 774 of file TrigTrackSelector.cxx.

774 {
775
776 // std::cout << "\t\t\tSUTT \tTrackContainer->size() = " << trigtracks->size() << std::endl;
777
778 TrackCollection::const_iterator trackitr = trigtracks->begin();
779 TrackCollection::const_iterator trackend = trigtracks->end();
780
781 while ( trackitr!=trackend ) {
782 selectTrack( *trackitr );
783 ++trackitr;
784 } // loop over tracks
785
786}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:861
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.

◆ selectTracks() [2/6]

void TrigTrackSelector::selectTracks ( const TrackParticleLinks_t & tracks)

Definition at line 999 of file TrigTrackSelector.cxx.

999 {
1000 for( const auto& track : tracks ) selectTrack( *track );
1001}
const std::vector< TIDA::Track * > & tracks() const

◆ selectTracks() [3/6]

void TrigTrackSelector::selectTracks ( const TruthParticleContainer * truthtracks)

neater code to make use of vector function also for a single ancestor pdgid, instead of the full code duplication, but less efficienct as it then needs to create a single element vector for each particle, to avoid the code duplication.

Perhaps something can be done for the compiler optimisation to realise this and somehow
reduce the opverhead of creating the single int vector - need to investiogate this more thoroghly before including this, as it would be a much neater solution

Definition at line 113 of file TrigTrackSelector.cxx.

113 {
114 // std::cout << "\t\t\tSUTT \tTrackParticleContainer->size() = " << trigtracks->size() << std::endl;
115
116 TruthParticleContainer::const_iterator trackitr = truthtracks->begin();
117 TruthParticleContainer::const_iterator trackend = truthtracks->end();
118
119 while ( trackitr!=trackend ) {
120
121 selectTrack( *trackitr );
122
123 ++trackitr;
124
125 } // loop over tracks
126
127}

◆ selectTracks() [4/6]

void TrigTrackSelector::selectTracks ( const xAOD::TrackParticleContainer * tracks,
void * = 0 )

Definition at line 975 of file TrigTrackSelector.cxx.

975 {
976 // std::cout << "\t\t\tSUTT \tTrackContainer->size() = " << trigtracks->size() << std::endl;
979 while ( trackitr!=trackend ) {
980 selectTrack( *trackitr );
981 ++trackitr;
982 } // loop over tracks
983}

◆ selectTracks() [5/6]

void TrigTrackSelector::selectTracks ( const xAOD::TruthParticleContainer * truthtracks)

get truth beamline

fix default (unset) TruthParticle charge

not just yet - save for later ... else ( gotPdgId && m_selectParentPdgIds.size()!=0 ) gotParentPdgId = fromAncestor(m_selectParentPdgIds, (*trackitr))!=nullptr;

Definition at line 208 of file TrigTrackSelector.cxx.

208 {
209
210 xAOD::TruthParticleContainer::const_iterator trackitr = truthtracks->begin();
211 xAOD::TruthParticleContainer::const_iterator trackend = truthtracks->end();
212
214 double x0 = 0;
215 double y0 = 0;
216
217 truthBeamline( truthtracks, x0, y0 );
218
219
220 for ( ; trackitr!=trackend; ++trackitr) {
221
222
223 // Only select charged final state particles
224 double q = (*trackitr)->charge();
225
227 static const particleType ptype;
228 if ( q==-999 ) q = ptype.charge( (*trackitr)->pdgId() );
229
230 if (q == 0 || !MC::isStable(*trackitr) ) continue;
231
232 // If looking for tau parents, don't select mu or e children
233
234 // select based on the pdg of final state particle
235 bool gotPdgId = true;
236 if (m_selectPdgId!=0) gotPdgId = (*trackitr)->absPdgId()==m_selectPdgId;
237
238 // select based on the pdg of the parent or ancestor
239 bool gotParentPdgId = true;
240 if ( gotPdgId && m_selectParentPdgId!=0 ) gotParentPdgId = fromAncestor(m_selectParentPdgId, (*trackitr))!=nullptr;
243
244 if ( gotParentPdgId && gotPdgId ) selectTrack( *trackitr, x0, y0);
245
246 } // loop over tracks
247
248}
void truthBeamline(const xAOD::TruthParticleContainer *truthtracks, double &x0, double &y0)
extract all the tracks from a xAOD::TruthParticle collection and histogram the x and y production coo...

◆ selectTracks() [6/6]

void TrigTrackSelector::selectTracks ( xAOD::TrackParticleContainer::const_iterator trackitr,
xAOD::TrackParticleContainer::const_iterator trackend,
void * = 0 )

MT selector access.

will need this printout during debugging, so leave commented until all the feature access has been properly debugged

Definition at line 987 of file TrigTrackSelector.cxx.

988 {
991 // std::cout << "\t\t\tSUTT \tTrackContainer->size() = " << trigtracks->size() << std::endl;
992 while ( trackitr!=trackend ) {
993 selectTrack( *trackitr );
994 ++trackitr;
995 } // loop over tracks
996}

◆ setBeamline()

void TrigTrackSelector::setBeamline ( double x,
double y,
double z = 0 )
inline

Definition at line 83 of file TrigTrackSelector.h.

83{ m_xBeam = x; m_yBeam = y; m_zBeam=z; }
#define y
#define x
#define z

◆ size()

unsigned TrackSelector::size ( ) const
inlineinherited

Definition at line 62 of file TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h.

62{ return m_tracks.size(); }

◆ tracks() [1/2]

const std::vector< TIDA::Track * > & TrackSelector::tracks ( ) const
inlineinherited

◆ tracks() [2/2]

std::vector< TIDA::Track * > TrackSelector::tracks ( TrackFilter * selector) const
inlineinherited

Definition at line 54 of file TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/TrackSelector.h.

54 {
55 if ( selector==0 ) return m_tracks;
56 std::vector<TIDA::Track*> t;
57 for ( int i=m_tracks.size() ; i-- ; ) if ( selector->select(m_tracks[i]) ) t.push_back(m_tracks[i]);
58 return t;
59 }

◆ truthBeamline()

void TrigTrackSelector::truthBeamline ( const xAOD::TruthParticleContainer * truthtracks,
double & x0,
double & y0 )

extract all the tracks from a xAOD::TruthParticle collection and histogram the x and y production coordinates to determine the event "beamline" position

histograms and book keeoing

positions

numbers of tracks

fill histograms ...

get track production vertex

add to the correct bins

calculate the most populous bin in x and y

require more than 1 particle for it to be classed a "vertex" therefore, for single particle Monte Carlo, this will not be updated and (0,0) will still be correctly used

Definition at line 134 of file TrigTrackSelector.cxx.

134 {
135
136 x0 = 0;
137 y0 = 0;
138
140
141 int Nx = 300;
142 int Ny = 300;
143
145 std::vector<double> xpos(Nx,0);
146 std::vector<double> ypos(Ny,0);
147
149 std::vector<int> xn(Nx,0);
150 std::vector<int> yn(Ny,0);
151
152 int xoffset = Nx/2;;
153 int yoffset = Ny/2;
154
155 double deltax = 3.0/Nx;
156 double deltay = 3.0/Ny;
157
159
160 xAOD::TruthParticleContainer::const_iterator trackitr = truthtracks->begin();
161 xAOD::TruthParticleContainer::const_iterator trackend = truthtracks->end();
162
163 for ( ; trackitr!=trackend ; ++trackitr ) {
164
165 const xAOD::TruthParticle* track = (*trackitr);
166
167 if ( !MC::isStable(track) || !track->hasProdVtx() ) continue;
168
170
171 double xp[3] = { track->prodVtx()->x(), track->prodVtx()->y(), track->prodVtx()->z() };
172
174
175 int ix = xp[0]/deltax + xoffset;
176 int iy = xp[1]/deltay + yoffset;
177
178 if ( ix<0 || ix>=Nx || iy<0 || iy>=Nx ) continue;
179
180 xpos[ix] += xp[0];
181 ypos[iy] += xp[1];
182
183 xn[ix]++;
184 yn[iy]++;
185
186 } // loop over tracks
187
189
190 int imx = 0;
191 int imy = 0;
192
193 for ( size_t i=0 ; i<xpos.size() ; i++ ) {
194 if ( xn[i]>xn[imx] ) imx = i;
195 if ( yn[i]>yn[imy] ) imy = i;
196 }
197
201 if ( xn[imx]>1 ) x0 = xpos[imx]/xn[imx];
202 if ( yn[imy]>1 ) y0 = ypos[imy]/yn[imy];
203
204}

Member Data Documentation

◆ m_correctTrkTracks

bool TrigTrackSelector::m_correctTrkTracks
private

Definition at line 172 of file TrigTrackSelector.h.

◆ m_id

unsigned long TrigTrackSelector::m_id
private

Definition at line 166 of file TrigTrackSelector.h.

◆ m_radius

double TrigTrackSelector::m_radius
private

Definition at line 174 of file TrigTrackSelector.h.

◆ m_selector

TrackFilter* TrackSelector::m_selector
protectedinherited

◆ m_selectParentPdgId

int TrigTrackSelector::m_selectParentPdgId
private

Definition at line 177 of file TrigTrackSelector.h.

◆ m_selectPdgId

int TrigTrackSelector::m_selectPdgId
private

Definition at line 176 of file TrigTrackSelector.h.

◆ m_tracks

std::vector<TIDA::Track*> TrackSelector::m_tracks
protectedinherited

◆ m_xBeam

double TrigTrackSelector::m_xBeam
private

Definition at line 168 of file TrigTrackSelector.h.

◆ m_yBeam

double TrigTrackSelector::m_yBeam
private

Definition at line 169 of file TrigTrackSelector.h.

◆ m_zBeam

double TrigTrackSelector::m_zBeam
private

Definition at line 170 of file TrigTrackSelector.h.

◆ s_default_radius

const double TrigTrackSelector::s_default_radius = 47
staticprivate

NB: This was 47 for Run 2, but with the addition of the IBL it should be 32 It was kept at 47 for all Run 2 and migration to MT, but for Run 3 we really want it changed to be 32.

Definition at line 179 of file TrigTrackSelector.h.


The documentation for this class was generated from the following files: