14#include "GaudiKernel/ISvcLocator.h"
15#include "GaudiKernel/Service.h"
31 const std::string& name ) :
49 return StatusCode::SUCCESS;
65 if(
r->composite() ) {
67 for(
unsigned i=
r->size() ; i-- ; )
73 if(
r->isFullscan() )
return true;
77 bool contained_phi = (
r->phiMinus() <
r->phiPlus() ) ?
78 (
phi(t) >
r->phiMinus() &&
phi(t) <
r->phiPlus() ) :
79 (
phi(t) >
r->phiMinus() ||
phi(t) <
r->phiPlus() );
81 bool contained_zed = (
z0(t) >
r->zedMinus() &&
z0(t) <
r->zedPlus() );
85 bool contained_eta = (
eta(t) <
r->etaPlus() &&
eta(t) >
r->etaMinus() );
97 float cross0 = exit.z * exitMinus.
r - exit.r * exitMinus.
z;
98 float cross1 = exit.z * exitPlus.
r - exit.r * exitPlus.
z;
100 contained_eta = ( cross0>0 && cross1<0 ) ?
true :
false;
105 if( newphi < -999. )
return false;
107 if(
r->phiMinus() <
r->phiPlus() ) contained_phi &= ( newphi >
r->phiMinus() && newphi < r->phiPlus() );
108 else contained_phi &= ( newphi >
r->phiMinus() || newphi < r->phiPlus() );
110 if( contained_eta && contained_phi && contained_zed )
return true;
129 float pt,
float phi,
float r )
const {
135 float mqR = 10 * pt / ( 2.99792458 * 2 );
136 float ratio = 0.5 *
r / mqR;
140 if( std::fabs( ratio ) > 1 )
return -9999.;
143 newphi -= std::asin( ratio );
146 while( newphi < -
M_PI ) newphi += 2 *
M_PI;
147 while( newphi >
M_PI ) newphi -= 2 *
M_PI;
157 float tz0,
float teta )
const {
160 float rexit(0.), zexit(0.);
161 const float maxRadius = 1000.;
162 const float maxZed = 2700.;
164 if ( teta < 0 ) zexit = -maxZed;
165 else if ( teta > 0 ) zexit = maxZed;
168 exitPoint.
r = maxRadius;
173 float tantheta = std::tan( 2 * std::atan( std::exp( -teta ) ) );
175 rexit = ( zexit - tz0 ) * tantheta;
178 if ( std::fabs(rexit) > maxRadius ) {
184 zexit = maxRadius / tantheta + tz0;
200 const std::vector< const T* >& tvec,
203 std::vector< const T* > selectedTracks;
205 for(
size_t it=0 ; it<tvec.size() ; it++ ) {
206 const T* thisTrack = tvec.at(it);
208 selectedTracks.push_back( thisTrack );
212 return selectedTracks;
216template std::vector< const xAOD::TrackParticle* >
218 const std::vector< const xAOD::TrackParticle* >& tvec,
222template std::vector< const xAOD::TruthParticle* >
224 const std::vector< const xAOD::TruthParticle* >& tvec,
231std::vector< const xAOD::TrackParticle* >
233 const std::vector< const xAOD::TrackParticle* >& tvec,
245 std::vector< const xAOD::TrackParticle* > selectedTrigTracks;
247 for( trkItr = trigTrkItrPair.first ; trkItr != trigTrkItrPair.second ; ++trkItr ) {
250 if( std::find( tvec.begin(), tvec.end(), *trkItr ) == tvec.end() ) {
251 ATH_MSG_DEBUG(
"Trigger track does not pass quality selection. Skipping." );
254 selectedTrigTracks.push_back( *trkItr );
257 return selectedTrigTracks;
271 ISvcLocator* svcLoc = Gaudi::svcLocator();
272 SmartIF< ITrackAnalysisDefinitionSvc > trkAnaDefSvc(
273 svcLoc->service(
"TrkAnaDefSvc"+trkAnaColls.
anaTag() ) );
289 if( trkAnaDefSvc->useOffline() ) {
298 if( trkAnaDefSvc->useTruth() ) {
310 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
Class to hold for each event collections needed in the TrkAnalsis.
Utility methods to access track/truth particles parmeters in a consitent way in this package.
DataModel_detail::const_iterator< DataVector > const_iterator
ElementConstPointer cptr() const
Return a pointer to the referenced element.
const std::vector< const xAOD::TrackParticle * > & offlTrackVec(Stage stage=FULL)
StatusCode fillTrigTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Trigger tracks.
const std::vector< const xAOD::TrackParticle * > & trigTrackVec(Stage stage=FULL)
const std::string & anaTag()
— Getter methods —
std::string printInfo(Stage stage=FULL, bool printVertex=true) const
print information about tracks in the collection(s)
StatusCode fillTruthPartVec(const std::vector< const xAOD::TruthParticle * > &vec, Stage stage=FULL)
fill truth/offline/trigger track vector (TEST or REFERENCE)
const std::vector< const xAOD::TruthParticle * > & truthPartVec(Stage stage=FULL)
get truth/offline/trigger track vector (TEST or REFERENCE)
StatusCode fillOfflTrackVec(const std::vector< const xAOD::TrackParticle * > &vec, Stage stage=FULL)
Offline tracks.
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
float pTsig(const U &p)
Accessor utility function for getting the value of signed pT.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.