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

#include <TagNProbe.h>

Collaboration diagram for TagNProbe:

Public Member Functions

 TagNProbe (const std::string &refName, double massMin, double massMax, bool unique_flag=true)
 TagNProbe (const std::string &refName0, const std::string &refName1, double massMin, double massMax, bool unique_flag=true)
virtual ~TagNProbe ()
void construct ()
void tag (const std::string &chainName)
 getters and setters
void probe (const std::string &chainName)
const std::string & tag () const
const std::string & probe () const
const std::string & type0 () const
const std::string & type1 () const
double mass0 () const
double mass1 () const
template<typename T>
std::vector< TIDA::Roi * > GetRois (std::vector< TIDA::Chain > &chains, const TrackSelector *selector, TrackFilter *filter, T *hmass, T *hmass_obj, TrigObjectMatcher *tom=0) const
template<typename T>
std::vector< TIDA::Roi * > GetRois (std::vector< TIDA::Chain > &chains, const TrackSelector *selector_tag, TrackFilter *filter_tag, const TrackSelector *selector_probe, TrackFilter *filter_probe, T *hmass, T *hmass_obj, TrigObjectMatcher *tom_tag=0, TrigObjectMatcher *tom_probe=0) const

Protected Member Functions

double pt (const TIDA::Track *t) const
double pt (const TrackTrigObject *t) const
template<typename T1, typename T2>
double mass (const T1 *t1, const T2 *t2) const
template<typename T>
bool selection (const TIDA::Roi &troi, const TIDA::Roi &proi, const TrackSelector *selector, TrackFilter *filter, T *hmass, T *hmass_obj, TrigObjectMatcher *tom=0) const
template<typename T>
bool selection (const TIDA::Roi &troi, const TIDA::Roi &proi, const TrackSelector *selector_tag, TrackFilter *filter_tag, const TrackSelector *selector_probe, TrackFilter *filter_probe, T *hmass, T *hmass_obj, TrigObjectMatcher *tom_tag=0, TrigObjectMatcher *tom_probe=0) const
double mass_obj (const TIDA::Track *t1, const TIDA::Track *t2, TrigObjectMatcher *tom=0) const
double mass_obj (const TIDA::Track *t1, const TIDA::Track *t2, TrigObjectMatcher *tom_tag, TrigObjectMatcher *tom_probe) const
TIDA::Chain * findChain (const std::string &chainname, std::vector< TIDA::Chain > &chains) const

Private Attributes

std::string m_particleType0
std::string m_particleType1
double m_mass0
double m_mass1
double m_massMin
double m_massMax
bool m_unique
std::string m_probeChainName
std::string m_tagChainName

Detailed Description

Constructor & Destructor Documentation

◆ TagNProbe() [1/2]

◆ TagNProbe() [2/2]

TagNProbe::TagNProbe ( const std::string & refName0,
const std::string & refName1,
double massMin,
double massMax,
bool unique_flag = true )

Definition at line 20 of file TrigAnalysis/TrigInDetAnalysisUtils/src/TagNProbe.cxx.

22 :
23 m_particleType0(refName0),
24 m_particleType1(refName1),
25 m_mass0(0),
26 m_mass1(0),
27 m_massMin(massMin),
28 m_massMax(massMax),
29 m_unique(unique_flag)
30{
31 construct();
32}

◆ ~TagNProbe()

virtual TagNProbe::~TagNProbe ( )
inlinevirtual

Member Function Documentation

◆ construct()

void TagNProbe::construct ( )

Definition at line 48 of file TrigAnalysis/TrigInDetAnalysisUtils/src/TagNProbe.cxx.

48 {
49
50
51#ifdef TRUTHUTILS_PARTICLECONSTANTS_H
52 const double muonMass = ParticleConstants::muonMassInMeV/1000.; // Convert MeV to GeV
53 const double electronMass = ParticleConstants::electronMassInMeV/1000.; // Convert MeV to GeV
54 const double tauMass = ParticleConstants::tauMassInMeV/1000.; // Convert MeV to GeV NB: mass in ParticleConstants is wrong
55#else
56 const double muonMass = 0.10565; // GeV
57 const double electronMass = 0.000511; // GeV
58 const double tauMass = 1.77686; // GeV
59#endif
60
61 if ( m_particleType0.find("Muon")!=std::string::npos ) m_mass0 = muonMass;
62 else if ( m_particleType0.find("Electron")!=std::string::npos ) m_mass0 = electronMass;
63 else if ( m_particleType0.find("Tau")!=std::string::npos ) m_mass0 = tauMass;
64
65 if ( m_particleType1.find("Muon")!=std::string::npos ) m_mass1 = muonMass;
66 else if ( m_particleType1.find("Electron")!=std::string::npos ) m_mass1 = electronMass;
67 else if ( m_particleType1.find("Tau")!=std::string::npos ) m_mass1 = tauMass;
68}
constexpr double muonMassInMeV
the mass of the muon (in MeV)
constexpr double tauMassInMeV
the mass of the tau (in MeV)
constexpr double electronMassInMeV
the mass of the electron (in MeV)

◆ findChain()

TIDA::Chain * TagNProbe::findChain ( const std::string & chainname,
std::vector< TIDA::Chain > & chains ) const
protected

Definition at line 106 of file TrigAnalysis/TrigInDetAnalysisUtils/src/TagNProbe.cxx.

106 {
107 for ( size_t i=chains.size() ; i-- ; ) {
108 if ( chains[i].name() == chainname ) return &chains[i];
109 }
110 return 0;
111}

◆ GetRois() [1/2]

template<typename T>
std::vector< TIDA::Roi * > TagNProbe::GetRois ( std::vector< TIDA::Chain > & chains,
const TrackSelector * selector,
TrackFilter * filter,
T * hmass,
T * hmass_obj,
TrigObjectMatcher * tom = 0 ) const
inline

Definition at line 63 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

68 {
69 return GetRois( chains, selector, filter, selector, filter, hmass, hmass_obj, tom, tom );
70 }
std::vector< TIDA::Roi * > GetRois(std::vector< TIDA::Chain > &chains, const TrackSelector *selector, TrackFilter *filter, T *hmass, T *hmass_obj, TrigObjectMatcher *tom=0) const

◆ GetRois() [2/2]

template<typename T>
std::vector< TIDA::Roi * > TagNProbe::GetRois ( std::vector< TIDA::Chain > & chains,
const TrackSelector * selector_tag,
TrackFilter * filter_tag,
const TrackSelector * selector_probe,
TrackFilter * filter_probe,
T * hmass,
T * hmass_obj,
TrigObjectMatcher * tom_tag = 0,
TrigObjectMatcher * tom_probe = 0 ) const
inline

tag and probe are the same: skip this tag

Definition at line 73 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

81 {
82
83 std::vector<TIDA::Roi*> probes;
84
85 TIDA::Chain* chain_tag = findChain( tag(), chains );
86 TIDA::Chain* chain_probe = findChain( probe(), chains );
87
88 if ( chain_tag==0 || chain_probe==0 ) return probes;
89
90 // loop for possible probes
91 for ( size_t ip=0 ; ip<chain_probe->size() ; ip++ ) {
92
93 TIDA::Roi& proi = chain_probe->rois()[ip];
94
95 TIDARoiDescriptor roi_probe( proi.roi() );
96
97 bool found_tnp = false;
98
99 // loop for possible tags
100 for ( size_t it=0 ; it<chain_tag->size() ; it++ ) {
101
102 TIDA::Roi& troi = chain_tag->rois()[it];
103 TIDARoiDescriptor roi_tag( troi.roi() );
104
106 if ( roi_probe == roi_tag ) continue;
107
108 if ( selection( troi, proi, selector_tag, filter_tag, selector_probe, filter_probe,
109 hmass, hmass_obj, tom_tag, tom_probe ) ) {
110
111 found_tnp = true;
112 if ( m_unique ) break;
113 }
114
115 } // end loop on tags
116
117 if ( found_tnp ) probes.push_back( &proi );
118
119 } // end loop on probes
120
121 return probes;
122
123 }
const std::vector< TIDA::Roi > & rois() const
get back roi vector
Definition TIDAChain.h:50
unsigned size() const
number of rois
Definition TIDAChain.h:54
const TIDARoiDescriptor & roi() const
access the roi information
Definition TIDARoi.h:42
TIDA::Chain * findChain(const std::string &chainname, std::vector< TIDA::Chain > &chains) const
const std::string selection
TrigRoiDescriptorCollection troi

◆ mass()

template<typename T1, typename T2>
double TagNProbe::mass ( const T1 * t1,
const T2 * t2 ) const
inlineprotected

Definition at line 131 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

131 {
132 TLorentzVector v1;
133 v1.SetPtEtaPhiM( pt(t1)*0.001, t1->eta(), t1->phi(), m_mass0 );
134 TLorentzVector v2;
135 v2.SetPtEtaPhiM( pt(t2)*0.001, t2->eta(), t2->phi(), m_mass1 );
136 return (v1+v2).M();
137 }
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1

◆ mass0()

double TagNProbe::mass0 ( ) const
inline

◆ mass1()

double TagNProbe::mass1 ( ) const
inline

◆ mass_obj() [1/2]

double TagNProbe::mass_obj ( const TIDA::Track * t1,
const TIDA::Track * t2,
TrigObjectMatcher * tom = 0 ) const
protected

Definition at line 72 of file TrigAnalysis/TrigInDetAnalysisUtils/src/TagNProbe.cxx.

72 {
73
74 if ( tom!=0 && tom->status() ) {
75 return mass( tom->object(t1->id()), tom->object(t2->id()) );
76 }
77 else {
78 return mass( t1, t2 );
79 }
80
81}
const TrackTrigObject * object(unsigned long track_id)

◆ mass_obj() [2/2]

double TagNProbe::mass_obj ( const TIDA::Track * t1,
const TIDA::Track * t2,
TrigObjectMatcher * tom_tag,
TrigObjectMatcher * tom_probe ) const
protected

different toms for each leg - eg if we wanted electron + tau

only tag tom ...

only probe tom ...

just tracks ...

Definition at line 84 of file TrigAnalysis/TrigInDetAnalysisUtils/src/TagNProbe.cxx.

84 {
85
86 if ( tom_tag!=0 && tom_tag->status() && tom_probe!=0 && tom_probe->status() ) {
88 return mass( tom_tag->object(t1->id()), tom_probe->object(t2->id()) );
89 }
90 else if ( tom_tag!=0 && tom_tag->status() ) {
92 return mass( tom_tag->object(t1->id()), t2 );
93 }
94 else if ( tom_probe!=0 && tom_probe->status() ) {
96 return mass( t1, tom_probe->object(t2->id()) );
97 }
98 else {
100 return mass( t1, t2 );
101 }
102
103}

◆ probe() [1/2]

const std::string & TagNProbe::probe ( ) const
inline

◆ probe() [2/2]

void TagNProbe::probe ( const std::string & chainName)
inline

◆ pt() [1/2]

double TagNProbe::pt ( const TIDA::Track * t) const
inlineprotected

◆ pt() [2/2]

double TagNProbe::pt ( const TrackTrigObject * t) const
inlineprotected

Definition at line 128 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

128{ return t->pt(); }

◆ selection() [1/2]

template<typename T>
bool TagNProbe::selection ( const TIDA::Roi & troi,
const TIDA::Roi & proi,
const TrackSelector * selector,
TrackFilter * filter,
T * hmass,
T * hmass_obj,
TrigObjectMatcher * tom = 0 ) const
inlineprotected

Definition at line 141 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

146 {
147 return selection( troi, proi, selector, filter, selector, filter, hmass, hmass_obj, tom, tom );
148 }

◆ selection() [2/2]

template<typename T>
bool TagNProbe::selection ( const TIDA::Roi & troi,
const TIDA::Roi & proi,
const TrackSelector * selector_tag,
TrackFilter * filter_tag,
const TrackSelector * selector_probe,
TrackFilter * filter_probe,
T * hmass,
T * hmass_obj,
TrigObjectMatcher * tom_tag = 0,
TrigObjectMatcher * tom_probe = 0 ) const
inlineprotected

get reference tracks from the tag roi

get reference tracks from the probe roi

loop over tag ref tracks

loop over probe ref tracks

check compatibility of the track z and invariant mass ...

Definition at line 151 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

159 {
160
162 TIDARoiDescriptor roi_tag( troi.roi() );
163
164 static_cast<Filter_Combined*>(filter_tag)->setRoi( &roi_tag );
165
166 std::vector<TIDA::Track*> refp_tag = selector_tag->tracks( filter_tag );
167
169
170 TIDARoiDescriptor roi_probe( proi.roi() );
171
172 static_cast<Filter_Combined*>( filter_probe )->setRoi( &roi_probe );
173
174 std::vector<TIDA::Track*> refp_probe = selector_probe->tracks( filter_probe );
175
177 bool found = false;
178
179 for ( size_t it=0; it<refp_tag.size() ; it++ ) {
180
182 for ( size_t ip=0; ip<refp_probe.size() ; ip++ ) {
183
185 double invmass = mass( refp_tag[it], refp_probe[ip] );
186 double invmass_obj = mass_obj( refp_tag[it], refp_probe[ip], tom_tag, tom_probe );
187 double deltaz0 = std::fabs(refp_tag[it]->z0() - refp_probe[ip]->z0() );
188
189 if ( invmass_obj>m_massMin && invmass_obj<m_massMax && deltaz0<5 ) {
190 hmass->Fill( invmass );
191 hmass_obj->Fill( invmass_obj );
192 found = true;
193 }
194 }
195 }
196
197 return found;
198
199 }
double mass_obj(const TIDA::Track *t1, const TIDA::Track *t2, TrigObjectMatcher *tom=0) const
const std::vector< TIDA::Track * > & tracks() const

◆ tag() [1/2]

const std::string & TagNProbe::tag ( ) const
inline

◆ tag() [2/2]

void TagNProbe::tag ( const std::string & chainName)
inline

getters and setters

could be moved to the constructor now ...

Definition at line 48 of file TrigAnalysis/TrigInDetAnalysisUtils/TrigInDetAnalysisUtils/TagNProbe.h.

48{ m_tagChainName = chainName; }

◆ type0()

const std::string & TagNProbe::type0 ( ) const
inline

◆ type1()

const std::string & TagNProbe::type1 ( ) const
inline

Member Data Documentation

◆ m_mass0

double TagNProbe::m_mass0
private

◆ m_mass1

double TagNProbe::m_mass1
private

◆ m_massMax

double TagNProbe::m_massMax
private

◆ m_massMin

double TagNProbe::m_massMin
private

◆ m_particleType0

std::string TagNProbe::m_particleType0
private

◆ m_particleType1

std::string TagNProbe::m_particleType1
private

◆ m_probeChainName

std::string TagNProbe::m_probeChainName
private

◆ m_tagChainName

std::string TagNProbe::m_tagChainName
private

◆ m_unique

bool TagNProbe::m_unique
private

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