ATLAS Offline Software
Loading...
Searching...
No Matches
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)
25 : TBBeamQualityTool(type,name,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
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
51StatusCode 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
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
TBBeamQualityTool(const std::string &name, const std::string &type, const IInterface *parent)
virtual StatusCode initializeTool() override
virtual StatusCode accept(const std::vector< std::string > &) override
TBBeamQualityTrackingTool(const std::string &type, const std::string &name, const IInterface *parent)
double getChi2_u() const
Definition TBTrack.h:54
double getChi2_v() const
Definition TBTrack.h:55