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::JetFitterVariablesFactory Class Reference

#include <JetFitterVariablesFactory.h>

Inheritance diagram for Analysis::JetFitterVariablesFactory:
Collaboration diagram for Analysis::JetFitterVariablesFactory:

Public Member Functions

 JetFitterVariablesFactory (const std::string &name, const std::string &n, const IInterface *p)
 
virtual ~JetFitterVariablesFactory ()
 Destructor - check up memory allocation delete any memory allocation on the heap. More...
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode fillJetFitterVariables (const xAOD::Jet &, xAOD::BTagging *BTag, const Trk::VxJetFitterVertexInfo *myJetFitterInfo, std::string basename) 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

void fill (xAOD::BTagging *BTag, const std::string &basename, float mass_uncorr, int nVTX, int nSingleTracks, int nTracksAtVtx, float mass, float energyFraction, float significance3d, float deltaeta, float deltaphi, float chi2, int ndof, float deltaRFlightDir) const
 
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_addNegativeTracksToPrimaryVertex
 
bool m_usePtCorrectedEnergy
 
bool m_useSingleTracksAlsoForMass
 
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 37 of file JetFitterVariablesFactory.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

◆ JetFitterVariablesFactory()

Analysis::JetFitterVariablesFactory::JetFitterVariablesFactory ( const std::string &  name,
const std::string &  n,
const IInterface *  p 
)

Definition at line 38 of file JetFitterVariablesFactory.cxx.

39  :
40  AthAlgTool(name, n,p),
44  {
45  declareProperty("addNegativeTracksToPrimaryVertex",m_addNegativeTracksToPrimaryVertex);
46  declareProperty("usePtCorrectedEnergy",m_usePtCorrectedEnergy);
47  declareProperty("useSingleTracksAlsoForMass",m_useSingleTracksAlsoForMass);
48  declareInterface<IJetFitterVariablesFactory>(this);
49  }

◆ ~JetFitterVariablesFactory()

Analysis::JetFitterVariablesFactory::~JetFitterVariablesFactory ( )
virtual

Destructor - check up memory allocation delete any memory allocation on the heap.

Definition at line 55 of file JetFitterVariablesFactory.cxx.

55 {}

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

◆ fill()

void Analysis::JetFitterVariablesFactory::fill ( xAOD::BTagging BTag,
const std::string &  basename,
float  mass_uncorr,
int  nVTX,
int  nSingleTracks,
int  nTracksAtVtx,
float  mass,
float  energyFraction,
float  significance3d,
float  deltaeta,
float  deltaphi,
float  chi2,
int  ndof,
float  deltaRFlightDir 
) const
private

Definition at line 373 of file JetFitterVariablesFactory.cxx.

375  {
376 
377  BTag->setVariable<float>(basename, "massUncorr", mass_uncorr);
378  BTag->setVariable<float>(basename, "chi2", chi2);
379  BTag->setVariable<int>(basename, "ndof", ndof);
380  BTag->setVariable<float>(basename, "dRFlightDir", deltaRFlightDir);
381 
382  if (basename == "JetFitter"){
383  BTag->setTaggerInfo(nVTX, xAOD::BTagInfo::JetFitter_nVTX);
384  BTag->setTaggerInfo(nSingleTracks, xAOD::BTagInfo::JetFitter_nSingleTracks);
385  BTag->setTaggerInfo(nTracksAtVtx, xAOD::BTagInfo::JetFitter_nTracksAtVtx);
386  BTag->setTaggerInfo(mass, xAOD::BTagInfo::JetFitter_mass);
387  BTag->setTaggerInfo(energyFraction, xAOD::BTagInfo::JetFitter_energyFraction);
388  BTag->setTaggerInfo(significance3d, xAOD::BTagInfo::JetFitter_significance3d);
389  BTag->setTaggerInfo(deltaeta, xAOD::BTagInfo::JetFitter_deltaeta);
390  BTag->setTaggerInfo(deltaphi, xAOD::BTagInfo::JetFitter_deltaphi);
391  } else {
392  BTag->setVariable<int>(basename, "nVTX", nVTX);
393  BTag->setVariable<int>(basename, "nSingleTracks", nSingleTracks);
394  BTag->setVariable<int>(basename, "nTracksAtVtx", nTracksAtVtx);
395  BTag->setVariable<float>(basename, "mass", mass);
396  BTag->setVariable<float>(basename, "energyFraction", energyFraction);
397  BTag->setVariable<float>(basename, "significance3d", significance3d);
398  BTag->setVariable<float>(basename, "deltaeta", deltaeta);
399  BTag->setVariable<float>(basename, "deltaphi", deltaphi);
400  }
401 }

◆ fillJetFitterVariables()

StatusCode Analysis::JetFitterVariablesFactory::fillJetFitterVariables ( const xAOD::Jet myJet,
xAOD::BTagging BTag,
const Trk::VxJetFitterVertexInfo myJetFitterInfo,
std::string  basename 
) const
virtual

Implements Analysis::IJetFitterVariablesFactory.

Definition at line 67 of file JetFitterVariablesFactory.cxx.

67  {
68 
69  //VALERIO NASTY HACK!!!!
70  bool nastyVsRevertPosToNeg = (basename.find("Flip")!=std::string::npos);
71  int nVTX(0);
72  int nTracksAtVtx(0);
73  int nSingleTracks(0);
74  float energyFraction(0);
75  float mass(0);
76  float mass_uncorr(0);
77  float significance3d(0);
78  float deltaphi(0.);
79  float deltaeta(0.);
80  float chi2(0.);
81  int ndof(0);
82  float deltaRFlightDir(0.);
83 
84  std::vector<Trk::VxJetCandidate*> myVertices;
85  Trk::VxJetCandidate* myVxJetCandidate = nullptr;
86  if (myJetFitterInfo) myVertices = myJetFitterInfo->verticesJF();
87  if(myVertices.size() == 0){
88  ATH_MSG_DEBUG("#BTAG# Trk::VxJetCandidate not found for jet fitter ");
89  fill(BTag, basename, mass_uncorr, nVTX, nSingleTracks, nTracksAtVtx, mass, energyFraction, significance3d, deltaeta, deltaphi, chi2, ndof, deltaRFlightDir);
90  return StatusCode::SUCCESS;
91  }
92  if(myVertices.size() > 0) myVxJetCandidate=dynamic_cast<Trk::VxJetCandidate*>(myVertices[0]);
93  if (myVxJetCandidate==0) {
94  ATH_MSG_WARNING("#BTAG# No correct VxJetCandidate could be retrieved." );
95  fill(BTag, basename, mass_uncorr, nVTX, nSingleTracks, nTracksAtVtx, mass, energyFraction, significance3d, deltaeta, deltaphi, chi2, ndof, deltaRFlightDir);
96  return StatusCode::SUCCESS;
97  }
98 
99  const Trk::VxJetCandidate& myJetCandidate =*myVxJetCandidate;
100 
101  const Trk::SelectedTracksInJet* mySelectedTracksInJet = myJetFitterInfo->getSelectedTracksInJet();
102 
103 
104  //put all needed information inside :-)
105 
106  //const double s_massks=497.648;
107  const double s_pion=139.57018;//hard coded pion mass ;-)
108 
109  double energyFromPrimary=0.;
110  double energyFromSecondary=0.;
111 
112  // get fit quality variables for the PV of jetfitter
113  const Trk::VxVertexOnJetAxis* pvtxjet = myVxJetCandidate->getPrimaryVertex();
114  const Trk::FitQuality& fitquality = pvtxjet->fitQuality();
115  chi2 = fitquality.chiSquared();
116  ndof = fitquality.numberDoF();
117 
118  if (mySelectedTracksInJet!=0)
119  {
120  ATH_MSG_DEBUG(" Adding the tracks from primary vertex information ");
121  const std::vector<const Trk::ITrackLink*> & myPrimaryLinks=mySelectedTracksInJet->getPrimaryTrackLinks();
122 
123  std::vector<const Trk::ITrackLink*>::const_iterator myPrimaryLinksBegin=myPrimaryLinks.begin();
124  std::vector<const Trk::ITrackLink*>::const_iterator myPrimaryLinksEnd=myPrimaryLinks.end();
125 
126  for(std::vector<const Trk::ITrackLink*>::const_iterator myPrimaryLinksIter=myPrimaryLinksBegin;
127  myPrimaryLinksIter!=myPrimaryLinksEnd;
128  ++myPrimaryLinksIter)
129  {
130  const Trk::TrackParameters* myParameters=(*myPrimaryLinksIter)->parameters();
131  if (myParameters)
132  {
133  energyFromPrimary+=std::sqrt(s_pion*s_pion+myParameters->momentum().mag2());
134  }
135  else
136  {
137  ATH_MSG_WARNING(" no perigee in track for energy computation. Skipping primary track...");
138  }
139  }
140  } else
141  {
142  ATH_MSG_DEBUG(" No information about further primary tracks available. Normal in JetFitter vs. 1");
143  }
144 
145 
146  const Trk::RecVertexPositions & recVertexPositions=myJetCandidate.getRecVertexPositions();
147  const Amg::VectorX & vertexPosition=recVertexPositions.position();
148  const Amg::MatrixX & vertexCovMatrix = recVertexPositions.covariancePosition();
149 
150  Amg::Vector3D primaryPos(vertexPosition[Trk::jet_xv],
151  vertexPosition[Trk::jet_yv],
152  vertexPosition[Trk::jet_zv]);
153 
154  Amg::Vector3D flightAxis(1,1,1);//has to be different from 0
155  Amg::setPhi(flightAxis, vertexPosition[Trk::jet_phi]);
156  Amg::setTheta(flightAxis, vertexPosition[Trk::jet_theta]);
157 
158  xAOD::IParticle::FourMom_t JetVector = myJet.p4();
159 
160  //loop over primary vertex
161  const std::vector<Trk::VxTrackAtVertex*> & TracksAtPrimary=myJetCandidate.getPrimaryVertex()->getTracksAtVertex();
162  const std::vector<Trk::VxTrackAtVertex*>::const_iterator TracksAtPrimaryBegin=TracksAtPrimary.begin();
163  const std::vector<Trk::VxTrackAtVertex*>::const_iterator TracksAtPrimaryEnd=TracksAtPrimary.end();
164 
165  for (std::vector<Trk::VxTrackAtVertex*>::const_iterator TracksAtPrimaryIter=TracksAtPrimaryBegin;
166  TracksAtPrimaryIter!=TracksAtPrimaryEnd;
167  ++TracksAtPrimaryIter) {
168 
169  //FIXME: dynamic cast necessary? neutral perigee commented out, fix when vertex supports neutral
170  if (dynamic_cast<const Trk::Perigee*>((*TracksAtPrimaryIter)->perigeeAtVertex())!=0)
171  {
172 
173  energyFromPrimary+=
174  std::sqrt(s_pion*s_pion+
175  (*TracksAtPrimaryIter)->perigeeAtVertex()->momentum().mag2());
176  }
177  else
178  {
179  ATH_MSG_ERROR(" FIXME: VERTEX DOESN'T SUPPORT NEUTRAL PERIGEE, commented out in line 163");
180  ATH_MSG_ERROR(" Track is not a normal track neither a KS. This is an ERROR (ask developer to fix it). Skipping track... ");
181  }
182  }
183 
184 
185 
186 
187  Amg::Vector3D sumPAllVertices(0.,0.,0.);
188  CLHEP::HepLorentzVector massVector(0,0,0,0);
189  double sumPtAdd(0.);
190 
191  double dist(0.);
192  double inverrordist(0.);
193 
194  //now access the vertices on the jet axis info...
195  std::vector<Trk::VxVertexOnJetAxis*> vectorOfVertices=myJetCandidate.getVerticesOnJetAxis();
196 
197  //then you have to order them...
198  std::vector<Trk::VxVertexOnJetAxis*>::iterator vectorOfClustersOfTrackBegin=vectorOfVertices.begin();
199  std::vector<Trk::VxVertexOnJetAxis*>::iterator vectorOfClustersOfTrackEnd=vectorOfVertices.end();
200 
201  for (std::vector<Trk::VxVertexOnJetAxis*>::const_iterator vectorOfClustersOfTrackIter=vectorOfClustersOfTrackBegin;
202  vectorOfClustersOfTrackIter!=vectorOfClustersOfTrackEnd;
203  ++vectorOfClustersOfTrackIter) {
204 
205  const std::vector<Trk::VxTrackAtVertex*> & tracksOfVertex=(*vectorOfClustersOfTrackIter)->getTracksAtVertex();
206 
207  int vertexSize=tracksOfVertex.size();
208  int ntrack=(*vectorOfClustersOfTrackIter)->getNumVertex()+5;//gets the right component (should add EDM method which does
209  if (!nastyVsRevertPosToNeg)
210  {
211  if (vertexPosition[ntrack]>0) {
212  if (vertexSize>1) {
213  nVTX+=1;
214  nTracksAtVtx+=vertexSize;
215  } else {
216  nSingleTracks+=1;
217  }
218  }
219  }
220  else
221  {
222  if (vertexPosition[ntrack]<=0) {
223  if (vertexSize>1) {
224  nVTX+=1;
225  nTracksAtVtx+=vertexSize;
226  } else {
227  nSingleTracks+=1;
228  }
229  }
230  }
231  }
232 
233  for (std::vector<Trk::VxVertexOnJetAxis*>::const_iterator vectorOfClustersOfTrackIter=vectorOfClustersOfTrackBegin;
234  vectorOfClustersOfTrackIter!=vectorOfClustersOfTrackEnd;
235  ++vectorOfClustersOfTrackIter) {
236 
237  const std::vector<Trk::VxTrackAtVertex*> & tracksOfVertex=(*vectorOfClustersOfTrackIter)->getTracksAtVertex();
238  std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackBegin=tracksOfVertex.begin();
239  std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackEnd=tracksOfVertex.end();
240 
241  int vertexSize=tracksOfVertex.size();
242 
243  int ntrack=(*vectorOfClustersOfTrackIter)->getNumVertex()+5;//gets the right component (should add EDM method which does
244  // this nasty little addition of 5...)
245 
246 
247  if ((vertexPosition[ntrack]<0 && (!nastyVsRevertPosToNeg))||(vertexPosition[ntrack]>=0 && nastyVsRevertPosToNeg)) {
249  {
250  for (std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackIter=clustersOfTrackBegin;
251  clustersOfTrackIter!=clustersOfTrackEnd;++clustersOfTrackIter) {
252 
253  energyFromPrimary+=
254  std::hypot(s_pion, (*clustersOfTrackIter)->perigeeAtVertex()->momentum().mag());
255  }
256  }
257  } else {
258 
259  if ( (nVTX>0 && vertexSize>1) || nVTX==0 ) {
260  dist+=std::abs(vertexPosition[ntrack])/vertexCovMatrix(ntrack,ntrack);
261  if (vertexCovMatrix(ntrack,ntrack)>0)
262  {
263  inverrordist+=1./vertexCovMatrix(ntrack,ntrack);
264  }
265  else
266  {
267  ATH_MSG_WARNING("The diagonal element of the vertex cov matrix ("<<ntrack<<","<<ntrack<<") is "<<vertexCovMatrix(ntrack,ntrack)<<". It should be positive... Ignoring vertex when computing L/sigma(L)");
268  }
269  }
270 
271  Amg::Vector3D sumP(0.,0.,0.);
272  CLHEP::HepLorentzVector massThisCluster(0.,0.,0.,0.);
273 
274  //in case it's a real seconday vertex track...
275 
276  for (std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackIter=clustersOfTrackBegin;
277  clustersOfTrackIter!=clustersOfTrackEnd;
278  ++clustersOfTrackIter) {
279 
280 // const Trk::MeasuredPerigee* aMeasPer=static_cast<const Trk::MeasuredPerigee*>((*clustersOfTrackIter)->perigeeAtVertex());
281  const Trk::TrackParameters* aMeasPer=(*clustersOfTrackIter)->perigeeAtVertex();
282 // CLHEP::HepVector perigeeParms = aMeasPer->parameters();
283 
284  Amg::Vector3D mytrack(aMeasPer->momentum());
285  sumP+=mytrack;
286  if (dynamic_cast<const Trk::Perigee*>((*clustersOfTrackIter)->perigeeAtVertex())!=0)
287  {
288  massThisCluster+=CLHEP::HepLorentzVector(mytrack.x(), mytrack.y(), mytrack.z(), std::hypot(s_pion, mytrack.mag()));
289  }
290  else
291  {
292  ATH_MSG_ERROR("Neutral parameter has been taken out until Vertex has been rewritten to support neutral perigee again. ");
293  ATH_MSG_ERROR(" Track is not a normal track neither a KS. This is an ERROR (ask developer to fix it). Skipping track... ");
294  }
295  }
296 
297 
298  sumPAllVertices+=sumP;
299  double ptadd=sumP.perp(flightAxis.unit());
300  double masswithneutrals=std::sqrt(massThisCluster.mag2()+ptadd*ptadd)+ptadd;
301 
303  {
304  massVector+=massThisCluster;
305  }
306  else
307  {
308  if ( (nVTX>0 && vertexSize>1) || nVTX==0 ) {
309  massVector+=massThisCluster;
310  sumPtAdd+=ptadd;
311  }
312  }
313 
314 
316  {
317  energyFromSecondary+=std::sqrt(masswithneutrals*masswithneutrals+sumP.mag2());
318  }
319  else
320  {
321  energyFromSecondary+=std::sqrt(massThisCluster.mag2()+sumP.mag2());
322  }
323 
324 
325 
326 
327  }//end if dist<0
328  }//end vectorOfVerteces
329 
330  if (energyFromSecondary+energyFromPrimary>0) {
331  energyFraction=energyFromSecondary/(energyFromSecondary+energyFromPrimary);
332  }
333 
334  if (massVector.mag()>0) {
335  mass=std::sqrt(massVector.mag2()+sumPtAdd*sumPtAdd)+sumPtAdd;
336  mass_uncorr=massVector.mag();
337  //port range of mass to maximum 10000.
338  if (mass>5000.) {
339  mass =
340  5000.+(5000./M_PI)*2.*std::atan((M_PI/2./5000.)*(mass-5000.));
341  }
342  if (mass_uncorr>5000.) {
343  mass_uncorr =
344  5000.+(5000./M_PI)*2.*std::atan((M_PI/2./5000.)*(mass_uncorr-5000.));
345  }
346  }
347 
348  if (inverrordist!=0) {
349  significance3d=dist/std::sqrt(inverrordist);
350  //port range of significance 3d to maximum 100.
351  significance3d=100./(M_PI/2.)*std::atan((M_PI/2./100.)*significance3d);
352  }
353 
354  if (std::abs(sumPAllVertices.mag())>1e-7) {
355  deltaphi=sumPAllVertices.eta()-JetVector.Eta();
356  deltaeta=sumPAllVertices.deltaPhi(Amg::Vector3D(JetVector.Px(), JetVector.Py(), JetVector.Pz()));
357  deltaRFlightDir = std::hypot(sumPAllVertices.deltaPhi(flightAxis), sumPAllVertices.eta()-flightAxis.eta());
358  } else {
359  deltaphi=-10.;
360  deltaeta=-10.;
361  deltaRFlightDir = -10;
362  }
363 
364 
365  fill(BTag, basename, mass_uncorr, nVTX, nSingleTracks, nTracksAtVtx, mass, energyFraction, significance3d, deltaeta, deltaphi, chi2, ndof, deltaRFlightDir);
366 
367  return StatusCode::SUCCESS;
368 
369 
370  }

◆ finalize()

StatusCode Analysis::JetFitterVariablesFactory::finalize ( )
virtual

Implements Analysis::IJetFitterVariablesFactory.

Definition at line 62 of file JetFitterVariablesFactory.cxx.

62  {
63  ATH_MSG_INFO(" Finalization of JetFitterVariablesFactory succesfull");
64  return StatusCode::SUCCESS;
65 }

◆ initialize()

StatusCode Analysis::JetFitterVariablesFactory::initialize ( )
virtual

Implements Analysis::IJetFitterVariablesFactory.

Definition at line 57 of file JetFitterVariablesFactory.cxx.

57  {
58  ATH_MSG_INFO(" Initialization of JetFitterVariablesFactory succesfull");
59  return StatusCode::SUCCESS;
60 }

◆ 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::IJetFitterVariablesFactory::interfaceID ( )
inlinestaticinherited

Definition at line 47 of file IJetFitterVariablesFactory.h.

47 { return IID_IJetFitterVariablesFactory; };

◆ 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.

◆ 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  }

◆ 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.

◆ 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_addNegativeTracksToPrimaryVertex

bool Analysis::JetFitterVariablesFactory::m_addNegativeTracksToPrimaryVertex
private

Definition at line 62 of file JetFitterVariablesFactory.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_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_usePtCorrectedEnergy

bool Analysis::JetFitterVariablesFactory::m_usePtCorrectedEnergy
private

Definition at line 63 of file JetFitterVariablesFactory.h.

◆ m_useSingleTracksAlsoForMass

bool Analysis::JetFitterVariablesFactory::m_useSingleTracksAlsoForMass
private

Definition at line 64 of file JetFitterVariablesFactory.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::JetFitter_deltaeta
@ JetFitter_deltaeta
JetFitter : Delta eta between jet and momentum sum of all tracks associated with displaced vertices r...
Definition: BTaggingEnums.h:56
Trk::VertexPositions::position
const Amg::VectorX & position() const
return position of vertex
Definition: VertexPositions.cxx:95
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
IDTPM::ndof
float ndof(const U &p)
Definition: TrackParametersHelper.h:132
Trk::SelectedTracksInJet
Definition: SelectedTracksInJet.h:62
Trk::VxJetCandidate::getVerticesOnJetAxis
const std::vector< VxVertexOnJetAxis * > & getVerticesOnJetAxis(void) const
Definition: VxJetCandidate.cxx:543
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:30
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::VxVertexOnJetAxis::getTracksAtVertex
const std::vector< VxTrackAtVertex * > & getTracksAtVertex(void) const
get Tracks At Vertex Method
Definition: VxVertexOnJetAxis.cxx:102
Trk::jet_theta
@ jet_theta
Definition: JetVtxParamDefs.h:28
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
xAOD::JetFitter_nSingleTracks
@ JetFitter_nSingleTracks
JetFitter : Number of single tracks.
Definition: BTaggingEnums.h:46
M_PI
#define M_PI
Definition: ActiveFraction.h:11
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Trk::VxVertexOnJetAxis
VxVertexOnJetAxis inherits from Vertex.
Definition: VxVertexOnJetAxis.h:79
Trk::jet_xv
@ jet_xv
Definition: JetVtxParamDefs.h:27
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Amg::setPhi
Amg::RotationMatrix3D setPhi(Amg::RotationMatrix3D mat, double angle, int convention=0)
Definition: EulerAnglesHelpers.h:102
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:69
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
Trk::VxJetCandidate::getRecVertexPositions
const Trk::RecVertexPositions & getRecVertexPositions() const
Definition: VxJetCandidate.cxx:519
xAOD::JetFitter_energyFraction
@ JetFitter_energyFraction
JetFitter : Jet efrac.
Definition: BTaggingEnums.h:52
xAOD::JetFitter_nVTX
@ JetFitter_nVTX
JetFitter : Number of vertices.
Definition: BTaggingEnums.h:44
Trk::VxJetCandidate::getPrimaryVertex
const VxVertexOnJetAxis * getPrimaryVertex(void) const
Definition: VxJetCandidate.cxx:551
Analysis::JetFitterVariablesFactory::m_addNegativeTracksToPrimaryVertex
bool m_addNegativeTracksToPrimaryVertex
Definition: JetFitterVariablesFactory.h:62
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::SelectedTracksInJet::getPrimaryTrackLinks
const std::vector< const ITrackLink * > & getPrimaryTrackLinks() const
Get the priamry tracks (please do not delete the pointers)
Definition: SelectedTracksInJet.cxx:167
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::jet_yv
@ jet_yv
Definition: JetVtxParamDefs.h:27
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
xAOD::JetFitter_mass
@ JetFitter_mass
JetFitter : Jet mass.
Definition: BTaggingEnums.h:50
xAOD::JetFitter_nTracksAtVtx
@ JetFitter_nTracksAtVtx
JetFitter : Number of tracks at vertex.
Definition: BTaggingEnums.h:48
Trk::VxVertexOnJetAxis::fitQuality
const Trk::FitQuality & fitQuality() const
Fit quality access method.
Definition: VxVertexOnJetAxis.cxx:86
Trk::FitQuality
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition: FitQuality.h:97
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::ParametersBase
Definition: ParametersBase.h:55
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
xAOD::JetFitter_significance3d
@ JetFitter_significance3d
JetFitter : 3D vertex significance.
Definition: BTaggingEnums.h:54
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
Analysis::JetFitterVariablesFactory::m_useSingleTracksAlsoForMass
bool m_useSingleTracksAlsoForMass
Definition: JetFitterVariablesFactory.h:64
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Amg::setTheta
void setTheta(Amg::Vector3D &v, double theta)
sets the theta of a vector without changing phi nor the magnitude
Definition: GeoPrimitivesHelpers.h:89
Trk::jet_zv
@ jet_zv
position x,y,z of primary vertex
Definition: JetVtxParamDefs.h:27
Trk::VxJetCandidate
Definition: VxJetCandidate.h:72
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Analysis::JetFitterVariablesFactory::m_usePtCorrectedEnergy
bool m_usePtCorrectedEnergy
Definition: JetFitterVariablesFactory.h:63
Trk::RecVertexPositions
Definition: RecVertexPositions.h:34
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
Trk::RecVertexPositions::covariancePosition
Amg::MatrixX const & covariancePosition() const
return the covDeltaV matrix of the vertex fit
Definition: RecVertexPositions.cxx:171
xAOD::Jet_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: Jet_v1.cxx:71
a
TList * a
Definition: liststreamerinfos.cxx:10
h
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:623
xAOD::JetFitter_deltaphi
@ JetFitter_deltaphi
JetFitter : Delta phi between jet and momentum sum of all tracks associated with displaced vertices r...
Definition: BTaggingEnums.h:58
Trk::FitQuality::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56
Trk::jet_phi
@ jet_phi
Definition: JetVtxParamDefs.h:28
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
Trk::FitQuality::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
Trk::VxJetFitterVertexInfo::verticesJF
const std::vector< Trk::VxJetCandidate * > & verticesJF() const
Definition: VxJetFitterVertexInfo.h:112
xAODType::BTag
@ BTag
The object is a b-tagging object.
Definition: ObjectType.h:60
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::VxJetFitterVertexInfo::getSelectedTracksInJet
const Trk::SelectedTracksInJet * getSelectedTracksInJet() const
Definition: VxJetFitterVertexInfo.h:107
Analysis::JetFitterVariablesFactory::fill
void fill(xAOD::BTagging *BTag, const std::string &basename, float mass_uncorr, int nVTX, int nSingleTracks, int nTracksAtVtx, float mass, float energyFraction, float significance3d, float deltaeta, float deltaphi, float chi2, int ndof, float deltaRFlightDir) const
Definition: JetFitterVariablesFactory.cxx:373
fitman.k
k
Definition: fitman.py:528
beamspotman.basename
basename
Definition: beamspotman.py:640