ATLAS Offline Software
Loading...
Searching...
No Matches
SimpleHypoJetVectorGenerator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
10
11#include <vector>
12#include <random>
13#include <sstream>
14
16
18 const std::string& name,
19 const IInterface* parent) :
20 base_class(type, name, parent){
21
22}
23
24
25StatusCode
27 if(m_es.size() != m_etas.size()){
28 ATH_MSG_ERROR("Config error: no of Et values != no of Eta values"
29 << m_es.size() << " " << m_etas.size());
30 return StatusCode::FAILURE;
31 }
32
33 return StatusCode::SUCCESS;
34
35}
36
38 std::stringstream ss;
39 ss << name() <<":: e: ";
40 for(const auto& e : m_es){ss << e << ", ";}
41 ss << " eta: ";
42 for(const auto& e : m_etas){ss << e << ", ";}
43 ss<<" bkgd: "<< m_nbkgd << " max E" << m_bkgd_etmax << " max abs eta: "
44 << m_bkgd_etamax << '\n';
45
46 return ss.str();
47}
48
49
52
53 auto factory = std::unique_ptr<ITLorentzVectorFactory>(nullptr);
55 factory.reset(new TLorentzVectorFactory());
56 } else {
57 factory.reset(new TLorentzVectorFactoryEtaE());
58 }
59
61
62 for(std::size_t i = 0; i < m_es.size(); ++i){
63 const auto& eta = m_etas[i];
64 const auto& et = m_es[i];
65 auto tlv = factory->make(eta, et);
66 result.push_back(std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(tlv)));
67 }
68
69 if(m_nbkgd){
70 std::default_random_engine generator;
71 std::uniform_real_distribution<double> eta_distribution(-m_bkgd_etamax,
73
74 std::uniform_real_distribution<double> en_distribution(5.,
76
77
78
79 for(int i = 0; i < m_nbkgd; ++i){
80 const auto& eta = eta_distribution(generator);
81 const auto& en = en_distribution(generator);
82 // depending on the factory, en is e or et
83 auto tlv = factory->make(eta, en);
84 result.push_back(std::shared_ptr<const HypoJet::IJet>(new TLorentzVectorAsIJet(tlv)));
85 }
86 }
87
88 std::shuffle(result.begin(), result.end(), m_shuffle_re);
89 return result;
90}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
std::vector< pHypoJet > HypoJetVector
Definition HypoJetDefs.h:27
static Double_t ss
SimpleHypoJetVectorGenerator(const std::string &type, const std::string &name, const IInterface *parent)
virtual std::string toString() const override
virtual StatusCode initialize() override
Gaudi::Property< std::vector< double > > m_es
virtual HypoJetVector get() override
Gaudi::Property< std::vector< double > > m_etas
std::default_random_engine m_shuffle_re
void shuffle(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, UniformRandom &g)
Specialization of shuffle for DataVector/List.
Extra patterns decribing particle interation process.