ATLAS Offline Software
Loading...
Searching...
No Matches
JVTCondition.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "./JVTCondition.h"
7#include <sstream>
8#include <stdexcept>
9#include <TLorentzVector.h>
10#include <limits>
11#include <memory>
12
13JVTCondition::JVTCondition(double workingPoint):
14 m_workingPoint(workingPoint) {
15}
16
17
18bool JVTCondition::isSatisfied(const HypoJetVector& ips, const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const{
19
20 if(ips.size() != 1){
21 std::stringstream ss;
22 ss << "Dijet::isSatisfied must see exactly 1 particle, but received "
23 << ips.size()
24 << '\n';
25 throw std::runtime_error(ss.str());
26 }
27
28 auto jet = ips[0];
29
30 // The conditions for each jet are: JVT>JVTwp or |eta|>2.5 or pT>60
31 auto pt = jet->pt() * 0.001; // MeV -> GeV
32 float detEta = 0;
33 if(!(jet->getAttribute("DetectorEta",detEta))){
34 throw std::runtime_error("JVT condition cannot retrieve variable 'DetectorEta', 'DetectorEta' does not exist");
35 }
36 auto absdetEta = std::abs(detEta);
37 bool jvtApplicable = (absdetEta<m_maxEta and pt<m_maxPt) ? true : false;
38 bool pass = false;
39 float jvt = -1.;
40 if(!jvtApplicable){ // jvt not applicable
41 pass = true;
42 } else { // jvt applicable
43 if(!(jet->getAttribute("Jvt",jvt))){
44 throw std::runtime_error("JVT condition cannot retrieve variable 'Jvt', 'Jvt' does not exist");
45 }
46
47 pass = (jvt>m_workingPoint) ? true : false;
48 }
49
50 if(collector){
51 std::stringstream ss0;
52 const void* address = static_cast<const void*>(this);
53 ss0 << "JVTCondition: (" << address
54 << ") jvt " << jvt
55 << " pt " << pt
56 << " absdetEta " << absdetEta
57 << " pass: " <<std::boolalpha << pass << " jet group: \n";
58
59 std::stringstream ss1;
60
61 for(const auto& ip : ips){
62 address = static_cast<const void*>(ip.get());
63 ss1 << " " << address << " " << ip->eta() << " pt " << ip->pt() << '\n';
64 }
65 ss1 << '\n';
66 collector -> collect(ss0.str(), ss1.str());
67 }
68 return pass;
69
70}
71
72std::string JVTCondition::toString() const {
73
74 std::stringstream ss;
75 const void* address = static_cast<const void*>(this);
76 ss << "JVTCondition: (" << address << ") Capacity: " << s_capacity
77 << " workingPoint: " << m_workingPoint << '\n';
78
79 return ss.str();
80}
std::vector< pHypoJet > HypoJetVector
Definition HypoJetDefs.h:27
static Double_t ss
static const unsigned int s_capacity
double m_workingPoint
double m_maxEta
std::string toString() const override
JVTCondition(double workingPoint)
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override