|
ATLAS Offline Software
|
Go to the documentation of this file.
14 using fastjet::PseudoJet;
18 namespace JetIsolation {
25 TVector3 v3 =
v.Vect();
26 return (1/v3.Mag())*v3;
42 static constexpr std::array<std::string_view, 6>
s_kname = {
"Pt",
"PtPUsub" ,
"SumPt",
"Par",
"Perp",
"P"};
79 virtual std::vector<float>
82 std::vector<float> calcVector;
92 jetArea= areaAcc(*
jet);
104 calcVector.push_back(
v);
111 std::vector<std::string>
v;
121 std::cout <<
"Isolation calculator "<<
baseName() <<std::endl;
123 std::cout <<
" - "<<
n << std::endl;
139 template<
typename ISOCRITERIA>
145 virtual IsolationResult
148 double rap =
jet->rapidity();
149 double phi =
jet->phi();
151 if (
m_iso.inIsolationArea(rap, phi, constit) ) {
152 result.isoP += constit->p4();
153 result.isoSumPt += constit->pt();
165 isoT->
m_iso.setup(j);
209 #define ISOAREA( calcName, deltaRcode , additionalDecl ) struct calcName : public IsolationAreaBase { \
210 calcName(double p) : IsolationAreaBase(p, #calcName){} \
211 virtual void setup(const xAOD::Jet* j) {double jetRadius=j->getSizeParameter(); double param = m_parameter; m_deltaRmax2=deltaRcode ; m_deltaRmax2*=m_deltaRmax2; (void)(param+jetRadius);} additionalDecl }
217 ISOAREA( IsoFixedArea, sqrt(jetRadius*jetRadius+param*M_1_PI) , ) ;
221 bool Iso6To8::inIsolationArea(
double rap,
double phi,
const xAOD::IParticle* constit)
const {
223 return ( (dr2<0.8*0.8) && (dr2>0.6*0.6) );
244 std::stringstream
str(in);
245 std::getline(
str, s1,
':' );
246 std::getline(
str,
s2,
':');
247 std::getline(
str,
s3);
259 declareInterface<IJetDecorator>(
this);
272 std::map<string, IsolationCalculator*> calcMap;
276 for (
size_t i=0;
i<nmom; ++
i ) {
277 string isocriteria, param_s, kinematic;
280 if( (param_s.empty())||(kinematic.empty())) {
282 return StatusCode::FAILURE;
284 string calcId = isocriteria + param_s;
288 if ( isoC ==
nullptr ) {
291 if( isoC ==
nullptr ) {
293 return StatusCode::FAILURE;
299 return StatusCode::FAILURE;
304 ATH_MSG_ERROR(
"JetIsolationTool needs to have its input jet container configured!");
305 return StatusCode::FAILURE;
311 for (
const auto& pair : calcMap ){
313 ATH_MSG_DEBUG(
"Will use iso calculation : "<< pair.second->baseName() <<
" and variables :" );
315 for(
const auto& kname: pair.second->calculationNames()){
326 return StatusCode::FAILURE;
341 return StatusCode::SUCCESS;
350 if (
jets.empty() )
return StatusCode::SUCCESS;
354 ATH_MSG_DEBUG(
"Retrieved input count is " << inputConstits->size());
359 std::vector<IsolationCalculator*> calculators;
363 calculators.push_back( cloned );
371 ATH_MSG_FATAL(
"Could not retrieve xAOD::EventShape::Density from xAOD::EventShape "<<
m_rhoKey.key());
372 return StatusCode::FAILURE;
379 std::vector<const xAOD::IParticle*> nearbyC;
380 nearbyC.reserve( inputConstits->size() );
387 const std::vector< ElementLink< xAOD::IParticleContainer > >& constitEL =
jet->constituentLinks();
397 bool found = std::any_of(constitEL.begin(), constitEL.end(), [&
part](
const auto& link) { return part == *link; });
399 nearbyC.push_back(
part);
402 if ( (nearbyC.size() +
jet->numConstituents()+nRejected) != inputConstits->size() ) {
403 ATH_MSG_WARNING(
"Inconsistent number of jet constituents found in jet.");
406 ATH_MSG_DEBUG(
jet->index()<<
" # outside jet: " << nearbyC.size() <<
", # rejected :"<< nRejected
407 <<
", in jet: "<<
jet->numConstituents()
408 <<
", total: "<< inputConstits->size() );
413 for(
auto * isoCalc:calculators){
415 std::vector<float>
results = isoCalc->calcIsolationVariables(
jet, nearbyC);
431 return StatusCode::SUCCESS;
442 return StatusCode::SUCCESS;
bool getDensity(EventDensityID id, double &v) const
Get a density variable from the object.
virtual ~IsolationCalculator()=default
virtual std::vector< float > calcIsolationVariables(const xAOD::Jet *jet, std::vector< const xAOD::IParticle * > &nearbyConstit) const
Implement the calculation of isolation variables for this jet.
IsolationCalculator * createCalulator(const std::string &n, double parameter)
std::vector< Kinematics > m_kinematics
kinematics isolation variables to be computed
IsolationCalculatorT(double param=0.)
virtual IsolationResult jetIsolation(const xAOD::Jet *, std::vector< const xAOD::IParticle * > &) const
Compute the isolation 4-momentum from jet and jet inputs.
std::string find(const std::string &s)
return a remapped string
Helper class to provide type-safe access to aux data.
virtual std::vector< std::string > calculationNames() const
virtual double rapidity() const =0
The true rapidity (y) of the particle.
float m_rho
Value of the event density in case it is needed.
Helper class to provide constant type-safe access to aux data.
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Class providing the definition of the 4-vector interface.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ JetConstitScaleMomentum
void setEventDensity(float rho)
Kinematics
Define the available isolation variables.
static constexpr std::array< std::string_view, 6 > s_kname
names for isolation variables. Must match EXACTLY the enum.
::StatusCode StatusCode
StatusCode definition for legacy code.
Handle class for adding a decoration to an object.
bool inIsolationArea(double rap, double phi, const xAOD::IParticle *part) const
IsolationAreaBase(double p, const string &n)
IsolationCalculator : base class for isolation calculations Implementations of this class encapsulate...
virtual IsolationCalculator * clone(const xAOD::Jet *) const
TVector3 unitVector(const FourMom_t &v)
virtual IsolationResult jetIsolation(const xAOD::Jet *jet, std::vector< const xAOD::IParticle * > &nearbyConstit) const
Compute the isolation 4-momentum from jet and jet inputs.
virtual string baseName() const
void colonSplit(const string &in, string &s1, string &s2, string &s3)
helper
#define ATH_MSG_WARNING(x)
const std::string & decorKey() const
Return the name of the decoration alias (CONT.DECOR).
bool scheduleKinematicCalculation(const std::string &kname)
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Holds the 4-vector of all constituents contributing to isolation.
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
virtual void copyFrom(const IsolationCalculator *o, const xAOD::Jet *)
virtual string baseName() const
virtual IsolationCalculator * clone(const xAOD::Jet *j) const
ISOAREA(IsoKR, jetRadius *param,)