ATLAS Offline Software
Loading...
Searching...
No Matches
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
20#include "./xAODJetCollector.h"
21
25
26#include "CxxUtils/fpcompare.h"
27#include "CxxUtils/phihelper.h"
30#include "CaloEvent/CaloClusterContainer.h"
31using namespace TrigCompositeUtils;
32
34 const std::string& name,
35 const IInterface* parent) :
36 AthAlgTool(type, name, 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
141StatusCode 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
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
#define y
#define x
#define z
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
virtual std::string toString() const override
Gaudi::Property< float > m_deltaR
Gaudi::Property< float > m_dBIBtime
Gaudi::Property< float > m_jetlogRCut
Gaudi::Property< float > m_celltime
TrigJetCRHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
bool decide_on_single_jet(JetInfo &input) const
Auxiluary method, single jet selection.
Gaudi::Property< float > m_trackPtCut
StatusCode decide(std::vector< JetInfo > &decisions) const
decides upon a collection of jets
Gaudi::Property< bool > m_doBIBrm
HLT::Identifier m_decisionId
Gaudi::Property< bool > m_visitDebug
Gaudi::Property< int > m_countCaloCell
ToolHandle< ITrigJetHypoToolHelper > m_helper
Gaudi::Property< float > m_minCellEt
virtual StatusCode initialize() override final
Class describing a TrackParticle.
Workaround x86 precision issues for FP inequality comparisons.
int r
Definition globals.cxx:22
std::vector< std::string > lineSplitter(const std::string &s, char delimiter)
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition fpcompare.h:140
bool greater_equal(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition fpcompare.h:192
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Helper for azimuthal angle calculations.