![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
31 declareInterface<ITrackIsolationTool>(
this);
32 #endif // XAOD_ANALYSIS
44 #endif // XAOD_ANALYSIS
48 return StatusCode::FAILURE;
69 return StatusCode::SUCCESS;
80 for (
const auto*
const vtx : *vtxC ) {
92 if( !
tp )
tp =
muon->primaryTrackParticle();
96 ATH_MSG_WARNING(
" No TrackParticle found for muon with pT: " <<
muon->pt() * 1.e-3 <<
"[GeV], eta: "<<
muon->eta()<<
" phi: "<<
97 muon->phi()<<
" q: "<<
muon->charge()<<
" primaryAuthor: "<<
muon->author()<<
" allAuthors: "<<
muon->allAuthors());
105 const std::vector<Iso::IsolationType>& isoTypes,
108 const std::set<const TrackParticle*>* exclusionSet,
122 ATH_MSG_DEBUG(
"No vertex provided, is required. Use the ID-chosen pvx, z = " <<
vertex->z());
135 for(
auto isoType : isoTypes ){
138 ATH_MSG_WARNING(
"Unsupported isolation type passed, cannot calculate isolation " << Iso::toCString(isoType));
142 input.coneSizesSquared.push_back(conesize*conesize);
145 for(
size_t i=1;
i<
input.coneSizesSquared.size();
i++){
146 if(
input.coneSizesSquared[
i]>
input.coneSizesSquared[
i-1])
ATH_MSG_ERROR(
"Isolation Cone should be in decreasing order. "<<
i <<
"th variable is " << Iso::toCString(isoTypes[
i]) <<
" is larger than the one before it: " << Iso::toCString(isoTypes[
i-1]));
149 std::sort(
input.coneSizesSquared.begin(),
input.coneSizesSquared.end(),[](
float i,
float j) { return i>j; });
153 input.maxRadius = sqrt(
input.coneSizesSquared[0]);
155 bool success =
false;
166 for(
unsigned int i = 0;
i<
result.ptcones.size();++
i ){
179 std::vector<const TrackParticle*> tps;
180 #ifndef XAOD_ANALYSIS
183 if( !getparticlesInCone(
input.particle->eta(),
input.particle->phi(),
input.maxRadius,tps) )
return false;
186 for(
const auto&
tp : tps ) {
190 ATH_MSG_DEBUG(
"Encountered a track isolation input with invalid vertex while requiring TTVA. Rejecting, please check your inputs!");
195 ATH_MSG_DEBUG(
"Accept track " <<
tp <<
" pt = " <<
tp->pt() <<
" z+vz = " <<
tp->z0()+
tp->vz() <<
" eta = " <<
tp->eta() <<
" phi = " <<
tp->phi());
208 if( !indetTrackParticles ) {
211 ATH_MSG_ERROR(
"Could not open a TrackParticle container with key "
215 indetTrackParticles = tpH.
ptr();
219 if( !indetTrackParticles )
return false;
222 for(
const auto *
const tp : *indetTrackParticles ) {
246 if(
input.particle == &tp2 ||
247 (
input.exclusionSet &&
input.exclusionSet->count(&tp2)) ||
249 ATH_MSG_DEBUG(
"track pointer " << &tp2 <<
", track pt = " << tp2.
pt() <<
", input pt = " <<
input.particle->pt()) ;
256 float deta =
input.particle->eta()-tp2.
eta();
257 if( fabs(deta) >
input.maxRadius )
return;
261 if( fabs(dphi) >
input.maxRadius )
return;
264 float dr2 = deta*deta + dphi*dphi;
274 for(
unsigned int k=0;
k<
input.coneSizesSquared.size();++
k ){
275 if( dr2 >=
input.coneSizesSquared[
k] )
return;
277 if( dr2 <=
input.ptvarconeRadiusSquared ){
278 result.ptvarcones_10GeVDivPt[
k] += tp2.
pt();
285 unsigned int typesize) {
287 result.corrlist = corrlist;
288 result.coreCorrections.clear();
289 result.ptcones.resize(typesize,0.);
290 result.ptvarcones_10GeVDivPt.resize(typesize,0.);
292 std::vector<float>
vec;
293 vec.resize(typesize,0.);
301 bool TrackIsolationTool::getparticlesInCone(
float eta,
float phi,
float dr, std::vector< const TrackParticle*>&
output )
const {
305 if(!trks.isValid()) {
306 ATH_MSG_ERROR(
"Could not find TrackParticle container with key "
314 for(
auto trk: *trks){
315 float dEta = fabs(
eta-trk->eta());
317 float dPhi = fabs(
phi-trk->phi());
326 #endif // XAOD_ANALYSIS
virtual double pt() const override final
The transverse momentum ( ) of the particle.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Scalar eta() const
pseudorapidity method
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
@ coreTrackPtr
tracks pointer
bool msgLvl(const MSG::Level lvl) const
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
std::vector< size_t > vec
This class provides conversion from CSC RDO data to CSC Digits.
Class providing the definition of the 4-vector interface.
@ numIsolationTrackCorrections
unknown
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
::StatusCode StatusCode
StatusCode definition for legacy code.
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
@ coreTrackCone
tracks in cone
virtual bool isValid() override final
Can the handle be successfully dereferenced?
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
struct TBPatternUnitContext Muon
const_pointer_type ptr()
Dereference the pointer.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
Class describing a TrackParticle.
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
bool empty() const noexcept
Returns true if the collection is empty.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)