00001
00002
00003
00004
00005 #ifndef INDETTRACKSELECTIONTOOL_INDETTRACKCUT_H
00006 #define INDETTRACKSELECTIONTOOL_INDETTRACKCUT_H
00007
00008 #include "InDetTrackAccessor.h"
00009
00010 #include <map>
00011 #include <array>
00012
00013 namespace InDet {
00014
00015 class InDetTrackSelectionTool;
00016
00017
00018
00019 class TrackCut : public asg::AsgMessaging {
00020
00021 public:
00022 TrackCut(InDetTrackSelectionTool*);
00023 virtual ~TrackCut() = 0;
00024
00025 virtual StatusCode initialize();
00026 virtual bool result() const = 0;
00027 operator bool() const {return this->result();}
00028 protected:
00029
00030 template <class AccessorType>
00031 StatusCode getAccessor(const std::string& name, std::shared_ptr<AccessorType>& accessor);
00032 private:
00033
00034 std::unordered_map< std::string, std::shared_ptr<TrackAccessor> >* m_trackAccessors;
00035
00036 InDetTrackSelectionTool* m_selectionTool;
00037 };
00038
00039
00040
00041 template <size_t N>
00042 class OrCut : public TrackCut {
00043 public:
00044 OrCut(InDetTrackSelectionTool*);
00045 virtual StatusCode initialize();
00046 virtual bool result() const;
00047 void setCut(size_t i, std::unique_ptr<TrackCut>&& cut) {m_cuts.at(i).swap(cut);}
00048
00049 std::unique_ptr<TrackCut>& Cut(size_t i) {return m_cuts.at(i);}
00050 private:
00051 std::array< std::unique_ptr<TrackCut> , N > m_cuts;
00052 };
00053
00054
00055 class MaxSummaryValueCut : public virtual TrackCut {
00056 public:
00057 MaxSummaryValueCut(InDetTrackSelectionTool*, Int_t max=0);
00058 MaxSummaryValueCut(InDetTrackSelectionTool*, Int_t max, const std::vector<xAOD::SummaryType>&);
00059 void setMaxValue(Int_t max) {m_maxValue = max;}
00060 void addSummaryType(xAOD::SummaryType type) {m_summaryTypes.push_back(type);}
00061 virtual StatusCode initialize();
00062 virtual bool result() const;
00063 private:
00064 Int_t m_maxValue;
00065
00066 std::vector< xAOD::SummaryType > m_summaryTypes;
00067 std::vector< std::shared_ptr<SummaryAccessor> > m_summaryAccessors;
00068 };
00069
00070
00071
00072 class MinSummaryValueCut : public virtual TrackCut {
00073 public:
00074 MinSummaryValueCut(InDetTrackSelectionTool*, Int_t min=0);
00075 MinSummaryValueCut(InDetTrackSelectionTool*, Int_t min, const std::vector<xAOD::SummaryType>&);
00076 void setMinValue(Int_t min) {m_minValue = min;}
00077 void addSummaryType(xAOD::SummaryType type) {m_summaryTypes.push_back(type);}
00078 virtual StatusCode initialize();
00079 virtual bool result() const;
00080 private:
00081 Int_t m_minValue;
00082 std::vector< xAOD::SummaryType > m_summaryTypes;
00083
00084 std::vector< std::shared_ptr<SummaryAccessor> > m_summaryAccessors;
00085 };
00086
00087
00088 template <size_t N>
00089 class FuncSummaryValueCut : public virtual TrackCut {
00090 public:
00091 FuncSummaryValueCut(InDetTrackSelectionTool*, const std::array<xAOD::SummaryType,N>&&);
00092 void setFunction(std::function<bool(const std::array<uint8_t,N>&)> func) {m_func = func;}
00093 virtual StatusCode initialize();
00094 virtual bool result() const;
00095 private:
00096 std::function<bool(const std::array<uint8_t,N>&)> m_func;
00097 std::array< xAOD::SummaryType, N> m_summaryTypes;
00098 std::array< std::shared_ptr<SummaryAccessor>,N > m_summaryAccessors;
00099 mutable std::array<uint8_t,N> m_results;
00100 };
00101
00102
00103
00104 class MaxSummaryValueRatioCut : public virtual TrackCut {
00105 public:
00106 MaxSummaryValueRatioCut(InDetTrackSelectionTool*, Double_t max);
00107 void setMaxValue(Double_t max) {m_maxValue = max;}
00108 void addSummaryTypeNumerator(xAOD::SummaryType type) {m_summaryTypesNum.push_back(type);}
00109 void addSummaryTypeDenominator(xAOD::SummaryType type) {m_summaryTypesDen.push_back(type);}
00110 virtual StatusCode initialize();
00111 virtual bool result() const;
00112 private:
00113 Double_t m_maxValue;
00114
00115 std::vector< xAOD::SummaryType > m_summaryTypesNum;
00116 std::vector< xAOD::SummaryType > m_summaryTypesDen;
00117 std::vector< std::shared_ptr<SummaryAccessor> > m_summaryAccessorsNum;
00118 std::vector< std::shared_ptr<SummaryAccessor> > m_summaryAccessorsDen;
00119 };
00120
00121
00122 class MinTrtHitCut : public virtual MinSummaryValueCut {
00123 public:
00124 MinTrtHitCut(InDetTrackSelectionTool*, Int_t min=0, Double_t etaLow=0, Double_t etaHigh=0);
00125 void setMaxEtaAcceptance(Double_t eta) {m_maxTrtEtaAcceptance = eta;}
00126 void setMaxEtaForCut(Double_t eta) {m_maxEtaForCut = eta;}
00127 virtual StatusCode initialize();
00128 virtual bool result() const;
00129 private:
00130 Double_t m_maxTrtEtaAcceptance;
00131 Double_t m_maxEtaForCut;
00132 std::shared_ptr< FuncAccessor<double, &xAOD::TrackParticle::eta> > m_etaAccessor;
00133 };
00134
00135
00136 class MaxTrtHitRatioCut : public virtual MaxSummaryValueRatioCut {
00137 public:
00138 MaxTrtHitRatioCut(InDetTrackSelectionTool*, Double_t ratio=0, Double_t etaLow=0, Double_t etaHigh=0);
00139 void setMaxEtaAcceptance(Double_t eta) {m_maxTrtEtaAcceptance = eta;}
00140 void setMaxEtaForCut(Double_t eta) {m_maxEtaForCut = eta;}
00141 virtual StatusCode initialize();
00142 virtual bool result() const;
00143 private:
00144 Double_t m_maxTrtEtaAcceptance;
00145 Double_t m_maxEtaForCut;
00146 std::shared_ptr< FuncAccessor<double, &xAOD::TrackParticle::eta> > m_etaAccessor;
00147 };
00148
00149
00150 class D0Cut : public virtual TrackCut {
00151 public:
00152 D0Cut(InDetTrackSelectionTool*, Double_t max=0);
00153 void setMaxValue(Double_t max) {m_maxValue = max;}
00154 virtual StatusCode initialize();
00155 virtual bool result() const;
00156 private:
00157 Double_t m_maxValue;
00158 std::shared_ptr< ParamAccessor<0> > m_paramAccessor;
00159 };
00160
00161
00162 class D0SigmaCut : public virtual TrackCut {
00163 public:
00164 D0SigmaCut(InDetTrackSelectionTool*, Double_t max=0);
00165 void setMaxValue(Double_t max) {m_maxValueSq = max*max;}
00166 virtual StatusCode initialize();
00167 virtual bool result() const;
00168 private:
00169 Double_t m_maxValueSq;
00170 std::shared_ptr< ParamCovAccessor<0,0> > m_paramCovAccessor;
00171 };
00172
00173
00174 class D0SignificanceCut : public virtual TrackCut {
00175 public:
00176 D0SignificanceCut(InDetTrackSelectionTool*, Double_t max=0);
00177 void setMaxValue(Double_t max) {m_maxValueSq = max*max;}
00178 virtual StatusCode initialize();
00179 virtual bool result() const;
00180 private:
00181 Double_t m_maxValueSq;
00182 std::shared_ptr< ParamAccessor<0> > m_paramAccessor;
00183 std::shared_ptr< ParamCovAccessor<0,0> > m_paramCovAccessor;
00184 };
00185
00186
00187
00188 class Z0Cut : public virtual TrackCut {
00189 public:
00190 Z0Cut(InDetTrackSelectionTool*, Double_t max=0);
00191 void setMaxValue(Double_t max) {m_maxValue = max;}
00192 virtual StatusCode initialize();
00193 virtual bool result() const;
00194 private:
00195 Double_t m_maxValue;
00196 std::shared_ptr< ParamAccessor<1> > m_paramAccessor;
00197 };
00198
00199
00200 class Z0SigmaCut : public virtual TrackCut {
00201 public:
00202 Z0SigmaCut(InDetTrackSelectionTool*, Double_t max=0);
00203 void setMaxValue(Double_t max) {m_maxValueSq = max*max;}
00204 virtual StatusCode initialize();
00205 virtual bool result() const;
00206 private:
00207 Double_t m_maxValueSq;
00208 std::shared_ptr< ParamCovAccessor<1,1> > m_paramCovAccessor;
00209 };
00210
00211
00212 class Z0SignificanceCut : public virtual TrackCut {
00213 public:
00214 Z0SignificanceCut(InDetTrackSelectionTool*, Double_t max=0);
00215 void setMaxValue(Double_t max) {m_maxValueSq = max*max;}
00216 virtual StatusCode initialize();
00217 virtual bool result() const;
00218 private:
00219 Double_t m_maxValueSq;
00220 std::shared_ptr< ParamAccessor<1> > m_paramAccessor;
00221 std::shared_ptr< ParamCovAccessor<1,1> > m_paramCovAccessor;
00222 };
00223
00224
00225
00226 class Z0SinThetaCut : public virtual TrackCut {
00227 public:
00228 Z0SinThetaCut(InDetTrackSelectionTool*, Double_t max=0);
00229 void setMaxValue(Double_t max) {m_maxValue = max;}
00230 virtual StatusCode initialize();
00231 virtual bool result() const;
00232 private:
00233 Double_t m_maxValue;
00234 std::shared_ptr< ParamAccessor<1> > m_Z0Accessor;
00235 std::shared_ptr< ParamAccessor<3> > m_ThetaAccessor;
00236 };
00237
00238
00239 class Z0SinThetaSigmaCut : public virtual TrackCut {
00240 public:
00241 Z0SinThetaSigmaCut(InDetTrackSelectionTool*, Double_t maxSigma=0);
00242 void setMaxValue(Double_t max) {m_maxValueSq = max*max;}
00243 virtual StatusCode initialize();
00244 virtual bool result() const;
00245 private:
00246 Double_t m_maxValueSq;
00247 std::shared_ptr< ParamAccessor<1> > m_Z0Accessor;
00248 std::shared_ptr< ParamCovAccessor<1,1> > m_Z0VarAccessor;
00249 std::shared_ptr< ParamAccessor<3> > m_ThetaAccessor;
00250 std::shared_ptr< ParamCovAccessor<3,3> > m_ThetaVarAccessor;
00251 std::shared_ptr< ParamCovAccessor<1,3> > m_CovAccessor;
00252 };
00253
00254
00255 class Z0SinThetaSignificanceCut : public virtual TrackCut {
00256 public:
00257 Z0SinThetaSignificanceCut(InDetTrackSelectionTool*, Double_t maxSig=0);
00258 void setMaxValue(Double_t max) {m_maxValueSq = max*max;}
00259 virtual StatusCode initialize();
00260 virtual bool result() const;
00261 private:
00262 Double_t m_maxValueSq;
00263 std::shared_ptr< ParamAccessor<1> > m_Z0Accessor;
00264 std::shared_ptr< ParamCovAccessor<1,1> > m_Z0VarAccessor;
00265 std::shared_ptr< ParamAccessor<3> > m_ThetaAccessor;
00266 std::shared_ptr< ParamCovAccessor<3,3> > m_ThetaVarAccessor;
00267 std::shared_ptr< ParamCovAccessor<1,3> > m_CovAccessor;
00268 };
00269
00270
00271 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00272 class MinCut : public virtual TrackCut {
00273 public:
00274 MinCut(InDetTrackSelectionTool*, T min, std::string accName);
00275 void setMinValue(T min) {m_minValue = min;}
00276 virtual StatusCode initialize();
00277 virtual bool result() const;
00278 private:
00279 T m_minValue;
00280 std::string m_accName;
00281 std::shared_ptr< FuncAccessor<T, Func> > m_accessor;
00282 };
00283
00284
00285 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00286 class MaxCut : public virtual TrackCut {
00287 public:
00288 MaxCut(InDetTrackSelectionTool*, T max, std::string accName);
00289 void setMaxValue(T max) {m_maxValue = max;}
00290 virtual StatusCode initialize();
00291 virtual bool result() const;
00292 private:
00293 T m_maxValue;
00294 std::string m_accName;
00295 std::shared_ptr< FuncAccessor<T, Func> > m_accessor;
00296 };
00297
00298
00299 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00300 class MinAbsCut : public virtual TrackCut {
00301 public:
00302 MinAbsCut(InDetTrackSelectionTool*, T min, std::string accName);
00303 void setMinValue(T min) {m_minValue = min;}
00304 virtual StatusCode initialize();
00305 virtual bool result() const;
00306 private:
00307 T m_minValue;
00308 std::string m_accName;
00309 std::shared_ptr< FuncAccessor<T, Func> > m_accessor;
00310 };
00311
00312
00313 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00314 class MaxAbsCut : public virtual TrackCut {
00315 public:
00316 MaxAbsCut(InDetTrackSelectionTool*, T max, std::string accName);
00317 void setMaxValue(T max) {m_maxValue = max;}
00318 virtual StatusCode initialize();
00319 virtual bool result() const;
00320 private:
00321 T m_maxValue;
00322 std::string m_accName;
00323 std::shared_ptr< FuncAccessor<T, Func> > m_accessor;
00324 };
00325
00326
00327 class EtaDependentChiSqCut : public virtual TrackCut {
00328 public:
00329 EtaDependentChiSqCut(InDetTrackSelectionTool*);
00330 virtual StatusCode initialize();
00331 virtual bool result() const;
00332 private:
00333 std::shared_ptr< FuncAccessor<double, &xAOD::TrackParticle::eta> > m_etaAccessor;
00334 std::shared_ptr<FitQualityAccessor> m_fitAccessor;
00335 };
00336
00337
00338 class MinNSiHitsAboveEta : public virtual TrackCut {
00339 public:
00340 MinNSiHitsAboveEta(InDetTrackSelectionTool*, Int_t hits=0, Double_t eta=0);
00341 void setEtaCutoff(Double_t eta) {m_etaCutoff = eta;}
00342 void setMinSiHits(Int_t hits) {m_minSiHits = hits;}
00343 virtual StatusCode initialize();
00344 virtual bool result() const;
00345 private:
00346 Double_t m_etaCutoff;
00347 Int_t m_minSiHits;
00348 std::shared_ptr<SummaryAccessor> m_pixAccessor;
00349 std::shared_ptr<SummaryAccessor> m_pixDeadAccessor;
00350 std::shared_ptr<SummaryAccessor> m_sctAccessor;
00351 std::shared_ptr<SummaryAccessor> m_sctDeadAccessor;
00352 std::shared_ptr< FuncAccessor<double, &xAOD::TrackParticle::eta> > m_etaAccessor;
00353 };
00354
00355
00356 class MaxChiSq : public virtual TrackCut {
00357 public:
00358 MaxChiSq(InDetTrackSelectionTool*, Double_t max=0);
00359 void setMaxValue(Double_t max) {m_maxValue = max;}
00360 virtual StatusCode initialize();
00361 virtual bool result() const;
00362 private:
00363 Double_t m_maxValue;
00364 std::shared_ptr<FitQualityAccessor> m_accessor;
00365 };
00366
00367
00368 class MaxChiSqPerNdf : public virtual TrackCut {
00369 public:
00370 MaxChiSqPerNdf(InDetTrackSelectionTool*, Double_t max=0);
00371 void setMaxValue(Double_t max) {m_maxValue = max;}
00372 virtual StatusCode initialize();
00373 virtual bool result() const;
00374 private:
00375 Double_t m_maxValue;
00376 std::shared_ptr<FitQualityAccessor> m_accessor;
00377 };
00378
00379
00380 class MinProb : public virtual TrackCut {
00381 public:
00382 MinProb(InDetTrackSelectionTool*, Double_t min=0);
00383 void setMinValue(Double_t min) {m_minValue = min;}
00384 virtual StatusCode initialize();
00385 virtual bool result() const;
00386 private:
00387 Double_t m_minValue;
00388 std::shared_ptr<FitQualityAccessor> m_accessor;
00389 };
00390
00391
00392
00393
00394 class MinEProbHTCut : public virtual TrackCut {
00395 public:
00396 MinEProbHTCut(InDetTrackSelectionTool*, Double_t min=0);
00397 void setMin(Double_t min) {m_minValue = min;}
00398 virtual StatusCode initialize();
00399 virtual bool result() const;
00400 private:
00401 Double_t m_minValue;
00402 std::shared_ptr<eProbabilityHTAccessor> m_accessor;
00403 };
00404
00405
00406 class EtaDependentSiliconHitsCut : public virtual TrackCut {
00407 public:
00408 EtaDependentSiliconHitsCut(InDetTrackSelectionTool*, std::vector<Double_t> eta, std::vector<Int_t> hits);
00409 void setEta(std::vector<Double_t> eta) {m_etaCutoffs = eta;}
00410 void setHits(std::vector<Int_t> hits) {m_siHitCuts = hits;}
00411 virtual StatusCode initialize();
00412 virtual bool result() const;
00413 private:
00414 std::vector<Double_t> m_etaCutoffs;
00415 std::vector<Int_t> m_siHitCuts;
00416 std::shared_ptr< FuncAccessor< double, &xAOD::TrackParticle::eta> > m_etaAccessor;
00417 std::shared_ptr<SummaryAccessor> m_sctAccessor;
00418 std::shared_ptr<SummaryAccessor> m_pixAccessor;
00419 std::shared_ptr<SummaryAccessor> m_sctDeadAccessor;
00420 std::shared_ptr<SummaryAccessor> m_pixDeadAccessor;
00421 } ;
00422
00423 class EtaDependentPtCut : public virtual TrackCut {
00424 public:
00425 EtaDependentPtCut(InDetTrackSelectionTool*, std::vector<Double_t> eta, std::vector<Double_t> pt);
00426 void setEta(std::vector<Double_t> eta) {m_etaCutoffs = eta;}
00427 void setPt(std::vector<Double_t> pt) {m_ptCuts = pt;}
00428 virtual StatusCode initialize();
00429 virtual bool result() const;
00430 private:
00431 std::vector<Double_t> m_etaCutoffs;
00432 std::vector<Double_t> m_ptCuts;
00433 std::shared_ptr< FuncAccessor< double, &xAOD::TrackParticle::eta> > m_etaAccessor;
00434 std::shared_ptr< FuncAccessor< double, &xAOD::TrackParticle::pt> > m_ptAccessor;
00435 } ;
00436
00437
00438
00439
00440
00441
00442
00443 class PtDependentSctHitsCut : public virtual TrackCut {
00444 public:
00445 PtDependentSctHitsCut(InDetTrackSelectionTool*, std::vector<Double_t> pt, std::vector<Int_t> sct);
00446 void setPt(std::vector<Double_t> pt) {m_ptCutoffs = pt;}
00447 void setSct(std::vector<Int_t> sct) {m_sctHitCuts = sct;}
00448 virtual StatusCode initialize();
00449 virtual bool result() const;
00450 private:
00451 std::vector<Double_t> m_ptCutoffs;
00452 std::vector<Int_t> m_sctHitCuts;
00453 std::shared_ptr< FuncAccessor< double, &xAOD::TrackParticle::pt> > m_ptAccessor;
00454 std::shared_ptr<SummaryAccessor> m_sctAccessor;
00455 std::shared_ptr<SummaryAccessor> m_sctDeadAccessor;
00456 };
00457
00458 #ifndef XAOD_ANALYSIS
00459
00460 class MinSiHitsModTopBottomCut : public virtual TrackCut {
00461 public:
00462 MinSiHitsModTopBottomCut(InDetTrackSelectionTool*, Int_t top=0, Int_t bottom=0);
00463 void setMinTop(uint8_t min) {m_minTop = min;}
00464 void setMinBottom(uint8_t min) {m_minBottom = min;}
00465 virtual StatusCode initialize();
00466 virtual bool result() const;
00467 private:
00468 uint8_t m_minTop;
00469 uint8_t m_minBottom;
00470 std::shared_ptr<SiHitsTopBottomAccessor> m_accessor;
00471 };
00472 #endif
00473
00474
00475 }
00476
00477
00478
00479
00480
00481
00482 template <class AccessorType>
00483 StatusCode InDet::TrackCut::getAccessor(const std::string& accessorName,
00484 std::shared_ptr<AccessorType>& accessor)
00485 {
00486
00487
00488
00489 std::unordered_map< std::string, std::shared_ptr<TrackAccessor> >::const_iterator it =
00490 std::find_if(m_trackAccessors->begin(), m_trackAccessors->end(),
00491 [&] (std::pair< std::string, std::shared_ptr<TrackAccessor> > acc)
00492 {return acc.first == accessorName;} );
00493 if (it == m_trackAccessors->end()) {
00494
00495 if (!m_selectionTool) {
00496 ATH_MSG_ERROR( "Must initialize TrackCut with pointer to the selection tool before adding accessors." );
00497 return StatusCode::FAILURE;
00498 }
00499 accessor = std::make_shared<AccessorType>(m_selectionTool);
00500 (*m_trackAccessors)[accessorName] = accessor;
00501 ATH_MSG_DEBUG( "Adding accessor " << accessorName );
00502 } else {
00503 accessor = std::dynamic_pointer_cast<AccessorType>(it->second);
00504 if (accessor==nullptr) {
00505 ATH_MSG_ERROR( "Logic error: could not cast accessor to type " << typeid(AccessorType).name() );
00506 return StatusCode::FAILURE;
00507 }
00508 }
00509
00510 if (!accessor) {
00511
00512 ATH_MSG_ERROR( "Could not instantiate "<< accessorName <<
00513 " accessor. Pointer to accessor is to type " <<
00514 typeid(AccessorType).name() << ". Is this correct?" );
00515 return StatusCode::FAILURE;
00516 }
00517 return StatusCode::SUCCESS;
00518 }
00519
00520
00521
00522
00523 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00524 InDet::MinCut<T,Func>::MinCut(InDet::InDetTrackSelectionTool* tool, T min, std::string accName)
00525 : InDet::TrackCut(tool)
00526 , m_minValue(min)
00527 , m_accName(accName)
00528 , m_accessor(nullptr)
00529 {
00530 }
00531
00532 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00533 StatusCode InDet::MinCut<T,Func>::initialize()
00534 {
00535 ATH_CHECK( TrackCut::initialize() );
00536 if (m_accName.empty()) {
00537 ATH_MSG_ERROR( "Accessor name string is empty!" );
00538 return StatusCode::FAILURE;
00539 }
00540 ATH_CHECK( getAccessor(m_accName, m_accessor) );
00541 return StatusCode::SUCCESS;
00542 }
00543
00544 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00545 bool InDet::MinCut<T,Func>::result() const
00546 {
00547 if (!m_accessor) {
00548 ATH_MSG_WARNING( m_accName << " accessor not valid. Track will not pass." );
00549 return false;
00550 }
00551 return m_accessor->getValue() >= m_minValue;
00552 }
00553
00554
00555 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00556 InDet::MaxCut<T,Func>::MaxCut(InDet::InDetTrackSelectionTool* tool, T max, std::string accName)
00557 : InDet::TrackCut(tool)
00558 , m_maxValue(max)
00559 , m_accName(accName)
00560 , m_accessor(nullptr)
00561 {
00562 }
00563
00564 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00565 StatusCode InDet::MaxCut<T,Func>::initialize()
00566 {
00567 ATH_CHECK( TrackCut::initialize() );
00568 if (m_accName.empty()) {
00569 ATH_MSG_ERROR( "Accessor name string is empty!" );
00570 return StatusCode::FAILURE;
00571 }
00572 ATH_CHECK( getAccessor(m_accName, m_accessor) );
00573 return StatusCode::SUCCESS;
00574 }
00575
00576 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00577 bool InDet::MaxCut<T,Func>::result() const
00578 {
00579 if (!m_accessor) {
00580 ATH_MSG_WARNING( m_accName << " accessor not valid. Track will not pass." );
00581 return false;
00582 }
00583 return m_accessor->getValue() <= m_maxValue;
00584 }
00585
00586
00587
00588 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00589 InDet::MinAbsCut<T,Func>::MinAbsCut(InDet::InDetTrackSelectionTool* tool, T min, std::string accName)
00590 : InDet::TrackCut(tool)
00591 , m_minValue(min)
00592 , m_accName(accName)
00593 , m_accessor(nullptr)
00594 {
00595 }
00596
00597 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00598 StatusCode InDet::MinAbsCut<T,Func>::initialize()
00599 {
00600 ATH_CHECK( TrackCut::initialize() );
00601 if (m_accName.empty()) {
00602 ATH_MSG_ERROR( "Accessor name string is empty!" );
00603 return StatusCode::FAILURE;
00604 }
00605 ATH_CHECK( getAccessor(m_accName, m_accessor) );
00606 return StatusCode::SUCCESS;
00607 }
00608
00609 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00610 bool InDet::MinAbsCut<T,Func>::result() const
00611 {
00612 if (!m_accessor) {
00613 ATH_MSG_WARNING( m_accName << " accessor not valid. Track will not pass." );
00614 return false;
00615 }
00616 return std::fabs(m_accessor)->getValue() >= m_minValue;
00617 }
00618
00619
00620 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00621 InDet::MaxAbsCut<T,Func>::MaxAbsCut(InDet::InDetTrackSelectionTool* tool, T max, std::string accName)
00622 : InDet::TrackCut(tool)
00623 , m_maxValue(max)
00624 , m_accName(accName)
00625 , m_accessor(nullptr)
00626 {
00627 }
00628
00629 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00630 StatusCode InDet::MaxAbsCut<T,Func>::initialize()
00631 {
00632 ATH_CHECK( TrackCut::initialize() );
00633 if (m_accName.empty()) {
00634 ATH_MSG_ERROR( "Accessor name string is empty!" );
00635 return StatusCode::FAILURE;
00636 }
00637 ATH_CHECK( getAccessor(m_accName, m_accessor) );
00638 return StatusCode::SUCCESS;
00639 }
00640
00641 template <typename T, T (xAOD::TrackParticle::*Func)() const>
00642 bool InDet::MaxAbsCut<T,Func>::result() const
00643 {
00644 if (!m_accessor) {
00645 ATH_MSG_WARNING( m_accName << " accessor not valid. Track will not pass." );
00646 return false;
00647 }
00648 return std::fabs(m_accessor->getValue()) <= m_maxValue;
00649 }
00650
00651
00652 #endif // INDETTRACKSELECTIONTOOL_INDETTRACKCUT_H