ATLAS Offline Software
TrigJetCRHypoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: TrigJetCRHypoTool.cxx
8 // PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo
9 //
10 //
11 // ********************************************************************
12 
13 #include "TrigJetCRHypoTool.h"
14 #include "GaudiKernel/StatusCode.h"
15 #include "CLHEP/Units/PhysicalConstants.h"
16 
19 #include "./DebugInfoCollector.h"
20 #include "./xAODJetCollector.h"
21 
25 
26 #include "CxxUtils/fpcompare.h"
27 #include "CxxUtils/phihelper.h"
30 #include "CaloEvent/CaloClusterContainer.h"
31 using namespace TrigCompositeUtils;
32 
34  const std::string& name,
35  const IInterface* parent) :
37  m_decisionId(HLT::Identifier::fromToolName(name)){
38 
39 }
40 
41 
42 
44  ATH_MSG_VERBOSE( "In TrigJetCRHypoTool, initialize()." );
45 
46  if (m_visitDebug){
47 
48  DebugInfoCollector collector(name());
49  ATH_CHECK(m_helper->getDescription(collector));
50  auto s = collector.toString();
51 
52  for(const auto& l : lineSplitter(s)){
53  ATH_MSG_INFO(l);
54  }
55  }
56 
57  return StatusCode::SUCCESS;
58 }
59 
61 
62  auto jet = input.jet;
63  auto trackContainer = input.allTracks;
64  auto cellContainer = input.cells;
65 
66  //Checking jet logRatio requirements
67  double jetEMF = jet->getAttribute<float>("EMFrac");
68  double jetRatio;
69 
70  if (CxxUtils::fpcompare::greater(jetEMF,0.)){
72  ATH_MSG_DEBUG( "Fails logR cut, EMF>=1" );
73  return false;
74  }
75  else jetRatio = log10(double(1./jetEMF - 1.));
76 
77  if( jetRatio < m_jetlogRCut ) return false;
78  }
79 
80  // Loop over all tracks above m_trackPtCut and reject the jet if the closest track is at dR(jet, track)< m_deltaR
81  auto jetPhi= jet->phi();
82  auto jetEta= jet->eta();
83 
84  for ( const xAOD::TrackParticle_v1* track : *trackContainer) {
85 
86  if(track->pt() < m_trackPtCut ) continue;
87 
88  double phi = track->phi0();
89  double eta = track->eta();
90 
91  double dR = xAOD::P4Helpers::deltaR( eta, phi, jetEta, jetPhi );
92  if (dR<m_deltaR) return false;
93  }
94 
95 
96  if(m_doBIBrm==1){
97  int countCaloCell=0;
98  double countCell_layer[4] = {0,0,0,0};
99 
100  for(CaloCellContainer::const_iterator celliter = cellContainer->begin(); celliter != cellContainer->end(); ++celliter){
101  //LoF cell selection in tile:
102  if((*celliter)->caloDDE()->is_tile() && (*celliter)->energy() > m_minCellEt){
103  double d_phi = xAOD::P4Helpers::deltaPhi( (*celliter)->phi(), jetPhi );
104  double d_R = xAOD::P4Helpers::deltaR( (*celliter)->eta(), (*celliter)->phi(), jetEta, jetPhi );
105  //select cells in a horizontal line, not being part of the jet and timing consistent with BIB
106  if(std::abs(d_phi) < 0.2 && d_R > 0.4){
107  //-early
108  float t = (*celliter)->time();
109  if(t < m_celltime){
110  // check cell's time consitency with BIB
111  float x = (*celliter)->x();
112  float y = (*celliter)->y();
113  float z = (*celliter)->z();
114  float r = sqrt(x*x + y*y);
115 
116  if((std::abs(t - (z-sqrt(z*z + r*r))/CLHEP::c_light) < m_dBIBtime) || (std::abs(t - (-z-sqrt(z*z + r*r))/CLHEP::c_light) < m_dBIBtime)){
117  // for selected cells, store in which layer they are
118  if(r<2200){ countCell_layer[0]++;}
119  else if(r>=2200 && r<2600){ countCell_layer[1]++;}
120  else if(r>=2600 && r<3100){ countCell_layer[2]++;}
121  else if(r>=3100){ countCell_layer[3]++;}
122  }
123  }
124  }
125  }
126  }
127 
128  // get max number of selected cells in a layer
129  for(int i=0; i<4; i++)
130  if(countCaloCell<countCell_layer[i]) countCaloCell=countCell_layer[i];
131 
132  //apply cut on number of cells here
133  if (countCaloCell>=m_countCaloCell) return false;
134 
135  return true;
136  }
137 
138  return true;
139 }
140 
141 StatusCode TrigJetCRHypoTool::decide( std::vector<JetInfo>& input ) const{
142  for ( JetInfo& j: input ) {
143  if ( passed ( m_decisionId.numeric(), j.previousDecisionIDs ) ) {
144  if ( decide_on_single_jet( j ) ) {
145  addDecisionID( m_decisionId, j.decision );
146  return StatusCode::SUCCESS;
147 
148  }
149  }
150  }
151 
152  return StatusCode::SUCCESS;
153 }
154 
155 
lineSplitter.h
beamspotman.r
def r
Definition: beamspotman.py:676
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
DebugInfoCollector::toString
virtual std::string toString() const override
Definition: DebugInfoCollector.cxx:70
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TrigCompositeUtils::passed
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
Definition: TrigCompositeUtilsRoot.cxx:117
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TrigCompositeUtils.h
HLT::Identifier::numeric
TrigCompositeUtils::DecisionID numeric() const
numeric ID
Definition: TrigCompositeUtils/TrigCompositeUtils/HLTIdentifier.h:47
TrigJetCRHypoTool::TrigJetCRHypoTool
TrigJetCRHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigJetCRHypoTool.cxx:33
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
xAODP4Helpers.h
TrigCompositeUtils::addDecisionID
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Definition: TrigCompositeUtilsRoot.cxx:61
TrigJetCRHypoTool::decide_on_single_jet
bool decide_on_single_jet(JetInfo &input) const
Auxiluary method, single jet selection.
Definition: TrigJetCRHypoTool.cxx:60
lineSplitter
std::vector< std::string > lineSplitter(const std::string &s, char delimiter)
Definition: lineSplitter.cxx:8
TrigJetCRHypoTool.h
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
x
#define x
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:140
TrigJetCRHypoTool::m_deltaR
Gaudi::Property< float > m_deltaR
Definition: TrigJetCRHypoTool.h:99
TrigJetCRHypoTool::JetInfo
Definition: TrigJetCRHypoTool.h:59
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
TrigJetCRHypoTool::m_doBIBrm
Gaudi::Property< bool > m_doBIBrm
Definition: TrigJetCRHypoTool.h:101
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloCluster.h
z
#define z
xAOD::P4Helpers::deltaR
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Definition: xAODP4Helpers.h:150
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
DebugInfoCollector.h
DebugInfoCollector
Definition: DebugInfoCollector.h:13
fpcompare.h
Workaround x86 precision issues for FP inequality comparisons.
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
xAODJetCollector.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigCompositeContainer.h
TrigJetCRHypoTool::m_decisionId
HLT::Identifier m_decisionId
Definition: TrigJetCRHypoTool.h:84
TrigJetCRHypoTool::m_celltime
Gaudi::Property< float > m_celltime
Definition: TrigJetCRHypoTool.h:107
CxxUtils::fpcompare::greater_equal
bool greater_equal(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:192
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TrigJetCRHypoTool::m_helper
ToolHandle< ITrigJetHypoToolHelper > m_helper
Definition: TrigJetCRHypoTool.h:86
xAODJetAsIJetFactory.h
phihelper.h
Helper for azimuthal angle calculations.
TrigJetCRHypoTool::decide
StatusCode decide(std::vector< JetInfo > &decisions) const
decides upon a collection of jets
Definition: TrigJetCRHypoTool.cxx:141
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
TrigJetCRHypoTool::initialize
virtual StatusCode initialize() override final
Definition: TrigJetCRHypoTool.cxx:43
y
#define y
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigJetCRHypoTool::m_dBIBtime
Gaudi::Property< float > m_dBIBtime
Definition: TrigJetCRHypoTool.h:108
HLTIdentifier.h
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
AthAlgTool
Definition: AthAlgTool.h:26
TrigJetCRHypoTool::m_visitDebug
Gaudi::Property< bool > m_visitDebug
Definition: TrigJetCRHypoTool.h:90
TrigJetCRHypoTool::m_minCellEt
Gaudi::Property< float > m_minCellEt
Definition: TrigJetCRHypoTool.h:106
TrigJetCRHypoTool::m_trackPtCut
Gaudi::Property< float > m_trackPtCut
Definition: TrigJetCRHypoTool.h:98
TrigJetCRHypoTool::m_countCaloCell
Gaudi::Property< int > m_countCaloCell
Definition: TrigJetCRHypoTool.h:109
TrigJetCRHypoTool::m_jetlogRCut
Gaudi::Property< float > m_jetlogRCut
Definition: TrigJetCRHypoTool.h:96