ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::TRT_TrackExtensionToolCosmics Class Reference

#include <TRT_TrackExtensionToolCosmics.h>

Inheritance diagram for InDet::TRT_TrackExtensionToolCosmics:
Collaboration diagram for InDet::TRT_TrackExtensionToolCosmics:

Classes

class  EventData

Public Member Functions

 TRT_TrackExtensionToolCosmics (const std::string &, const std::string &, const IInterface *)
virtual ~TRT_TrackExtensionToolCosmics ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual std::vector< const Trk::MeasurementBase * > & extendTrack (const EventContext &ctx, const Trk::Track &, InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data, InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap &used) const override
virtual std::vector< const Trk::MeasurementBase * > & extendTrack (const EventContext &ctx, const Trk::TrackParameters *, InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data, InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap &used) const override
virtual Trk::TrackSegmentfindSegment (const EventContext &ctx, const Trk::TrackParameters *, InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data, InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap &used) const override
virtual Trk::TracknewTrack (const EventContext &ctx, const Trk::Track &, InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data, InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap &used) const override
virtual std::unique_ptr< InDet::ITRT_TrackExtensionTool::IEventDatanewEvent (const EventContext &ctx) const override
virtual MsgStream & dump (MsgStream &out) const override
virtual std::ostream & dump (std::ostream &out) const override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void analyze_tpars (const std::vector< const Trk::TrackParameters * > *tpars, InDet::TRT_TrackExtensionToolCosmics::EventData &event_data) const
Trk::SurfacefindBoundarySurface (const Trk::TrackParameters &par, Trk::PropDirection dir, InDet::TRT_TrackExtensionToolCosmics::EventData &event_data) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Static Protected Member Functions

static MsgStream & dumpConditions (MsgStream &out)
static MsgStream & dumpEvent (MsgStream &out)
static Amg::Vector3D intersect (const Trk::Surface *surf, const Trk::Perigee *per)

Protected Attributes

ToolHandle< Trk::IExtrapolatorm_extrapolator {this, "Extrapolator", "Trk::Extrapolator/InDetExtrapolator"}
ToolHandle< Trk::IRIO_OnTrackCreatorm_riontrackN {this, "RIOonTrackToolNoDr", "InDet::TRT_DriftCircleOnTrackNoDriftTimeTool/TRT_DriftCircleOnTrackNoDriftTimeTool"}
int m_outputlevel {}
int m_nprint {}
DoubleProperty m_roadwidth
DoubleProperty m_roadwidth_locz
BooleanProperty m_searchNeighbour
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trtname {this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircles"}
AtlasDetectorIDm_idHelper {}
const TRT_IDm_trtid {}

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

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

◆ TRT_TrackExtensionToolCosmics()

InDet::TRT_TrackExtensionToolCosmics::TRT_TrackExtensionToolCosmics ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 31 of file TRT_TrackExtensionToolCosmics.cxx.

33 : AthAlgTool(t,n,p)
34{
35 declareInterface<ITRT_TrackExtensionTool>(this);
36}
AthAlgTool()
Default constructor:

◆ ~TRT_TrackExtensionToolCosmics()

InDet::TRT_TrackExtensionToolCosmics::~TRT_TrackExtensionToolCosmics ( )
virtualdefault

Member Function Documentation

◆ analyze_tpars()

void InDet::TRT_TrackExtensionToolCosmics::analyze_tpars ( const std::vector< const Trk::TrackParameters * > * tpars,
InDet::TRT_TrackExtensionToolCosmics::EventData & event_data ) const
protected

Definition at line 230 of file TRT_TrackExtensionToolCosmics.cxx.

232{
233 msg(MSG::DEBUG)<<"Number of tpars: "<<tpars->size()<<endmsg;
234
235 double lastz=-99999;
236 std::vector< const Trk::TrackParameters* >::const_iterator parameterIter = tpars->begin();
237 for ( ; parameterIter != tpars->end(); ++parameterIter) {
238 msg(MSG::DEBUG)<< "par pos: " << (**parameterIter).position() <<endmsg;
239
240 if ( (*parameterIter)->associatedSurface().associatedDetectorElementIdentifier()==0 ) {
241 msg(MSG::DEBUG)<<"No DE identifier!!!"<<endmsg;
242 continue;
243 }
244
245 const Identifier& DCId = (*parameterIter)->associatedSurface().associatedDetectorElementIdentifier();
246 if ( m_trtid->is_trt( DCId ) ) {
247
248 IdentifierHash detElements[3];
249 detElements[1]=(*parameterIter)->associatedSurface().associatedDetectorElement()->identifyHash();
251 //fill entry 0 and 2 with the neighbours (different in phi but identical in layer)
252 int bec=m_trtid->barrel_ec(DCId);
253 int phi_mod=m_trtid->phi_module(DCId);
254 int layer_or_wheel=m_trtid->layer_or_wheel(DCId);
255 int slay=m_trtid->straw_layer(DCId);
256
257 phi_mod-=1;
258 if(phi_mod<0) phi_mod=31;
259
260 Identifier temp=m_trtid->straw_id(bec,phi_mod,layer_or_wheel,slay,0);
261 detElements[0]=m_trtid->straw_layer_hash(temp);
262
263 phi_mod+=2;
264 if(phi_mod>31) phi_mod=0;
265 temp=m_trtid->straw_id(bec,phi_mod,layer_or_wheel,slay,0);
266 detElements[2]=m_trtid->straw_layer_hash(temp);
267 }
268 double maxdist=m_roadwidth;
269 const InDet::TRT_DriftCircle *circ=nullptr;
270
271 for(int i=-1;i<2;i++) {
272 if(m_searchNeighbour || i==0){
273
274 //check if this PRD exists
275 // get the driftCircleCollection belonging to this id
276 const InDet::TRT_DriftCircleCollection *container = event_data.m_trtcontainer->indexFindPtr(detElements[i+1]);
277
278 if(container==nullptr) {
279 msg(MSG::DEBUG)<<"for the current detectorElement no DriftCircleContainer seems to exist: "<<m_trtid->show_to_string(m_trtid->layer_id(detElements[i+1]))<<endmsg;
280 continue;
281 }
282
283 msg(MSG::DEBUG)<< "There are " << container->size() << " entries in the TRT_DriftCircleCollection "<<m_trtid->show_to_string(m_trtid->layer_id(detElements[i+1])) <<endmsg;
284
285 //take the closest one in case it satisfies some default cuts
286 InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = container->begin();
287 for (; driftCircleIterator != container->end(); ++driftCircleIterator) {
288
289 //get the associated surface of the driftcircle
290 const Trk::Surface &dc_surface=(*driftCircleIterator)->detectorElement()->surface((*driftCircleIterator)->identify());
291
292 //get the local position of the track prediction in the frame of the driftcircle
293 std::optional<Amg::Vector2D> lpos=dc_surface.globalToLocal((*parameterIter)->position());
294
295 double distance=m_roadwidth+1;
296 if(lpos){
297 distance = std::abs(lpos->x());
298 msg(MSG::DEBUG)<<"Hit "<<m_trtid->show_to_string((*driftCircleIterator)->identify())<<" has a distance of "<<distance<<endmsg;
299
300 double dist_locz=std::abs(lpos->y());
301 if(distance<m_roadwidth+1){
302 if(!dc_surface.insideBounds(*lpos,m_roadwidth,m_roadwidth_locz)){
303 msg(MSG::DEBUG)<<"Hit not inside surface bounds! "<<distance<<" , "<<dist_locz<<endmsg;
304 msg(MSG::DEBUG)<<"\trejecting hit"<<endmsg;
306 }
307 }
308
309 }
310
311 if(distance<maxdist){
312 maxdist=distance;
313 circ=(*driftCircleIterator);
314 }
315 }
316 }
317 }
318 msg(MSG::DEBUG)<<"Maximal distance: "<<maxdist<<endmsg;
319 if(circ){
320 msg(MSG::DEBUG)<<"Found Driftcircle! Adding it to list ..."<<m_trtid->show_to_string(circ->identify())<<endmsg;
321 if (lastz<-9999) lastz=(**parameterIter).position().z();
322 if (std::abs(lastz-(**parameterIter).position().z())>500.) return;
323 lastz=(**parameterIter).position().z();
324 const Trk::StraightLineSurface *slsurf=dynamic_cast<const Trk::StraightLineSurface *>(&circ->detectorElement()->surface(circ->identify())); if(!slsurf) continue;
325 Trk::AtaStraightLine atasl((**parameterIter).position(),(**parameterIter).parameters()[Trk::phi],(**parameterIter).parameters()[Trk::theta],(**parameterIter).parameters()[Trk::qOverP],*slsurf);
326 const Trk::MeasurementBase *newmeas=m_riontrackN->correct(*circ,atasl,Gaudi::Hive::currentContext());
327 event_data.m_measurement.push_back(newmeas);
328
329 }
330 }
331 }
332}
#define endmsg
MsgStream & msg() const
virtual const InDetDD::TRT_BaseElement * detectorElement() const override final
return the detector element corresponding to this PRD
std::vector< const Trk::MeasurementBase * > m_measurement
ToolHandle< Trk::IRIO_OnTrackCreator > m_riontrackN
Trk::PrepRawDataCollection< TRT_DriftCircle > TRT_DriftCircleCollection
Identifier identify() const
return the identifier
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const =0
virtual methods to be overwritten by the inherited surfaces
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ phi
Definition ParamDefs.h:75

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

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

◆ dump() [1/2]

MsgStream & InDet::TRT_TrackExtensionToolCosmics::dump ( MsgStream & out) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 101 of file TRT_TrackExtensionToolCosmics.cxx.

102{
103 out<<std::endl;
104 if(m_nprint) return dumpEvent(out);
105 return dumpConditions(out);
106}
static MsgStream & dumpConditions(MsgStream &out)

◆ dump() [2/2]

std::ostream & InDet::TRT_TrackExtensionToolCosmics::dump ( std::ostream & out) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 132 of file TRT_TrackExtensionToolCosmics.cxx.

133{
134 return out;
135}

◆ dumpConditions()

MsgStream & InDet::TRT_TrackExtensionToolCosmics::dumpConditions ( MsgStream & out)
staticprotected

Definition at line 113 of file TRT_TrackExtensionToolCosmics.cxx.

114{
115
116 return out;
117}

◆ dumpEvent()

MsgStream & InDet::TRT_TrackExtensionToolCosmics::dumpEvent ( MsgStream & out)
staticprotected

Definition at line 123 of file TRT_TrackExtensionToolCosmics.cxx.

124{
125 return out;
126}

◆ evtStore()

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.

◆ extendTrack() [1/2]

std::vector< const Trk::MeasurementBase * > & InDet::TRT_TrackExtensionToolCosmics::extendTrack ( const EventContext & ctx,
const Trk::Track & Tr,
InDet::ITRT_TrackExtensionTool::IEventData & virt_event_data,
InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap & used ) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 192 of file TRT_TrackExtensionToolCosmics.cxx.

196{
197 InDet::TRT_TrackExtensionToolCosmics::EventData &
199
200 event_data.m_measurement.clear();
201
202 if(not event_data.m_trtcontainer) return event_data.m_measurement;
203
204 const Trk::TrackStates*
205 tsos = Tr.trackStateOnSurfaces();
206
208 par = (*(tsos->rbegin()))->trackParameters(); if(!par ) return event_data.m_measurement;
210 parb = (*(tsos->begin()))->trackParameters();
211
212
213 if(parb && par!=parb) {
214
215 const Amg::Vector3D& g1 = par ->position();
216 const Amg::Vector3D& g2 = parb->position();
217 if((g2.x()*g2.x()+g2.y()*g2.y()) > (g1.x()*g1.x()+g1.y()*g1.y())) par=parb;
218 }
219
220 if(Tr.perigeeParameters()) {
221 return extendTrack(ctx, Tr.perigeeParameters(),event_data, used);
222 }
223 event_data.m_measurement.clear();
224 return event_data.m_measurement;
225}
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
virtual std::vector< const Trk::MeasurementBase * > & extendTrack(const EventContext &ctx, const Trk::Track &, InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data, InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap &used) const override
static EventData & getPrivateEventData(InDet::ITRT_TrackExtensionTool::IEventData &virt_event_data)
const Amg::Vector3D & position() const
Access method for the position.
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const Perigee * perigeeParameters() const
return Perigee.
Eigen::Matrix< double, 3, 1 > Vector3D
DataVector< const Trk::TrackStateOnSurface > TrackStates
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ extendTrack() [2/2]

std::vector< const Trk::MeasurementBase * > & InDet::TRT_TrackExtensionToolCosmics::extendTrack ( const EventContext & ctx,
const Trk::TrackParameters * par,
InDet::ITRT_TrackExtensionTool::IEventData & virt_event_data,
InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap & used ) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 352 of file TRT_TrackExtensionToolCosmics.cxx.

356{
357 InDet::TRT_TrackExtensionToolCosmics::EventData &
359
360 event_data.m_measurement.clear();
361
362 std::vector<Identifier> vecID;
363 std::vector<const Trk::TrackParameters*> vecTP;
364
365
366
367 std::vector<const Trk::TrackParameters* >* tpars_down=nullptr;
368 std::vector<const Trk::TrackParameters* >* tpars_up=nullptr;
369 const Trk::Perigee *per=dynamic_cast<const Trk::Perigee *>(par);
370 if (!per) {
371 msg(MSG::FATAL)<<"Track perigee not found!"<<endmsg;
372 return event_data.m_measurement;
373 }
374
375 if (!event_data.m_trtcontainer) {
376 return event_data.m_measurement;
377 }
378
379 InDet::TRT_DriftCircleContainer::const_iterator
380 w = event_data.m_trtcontainer->begin(),we = event_data.m_trtcontainer->end();
381 for(; w!=we; ++w) {
382 if ((**w).empty()) continue;
383 const Trk::Surface &surf=(**(**w).begin()).detectorElement()->surface();
384 Amg::Vector3D pos=intersect(&surf,per);
385 Amg::Vector3D locintersec = (surf.transform().inverse())*pos;
386 Amg::Vector2D locpos(locintersec.x(), locintersec.y());
387 if (pos.perp()<500. || !surf.insideBounds(locpos,50.,50.)) continue;
388
389 Amg::Vector3D pos2=surf.transform()*Amg::Vector3D(locintersec.x(),locintersec.y(),0);
390
391 const Trk::PlaneSurface *plsurf=dynamic_cast<const Trk::PlaneSurface *>(&surf);
392 const Trk::DiscSurface *discsurf=dynamic_cast<const Trk::DiscSurface *>(&surf);
393 Trk::TrackParameters *newpar=nullptr;
394 if (plsurf) newpar=new Trk::AtaPlane(pos2,per->parameters()[Trk::phi],per->parameters()[Trk::theta],per->parameters()[Trk::qOverP],*plsurf);
395 else newpar=new Trk::AtaDisc(pos2,per->parameters()[Trk::phi],per->parameters()[Trk::theta],per->parameters()[Trk::qOverP],*discsurf);
396 vecTP.push_back(newpar);
397 }
398 tpars_down=new std::vector<const Trk::TrackParameters* >;
399 tpars_up=new std::vector<const Trk::TrackParameters* >;
400
401 if(!tpars_down || !tpars_up) return event_data.m_measurement;
402
403 tp_sort_cosmics sorter(per->parameters()[Trk::theta]);
404 std::sort(vecTP.begin(),vecTP.end(),sorter);
405 for (const auto *tmppar : vecTP){
406 if ((per->parameters()[Trk::theta]>M_PI/2 && per->position().z()<tmppar->position().z()) || (per->parameters()[Trk::theta]<M_PI/2 && per->position().z()>tmppar->position().z())) tpars_up->push_back(tmppar);
407 else tpars_down->push_back(tmppar);
408
409 }
410 if (!tpars_up->empty()) std::reverse(tpars_up->begin(),tpars_up->end());
411
412
413 if(tpars_down){
414 analyze_tpars(tpars_down,event_data);
415 }
416 if(tpars_up){
417 analyze_tpars(tpars_up, event_data);
418 }
419
420 //clean up
421 if(tpars_up){
422 std::vector< const Trk::TrackParameters* >::const_iterator parameterIter= tpars_up->begin();
423 for ( ; parameterIter != tpars_up->end(); ++parameterIter) {
424 delete *parameterIter;
425 }
426 delete tpars_up;
427 }
428
429 if(tpars_down){
430 std::vector< const Trk::TrackParameters* >::const_iterator parameterIter = tpars_down->begin();
431 for ( ; parameterIter != tpars_down->end(); ++parameterIter) {
432 delete *parameterIter;
433 }
434 delete tpars_down;
435 }
436
437 msg(MSG::DEBUG)<<"Found "<<event_data.m_measurement.size()<<" driftcircles"<<endmsg;
438
439 return event_data.m_measurement;
440}
#define M_PI
void analyze_tpars(const std::vector< const Trk::TrackParameters * > *tpars, InDet::TRT_TrackExtensionToolCosmics::EventData &event_data) const
static Amg::Vector3D intersect(const Trk::Surface *surf, const Trk::Perigee *per)
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Eigen::Matrix< double, 2, 1 > Vector2D
ParametersT< TrackParametersDim, Charged, DiscSurface > AtaDisc
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersT< TrackParametersDim, Charged, PlaneSurface > AtaPlane
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.

◆ 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

◆ finalize()

StatusCode InDet::TRT_TrackExtensionToolCosmics::finalize ( )
overridevirtual

Definition at line 90 of file TRT_TrackExtensionToolCosmics.cxx.

91{
92 StatusCode sc = AlgTool::finalize();
93
94 return sc;
95}
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ findBoundarySurface()

Trk::Surface * InDet::TRT_TrackExtensionToolCosmics::findBoundarySurface ( const Trk::TrackParameters & par,
Trk::PropDirection dir,
InDet::TRT_TrackExtensionToolCosmics::EventData & event_data ) const
protected

Definition at line 457 of file TRT_TrackExtensionToolCosmics.cxx.

460{
461
462 const EventContext& ctx = Gaudi::Hive::currentContext();
463 const Trk::TrackParameters* test=m_extrapolator->extrapolateDirectly(ctx,
464 par,
465 *event_data.m_trtcylinder,
466 dir,true,Trk::muon).release();
467 if(test){
468 delete test;
469 return event_data.m_trtcylinder;
470 }
471
472 test=m_extrapolator->extrapolateDirectly(ctx,
473 par,
474 *event_data.m_trtdiscA,dir,true,Trk::muon).release();
475 if(test){
476 delete test;
477 return event_data.m_trtdiscA;
478 }
479
480 test=m_extrapolator->extrapolateDirectly(ctx,
481 par,
482 *event_data.m_trtdiscC,dir,true,Trk::muon).release();
483 if(test){
484 delete test;
485 return event_data.m_trtdiscC;
486 }
487
488 return nullptr;
489}
ToolHandle< Trk::IExtrapolator > m_extrapolator

◆ findSegment()

Trk::TrackSegment * InDet::TRT_TrackExtensionToolCosmics::findSegment ( const EventContext & ctx,
const Trk::TrackParameters * ,
InDet::ITRT_TrackExtensionTool::IEventData & virt_event_data,
InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap & used ) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 447 of file TRT_TrackExtensionToolCosmics.cxx.

451{
452 return nullptr;
453}

◆ initialize()

StatusCode InDet::TRT_TrackExtensionToolCosmics::initialize ( )
overridevirtual

Definition at line 49 of file TRT_TrackExtensionToolCosmics.cxx.

50{
51 StatusCode sc = AlgTool::initialize();
52
53 // Get RIO_OnTrack creator without drift time information
54 //
55 if(m_riontrackN.retrieve().isFailure()) {
56 ATH_MSG_FATAL("Failed to retrieve tool "<< m_riontrackN);
57 return StatusCode::FAILURE;
58 }
59 ATH_MSG_DEBUG("Retrieved tool " << m_riontrackN);
60
61 ATH_CHECK( m_extrapolator.retrieve() );
62
63 if ((detStore()->retrieve(m_trtid)).isFailure()) {
64 ATH_MSG_FATAL("Problem retrieving TRTID helper");
65 return StatusCode::FAILURE;
66 }
67
68 // Get output print level
69 //
70 m_outputlevel = msg().level()-MSG::DEBUG;
71 if(m_outputlevel<=0) {
72 m_nprint=0; msg(MSG::DEBUG)<<(*this)<<endmsg;
73 }
74
75
76 //Initialize container
77 ATH_CHECK(m_trtname.initialize());
78
79 return sc;
80
81
82
83
84}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
const ServiceHandle< StoreGateSvc > & detStore() const
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trtname
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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()

const InterfaceID & InDet::ITRT_TrackExtensionTool::interfaceID ( )
inlinestaticinherited

Definition at line 116 of file ITRT_TrackExtensionTool.h.

117 {
119 }
static const InterfaceID IID_ITRT_TrackExtensionTool("InDet::ITRT_TrackExtensionTool", 1, 0)

◆ intersect()

Amg::Vector3D InDet::TRT_TrackExtensionToolCosmics::intersect ( const Trk::Surface * surf,
const Trk::Perigee * per )
staticprotected

Definition at line 491 of file TRT_TrackExtensionToolCosmics.cxx.

491 {
492 // Calculate intersection of helix with silicon module. Assume barrel modules parallel to z-axis, endcap modules perpendicular to z-axis
493
494 double sinTheta = std::sin(per->parameters()[3]);
495 double r= (std::abs(per->parameters()[Trk::qOverP]) > 1e-10) ? -sinTheta/(per->parameters()[Trk::qOverP]*0.6) : 1e6;
496 double xc=per->position().x()-r*std::sin(per->parameters()[2]);
497 double yc=per->position().y()+r*std::cos(per->parameters()[2]);
498 double phi0=std::atan2(per->position().y()-yc,per->position().x()-xc);
499 double theta=per->parameters()[Trk::theta];
500 double z0=per->position().z();
501
502 if (std::abs(surf->normal().z())>0.5){ // endcap module
503 double delta_s=(surf->center().z()-z0)/cos(theta);
504 double delta_phi=delta_s*std::sin(theta)/r;
505 double x=xc+std::abs(r)*std::cos(phi0+delta_phi);
506 double y=yc+std::abs(r)*std::sin(phi0+delta_phi);
507 return Amg::Vector3D(x,y,surf->center().z());
508
509
510
511 }
512 else { // barrel module
513 double x1=surf->center().x();
514 double y1=surf->center().y();
515 double x2=x1+surf->transform()(0,0);
516 double y2=y1+surf->transform()(1,0);
517 double a=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
518 double b=2*( (x2 - x1)*(x1 - xc) + (y2 - y1)*(y1 - yc));
519 double c=xc*xc + yc*yc + x1*x1 + y1*y1 - 2*(xc*x1 + yc*y1) - r*r;
520 double discr=b*b-4*a*c;
521 if (discr<0) return Amg::Vector3D(0,0,0);
522 double u1=(-b-std::sqrt(discr))/(2*a);
523 double u2=(-b+std::sqrt(discr))/(2*a);
524 double u=(std::abs(u1)<std::abs(u2)) ? u1 : u2;
525 double x=x1+u*(x2-x1);
526 double y=y1+u*(y2-y1);
527 double phi=std::atan2(y-yc,x-xc);
528 double delta_phi=phi-phi0;
529 if (std::abs(std::abs(delta_phi)-2*M_PI)<std::abs(delta_phi)){
530 if (delta_phi<0) delta_phi+=2*M_PI;
531 else delta_phi-=2*M_PI;
532
533 }
534 double delta_z=r*delta_phi/std::tan(theta);
535
536 double z=z0+delta_z;
537 return Amg::Vector3D(x,y,z);
538 }
539}
Scalar phi() const
phi method
Scalar theta() const
theta method
static Double_t a
#define y
#define x
#define z
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
int r
Definition globals.cxx:22
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
delta_phi(phi1, phi2)
Definition eFEXNTuple.py:14

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

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

◆ newEvent()

std::unique_ptr< InDet::ITRT_TrackExtensionTool::IEventData > InDet::TRT_TrackExtensionToolCosmics::newEvent ( const EventContext & ctx) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 162 of file TRT_TrackExtensionToolCosmics.cxx.

163{
164 //create the boundary surfaces
165 //
166 SG::ReadHandle<TRT_DriftCircleContainer> trtcontainer(m_trtname, ctx);
167 if(not trtcontainer.isValid() && m_outputlevel<=0) {
168 std::stringstream msg;
169 msg << "Missing TRT_DriftCircleContainer " << m_trtname.key();
170 throw std::runtime_error( msg.str() );
171 }
172
173 std::unique_ptr<EventData> event_data(new EventData(trtcontainer.cptr()));
174
175 Amg::RotationMatrix3D r; r.setIdentity();
176 Amg::Transform3D t = Amg::Transform3D(r * Amg::Translation3D(Amg::Vector3D::Zero()));
177 event_data->m_trtcylinder= new Trk::CylinderSurface(t,1150.,3000.);
179 event_data->m_trtdiscA = new Trk::DiscSurface (transf,1.,1200.);
180 transf = Amg::Transform3D(r * Amg::Translation3D(Amg::Vector3D(0.,0.,-3000)));
181 event_data->m_trtdiscC = new Trk::DiscSurface (transf,1.,1200.);
182
183 return std::unique_ptr<InDet::ITRT_TrackExtensionTool::IEventData>(event_data.release());
184
185}
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Eigen::Translation< double, 3 > Translation3D

◆ newTrack()

Trk::Track * InDet::TRT_TrackExtensionToolCosmics::newTrack ( const EventContext & ctx,
const Trk::Track & ,
InDet::ITRT_TrackExtensionTool::IEventData & virt_event_data,
InDet::TRT_DetElementLink_xk::TRT_DetElemUsedMap & used ) const
overridevirtual

Implements InDet::ITRT_TrackExtensionTool.

Definition at line 547 of file TRT_TrackExtensionToolCosmics.cxx.

551{
552 return nullptr;
553}

◆ 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();
384 }
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)

◆ 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 {
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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

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

ToolHandle<Trk::IExtrapolator> InDet::TRT_TrackExtensionToolCosmics::m_extrapolator {this, "Extrapolator", "Trk::Extrapolator/InDetExtrapolator"}
protected

Definition at line 111 of file TRT_TrackExtensionToolCosmics.h.

112{this, "Extrapolator", "Trk::Extrapolator/InDetExtrapolator"};

◆ m_idHelper

AtlasDetectorID* InDet::TRT_TrackExtensionToolCosmics::m_idHelper {}
protected

Definition at line 150 of file TRT_TrackExtensionToolCosmics.h.

150{}; //<! Detector ID helper

◆ m_nprint

int InDet::TRT_TrackExtensionToolCosmics::m_nprint {}
protected

Definition at line 117 of file TRT_TrackExtensionToolCosmics.h.

117{} ; // Kind of print

◆ m_outputlevel

int InDet::TRT_TrackExtensionToolCosmics::m_outputlevel {}
protected

Definition at line 116 of file TRT_TrackExtensionToolCosmics.h.

116{} ; // Print level

◆ m_riontrackN

ToolHandle<Trk::IRIO_OnTrackCreator> InDet::TRT_TrackExtensionToolCosmics::m_riontrackN {this, "RIOonTrackToolNoDr", "InDet::TRT_DriftCircleOnTrackNoDriftTimeTool/TRT_DriftCircleOnTrackNoDriftTimeTool"}
protected

Definition at line 113 of file TRT_TrackExtensionToolCosmics.h.

114{this, "RIOonTrackToolNoDr", "InDet::TRT_DriftCircleOnTrackNoDriftTimeTool/TRT_DriftCircleOnTrackNoDriftTimeTool"}; //

◆ m_roadwidth

DoubleProperty InDet::TRT_TrackExtensionToolCosmics::m_roadwidth
protected
Initial value:
{this, "RoadWidth", 10.,
"Max width of the road"}

Definition at line 118 of file TRT_TrackExtensionToolCosmics.h.

118 {this, "RoadWidth", 10.,
119 "Max width of the road"};

◆ m_roadwidth_locz

DoubleProperty InDet::TRT_TrackExtensionToolCosmics::m_roadwidth_locz
protected
Initial value:
{this, "BoundaryLocZTolerance", 10.,
"Max width of the road along the straw"}

Definition at line 120 of file TRT_TrackExtensionToolCosmics.h.

120 {this, "BoundaryLocZTolerance", 10.,
121 "Max width of the road along the straw"};

◆ m_searchNeighbour

BooleanProperty InDet::TRT_TrackExtensionToolCosmics::m_searchNeighbour
protected
Initial value:
{this, "SearchNeighbour", false,
"Also search neighbouring detector elements?"}

Definition at line 122 of file TRT_TrackExtensionToolCosmics.h.

122 {this, "SearchNeighbour", false,
123 "Also search neighbouring detector elements?"};

◆ m_trtid

const TRT_ID* InDet::TRT_TrackExtensionToolCosmics::m_trtid {}
protected

Definition at line 152 of file TRT_TrackExtensionToolCosmics.h.

152{} ;

◆ m_trtname

SG::ReadHandleKey<TRT_DriftCircleContainer> InDet::TRT_TrackExtensionToolCosmics::m_trtname {this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircles"}
protected

Definition at line 125 of file TRT_TrackExtensionToolCosmics.h.

125{this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircles"};

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