|
ATLAS Offline Software
|
#include <MuonSegmentMomentumFromField.h>
|
| MuonSegmentMomentumFromField (const std::string &, const std::string &, const IInterface *) |
| constructor More...
|
|
MuonSegmentMomentumFromField & | operator= (const MuonSegmentMomentumFromField &)=delete |
|
virtual StatusCode | initialize () |
| to initiate private members More...
|
|
virtual void | fitMomentum2Segments (const EventContext &ctx, const Muon::MuonSegment *segment1, const Muon::MuonSegment *segment2, double &signedMomentum) const |
| fits a momentum to 2 segments More...
|
|
virtual void | fitMomentum2Segments_old (const EventContext &ctx, const Muon::MuonSegment *segment1, const Muon::MuonSegment *segment2, double &signedMomentum) const |
|
virtual void | fitMomentumVectorSegments (const EventContext &, const std::vector< const Muon::MuonSegment * > &, double &signedMomentum) const |
| fits a momentum to a vector of segments More...
|
|
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 |
|
◆ StoreGateSvc_t
◆ MuonSegmentMomentumFromField()
MuonSegmentMomentumFromField::MuonSegmentMomentumFromField |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation 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.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation 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.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation 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.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation 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.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
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
◆ fieldIntegralEstimate()
Definition at line 66 of file MuonSegmentMomentumFromField.cxx.
86 throw std::runtime_error(Form(
"File: %s, Line: %d\nMuonSegmentMomentumFromField::fieldIntegralEstimate() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (
m_fieldCondObjInputKey.
key()).c_str()));
88 fieldCondObj->getInitializedCache(fieldCache);
90 fieldCache.
getField(point1.data(),field1.data());
91 fieldCache.
getField(point2.data(),field2.data());
92 fieldCache.
getField(point3.data(),field3.data());
94 field1[2]=field2[2]=field3[2]=0;
96 Amg::Vector3D crossvec=posdiff.unit().cross(field1+field2+field3);
98 double averagelcrossB=crossvec.mag()/3;
99 if (rphidir.x()*fieldsum.x()+rphidir.y()*fieldsum.y()<0) averagelcrossB=-averagelcrossB;
100 ATH_MSG_DEBUG(
"field integral " << averagelcrossB <<
"dist " << posdiff.mag() <<
" tot " << averagelcrossB*posdiff.mag());
101 return averagelcrossB*posdiff.mag();
◆ fieldIntegralEstimate_old()
Definition at line 244 of file MuonSegmentMomentumFromField.cxx.
264 throw std::runtime_error(Form(
"File: %s, Line: %d\nMuonSegmentMomentumFromField::fieldIntegralEstimate_old() - Failed to retrieve AtlasFieldCacheCondObj with key %s", __FILE__, __LINE__, (
m_fieldCondObjInputKey.
key()).c_str()));
266 fieldCondObj->getInitializedCache(fieldCache);
268 fieldCache.
getField(point1.data(),field1.data());
269 fieldCache.
getField(point2.data(),field2.data());
270 fieldCache.
getField(point3.data(),field3.data());
272 double averageBcrossl=(field1.cross(posdiff.unit()).mag()+field2.cross(posdiff.unit()).mag()+field3.cross(posdiff.unit()).mag())/3;
273 ATH_MSG_DEBUG(
"field integral " << averageBcrossl <<
"dist " << posdiff.mag() <<
" tot " << averageBcrossl*posdiff.mag());
274 return averageBcrossl*posdiff.mag();
◆ fitMomentum2Segments()
fits a momentum to 2 segments
Estimate signed momentum for two segments by fitting 2 segments to one approximate track model
Implements Muon::IMuonSegmentMomentumEstimator.
Definition at line 104 of file MuonSegmentMomentumFromField.cxx.
110 ATH_MSG_VERBOSE(
" Executing MuonSegmentMomentumTool fitMomentum2Segments ");
119 double theta2=myseg2->globalDirection().theta();
121 double phi2=myseg2->globalDirection().phi();
122 double deltaphi=std::abs(phi2-phi1);
123 double deltatheta=99999999;
124 if (std::abs(deltaphi-2*
M_PI)<deltaphi) deltaphi=std::abs(deltaphi-2*
M_PI);
125 if (deltaphi<
M_PI/2) deltatheta=theta2-theta1;
127 if (theta1>
M_PI/2) deltatheta=2*
M_PI-theta2-theta1;
128 else deltatheta=-theta1-theta2;
130 double dist1=-1,dist2=-1;
131 const Trk::RIO_OnTrack *firstphi1=
nullptr,*lastphi1=
nullptr,*firstphi2=
nullptr,*lastphi2=
nullptr;
145 if (!firstphi1) firstphi1=rot;
149 for (
int i=0;
i<(
int)myseg2->numberOfMeasurementBases();
i++){
159 if (!firstphi2) firstphi2=rot;
165 if (firstphi2) dist2=std::abs((firstphi2->globalPosition()-lastphi2->globalPosition()).dot(myseg2->globalDirection()));
172 for (
int itry=0;itry<2;itry++){
185 signedMomentum =-.3e3*fieldintegral/deltatheta;
186 if(std::abs(signedMomentum)<1000.) signedMomentum = 1e6;
187 ATH_MSG_DEBUG(
"integral: " << fieldintegral <<
" deltatheta: " << deltatheta <<
" signedmomentum : " << signedMomentum);
189 double resi[4],qoverp[4];
190 for (
int i=0;
i<4;
i++){
191 std::optional<Trk::TransportJacobian> jac{};
195 ctx, startpar,worstseg->associatedSurface(),
199 if (
par && jac && (*jac)(1,4)!=0){
202 qoverp[
i] = 1/signedMomentum;
204 double delta_qoverp=
residual/(*jac)(1,4);
205 double der_simple = -10.*(bestseg->
globalPosition()-worstseg->globalPosition()).
mag()/(.3*fieldintegral);
208 if(qoverp[
i]!=qoverp[
i-1]) {
210 ATH_MSG_DEBUG(
" numerical derivative " <<
derivative <<
" derivative from track " << (*jac)(1,4) <<
" der_simple " << der_simple);
211 if(std::abs(
derivative)>std::abs((*jac)(1,4))) {
217 if(std::abs(der_simple)>std::abs((*jac)(1,4))) {
218 ATH_MSG_DEBUG(
" use simple numerical derivative " << der_simple <<
" derivative from track " << (*jac)(1,4));
222 ATH_MSG_DEBUG(
"residual: " <<
residual <<
" jac " << (*jac)(1,4) <<
" signedmomentum: " << signedMomentum <<
" delta_qoverp " << delta_qoverp);
223 double signedMomentum_updated = signedMomentum/(1+signedMomentum*delta_qoverp);
224 if(std::abs(signedMomentum_updated)<1000.) {
225 ATH_MSG_DEBUG(
"Too low signed momentum " << signedMomentum_updated );
227 signedMomentum = signedMomentum_updated>0? 1000.:-1000;
230 if(
i<3) signedMomentum = signedMomentum_updated;
238 if(itry==1)
ATH_MSG_DEBUG(
"NOT converged residual after two trials ");
◆ fitMomentum2Segments_old()
Estimate signed momentum for two segments by fitting 2 segments to one approximate track model
Definition at line 277 of file MuonSegmentMomentumFromField.cxx.
283 ATH_MSG_VERBOSE(
" Executing MuonSegmentMomentumTool fitMomentum2Segments ");
292 double theta2=myseg2->globalDirection().theta();
294 double phi2=myseg2->globalDirection().phi();
295 double deltaphi=std::abs(phi2-phi1);
296 double deltatheta=99999999;
297 if (std::abs(deltaphi-2*
M_PI)<deltaphi) deltaphi=std::abs(deltaphi-2*
M_PI);
298 if (deltaphi<
M_PI/2) deltatheta=theta2-theta1;
300 if (theta1>
M_PI/2) deltatheta=2*
M_PI-theta2-theta1;
301 else deltatheta=-theta1-theta2;
303 double dist1=-1,dist2=-1;
304 const Trk::RIO_OnTrack *firstphi1=
nullptr,*lastphi1=
nullptr,*firstphi2=
nullptr,*lastphi2=
nullptr;
318 if (!firstphi1) firstphi1=rot;
322 for (
int i=0;
i<(
int)myseg2->numberOfMeasurementBases();
i++){
332 if (!firstphi2) firstphi2=rot;
338 if (firstphi2) dist2=std::abs((firstphi2->globalPosition()-lastphi2->globalPosition()).dot(myseg2->globalDirection()));
343 signedMomentum =-.3e3*fieldintegral/deltatheta;
344 ATH_MSG_DEBUG(
"integral: " << fieldintegral <<
" deltatheta: " << deltatheta <<
" signedmomentum : " << signedMomentum);
345 for (
int i=0;
i<3;
i++){
348 std::optional<Trk::TransportJacobian> jac{};
350 ctx,startpar,worstseg->associatedSurface(),
353 if (
par && jac && (*jac)(1,4)!=0){
355 double delta_qoverp=
residual/(*jac)(1,4);
356 signedMomentum=1/(1/signedMomentum+delta_qoverp);
357 ATH_MSG_DEBUG(
"residual: " <<
residual <<
" jac " << (*jac)(1,4) <<
" dp " << delta_qoverp <<
" signedmomentum: " << signedMomentum);
◆ fitMomentumVectorSegments()
void MuonSegmentMomentumFromField::fitMomentumVectorSegments |
( |
const EventContext & |
ctx, |
|
|
const std::vector< const Muon::MuonSegment * > & |
segments, |
|
|
double & |
signedMomentum |
|
) |
| const |
|
virtual |
fits a momentum to a vector of segments
Estimate signed momentum from vector of MDT/CSC segments using fit to pairs of segments
Implements Muon::IMuonSegmentMomentumEstimator.
Definition at line 38 of file MuonSegmentMomentumFromField.cxx.
44 ATH_MSG_VERBOSE(
" Executing MuonSegmentMomentumTool fitMomentumVectorSegments ");
45 ATH_MSG_DEBUG(
" fitMomentumVectorSegments " << segments.size() <<
" segments " );
47 std::vector<const Muon::MuonSegment*>::const_iterator
it = segments.begin();
48 std::vector<const Muon::MuonSegment*>::const_iterator it2 = segments.begin();
49 std::vector<const Muon::MuonSegment*>::const_iterator it_end = segments.end();
63 ATH_MSG_DEBUG(
" Estimated signed momentum " << signedMomentum );
◆ initialize()
StatusCode MuonSegmentMomentumFromField::initialize |
( |
| ) |
|
|
virtual |
◆ inputHandles()
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()
const InterfaceID & Muon::IMuonSegmentMomentumEstimator::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ operator=()
◆ outputHandles()
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()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_detStore
◆ m_doOld
Gaudi::Property<bool> MuonSegmentMomentumFromField::m_doOld {this, "DoOld", false, "Use old fitMomentum2Segments"} |
|
private |
◆ m_evtStore
◆ m_fieldCondObjInputKey
◆ m_idHelperSvc
◆ m_navigator
◆ m_propagator
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
virtual void fitMomentum2Segments(const EventContext &ctx, const Muon::MuonSegment *segment1, const Muon::MuonSegment *segment2, double &signedMomentum) const
fits a momentum to 2 segments
double fieldIntegralEstimate_old(const EventContext &ctx, const Muon::MuonSegment *segment1, const Muon::MuonSegment *segment2) const
double fieldIntegralEstimate(const EventContext &ctx, const Muon::MuonSegment *segment1, const Muon::MuonSegment *segment2) const
Eigen::Matrix< double, 2, 1 > Vector2D
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
ToolHandle< Trk::IPropagator > m_propagator
virtual const Amg::Vector3D & globalPosition() const override=0
Interface method to get the global Position.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
constexpr double derivative(const double x)
unsigned int numberOfMeasurementBases() const
Return the number of contained Trk::MeasurementBase (s)
virtual void setOwner(IDataHandleHolder *o)=0
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Base class for all CompetingRIOsOnTack implementations, extends the common MeasurementBase.
const MeasurementBase * measurement(unsigned int) const
returns the Trk::MeasurementBase objects depending on the integer
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Gaudi::Property< bool > m_doOld
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
@ FullField
Field is set to be realistic, but within a given Volume.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
ToolHandle< Trk::INavigator > m_navigator
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
virtual void fitMomentum2Segments_old(const EventContext &ctx, const Muon::MuonSegment *segment1, const Muon::MuonSegment *segment2, double &signedMomentum) const
Identifier identify() const
return the identifier -extends MeasurementBase
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
virtual const Amg::Vector3D & globalPosition() const override final
global position
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Scalar mag() const
mag method
virtual const Trk::PlaneSurface & associatedSurface() const override final
returns the surface for the local to global transformation
const Amg::Vector3D & globalDirection() const
global direction