ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Analysis::JpsiFinder Class Reference

#include <JpsiFinder.h>

Inheritance diagram for Analysis::JpsiFinder:
Collaboration diagram for Analysis::JpsiFinder:

Public Member Functions

 JpsiFinder (const std::string &t, const std::string &n, const IInterface *p)
 
 ~JpsiFinder ()
 
virtual StatusCode initialize () override
 
virtual StatusCode performSearch (const EventContext &ctx, xAOD::VertexContainer &vxContainer) const override
 
std::vector< JpsiCandidategetPairs (const std::vector< const xAOD::TrackParticle * > &) const
 
std::vector< JpsiCandidategetPairs (const std::vector< const xAOD::Muon * > &) const
 
std::vector< JpsiCandidategetPairs2Colls (const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::Muon * > &, bool) const
 
double getInvariantMass (const JpsiCandidate &, std::span< const double >) const
 
std::vector< JpsiCandidateselectCharges (const std::vector< JpsiCandidate > &) const
 
xAOD::Vertexfit (const std::vector< const xAOD::TrackParticle * > &, const xAOD::TrackParticleContainer *importedTrackCollection) const
 
bool passesMCPCuts (const xAOD::Muon *) const
 
bool isContainedIn (const xAOD::TrackParticle *, const xAOD::TrackParticleContainer *) const
 
TVector3 trackMomentum (const xAOD::Vertex *vxCandidate, int trkIndex) const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

bool m_mumu
 
bool m_mutrk
 
bool m_trktrk
 
bool m_allMuons
 
bool m_combOnly
 
bool m_atLeastOneComb
 
bool m_useCombMeasurement
 
bool m_useV0Fitter
 
bool m_diMuons
 
double m_trk1M
 
double m_trk2M
 
double m_thresholdPt
 
double m_higherPt
 
double m_trkThresholdPt
 
double m_invMassUpper
 
double m_invMassLower
 
double m_collAngleTheta
 
double m_collAnglePhi
 
double m_Chi2Cut
 
bool m_oppChOnly
 
bool m_sameChOnly
 
bool m_allChCombs
 
SG::ReadHandleKey< xAOD::MuonContainerm_muonCollectionKey {this, "muonCollectionKey", "Muons"}
 
SG::ReadHandleKey< xAOD::TrackParticleContainerm_TrkParticleCollection {this, "TrackParticleCollection", "InDetTrackParticles" }
 
SG::ReadHandleKeyArray< xAOD::TrackParticleContainerm_MuonTrackKeys {this, "MuonTrackKeys", {}}
 
ToolHandle< Trk::IVertexFitterm_iVertexFitter
 
ToolHandle< Trk::IVertexFitterm_iV0VertexFitter
 
ToolHandle< Trk::ITrackSelectorToolm_trkSelector
 
ToolHandle< InDet::VertexPointEstimatorm_vertexEstimator
 
bool m_mcpCuts
 
bool m_doTagAndProbe
 
bool m_forceTagAndProbe
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 52 of file JpsiFinder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JpsiFinder()

Analysis::JpsiFinder::JpsiFinder ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 108 of file JpsiFinder.cxx.

108  : AthAlgTool(t,n,p),
109  m_mumu(true),
110  m_mutrk(false),
111  m_trktrk(false),
112  m_allMuons(false),
113  m_combOnly(false),
114  m_atLeastOneComb(true),
115  m_useCombMeasurement(false),
116  m_useV0Fitter(false),
117  m_diMuons(true),
118  m_trk1M(105.66),
119  m_trk2M(105.66),
120  m_thresholdPt(0.0),
121  m_higherPt(0.0),
122  m_trkThresholdPt(0.0),
123  m_invMassUpper(100000.0),
124  m_invMassLower(0.0),
125  m_collAngleTheta(0.0),
126  m_collAnglePhi(0.0),
127  m_Chi2Cut(50.),
128  m_oppChOnly(true),
129  m_sameChOnly(false),
130  m_allChCombs(false),
131  m_iVertexFitter("Trk::TrkVKalVrtFitter"),
132  m_iV0VertexFitter("Trk::V0VertexFitter"),
133  m_trkSelector("InDet::TrackSelectorTool"),
134  m_vertexEstimator("InDet::VertexPointEstimator"),
135  m_mcpCuts(true),
136  m_doTagAndProbe(false),
137  m_forceTagAndProbe(false) //forcing T&P method for any charge combinations
138 
139  {
140  declareInterface<JpsiFinder>(this);
141  declareProperty("muAndMu",m_mumu);
142  declareProperty("muAndTrack",m_mutrk);
143  declareProperty("TrackAndTrack",m_trktrk);
144  declareProperty("allMuons",m_allMuons);
145  declareProperty("combOnly",m_combOnly);
146  declareProperty("atLeastOneComb",m_atLeastOneComb);
147  declareProperty("useCombinedMeasurement",m_useCombMeasurement);
148  declareProperty("useV0Fitter",m_useV0Fitter);
149  declareProperty("assumeDiMuons",m_diMuons);
150  declareProperty("track1Mass",m_trk1M);
151  declareProperty("track2Mass",m_trk2M);
152  declareProperty("muonThresholdPt",m_thresholdPt);
153  declareProperty("higherPt",m_higherPt);
154  declareProperty("trackThresholdPt",m_trkThresholdPt);
155  declareProperty("invMassUpper",m_invMassUpper);
156  declareProperty("invMassLower",m_invMassLower);
157  declareProperty("collAngleTheta",m_collAngleTheta);
158  declareProperty("collAnglePhi",m_collAnglePhi);
159  declareProperty("Chi2Cut",m_Chi2Cut);
160  declareProperty("oppChargesOnly",m_oppChOnly);
161  declareProperty("sameChargesOnly",m_sameChOnly);
162  declareProperty("allChargeCombinations",m_allChCombs);
163  declareProperty("TrkVertexFitterTool",m_iVertexFitter);
164  declareProperty("V0VertexFitterTool",m_iV0VertexFitter);
165  declareProperty("TrackSelectorTool",m_trkSelector);
166  declareProperty("VertexPointEstimator",m_vertexEstimator);
167  declareProperty("useMCPCuts",m_mcpCuts);
168  declareProperty("doTagAndProbe",m_doTagAndProbe);
169  declareProperty("forceTagAndProbe",m_forceTagAndProbe);
170  }

◆ ~JpsiFinder()

Analysis::JpsiFinder::~JpsiFinder ( )

Definition at line 172 of file JpsiFinder.cxx.

172 { }

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fit()

xAOD::Vertex * Analysis::JpsiFinder::fit ( const std::vector< const xAOD::TrackParticle * > &  inputTracks,
const xAOD::TrackParticleContainer importedTrackCollection 
) const

Definition at line 425 of file JpsiFinder.cxx.

425  {
426 
427  const Trk::TrkV0VertexFitter* concreteVertexFitter=0;
428  if (m_useV0Fitter) {
429  // making a concrete fitter for the V0Fitter
430  concreteVertexFitter = dynamic_cast<const Trk::TrkV0VertexFitter * >(m_iV0VertexFitter.get());
431  if(concreteVertexFitter == 0) {
432  ATH_MSG_FATAL("The vertex fitter passed is not a V0 Vertex Fitter");
433  return NULL;
434  }
435  }
436 
437  const Trk::Perigee& aPerigee1 = inputTracks[0]->perigeeParameters();
438  const Trk::Perigee& aPerigee2 = inputTracks[1]->perigeeParameters();
439  int sflag = 0;
440  int errorcode = 0;
441  Amg::Vector3D startingPoint = m_vertexEstimator->getCirclesIntersectionPoint(&aPerigee1,&aPerigee2,sflag,errorcode);
442  if (errorcode != 0) {startingPoint(0) = 0.0; startingPoint(1) = 0.0; startingPoint(2) = 0.0;}
443  if (m_useV0Fitter) {
444  xAOD::Vertex* myVxCandidate = concreteVertexFitter->fit(inputTracks, startingPoint);
445 
446  // Added by ASC
447  if(myVxCandidate != 0){
448  std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector;
449  for(unsigned int i=0; i< myVxCandidate->trackParticleLinks().size(); i++)
450  { ElementLink<DataVector<xAOD::TrackParticle> > mylink=myVxCandidate->trackParticleLinks()[i]; //makes a copy (non-const)
451  mylink.setStorableObject(*importedTrackCollection, true);
452  newLinkVector.push_back( mylink ); }
453 
454  myVxCandidate->clearTracks();
455  myVxCandidate->setTrackParticleLinks( newLinkVector );
456  }
457 
458 
459 
460  return myVxCandidate;
461  } else {
462  xAOD::Vertex* myVxCandidate = m_iVertexFitter->fit(inputTracks, startingPoint);
463 
464  // Added by ASC
465  if(myVxCandidate != 0){
466  std::vector<ElementLink<DataVector<xAOD::TrackParticle> > > newLinkVector;
467  for(unsigned int i=0; i< myVxCandidate->trackParticleLinks().size(); i++)
468  { ElementLink<DataVector<xAOD::TrackParticle> > mylink=myVxCandidate->trackParticleLinks()[i]; //makes a copy (non-const)
469  mylink.setStorableObject(*importedTrackCollection, true);
470  newLinkVector.push_back( mylink ); }
471 
472  myVxCandidate->clearTracks();
473  myVxCandidate->setTrackParticleLinks( newLinkVector );
474  }
475 
476 
477  return myVxCandidate;
478  }
479 
480 
481 
482  return NULL;
483 
484  } // End of fit method

◆ getInvariantMass()

double Analysis::JpsiFinder::getInvariantMass ( const JpsiCandidate jpsiIn,
std::span< const double >  massHypotheses 
) const

Definition at line 597 of file JpsiFinder.cxx.

597  {
598 
599  // construct 4-vectors from track perigee parameters using given mass hypotheses.
600  // NOTE: in new data model (xAOD) the defining parameters are expressed as perigee parameters w.r.t. the beamspot
601  // NOTE2: TrackParticle::p4() method already returns TLorentzVector, however, we want to enforce our own mass hypothesis
602  TLorentzVector mu1;
603  TLorentzVector mu2;
604  mu1.SetVectM(jpsiIn.trackParticle1->p4().Vect(), massHypotheses[0]);
605  mu2.SetVectM(jpsiIn.trackParticle2->p4().Vect(), massHypotheses[1]);
606 
607  return (mu1+mu2).M();
608 
609  }

◆ getPairs() [1/2]

std::vector< JpsiCandidate > Analysis::JpsiFinder::getPairs ( const std::vector< const xAOD::Muon * > &  muonsIn) const

Definition at line 518 of file JpsiFinder.cxx.

518  {
519 
520  std::vector<JpsiCandidate> myPairs;
521  JpsiCandidate pair;
522  std::vector<const xAOD::Muon*>::const_iterator outerItr;
523  std::vector<const xAOD::Muon*>::const_iterator innerItr;
524 
525  if(muonsIn.size()>=2){
526  for(outerItr=muonsIn.begin();outerItr<muonsIn.end();++outerItr){
527  for(innerItr=(outerItr+1);innerItr!=muonsIn.end();++innerItr){
528  pair.muon1 = *innerItr;
529  pair.muon2 = *outerItr;
530  pair.pairType = MUMU;
531  bool mu1Comb( (*innerItr)->muonType() == xAOD::Muon::Combined );
532  bool mu2Comb( (*outerItr)->muonType() == xAOD::Muon::Combined );
533  if (mu1Comb && mu2Comb) pair.muonTypes = CC;
534  if ( (mu1Comb && !mu2Comb) || (!mu1Comb && mu2Comb) ) pair.muonTypes = CT;
535  if (!mu1Comb && !mu2Comb) pair.muonTypes = TT;
536  myPairs.push_back(pair);
537  }
538  }
539  }
540 
541  return(myPairs);
542  }

◆ getPairs() [2/2]

std::vector< JpsiCandidate > Analysis::JpsiFinder::getPairs ( const std::vector< const xAOD::TrackParticle * > &  TracksIn) const

Definition at line 493 of file JpsiFinder.cxx.

493  {
494 
495  std::vector<JpsiCandidate> myPairs;
496  JpsiCandidate pair;
497  std::vector<const xAOD::TrackParticle*>::const_iterator outerItr;
498  std::vector<const xAOD::TrackParticle*>::const_iterator innerItr;
499 
500  if(TracksIn.size()>=2){
501  for(outerItr=TracksIn.begin();outerItr<TracksIn.end();++outerItr){
502  for(innerItr=(outerItr+1);innerItr!=TracksIn.end();++innerItr){
503  pair.trackParticle1 = *innerItr;
504  pair.trackParticle2 = *outerItr;
505  pair.pairType = TRKTRK;
506  myPairs.push_back(pair);
507  }
508  }
509  }
510 
511  return(myPairs);
512  }

◆ getPairs2Colls()

std::vector< JpsiCandidate > Analysis::JpsiFinder::getPairs2Colls ( const std::vector< const xAOD::TrackParticle * > &  tracks,
const std::vector< const xAOD::Muon * > &  muons,
bool  tagAndProbe 
) const

Definition at line 550 of file JpsiFinder.cxx.

550  {
551 
552  std::vector<JpsiCandidate> myPairs;
553  JpsiCandidate pair;
554 
555  // Unless user is running in tag and probe mode, remove tracks which are also identified as muons
556  std::vector<const xAOD::TrackParticle*> tracksToKeep;
557  if (!tagAndProbe) {
558  if(tracks.size()>=1 && muons.size()>=1){
559  for (const xAOD::TrackParticle* trk : tracks) {
560  bool trackIsMuon(false);
561  for (const xAOD::Muon* mu : muons) {
562  auto& link = mu->inDetTrackParticleLink();
563  if ( link.isValid() && *link == trk ) {
564  trackIsMuon=true;
565  break;
566  }
567  }
568  if (!trackIsMuon) tracksToKeep.push_back(trk);
569  }
570  }
571  } else {tracksToKeep = tracks;}
572 
573  if(tracksToKeep.size()>=1 && muons.size()>=1){
574  for (const xAOD::TrackParticle* trk : tracksToKeep) {
575  for (const xAOD::Muon* mu : muons) {
576  pair.muon1 = mu;
577  // Muon track 1st
578  pair.trackParticle1 = mu->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
579  pair.trackParticle2 = trk;
580  pair.pairType = MUTRK;
581  myPairs.push_back(pair);
582  }
583  }
584  }
585 
586  return(myPairs);
587  }

◆ initialize()

StatusCode Analysis::JpsiFinder::initialize ( )
overridevirtual

Definition at line 32 of file JpsiFinder.cxx.

32  {
33 
34  // retrieving vertex Fitter
35  ATH_CHECK(m_iVertexFitter.retrieve());
36 
37  // retrieving V0 Fitter
38  ATH_CHECK(m_iV0VertexFitter.retrieve(DisableTool{!m_useV0Fitter }));
39 
40  // Get the track selector tool from ToolSvc
41  ATH_CHECK(m_trkSelector.retrieve());
42 
43  // Get the vertex point estimator tool from ToolSvc
44  ATH_CHECK(m_vertexEstimator.retrieve());
45 
46 
47  ATH_CHECK(m_muonCollectionKey.initialize());
49  ATH_CHECK(m_MuonTrackKeys.initialize(m_MuonTrackKeys.size() != 0));
50 
51  // Get the Particle Properties Service
52  IPartPropSvc* partPropSvc = 0;
53  StatusCode sc = service("PartPropSvc", partPropSvc, true);
54  if (sc.isFailure()) {
55  ATH_MSG_ERROR("Could not initialize Particle Properties Service");
56  return StatusCode::SUCCESS;
57  } else {
58  auto particleDataTable = partPropSvc->PDT();
59  const HepPDT::ParticleData* pd_mu = particleDataTable->particle(MC::MUON);
60  if (m_diMuons) {m_trk1M = pd_mu->mass(); m_trk2M = pd_mu->mass();}
61  }
62 
63  if (m_doTagAndProbe) ATH_MSG_WARNING("You have requested tag and probe mode. Duplicate mu+trk pairs WILL be allowed, charge ordering WILL NOT be done. Tag track will be first in each candidate");
64 
65 
66 // // Check that the user's settings are sensible
67  bool illogicalOptions(false);
68  if ( (m_mumu && m_mutrk) || (m_mumu && m_trktrk) || (m_mutrk && m_trktrk) ) {
69  ATH_MSG_WARNING("You are requesting incompatible combinations of muons and tracks in the pairs. JpsiCandidates will be EMPTY!");
70  illogicalOptions=true;
71  };
72  if ( (m_doTagAndProbe && m_mumu) || (m_doTagAndProbe && m_trktrk) ) {
73  ATH_MSG_WARNING("You are requesting Tag and Probe analysis but have not requested mu+trk mode. This is impossible. JpsiCandidates will be EMPTY!");
74  illogicalOptions=true;
75  };
76  if ( (m_mutrk || m_trktrk ) && m_useCombMeasurement ) {
77  ATH_MSG_WARNING("You are requesting a combined muon measurement to be used with pairs involving non-muon tracks. Not permitted. JpsiCandidates will be EMPTY!");
78  illogicalOptions=true;
79  };
81  ATH_MSG_WARNING("You are requesting incompatible combinations of combined muons non-combined muons in the pairs. JpsiCandidates will be EMPTY!");
82  illogicalOptions=true;
83  };
85  ATH_MSG_WARNING("You are requesting at least one muon to be combined in a tag and probe analysis. This doesn't make sense. JpsiCandidates will be EMPTY!");
86  illogicalOptions=true;
87  };
89  ATH_MSG_WARNING("You are requesting incompatible combinations of charges in the pairs. JpsiCandidates will be EMPTY!");
90  illogicalOptions=true;
91  };
93  if (!m_forceTagAndProbe){ //if m_forceTagAndProbe=TRUE then T&P will work with any charge combinations
94  ATH_MSG_WARNING("You are requesting same-sign or all-sign combinations in a tag and probe analysis. This doesn't make sense. JpsiCandidates will be EMPTY!");
95  illogicalOptions=true;
96  }
97  }
98  if (illogicalOptions) return StatusCode::FAILURE;;
99 
100 
101  ATH_MSG_DEBUG("Initialize successful");
102 
103  return StatusCode::SUCCESS;
104 
105  }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& Analysis::JpsiFinder::interfaceID ( )
inlinestatic

Definition at line 59 of file JpsiFinder.h.

59 { return IID_JpsiFinder;}

◆ isContainedIn()

bool Analysis::JpsiFinder::isContainedIn ( const xAOD::TrackParticle theTrack,
const xAOD::TrackParticleContainer theCollection 
) const

Definition at line 667 of file JpsiFinder.cxx.

667  {
668  return std::find(theCollection->begin(), theCollection->end(), theTrack) != theCollection->end();
669  }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ passesMCPCuts()

bool Analysis::JpsiFinder::passesMCPCuts ( const xAOD::Muon muon) const

Definition at line 657 of file JpsiFinder.cxx.

657  {
658 
659  return muon->passesIDCuts();
660 
661  }

◆ performSearch()

StatusCode Analysis::JpsiFinder::performSearch ( const EventContext &  ctx,
xAOD::VertexContainer vxContainer 
) const
overridevirtual

Implements Analysis::ICandidateSearch.

Definition at line 177 of file JpsiFinder.cxx.

178  {
179  ATH_MSG_DEBUG( "JpsiFinder::performSearch" );
180 
182  if(!muonhandle.isValid()){
183  ATH_MSG_ERROR("Could not retrieve " << m_muonCollectionKey.key());
184  return StatusCode::FAILURE;
185  }
186  // Get the muons from StoreGate
187  const xAOD::MuonContainer* importedMuonCollection = muonhandle.cptr();
188  ATH_MSG_DEBUG("Muon container size "<<importedMuonCollection->size());
189 
190  // Get muon tracks if combined measurement requested
191  std::vector<const xAOD::TrackParticleContainer*> importedMuonTrackCollections;
192  if (m_useCombMeasurement) {
193 
194  for (SG::ReadHandle<xAOD::TrackParticleContainer>& handle: m_MuonTrackKeys.makeHandles(ctx)) {
195  if(!handle.isValid()){
196  ATH_MSG_WARNING("No muon TrackParticle collection with name " << handle.key() << " found in StoreGate!");
197  return StatusCode::FAILURE;
198  } else {
199  ATH_MSG_DEBUG("Found muon TrackParticle collection " << handle.key() << " in StoreGate!");
200  ATH_MSG_DEBUG("Muon TrackParticle container size "<< handle->size());
201  importedMuonTrackCollections.push_back(handle.cptr());
202  }
203  }
204  }
205 
206  // Get ID tracks
208  const xAOD::TrackParticleContainer* importedTrackCollection{nullptr};
209  if(!handle.isValid()){
210  ATH_MSG_WARNING("No TrackParticle collection with name " << handle.key() << " found in StoreGate!");
211  return StatusCode::FAILURE;
212  } else {
213  importedTrackCollection = handle.cptr();
214  ATH_MSG_DEBUG("Found TrackParticle collection " << handle.key() << " in StoreGate!");
215  }
216  ATH_MSG_DEBUG("ID TrackParticle container size "<< handle->size());
217 
218  // Typedef for vectors of tracks and muons
219  typedef std::vector<const xAOD::TrackParticle*> TrackBag;
220  typedef std::vector<const xAOD::Muon*> MuonBag;
221 
222  // Select the inner detector tracks
223  const xAOD::Vertex* vx = nullptr;
224  TrackBag theIDTracksAfterSelection;
225  if (m_trktrk || m_mutrk) {
227  for (trkCItr=importedTrackCollection->begin(); trkCItr!=importedTrackCollection->end(); ++trkCItr) {
228  const xAOD::TrackParticle* TP = (*trkCItr);
229  if ( fabs(TP->pt())<m_trkThresholdPt ) continue;
230  if ( !m_trkSelector->decision(*TP, vx) ) continue;
231  theIDTracksAfterSelection.push_back(TP);
232  }
233  if (theIDTracksAfterSelection.size() == 0) return StatusCode::SUCCESS;;
234  ATH_MSG_DEBUG("Number of tracks after ID track selection: " << theIDTracksAfterSelection.size());
235  }
236 
237  // Select the muons
238  MuonBag theMuonsAfterSelection;
239  if (m_mumu || m_mutrk) {
240  for (auto muItr=importedMuonCollection->begin(); muItr!=importedMuonCollection->end(); ++muItr) {
241  if ( *muItr == NULL ) continue;
242  if (!(*muItr)->inDetTrackParticleLink().isValid()) continue; // No muons without ID tracks
243  const xAOD::TrackParticle* muonTrk = *((*muItr)->inDetTrackParticleLink());
244  if ( muonTrk==NULL) continue;
245  if ( !m_trkSelector->decision(*muonTrk, vx) ) continue; // all ID tracks must pass basic tracking cuts
246  if ( fabs(muonTrk->pt())<m_thresholdPt ) continue; // higher pt cut if needed
247  if ( m_mcpCuts && !passesMCPCuts(*muItr)) continue; // MCP cuts
248  if ( m_combOnly && (*muItr)->muonType() != xAOD::Muon::Combined ) continue; // require combined muons
249  if ( (*muItr)->muonType() == xAOD::Muon::SiliconAssociatedForwardMuon && !m_useCombMeasurement) continue;
250  theMuonsAfterSelection.push_back(*muItr);
251  }
252  if (theMuonsAfterSelection.size() == 0) return StatusCode::SUCCESS;;
253  ATH_MSG_DEBUG("Number of muons after selection: " << theMuonsAfterSelection.size());
254  }
255 
256  // Sort into pairs - end result will be a vector of JpsiCandidate structs
257  std::vector<JpsiCandidate> jpsiCandidates;
258  if (m_mumu) jpsiCandidates = getPairs(theMuonsAfterSelection);
259  if (m_trktrk) jpsiCandidates = getPairs(theIDTracksAfterSelection);
260  if (m_mutrk) jpsiCandidates = getPairs2Colls(theIDTracksAfterSelection,theMuonsAfterSelection,m_doTagAndProbe);
261 
262 
263  // (1) Enforce one combined muon
264  if (m_atLeastOneComb) {
265  std::vector<JpsiCandidate> selectCandidates;
266  for(auto &cand : jpsiCandidates) { if(cand.muonTypes!=TT) selectCandidates.push_back(cand); }
267  selectCandidates.swap(jpsiCandidates);
268  ATH_MSG_DEBUG("Number of candidates after requirement of at least 1 combined muon: " << jpsiCandidates.size() );
269  }
270 
271  // (2) Establish track content for candidates
272  // and set the appropriate track collections for the combined muon tracks where appropriate (for saving to persistency later)
273 
274  // mu+trk or trk+trk - always ID track collection
275  if (m_mutrk || m_trktrk) {
276  for (auto jpsiItr=jpsiCandidates.begin(); jpsiItr!=jpsiCandidates.end(); ++jpsiItr) {
277  (*jpsiItr).collection1 = importedTrackCollection;
278  (*jpsiItr).collection2 = importedTrackCollection;
279  }
280  }
281 
282  if (m_mumu) {
283  for (auto jpsiItr=jpsiCandidates.begin(); jpsiItr!=jpsiCandidates.end(); ++jpsiItr) {
285  (*jpsiItr).trackParticle1 = (*jpsiItr).muon1->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
286  (*jpsiItr).trackParticle2 = (*jpsiItr).muon2->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
287  (*jpsiItr).collection1 = importedTrackCollection;
288  (*jpsiItr).collection2 = importedTrackCollection;
289  }
291  if (!(*jpsiItr).muon1->combinedTrackParticleLink().isValid()) {
292  (*jpsiItr).trackParticle1 = (*jpsiItr).muon1->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
293  (*jpsiItr).collection1 = importedTrackCollection;
294  }
295 
296  if (!(*jpsiItr).muon2->combinedTrackParticleLink().isValid()) {
297  (*jpsiItr).trackParticle2 = (*jpsiItr).muon2->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
298  (*jpsiItr).collection2 = importedTrackCollection;
299  }
300 
301  if ((*jpsiItr).muon1->combinedTrackParticleLink().isValid()) {
302  (*jpsiItr).trackParticle1 = (*jpsiItr).muon1->trackParticle( xAOD::Muon::CombinedTrackParticle );
303  bool foundCollection(false);
304  // Look for correct muon track container
305  for (auto muTrkCollItr=importedMuonTrackCollections.begin(); muTrkCollItr!=importedMuonTrackCollections.end(); ++muTrkCollItr) {
306  if (isContainedIn((*jpsiItr).trackParticle1,*muTrkCollItr)) { (*jpsiItr).collection1 = *muTrkCollItr; foundCollection=true; break;}
307  }
308  if (!foundCollection) { // didn't find the correct muon track container so go back to ID
309  (*jpsiItr).trackParticle1 = (*jpsiItr).muon1->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
310  (*jpsiItr).collection1 = importedTrackCollection;
311  ATH_MSG_WARNING("Muon track from muon of author " << (*jpsiItr).muon1->author() << " not found in muon track collections you have provided.");
312  ATH_MSG_WARNING("Defaulting to ID track collection - combined measurement will not be used");
313  }
314  }
315 
316  if ((*jpsiItr).muon2->combinedTrackParticleLink().isValid()) {
317  (*jpsiItr).trackParticle2 = (*jpsiItr).muon2->trackParticle( xAOD::Muon::CombinedTrackParticle );
318  bool foundCollection(false);
319  // Look for correct muon track container
320  for (auto muTrkCollItr=importedMuonTrackCollections.begin(); muTrkCollItr!=importedMuonTrackCollections.end(); ++muTrkCollItr) {
321  if (isContainedIn((*jpsiItr).trackParticle2,*muTrkCollItr)) { (*jpsiItr).collection2 = *muTrkCollItr; foundCollection=true; break;}
322  }
323  if (!foundCollection) { // didn't find the correct muon track container so go back to ID
324  (*jpsiItr).trackParticle2 = (*jpsiItr).muon2->trackParticle( xAOD::Muon::InnerDetectorTrackParticle );
325  (*jpsiItr).collection2 = importedTrackCollection;
326  ATH_MSG_WARNING("Muon track from muon of author " << (*jpsiItr).muon2->author() << " not found in muon track collections you have provided.");
327  ATH_MSG_WARNING("Defaulting to ID track collection - combined measurement will not be used");
328  }
329  }
330  } // combined measurement
331  } // iteration over candidates
332  }
333 
334 
335  // (3) Enforce higher track pt if requested
336  if (m_higherPt>0.0) {
337  std::vector<JpsiCandidate> selectCandidates;
338  for(auto& cand : jpsiCandidates){
339  bool reject = (fabs(cand.trackParticle1->pt()) < m_higherPt) && (fabs(cand.trackParticle2->pt()) < m_higherPt);
340  if(!reject) selectCandidates.push_back(cand);
341  }
342  selectCandidates.swap(jpsiCandidates);
343  ATH_MSG_DEBUG("Number of candidates after higherPt cut: " << jpsiCandidates.size() );
344  }
345 
346  // (4) Select all opp/same charged track pairs
347  std::vector<JpsiCandidate> sortedJpsiCandidates;
348  sortedJpsiCandidates = selectCharges(jpsiCandidates);
349 
350  ATH_MSG_DEBUG("Number of candidates after charge selection: " << sortedJpsiCandidates.size() );
351 
352  // (5) Select for decay angle, if requested
353  if (m_collAnglePhi>0.0 && m_collAngleTheta>0.0) {
354  std::vector<JpsiCandidate> selectCandidates;
355  for(auto& cand : sortedJpsiCandidates){
356  double deltatheta = fabs( cand.trackParticle1->theta() - cand.trackParticle2->theta() );
357  double deltaphi = std::abs(xAOD::P4Helpers::deltaPhi(cand.trackParticle1->phi0() , cand.trackParticle2->phi0()));
358  bool reject = (deltatheta > m_collAngleTheta) || (deltaphi > m_collAnglePhi);
359  if(!reject) selectCandidates.push_back(cand);
360  }
361  sortedJpsiCandidates.swap(selectCandidates);
362  ATH_MSG_DEBUG("Number of collimated candidates: " << sortedJpsiCandidates.size() );
363  }
364 
365  // (6) Select for invariant mass, if requested
366  std::array<double,2> trkMasses{m_trk1M, m_trk2M};
367  if ( (m_invMassLower > 0.0) || (m_invMassUpper > 0.0) ) {
368  std::vector<JpsiCandidate> selectCandidates;
369  for(auto& cand : sortedJpsiCandidates){
370  double invMass = getInvariantMass(cand,trkMasses);
371  bool reject = invMass < m_invMassLower || invMass > m_invMassUpper;
372  if(!reject) selectCandidates.push_back(cand);
373  }
374  selectCandidates.swap(sortedJpsiCandidates);
375  ATH_MSG_DEBUG("Number of candidates passing invariant mass selection: " << sortedJpsiCandidates.size() );
376  }
377 
378  ATH_MSG_DEBUG("Number of pairs passing all selections and going to vertexing: " << sortedJpsiCandidates.size() );
379  if (sortedJpsiCandidates.size() == 0) return StatusCode::SUCCESS;;
380  std::vector<const xAOD::TrackParticle*> theTracks;
381  std::vector<const xAOD::Muon*> theStoredMuons;
382  // Fit each pair of tracks to a vertex
383  for(auto jpsiItr=sortedJpsiCandidates.begin(); jpsiItr!=sortedJpsiCandidates.end(); ++jpsiItr) {
384  theTracks.clear();
385  theTracks.push_back((*jpsiItr).trackParticle1);
386  theTracks.push_back((*jpsiItr).trackParticle2);
387  std::unique_ptr<xAOD::Vertex> myVxCandidate {fit(theTracks,importedTrackCollection)}; // This line actually does the fitting and object making
388  if (myVxCandidate) {
389  // Chi2 cut if requested
390  double chi2 = myVxCandidate->chiSquared();
391  ATH_MSG_DEBUG("chi2 is: " << chi2);
392  if (m_Chi2Cut <= 0.0 || chi2 <= m_Chi2Cut) {
393  // decorate the candidate with refitted tracks and muons via the BPhysHelper
394  xAOD::BPhysHelper jpsiHelper(myVxCandidate.get());
395  bool validtrk = jpsiHelper.setRefTrks();
396  if(!validtrk) ATH_MSG_WARNING("Problem setting tracks " << __FILE__ << ':' << __LINE__);
397  if (m_mumu || m_mutrk) {
398  theStoredMuons.clear();
399  theStoredMuons.push_back((*jpsiItr).muon1);
400  if (m_mumu) theStoredMuons.push_back((*jpsiItr).muon2);
401  bool valid = jpsiHelper.setMuons(theStoredMuons,importedMuonCollection);
402  if(!valid) ATH_MSG_WARNING("Problem setting muons " << __FILE__ << ':' << __LINE__);
403  }
404  // Retain the vertex
405  vxContainer.push_back(std::move(myVxCandidate));
406  }
407  } else { // fit failed
408  ATH_MSG_DEBUG("Fitter failed!");
409  // Don't try to delete the object, since we arrived here,
410  // because this pointer is null...
411  //delete myVxCandidate;
412  }
413  }
414  ATH_MSG_DEBUG("vxContainer size " << vxContainer.size());
415 
416  return StatusCode::SUCCESS;;
417  }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ selectCharges()

std::vector< JpsiCandidate > Analysis::JpsiFinder::selectCharges ( const std::vector< JpsiCandidate > &  jpsisIn) const

Definition at line 617 of file JpsiFinder.cxx.

617  {
618 
619  bool opposite(false),same(false),all(false);
620  opposite=m_oppChOnly;
623 
624  JpsiCandidate tmpJpsi;
625  std::vector<JpsiCandidate> jpsis;
626  double qOverP1=0.;
627  double qOverP2=0.;
628  for(auto jpsiItr=jpsisIn.cbegin();jpsiItr!=jpsisIn.cend();jpsiItr++){
629  bool oppCh(false),sameCh(false);
630  tmpJpsi = *jpsiItr;
631  qOverP1=(*jpsiItr).trackParticle1->qOverP();
632  qOverP2=(*jpsiItr).trackParticle2->qOverP();
633  if(qOverP1*qOverP2<0.0) oppCh=true; // product charge < 0
634  if(qOverP1*qOverP2>0.0) sameCh=true; // product charge > 0
635  // +ve should be first so swap
636  // Don't do it for tag and probe analyses (because tag muon must not change position)
637  if (oppCh && qOverP1<0.0 && !m_doTagAndProbe && !m_mutrk) {
638  tmpJpsi.trackParticle1 = (*jpsiItr).trackParticle2;
639  tmpJpsi.trackParticle2 = (*jpsiItr).trackParticle1;
640  tmpJpsi.muon1 = (*jpsiItr).muon2;
641  tmpJpsi.muon2 = (*jpsiItr).muon1;
642  tmpJpsi.collection1 = (*jpsiItr).collection2;
643  tmpJpsi.collection2 = (*jpsiItr).collection1;
644  }
645  if (oppCh && (opposite || all) ) jpsis.push_back(tmpJpsi);
646  if (sameCh && (same || all) ) jpsis.push_back(tmpJpsi);
647 
648  } // end of for loop
649 
650  return(jpsis);
651  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ trackMomentum()

TVector3 Analysis::JpsiFinder::trackMomentum ( const xAOD::Vertex vxCandidate,
int  trkIndex 
) const

Definition at line 675 of file JpsiFinder.cxx.

676  {
677  double px = 0., py = 0., pz = 0.;
678  if (0 != vxCandidate) {
679  const Trk::TrackParameters* aPerigee = vxCandidate->vxTrackAtVertex()[trkIndex].perigeeAtVertex();
680  px = aPerigee->momentum()[Trk::px];
681  py = aPerigee->momentum()[Trk::py];
682  pz = aPerigee->momentum()[Trk::pz];
683  }
684  TVector3 mom(px,py,pz);
685  return mom;
686  }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_allChCombs

bool Analysis::JpsiFinder::m_allChCombs
private

Definition at line 98 of file JpsiFinder.h.

◆ m_allMuons

bool Analysis::JpsiFinder::m_allMuons
private

Definition at line 80 of file JpsiFinder.h.

◆ m_atLeastOneComb

bool Analysis::JpsiFinder::m_atLeastOneComb
private

Definition at line 82 of file JpsiFinder.h.

◆ m_Chi2Cut

double Analysis::JpsiFinder::m_Chi2Cut
private

Definition at line 95 of file JpsiFinder.h.

◆ m_collAnglePhi

double Analysis::JpsiFinder::m_collAnglePhi
private

Definition at line 94 of file JpsiFinder.h.

◆ m_collAngleTheta

double Analysis::JpsiFinder::m_collAngleTheta
private

Definition at line 93 of file JpsiFinder.h.

◆ m_combOnly

bool Analysis::JpsiFinder::m_combOnly
private

Definition at line 81 of file JpsiFinder.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_diMuons

bool Analysis::JpsiFinder::m_diMuons
private

Definition at line 85 of file JpsiFinder.h.

◆ m_doTagAndProbe

bool Analysis::JpsiFinder::m_doTagAndProbe
private

Definition at line 107 of file JpsiFinder.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_forceTagAndProbe

bool Analysis::JpsiFinder::m_forceTagAndProbe
private

Definition at line 108 of file JpsiFinder.h.

◆ m_higherPt

double Analysis::JpsiFinder::m_higherPt
private

Definition at line 89 of file JpsiFinder.h.

◆ m_invMassLower

double Analysis::JpsiFinder::m_invMassLower
private

Definition at line 92 of file JpsiFinder.h.

◆ m_invMassUpper

double Analysis::JpsiFinder::m_invMassUpper
private

Definition at line 91 of file JpsiFinder.h.

◆ m_iV0VertexFitter

ToolHandle< Trk::IVertexFitter > Analysis::JpsiFinder::m_iV0VertexFitter
private

Definition at line 103 of file JpsiFinder.h.

◆ m_iVertexFitter

ToolHandle< Trk::IVertexFitter > Analysis::JpsiFinder::m_iVertexFitter
private

Definition at line 102 of file JpsiFinder.h.

◆ m_mcpCuts

bool Analysis::JpsiFinder::m_mcpCuts
private

Definition at line 106 of file JpsiFinder.h.

◆ m_mumu

bool Analysis::JpsiFinder::m_mumu
private

Definition at line 77 of file JpsiFinder.h.

◆ m_muonCollectionKey

SG::ReadHandleKey<xAOD::MuonContainer> Analysis::JpsiFinder::m_muonCollectionKey {this, "muonCollectionKey", "Muons"}
private

Definition at line 99 of file JpsiFinder.h.

◆ m_MuonTrackKeys

SG::ReadHandleKeyArray<xAOD::TrackParticleContainer> Analysis::JpsiFinder::m_MuonTrackKeys {this, "MuonTrackKeys", {}}
private

Definition at line 101 of file JpsiFinder.h.

◆ m_mutrk

bool Analysis::JpsiFinder::m_mutrk
private

Definition at line 78 of file JpsiFinder.h.

◆ m_oppChOnly

bool Analysis::JpsiFinder::m_oppChOnly
private

Definition at line 96 of file JpsiFinder.h.

◆ m_sameChOnly

bool Analysis::JpsiFinder::m_sameChOnly
private

Definition at line 97 of file JpsiFinder.h.

◆ m_thresholdPt

double Analysis::JpsiFinder::m_thresholdPt
private

Definition at line 88 of file JpsiFinder.h.

◆ m_trk1M

double Analysis::JpsiFinder::m_trk1M
private

Definition at line 86 of file JpsiFinder.h.

◆ m_trk2M

double Analysis::JpsiFinder::m_trk2M
private

Definition at line 87 of file JpsiFinder.h.

◆ m_TrkParticleCollection

SG::ReadHandleKey<xAOD::TrackParticleContainer> Analysis::JpsiFinder::m_TrkParticleCollection {this, "TrackParticleCollection", "InDetTrackParticles" }
private

Definition at line 100 of file JpsiFinder.h.

◆ m_trkSelector

ToolHandle< Trk::ITrackSelectorTool > Analysis::JpsiFinder::m_trkSelector
private

Definition at line 104 of file JpsiFinder.h.

◆ m_trkThresholdPt

double Analysis::JpsiFinder::m_trkThresholdPt
private

Definition at line 90 of file JpsiFinder.h.

◆ m_trktrk

bool Analysis::JpsiFinder::m_trktrk
private

Definition at line 79 of file JpsiFinder.h.

◆ m_useCombMeasurement

bool Analysis::JpsiFinder::m_useCombMeasurement
private

Definition at line 83 of file JpsiFinder.h.

◆ m_useV0Fitter

bool Analysis::JpsiFinder::m_useV0Fitter
private

Definition at line 84 of file JpsiFinder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexEstimator

ToolHandle< InDet::VertexPointEstimator > Analysis::JpsiFinder::m_vertexEstimator
private

Definition at line 105 of file JpsiFinder.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
Analysis::JpsiFinder::m_invMassLower
double m_invMassLower
Definition: JpsiFinder.h:92
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
Trk::py
@ py
Definition: ParamDefs.h:66
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Analysis::JpsiFinder::getPairs
std::vector< JpsiCandidate > getPairs(const std::vector< const xAOD::TrackParticle * > &) const
Definition: JpsiFinder.cxx:493
xAOD::BPhysHelper
Definition: BPhysHelper.h:71
test_pyathena.px
px
Definition: test_pyathena.py:18
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Analysis::JpsiFinder::m_Chi2Cut
double m_Chi2Cut
Definition: JpsiFinder.h:95
P4Helpers::invMass
double invMass(const I4Momentum &pA, const I4Momentum &pB)
invariant mass from two I4momentum references
Definition: P4Helpers.h:239
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
Analysis::JpsiFinder::m_collAngleTheta
double m_collAngleTheta
Definition: JpsiFinder.h:93
Analysis::JpsiFinder::m_trktrk
bool m_trktrk
Definition: JpsiFinder.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Analysis::JpsiFinder::m_allMuons
bool m_allMuons
Definition: JpsiFinder.h:80
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
xAOD::Vertex_v1::trackParticleLinks
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
Analysis::JpsiFinder::m_collAnglePhi
double m_collAnglePhi
Definition: JpsiFinder.h:94
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
Analysis::JpsiFinder::passesMCPCuts
bool passesMCPCuts(const xAOD::Muon *) const
Definition: JpsiFinder.cxx:657
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Analysis::JpsiFinder::m_TrkParticleCollection
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrkParticleCollection
Definition: JpsiFinder.h:100
Analysis::CT
@ CT
Definition: JpsiFinder.h:39
Analysis::JpsiFinder::m_MuonTrackKeys
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_MuonTrackKeys
Definition: JpsiFinder.h:101
Trk::pz
@ pz
global momentum (cartesian)
Definition: ParamDefs.h:67
Analysis::JpsiFinder::m_vertexEstimator
ToolHandle< InDet::VertexPointEstimator > m_vertexEstimator
Definition: JpsiFinder.h:105
Analysis::TRKTRK
@ TRKTRK
Definition: JpsiFinder.h:38
python.TrigEgammaFastCaloHypoTool.same
def same(val, tool)
Definition: TrigEgammaFastCaloHypoTool.py:12
Analysis::JpsiFinder::m_iVertexFitter
ToolHandle< Trk::IVertexFitter > m_iVertexFitter
Definition: JpsiFinder.h:102
DerivationFramework::MuonBag
std::vector< const xAOD::Muon * > MuonBag
Definition: BPhysAddMuonBasedInvMass.h:33
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Analysis::JpsiFinder::m_combOnly
bool m_combOnly
Definition: JpsiFinder.h:81
Analysis::JpsiFinder::isContainedIn
bool isContainedIn(const xAOD::TrackParticle *, const xAOD::TrackParticleContainer *) const
Definition: JpsiFinder.cxx:667
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Analysis::JpsiFinder::selectCharges
std::vector< JpsiCandidate > selectCharges(const std::vector< JpsiCandidate > &) const
Definition: JpsiFinder.cxx:617
calibdata.valid
list valid
Definition: calibdata.py:45
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Analysis::JpsiFinder::m_mumu
bool m_mumu
Definition: JpsiFinder.h:77
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
python.TrigInDetConfig.inputTracks
inputTracks
Definition: TrigInDetConfig.py:168
lumiFormat.i
int i
Definition: lumiFormat.py:92
Analysis::JpsiFinder::m_sameChOnly
bool m_sameChOnly
Definition: JpsiFinder.h:97
Analysis::JpsiFinder::m_useCombMeasurement
bool m_useCombMeasurement
Definition: JpsiFinder.h:83
Analysis::MUTRK
@ MUTRK
Definition: JpsiFinder.h:38
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Analysis::JpsiFinder::m_allChCombs
bool m_allChCombs
Definition: JpsiFinder.h:98
Analysis::JpsiFinder::getInvariantMass
double getInvariantMass(const JpsiCandidate &, std::span< const double >) const
Definition: JpsiFinder.cxx:597
xAOD::Vertex_v1::setTrackParticleLinks
void setTrackParticleLinks(const TrackParticleLinks_t &trackParticles)
Set all track particle links at once.
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
Trk::px
@ px
Definition: ParamDefs.h:65
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
MUON
xAOD::Muon MUON
D3PD INCLUDES.
Definition: TileCellFillerTool.h:37
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Analysis::JpsiFinder::m_doTagAndProbe
bool m_doTagAndProbe
Definition: JpsiFinder.h:107
Analysis::JpsiFinder::m_useV0Fitter
bool m_useV0Fitter
Definition: JpsiFinder.h:84
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DerivationFramework::TrackBag
std::vector< const xAOD::TrackParticle * > TrackBag
Definition: BPhysAddMuonBasedInvMass.h:32
xAOD::Vertex_v1::clearTracks
void clearTracks()
Remove all tracks from the vertex.
Definition: Vertex_v1.cxx:331
Trk::ParametersBase
Definition: ParametersBase.h:55
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Analysis::JpsiFinder::m_muonCollectionKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonCollectionKey
Definition: JpsiFinder.h:99
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
Analysis::JpsiFinder::m_trk1M
double m_trk1M
Definition: JpsiFinder.h:86
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Amg::py
@ py
Definition: GeoPrimitives.h:39
Analysis::JpsiFinder::m_mutrk
bool m_mutrk
Definition: JpsiFinder.h:78
Analysis::JpsiFinder::m_higherPt
double m_higherPt
Definition: JpsiFinder.h:89
Analysis::JpsiFinder::m_atLeastOneComb
bool m_atLeastOneComb
Definition: JpsiFinder.h:82
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Analysis::JpsiFinder::m_oppChOnly
bool m_oppChOnly
Definition: JpsiFinder.h:96
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Analysis::JpsiFinder::getPairs2Colls
std::vector< JpsiCandidate > getPairs2Colls(const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::Muon * > &, bool) const
Definition: JpsiFinder.cxx:550
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
Trk::TrkV0VertexFitter::fit
virtual xAOD::Vertex * fit(const std::vector< const xAOD::TrackParticle * > &vectorTrk, const Amg::Vector3D &startingPoint) const override
Interface for xAOD::TrackParticle with Amg::Vector3D starting point.
Definition: TrkV0VertexFitter.cxx:83
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
Analysis::JpsiFinder::m_trkThresholdPt
double m_trkThresholdPt
Definition: JpsiFinder.h:90
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Analysis::JpsiFinder::m_invMassUpper
double m_invMassUpper
Definition: JpsiFinder.h:91
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
Trk::TrkV0VertexFitter
This class implements a vertex fitting algorithm optimised for V0 finding.
Definition: TrkV0VertexFitter.h:40
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Analysis::JpsiFinder::m_forceTagAndProbe
bool m_forceTagAndProbe
Definition: JpsiFinder.h:108
xAOD::Vertex_v1::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Definition: Vertex_v1.cxx:181
Analysis::MUMU
@ MUMU
Definition: JpsiFinder.h:38
Analysis::JpsiFinder::m_trkSelector
ToolHandle< Trk::ITrackSelectorTool > m_trkSelector
Definition: JpsiFinder.h:104
Analysis::TT
@ TT
Definition: JpsiFinder.h:39
Analysis::JpsiFinder::m_thresholdPt
double m_thresholdPt
Definition: JpsiFinder.h:88
Analysis::JpsiFinder::m_trk2M
double m_trk2M
Definition: JpsiFinder.h:87
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
Analysis::JpsiFinder::m_iV0VertexFitter
ToolHandle< Trk::IVertexFitter > m_iV0VertexFitter
Definition: JpsiFinder.h:103
Analysis::JpsiFinder::m_diMuons
bool m_diMuons
Definition: JpsiFinder.h:85
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Analysis::JpsiFinder::fit
xAOD::Vertex * fit(const std::vector< const xAOD::TrackParticle * > &, const xAOD::TrackParticleContainer *importedTrackCollection) const
Definition: JpsiFinder.cxx:425
Analysis::CC
@ CC
Definition: JpsiFinder.h:39
Analysis::JpsiFinder::m_mcpCuts
bool m_mcpCuts
Definition: JpsiFinder.h:106
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528