ATLAS Offline Software
DisplacedJetBeamspotInfo.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef TRIGT2DJTRIG_BEAMSPOT_H
5 #define TRIGT2DJTRIG_BEAMSPOT_H
6 
8 
9 //keep all code for handling the beamspot info in the displaced jet trigger in one place
10 //Two tools under different hypo algs use this info so better to only write once
12 {
13 public:
14  DisplacedJetBeamspotInfo(const InDet::BeamSpotData* beamspot = nullptr): m_bs_data(beamspot) {}
15 
16  //m_errPar { sigmaX, sigmaY, sigmaZ, tiltX, tiltY, sigmaXY }, so sigma x = 0 sigma y = 1 sigma xy has a helper
17  float sigmaX(){
18  if(!is_available()){
19  return 0.0;
20  }
21 
22  return m_bs_data->beamSigma(0);
23  }
24 
25  float sigmaY(){
26  if(!is_available()){
27  return 0.0;
28  }
29 
30  return m_bs_data->beamSigma(1);
31  }
32 
33  float sigmaXY(){
34  if(!is_available()){
35  return 0.0;
36  }
37 
38  return m_bs_data->beamSigmaXY();
39  }
40 
41 private:
43 
44  bool is_available(){
45  if(m_bs_data == nullptr){
46  return false;
47  }
48 
49  //check if the beamspot info is valid and should be used
50  //info from https://twiki.cern.ch/twiki/bin/view/Atlas/CoolBeamSpotParameters
51  int beamSpotBitMap = m_bs_data->beamStatus();
52  bool isOnlineBeamspot = ((beamSpotBitMap & 0x4) == 0x4);
53 
54  //offline/mc -> assume to be valid
55  if(!isOnlineBeamspot){
56  return true;
57  }
58 
59  //check if the beamspot has converged
60  if((beamSpotBitMap&0x3) == 0x3){
61  //beamspot has converged
62  return true;
63  }
64 
65  return false;
66  }
67 };
68 
69  #endif //> !TRIGT2MINBIAS_TRACKCOUNTHYPOTOOL_H
DisplacedJetBeamspotInfo::sigmaY
float sigmaY()
Definition: DisplacedJetBeamspotInfo.h:25
DisplacedJetBeamspotInfo::DisplacedJetBeamspotInfo
DisplacedJetBeamspotInfo(const InDet::BeamSpotData *beamspot=nullptr)
Definition: DisplacedJetBeamspotInfo.h:14
DisplacedJetBeamspotInfo::is_available
bool is_available()
Definition: DisplacedJetBeamspotInfo.h:44
DisplacedJetBeamspotInfo::sigmaX
float sigmaX()
Definition: DisplacedJetBeamspotInfo.h:17
InDet::BeamSpotData::beamSigmaXY
float beamSigmaXY() const noexcept
Definition: BeamSpotData.h:72
DisplacedJetBeamspotInfo
Definition: DisplacedJetBeamspotInfo.h:12
InDet::BeamSpotData
Definition: BeamSpotData.h:21
DisplacedJetBeamspotInfo::m_bs_data
const InDet::BeamSpotData * m_bs_data
Definition: DisplacedJetBeamspotInfo.h:42
BeamSpotData.h
InDet::BeamSpotData::beamStatus
int beamStatus() const noexcept
Definition: BeamSpotData.h:76
DisplacedJetBeamspotInfo::sigmaXY
float sigmaXY()
Definition: DisplacedJetBeamspotInfo.h:33
InDet::BeamSpotData::beamSigma
float beamSigma(int i) const noexcept
Returns the beam sigma for the i-th error matrix element.
Definition: BeamSpotData.h:70