ATLAS Offline Software
TBBeamQualityTrackingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //#####################################################
6 //# #
7 //# File : TBBeamQualityTrackingTool.cxx #
8 //# Package: TBRec #
9 //# #
10 //# Author : P.Krieger <krieger@physics.utoronto.ca> #
11 //# Based on existing BQ tools from M.Bieri #
12 //# Last Modified: Jun 30/2005 #
13 //#####################################################
14 
16 #include "TBEvent/TBTrack.h"
17 
18 #include <string>
19 #include <ios>
20 #include <algorithm>
21 
23  const std::string& name,
24  const IInterface* parent)
26 {
27 
28  // defaults are 0, which means no cut.
29  // if cutting, must specify both.
30  declareInterface<TBBeamQualityTool>(this);
31  declareProperty("Chi2Cut_x",m_chi2cut_u=0.);
32  declareProperty("Chi2Cut_y",m_chi2cut_v=0.);
33 
34 }
35 
37 { }
38 
40 {
41 
42  MsgStream log(msgSvc(),name());
43 
44  log << MSG::DEBUG
45  << "initializing TBBeamQualityTrackingTool"
46  << endmsg;
47 
48  return StatusCode::SUCCESS;
49 }
50 
51 StatusCode TBBeamQualityTrackingTool::accept(const std::vector<std::string>& particles)
52 {//accept
53 
54  MsgStream log(msgSvc(),name());
55 
56  log << MSG::DEBUG << "Asked for : "<<particles.size()<<" particles"<<endmsg;
57 
58  // Retrieve Beam Track and select on chi2 values in x and y
59 
60  if (m_chi2cut_u>0. && m_chi2cut_v>0.) {
61 
62  TBTrack *thisTBTrack = nullptr;
63  ATH_CHECK( evtStore()->retrieve(thisTBTrack,"Track") );
64  if (thisTBTrack->getChi2_u() > m_chi2cut_u || thisTBTrack->getChi2_v() > m_chi2cut_v ) {
65  log << MSG::DEBUG
66  << "Rejecting event with chi2(u,v) = "
67  << thisTBTrack->getChi2_u()
68  << ", "
69  << thisTBTrack->getChi2_v()
70  << endmsg;
71  return StatusCode::FAILURE;
72  } else {
73  return StatusCode::SUCCESS;
74  }
75  } else {
76  if (m_chi2cut_u==0. && m_chi2cut_v==0.) {
77  return StatusCode::SUCCESS;
78  } else {
79  log << MSG::WARNING << "Improper Track Chi2 Cuts Applied ! : "
80  << "Must specfiy cuts for both X and Y fits"
81  << endmsg;
82  return StatusCode::FAILURE;
83  }
84  }
85  // NOT REACHED
86 }
87 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TBBeamQualityTrackingTool::initializeTool
virtual StatusCode initializeTool() override
Definition: TBBeamQualityTrackingTool.cxx:39
TBBeamQualityTrackingTool.h
TBTrack
Definition: TBTrack.h:20
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TBBeamQualityTrackingTool::TBBeamQualityTrackingTool
TBBeamQualityTrackingTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TBBeamQualityTrackingTool.cxx:22
TBBeamQualityTrackingTool::m_chi2cut_u
float m_chi2cut_u
Definition: TBBeamQualityTrackingTool.h:44
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TBTrack::getChi2_u
double getChi2_u() const
Definition: TBTrack.h:49
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TBTrack.h
TBTrack::getChi2_v
double getChi2_v() const
Definition: TBTrack.h:50
TBBeamQualityTrackingTool::accept
virtual StatusCode accept(const std::vector< std::string > &) override
Definition: TBBeamQualityTrackingTool.cxx:51
TBBeamQualityTool
Definition: TBBeamQualityTool.h:26
TBBeamQualityTrackingTool::m_chi2cut_v
float m_chi2cut_v
Definition: TBBeamQualityTrackingTool.h:45
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TBBeamQualityTrackingTool::~TBBeamQualityTrackingTool
virtual ~TBBeamQualityTrackingTool()
Definition: TBBeamQualityTrackingTool.cxx:36
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84